Add wxAUI_TB_PLAIN_BACKGROUND wxAuiToolBar style.

This style allows to use a plain, solid colour, background instead of the
default gradient one.

Closes #10585.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-01-21 11:19:00 +00:00
parent ae72623b64
commit 526502d1b9
4 changed files with 48 additions and 2 deletions

View File

@@ -608,6 +608,7 @@ All (GUI):
- Fix bug in generic wxDataViewCtrl column dragging (jobuz). - Fix bug in generic wxDataViewCtrl column dragging (jobuz).
- Add wxMask::GetBitmap() for wxMSW, wxGTK and wxOSX - Add wxMask::GetBitmap() for wxMSW, wxGTK and wxOSX
- Add wxCheckListBox::GetCheckedItems() (hartwigw). - Add wxCheckListBox::GetCheckedItems() (hartwigw).
- Add wxAUI_TB_PLAIN_BACKGROUND wxAuiToolBar style (Allann Jones).
wxGTK: wxGTK:

View File

@@ -39,6 +39,7 @@ enum wxAuiToolBarStyle
// analogous to wxAUI_TB_VERTICAL, but forces the toolbar // analogous to wxAUI_TB_VERTICAL, but forces the toolbar
// to be horizontal // to be horizontal
wxAUI_TB_HORIZONTAL = 1 << 7, wxAUI_TB_HORIZONTAL = 1 << 7,
wxAUI_TB_PLAIN_BACKGROUND = 1 << 8,
wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT), wxAUI_TB_HORZ_TEXT = (wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT),
wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL), wxAUI_ORIENTATION_MASK = (wxAUI_TB_VERTICAL | wxAUI_TB_HORIZONTAL),
wxAUI_TB_DEFAULT_STYLE = 0 wxAUI_TB_DEFAULT_STYLE = 0
@@ -282,6 +283,11 @@ public:
wxWindow* wnd, wxWindow* wnd,
const wxRect& rect) = 0; const wxRect& rect) = 0;
virtual void DrawPlainBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawLabel( virtual void DrawLabel(
wxDC& dc, wxDC& dc,
wxWindow* wnd, wxWindow* wnd,
@@ -363,6 +369,10 @@ public:
wxWindow* wnd, wxWindow* wnd,
const wxRect& rect); const wxRect& rect);
virtual void DrawPlainBackground(wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
virtual void DrawLabel( virtual void DrawLabel(
wxDC& dc, wxDC& dc,
wxWindow* wnd, wxWindow* wnd,

View File

@@ -57,6 +57,14 @@ enum wxAuiToolBarStyle
*/ */
wxAUI_TB_HORIZONTAL = 1 << 7, wxAUI_TB_HORIZONTAL = 1 << 7,
/**
Draw a plain background (based on parent) instead of the default gradient background.
@since 2.9.5
*/
wxAUI_TB_PLAIN_BACKGROUND = 1 << 8,
/** /**
Shows the text alongside the icons, not vertically stacked. Shows the text alongside the icons, not vertically stacked.
*/ */
@@ -406,6 +414,11 @@ public:
wxWindow* wnd, wxWindow* wnd,
const wxRect& rect) = 0; const wxRect& rect) = 0;
virtual void DrawPlainBackground(
wxDC& dc,
wxWindow* wnd,
const wxRect& rect) = 0;
virtual void DrawLabel( virtual void DrawLabel(
wxDC& dc, wxDC& dc,
wxWindow* wnd, wxWindow* wnd,
@@ -493,6 +506,10 @@ public:
wxWindow* wnd, wxWindow* wnd,
const wxRect& rect); const wxRect& rect);
virtual void DrawPlainBackground(wxDC& dc,
wxWindow* wnd,
const wxRect& rect);
virtual void DrawLabel( virtual void DrawLabel(
wxDC& dc, wxDC& dc,
wxWindow* wnd, wxWindow* wnd,
@@ -573,6 +590,9 @@ public:
@style{wxAUI_TB_HORIZONTAL} @style{wxAUI_TB_HORIZONTAL}
analogous to wxAUI_TB_VERTICAL, but forces the toolbar analogous to wxAUI_TB_VERTICAL, but forces the toolbar
to be horizontal to be horizontal
@style{wxAUI_TB_PLAIN_BACKGROUND}
Draw a plain background (based on parent) instead of the
default gradient background.
@style{wxAUI_TB_HORZ_TEXT} @style{wxAUI_TB_HORZ_TEXT}
Equivalent to wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT Equivalent to wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_TEXT
@style{wxAUI_TB_DEFAULT_STYLE} @style{wxAUI_TB_DEFAULT_STYLE}

View File

@@ -214,6 +214,19 @@ void wxAuiDefaultToolBarArt::DrawBackground(
dc.GradientFillLinear(rect, startColour, endColour, wxSOUTH); dc.GradientFillLinear(rect, startColour, endColour, wxSOUTH);
} }
void wxAuiDefaultToolBarArt::DrawPlainBackground(wxDC& dc,
wxWindow* WXUNUSED(wnd),
const wxRect& _rect)
{
wxRect rect = _rect;
rect.height++;
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
dc.DrawRectangle(rect.GetX() - 1, rect.GetY() - 1,
rect.GetWidth() + 2, rect.GetHeight() + 1);
}
void wxAuiDefaultToolBarArt::DrawLabel( void wxAuiDefaultToolBarArt::DrawLabel(
wxDC& dc, wxDC& dc,
wxWindow* WXUNUSED(wnd), wxWindow* WXUNUSED(wnd),
@@ -2367,8 +2380,10 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt))
bool horizontal = m_orientation == wxHORIZONTAL; bool horizontal = m_orientation == wxHORIZONTAL;
if (m_windowStyle & wxAUI_TB_PLAIN_BACKGROUND)
m_art->DrawBackground(dc, this, cli_rect); m_art->DrawPlainBackground(dc, this, cli_rect);
else
m_art->DrawBackground(dc, this, cli_rect);
int gripperSize = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE); int gripperSize = m_art->GetElementSize(wxAUI_TBART_GRIPPER_SIZE);
int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE); int dropdown_size = m_art->GetElementSize(wxAUI_TBART_OVERFLOW_SIZE);