20#include <wx/aui/aui.h>
21#include <wx/aui/framemanager.h>
24#include <wx/settings.h>
37 if( m_flags & wxAUI_TB_TEXT )
39 aDc.SetFont( m_font );
43 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &textHeight );
45 aDc.GetTextExtent( aItem.GetLabel(), &textWidth, &ty );
48 int bmpX = 0, bmpY = 0;
49 int textX = 0, textY = 0;
51 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
53 bmpX = aRect.x + ( aRect.width / 2 ) - ( aItem.GetBitmap().GetWidth() / 2 );
55 bmpY = aRect.y + ( ( aRect.height - textHeight ) / 2 ) -
56 ( aItem.GetBitmap().GetHeight() / 2 );
58 textX = aRect.x + ( aRect.width / 2 ) - ( textWidth / 2 ) + 1;
59 textY = aRect.y + aRect.height - textHeight - 1;
61 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
65 bmpY = aRect.y + ( aRect.height / 2 ) - ( aItem.GetBitmap().GetHeight() / 2 );
67 textX = bmpX + 3 + aItem.GetBitmap().GetWidth();
68 textY = aRect.y + ( aRect.height / 2 ) - ( textHeight / 2 );
71 if( !( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED ) )
73 if( aItem.GetState() & wxAUI_BUTTON_STATE_PRESSED )
75 aDc.SetPen( wxPen( m_highlightColour ) );
76 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( darkMode ? 20 : 150 ) ) );
77 aDc.DrawRectangle( aRect );
79 else if( ( aItem.GetState() & wxAUI_BUTTON_STATE_HOVER ) || aItem.IsSticky() )
81 aDc.SetPen( wxPen( m_highlightColour ) );
82 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( darkMode ? 40 : 170 ) ) );
86 if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
87 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( darkMode ? 50 : 180 ) ) );
89 aDc.DrawRectangle( aRect );
91 else if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
95 aDc.SetPen( wxPen( m_highlightColour ) );
96 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( darkMode ? 40 : 170 ) ) );
97 aDc.DrawRectangle( aRect );
103 if( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
104 bmp = aItem.GetDisabledBitmap();
106 bmp = aItem.GetBitmap();
109 aDc.DrawBitmap( bmp, bmpX, bmpY,
true );
112 aDc.SetTextForeground( *wxBLACK );
114 if( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
115 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
117 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
119 aDc.DrawText( aItem.GetLabel(), textX, textY );
128 m_captionFont = *wxNORMAL_FONT;
131 m_captionSize = wxWindow::FromDIP( 20,
nullptr );
134 SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
135 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
136 SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
137 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
140 m_gradientType = wxAUI_GRADIENT_NONE;