]> git.saurik.com Git - wxWidgets.git/commitdiff
Add a setting for the disabled text colour to wxRibbon art.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 4 Oct 2012 23:23:41 +0000 (23:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 4 Oct 2012 23:23:41 +0000 (23:23 +0000)
Allow specifying the text for the labels of the disabled items separately.

Closes #14721.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72619 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/ribbon/art.h
interface/wx/ribbon/art.h
samples/ribbon/ribbondemo.cpp
src/ribbon/art_aui.cpp
src/ribbon/art_msw.cpp

index 5042f39d489b6b46c54dc0d546802acd20fa981b..86229f6698086dba599b7f4b1b28a7e813a9df10 100644 (file)
@@ -131,7 +131,8 @@ enum wxRibbonArtSetting
     wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_COLOUR,
     wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_TOP_GRADIENT_COLOUR,
     wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_COLOUR,
-    wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR
+    wxRIBBON_ART_TOOL_ACTIVE_BACKGROUND_GRADIENT_COLOUR,
+    wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR
 };
 
 enum wxRibbonScrollButtonStyle
@@ -650,6 +651,7 @@ protected:
     wxColour m_tertiary_scheme_colour;
 
     wxColour m_button_bar_label_colour;
+    wxColour m_button_bar_label_disabled_colour;
     wxColour m_tab_label_colour;
     wxColour m_tab_separator_colour;
     wxColour m_tab_separator_gradient_colour;
index a5fd62f1cd4eed8def258978d6864f7cbba75f65..cab03f0ea16e6b2b05b1db60abe561d04a9df2a7 100644 (file)
@@ -35,6 +35,8 @@ enum wxRibbonArtSetting
     wxRIBBON_ART_BUTTON_BAR_LABEL_FONT,
     wxRIBBON_ART_TAB_LABEL_FONT,
     wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR,
+    /// @since 2.9.5
+    wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR,
     wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR,
     wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR,
     wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_GRADIENT_COLOUR,
index a3933a0b3dc92e10d29fb29ebe21c18bf194c108..e30b1db9a220a7120a15db094f3e5c65d4e21bb2 100644 (file)
@@ -405,6 +405,11 @@ MyFrame::MyFrame()
         bar->AddButton(ID_CHANGE_TEXT1, wxT("One"), ribbon_xpm);
         bar->AddButton(ID_CHANGE_TEXT2, wxT("Two"), ribbon_xpm);
         bar->AddButton(ID_UI_CHANGE_TEXT_UPDATED, wxT("Zero"), ribbon_xpm);
+
+        //Also set the general disabled text colour:
+        wxRibbonArtProvider* artProvider = m_ribbon->GetArtProvider();
+        wxColour tColour = artProvider->GetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR);
+        artProvider->SetColor(wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR, tColour.MakeDisabled());
     }
     new wxRibbonPage(m_ribbon, wxID_ANY, wxT("Empty Page"), empty_xpm);
     {
index 7249af03eed980aed69dfc52ecba8ff10d2b82f1..b284e2478603b312efa95aa37c6b3652343fb2ba 100644 (file)
@@ -244,6 +244,7 @@ void wxRibbonAUIArtProvider::SetColourScheme(
     m_button_bar_hover_background_brush = LikeSecondary(1.7);
     m_button_bar_active_background_brush = LikeSecondary(1.4);
     m_button_bar_label_colour = m_tab_label_colour;
+    m_button_bar_label_disabled_colour = m_tab_label_colour;
     m_gallery_border_pen = m_tab_border_pen;
     m_gallery_item_border_pen = m_button_bar_hover_border_pen;
     m_gallery_hover_background_brush = LikePrimary(1.2);
@@ -1082,7 +1083,9 @@ void wxRibbonAUIArtProvider::DrawButtonBarButton(
     }
 
     dc.SetFont(m_button_bar_label_font);
-    dc.SetTextForeground(m_button_bar_label_colour);
+    dc.SetTextForeground(state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED
+                            ? m_button_bar_label_disabled_colour
+                            : m_button_bar_label_colour);
     DrawButtonBarButtonForeground(dc, rect, kind, state, label, bitmap_large,
         bitmap_small);
 }
index ca4b457e231ad6bd33ae478c99c0849c0f09d969..65b7870d5aa585d3f21dc5fab848044ffea34cc6 100644 (file)
@@ -435,6 +435,8 @@ void wxRibbonMSWArtProvider::SetColourScheme(
     m_gallery_button_active_background_top_brush = LikeSecondary(-9.0, 0.15, -0.08);
 
     m_button_bar_label_colour = m_tab_label_colour;
+    m_button_bar_label_disabled_colour = m_tab_label_colour;
+
     m_button_bar_hover_border_pen = LikeSecondary(-6.2, -0.47, -0.14);
     m_button_bar_hover_background_gradient_colour = LikeSecondary(-0.6, 0.16, 0.04);
     m_button_bar_hover_background_colour = LikeSecondary(-0.2, 0.16, -0.10);
@@ -502,6 +504,7 @@ void wxRibbonMSWArtProvider::CloneTo(wxRibbonMSWArtProvider* copy) const
     copy->m_page_toggle_hover_face_colour = m_page_toggle_hover_face_colour;
 
     copy->m_button_bar_label_colour = m_button_bar_label_colour;
+    copy->m_button_bar_label_disabled_colour = m_button_bar_label_disabled_colour;
     copy->m_tab_label_colour = m_tab_label_colour;
     copy->m_tab_separator_colour = m_tab_separator_colour;
     copy->m_tab_separator_gradient_colour = m_tab_separator_gradient_colour;
@@ -754,6 +757,8 @@ wxColour wxRibbonMSWArtProvider::GetColour(int id) const
     {
         case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR:
             return m_button_bar_label_colour;
+        case wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR:
+            return m_button_bar_label_disabled_colour;
         case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR:
             return m_button_bar_hover_border_pen.GetColour();
         case wxRIBBON_ART_BUTTON_BAR_HOVER_BACKGROUND_TOP_COLOUR:
@@ -912,6 +917,9 @@ void wxRibbonMSWArtProvider::SetColour(int id, const wxColor& colour)
         case wxRIBBON_ART_BUTTON_BAR_LABEL_COLOUR:
             m_button_bar_label_colour = colour;
             break;
+        case wxRIBBON_ART_BUTTON_BAR_LABEL_DISABLED_COLOUR:
+            m_button_bar_label_disabled_colour = colour;
+            break;
         case wxRIBBON_ART_BUTTON_BAR_HOVER_BORDER_COLOUR:
             m_button_bar_hover_border_pen.SetColour(colour);
             break;
@@ -2444,7 +2452,9 @@ void wxRibbonMSWArtProvider::DrawButtonBarButton(
     }
 
     dc.SetFont(m_button_bar_label_font);
-    dc.SetTextForeground(m_button_bar_label_colour);
+    dc.SetTextForeground(state & wxRIBBON_BUTTONBAR_BUTTON_DISABLED
+                            ? m_button_bar_label_disabled_colour
+                            : m_button_bar_label_colour);
     DrawButtonBarButtonForeground(dc, rect, kind, state, label, bitmap_large,
         bitmap_small);
 }