38 const wxAuiToolBarItem& aItem )
51 if( m_flags & wxAUI_TB_TEXT )
53 aDc.SetFont( m_font );
56 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
58 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &ty );
61 if( !aItem.GetLabel().empty() )
63 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
64 width = wxMax( width, tx + aWindow->FromDIP( 6 ) );
67 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT && !aItem.GetLabel().empty() )
69 width += aWindow->FromDIP( 3 );
70 width += aWindow->FromDIP( 3 );
72 if( !aItem.GetLabel().empty() )
74 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
76 height = wxMax( height, ty );
81 if( aItem.HasDropDown() )
83 int dropdownWidth = GetElementSize( wxAUI_TBART_DROPDOWN_SIZE );
84 width += dropdownWidth + aWindow->FromDIP( 4 );
87 return wxSize( width, height );
95 wxSize bmpSize =
GetToolSize( aDc, aWindow, aItem );
97 int textWidth = 0, textHeight = 0;
99 if( m_flags & wxAUI_TB_TEXT )
101 aDc.SetFont( m_font );
105 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &textHeight );
107 aDc.GetTextExtent( aItem.GetLabel(), &textWidth, &ty );
110 int bmpX = 0, bmpY = 0;
111 int textX = 0, textY = 0;
114 const wxBitmapBundle& bundle = ( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
115 ? aItem.GetDisabledBitmapBundle()
116 : aItem.GetBitmapBundle();
117 wxBitmap bmp = bundle.GetBitmap( bmpSize *
scale );
121 bmp.SetScaleFactor(
scale );
123 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
125 bmpX = aRect.x + ( aRect.width / 2 ) - ( bmpSize.x / 2 );
127 bmpY = aRect.y + ( ( aRect.height - textHeight ) / 2 ) - ( bmpSize.y / 2 );
129 textX = aRect.x + ( aRect.width / 2 ) - ( textWidth / 2 ) + 1;
130 textY = aRect.y + aRect.height - textHeight - 1;
132 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
134 bmpX = aRect.x + aWindow->FromDIP( 3 );
136 bmpY = aRect.y + ( aRect.height / 2 ) - ( bmpSize.y / 2 );
138 textX = bmpX + aWindow->FromDIP( 3 ) + bmpSize.x;
139 textY = aRect.y + ( aRect.height / 2 ) - ( textHeight / 2 );
144 if( !( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED ) )
146 if( aItem.GetState() & wxAUI_BUTTON_STATE_PRESSED )
148 aDc.SetPen( wxPen( m_highlightColour ) );
149 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 20 : 150 ) ) );
150 aDc.DrawRectangle( aRect );
152 else if( ( aItem.GetState() & wxAUI_BUTTON_STATE_HOVER ) || aItem.IsSticky() )
154 aDc.SetPen( wxPen( m_highlightColour ) );
155 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
159 if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
161 wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 50 : 180 ) ) );
163 aDc.DrawRectangle( aRect );
165 else if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
169 aDc.SetPen( wxPen( m_highlightColour ) );
170 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
171 aDc.DrawRectangle( aRect );
176 aDc.DrawBitmap( bmp, bmpX, bmpY,
true );
179 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
181 if( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
183 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
186 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
188 aDc.DrawText( aItem.GetLabel(), textX, textY );
194 wxAuiDefaultDockArt()
198 m_captionFont = *wxNORMAL_FONT;
201 m_captionSize = ( wxNORMAL_FONT->GetPointSize() * 7 ) / 4 + 6;
204 SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
205 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
206 SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
207 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
210 m_gradientType = wxAUI_GRADIENT_NONE;
215 int close_button_state, wxRect* out_tab_rect, wxRect* out_button_rect,
221 close_button_state = wxAUI_BUTTON_STATE_HIDDEN;
223 return wxAuiGenericTabArt::DrawTab( dc, wnd, page, in_rect, close_button_state, out_tab_rect,
224 out_button_rect, x_extent );
void DrawTab(wxDC &dc, wxWindow *wnd, const wxAuiNotebookPage &page, const wxRect &in_rect, int close_button_state, wxRect *out_tab_rect, wxRect *out_button_rect, int *x_extent) override