20#include <wx/aui/aui.h>
21#include <wx/aui/framemanager.h>
24#include <wx/settings.h>
33 const wxAuiToolBarItem& aItem )
45 if( m_flags & wxAUI_TB_TEXT )
47 aDc.SetFont( m_font );
50 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
52 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &ty );
55 if( !aItem.GetLabel().empty() )
57 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
58 width = wxMax( width, tx + aWindow->FromDIP( 6 ) );
61 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT && !aItem.GetLabel().empty() )
63 width += aWindow->FromDIP( 3 );
64 width += aWindow->FromDIP( 3 );
66 if( !aItem.GetLabel().empty() )
68 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
70 height = wxMax( height, ty );
75 if( aItem.HasDropDown() )
77 int dropdownWidth = GetElementSize( wxAUI_TBART_DROPDOWN_SIZE );
78 width += dropdownWidth + aWindow->FromDIP( 4 );
81 return wxSize( width, height );
89 wxSize bmpSize =
GetToolSize( aDc, aWindow, aItem );
91 int textWidth = 0, textHeight = 0;
93 if( m_flags & wxAUI_TB_TEXT )
95 aDc.SetFont( m_font );
99 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &textHeight );
101 aDc.GetTextExtent( aItem.GetLabel(), &textWidth, &ty );
104 int bmpX = 0, bmpY = 0;
105 int textX = 0, textY = 0;
108 const wxBitmapBundle& bundle = ( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
109 ? aItem.GetDisabledBitmapBundle()
110 : aItem.GetBitmapBundle();
111 wxBitmap bmp = bundle.GetBitmap( bmpSize *
scale );
115 bmp.SetScaleFactor(
scale );
117 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
119 bmpX = aRect.x + ( aRect.width / 2 ) - ( bmpSize.x / 2 );
121 bmpY = aRect.y + ( ( aRect.height - textHeight ) / 2 ) - ( bmpSize.y / 2 );
123 textX = aRect.x + ( aRect.width / 2 ) - ( textWidth / 2 ) + 1;
124 textY = aRect.y + aRect.height - textHeight - 1;
126 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
128 bmpX = aRect.x + aWindow->FromDIP( 3 );
130 bmpY = aRect.y + ( aRect.height / 2 ) - ( bmpSize.y / 2 );
132 textX = bmpX + aWindow->FromDIP( 3 ) + bmpSize.x;
133 textY = aRect.y + ( aRect.height / 2 ) - ( textHeight / 2 );
138 if( !( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED ) )
140 if( aItem.GetState() & wxAUI_BUTTON_STATE_PRESSED )
142 aDc.SetPen( wxPen( m_highlightColour ) );
143 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 20 : 150 ) ) );
144 aDc.DrawRectangle( aRect );
146 else if( ( aItem.GetState() & wxAUI_BUTTON_STATE_HOVER ) || aItem.IsSticky() )
148 aDc.SetPen( wxPen( m_highlightColour ) );
149 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
153 if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
155 wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 50 : 180 ) ) );
157 aDc.DrawRectangle( aRect );
159 else if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
163 aDc.SetPen( wxPen( m_highlightColour ) );
164 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
165 aDc.DrawRectangle( aRect );
170 aDc.DrawBitmap( bmp, bmpX, bmpY,
true );
173 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
175 if( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
177 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
180 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
182 aDc.DrawText( aItem.GetLabel(), textX, textY );
191 m_captionFont = *wxNORMAL_FONT;
194 m_captionSize = ( wxNORMAL_FONT->GetPixelSize().y * 7 ) / 4;
197 SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
198 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
199 SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
200 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
203 m_gradientType = wxAUI_GRADIENT_NONE;
virtual COMMON_SETTINGS * GetCommonSettings() const
PGM_BASE & Pgm()
The global Program "get" accessor.