Hello,
Is it possible for me to set a different text color (for the tab label) on a per tab basis?
Thanks!
Kirix Support Forums
Set Text Color Per Tab
5 posts
• Page 1 of 1
Re: Set Text Color Per Tab
Yes. You'll have to derive your own art provider from the default one. Then you can override the tab drawing code and draw the tab caption in your own color.
I realize that this isn't as good as just having a text color attribute, but at least it's possible at the moment.
Thanks,
Ben
I realize that this isn't as good as just having a text color attribute, but at least it's possible at the moment.
Thanks,
Ben
Ben Williams
Kirix Support Team
Kirix Support Team
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: Set Text Color Per Tab
Hello,
how is it with implementing with per-tab settings now? I know this topic is 3 years old but did something change since that time?
I wanted to draw bold text on inactive tabs (something like kind of notification that something happened in that tab) but it's not possible (using wxAUI in wxWidgets SVN). I tried to make my own art provider but I must say that it's absolutely stupid. Deriving from wxAuiDefaultArt isn't possible, because its functions aren't virtual so my overriden functions won't be called at all. And abstract class wxAuiTabArt requires me to write all its virtual functions code again. I don't see point in rewriting code for 12 functions when I want only change font before drawing tab!
Any advices or any progress in wxAUI?
Thank you in advance!
how is it with implementing with per-tab settings now? I know this topic is 3 years old but did something change since that time?
I wanted to draw bold text on inactive tabs (something like kind of notification that something happened in that tab) but it's not possible (using wxAUI in wxWidgets SVN). I tried to make my own art provider but I must say that it's absolutely stupid. Deriving from wxAuiDefaultArt isn't possible, because its functions aren't virtual so my overriden functions won't be called at all. And abstract class wxAuiTabArt requires me to write all its virtual functions code again. I don't see point in rewriting code for 12 functions when I want only change font before drawing tab!
Any advices or any progress in wxAUI?
Thank you in advance!
- Big Muscle
- Registered User
- Posts: 2
- Joined: Tue Dec 28, 2010 4:57 pm
Re: Set Text Color Per Tab
wxAuiDefaultArt's methods are most certainly virtual, because they inherit the virtual trait from the base class. This means that you should be able to override them just fine.
I'd encourage you to try this route. It's specifically why art providers exist. I believe that you can accomplish this task in a short amount of time.
I'd encourage you to try this route. It's specifically why art providers exist. I believe that you can accomplish this task in a short amount of time.
Ben Williams
Kirix Support Team
Kirix Support Team
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: Set Text Color Per Tab
Thanks for your answer. This is wxAuiDefaultTabArt header from wxWidgets SVN code:
Nothing is virtual. Only class "wxAuiTabArt" has virtual functions but they are pure virtual.
- Code: Select all
class WXDLLIMPEXP_AUI wxAuiDefaultTabArt : public wxAuiTabArt
{
public:
wxAuiDefaultTabArt();
virtual ~wxAuiDefaultTabArt();
wxAuiTabArt* Clone();
void SetFlags(unsigned int flags);
void SetSizingInfo(const wxSize& tab_ctrl_size,
size_t tab_count);
void SetNormalFont(const wxFont& font);
void SetSelectedFont(const wxFont& font);
void SetMeasuringFont(const wxFont& font);
void DrawBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
void DrawTab(wxDC& dc,
wxWindow* wnd,
const wxAuiNotebookPage& pane,
const wxRect& in_rect,
int close_button_state,
wxRect* out_tab_rect,
wxRect* out_button_rect,
int* x_extent);
void DrawButton(
wxDC& dc,
wxWindow* wnd,
const wxRect& in_rect,
int bitmap_id,
int button_state,
int orientation,
wxRect* out_rect);
int GetIndentSize();
wxSize GetTabSize(
wxDC& dc,
wxWindow* wnd,
const wxString& caption,
const wxBitmap& bitmap,
bool active,
int close_button_state,
int* x_extent);
int ShowDropDown(
wxWindow* wnd,
const wxAuiNotebookPageArray& items,
int active_idx);
int GetBestTabCtrlSize(wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& required_bmp_size);
protected:
wxFont m_normal_font;
wxFont m_selected_font;
wxFont m_measuring_font;
wxColour m_base_colour;
wxPen m_base_colour_pen;
wxPen m_border_pen;
wxBrush m_base_colour_brush;
wxBitmap m_active_close_bmp;
wxBitmap m_disabled_close_bmp;
wxBitmap m_active_left_bmp;
wxBitmap m_disabled_left_bmp;
wxBitmap m_active_right_bmp;
wxBitmap m_disabled_right_bmp;
wxBitmap m_active_windowlist_bmp;
wxBitmap m_disabled_windowlist_bmp;
int m_fixed_tab_width;
int m_tab_ctrl_height;
unsigned int m_flags;
};
Nothing is virtual. Only class "wxAuiTabArt" has virtual functions but they are pure virtual.
- Big Muscle
- Registered User
- Posts: 2
- Joined: Tue Dec 28, 2010 4:57 pm
5 posts
· Page 1 of 1
Return to wxAUI Questions, Thoughts & Feedback