20#include <wx/aui/aui.h>
21#include <wx/aui/framemanager.h>
24#include <wx/settings.h>
31#if wxCHECK_VERSION( 3, 3, 0 )
33 const wxAuiToolBarItem& aItem )
36 const wxAuiToolBarItem& aItem )
49 if( m_flags & wxAUI_TB_TEXT )
51 aDc.SetFont( m_font );
54 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
56 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &ty );
59 if( !aItem.GetLabel().empty() )
61 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
62 width = wxMax( width, tx + aWindow->FromDIP( 6 ) );
65 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT && !aItem.GetLabel().empty() )
67 width += aWindow->FromDIP( 3 );
68 width += aWindow->FromDIP( 3 );
70 if( !aItem.GetLabel().empty() )
72 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
74 height = wxMax( height, ty );
79 if( aItem.HasDropDown() )
81 int dropdownWidth = GetElementSize( wxAUI_TBART_DROPDOWN_SIZE );
82 width += dropdownWidth + aWindow->FromDIP( 4 );
85 return wxSize( width, height );
93 wxSize bmpSize =
GetToolSize( aDc, aWindow, aItem );
95 int textWidth = 0, textHeight = 0;
97 if( m_flags & wxAUI_TB_TEXT )
99 aDc.SetFont( m_font );
103 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &textHeight );
105 aDc.GetTextExtent( aItem.GetLabel(), &textWidth, &ty );
108 int bmpX = 0, bmpY = 0;
109 int textX = 0, textY = 0;
112 const wxBitmapBundle& bundle = ( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
113 ? aItem.GetDisabledBitmapBundle()
114 : aItem.GetBitmapBundle();
115 wxBitmap bmp = bundle.GetBitmap( bmpSize *
scale );
119 bmp.SetScaleFactor(
scale );
121 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
123 bmpX = aRect.x + ( aRect.width / 2 ) - ( bmpSize.x / 2 );
125 bmpY = aRect.y + ( ( aRect.height - textHeight ) / 2 ) - ( bmpSize.y / 2 );
127 textX = aRect.x + ( aRect.width / 2 ) - ( textWidth / 2 ) + 1;
128 textY = aRect.y + aRect.height - textHeight - 1;
130 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
132 bmpX = aRect.x + aWindow->FromDIP( 3 );
134 bmpY = aRect.y + ( aRect.height / 2 ) - ( bmpSize.y / 2 );
136 textX = bmpX + aWindow->FromDIP( 3 ) + bmpSize.x;
137 textY = aRect.y + ( aRect.height / 2 ) - ( textHeight / 2 );
142 if( !( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED ) )
144 if( aItem.GetState() & wxAUI_BUTTON_STATE_PRESSED )
146 aDc.SetPen( wxPen( m_highlightColour ) );
147 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 20 : 150 ) ) );
148 aDc.DrawRectangle( aRect );
150 else if( ( aItem.GetState() & wxAUI_BUTTON_STATE_HOVER ) || aItem.IsSticky() )
152 aDc.SetPen( wxPen( m_highlightColour ) );
153 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
157 if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
159 wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 50 : 180 ) ) );
161 aDc.DrawRectangle( aRect );
163 else if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
167 aDc.SetPen( wxPen( m_highlightColour ) );
168 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
169 aDc.DrawRectangle( aRect );
174 aDc.DrawBitmap( bmp, bmpX, bmpY,
true );
177 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
179 if( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
181 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
184 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
186 aDc.DrawText( aItem.GetLabel(), textX, textY );
195 m_captionFont = *wxNORMAL_FONT;
198 m_captionSize = ( wxNORMAL_FONT->GetPixelSize().y * 7 ) / 4;
201 SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
202 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
203 SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
204 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
207 m_gradientType = wxAUI_GRADIENT_NONE;
virtual COMMON_SETTINGS * GetCommonSettings() const
PGM_BASE & Pgm()
The global program "get" accessor.