39 const wxAuiToolBarItem& aItem )
43 int size = aWindow->FromDIP(
Pgm().GetCommonSettings()->m_Appearance.toolbar_icon_size );
48 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
50 aDc.SetFont( m_font );
53 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
55 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &ty );
58 if( !aItem.GetLabel().empty() )
60 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
61 width = wxMax( width, tx + aWindow->FromDIP( 6 ) );
64 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
66 width += aWindow->FromDIP( 3 );
67 width += aWindow->FromDIP( 3 );
69 if( !aItem.GetLabel().empty() )
71 aDc.GetTextExtent( aItem.GetLabel(), &tx, &ty );
73 height = wxMax( height, ty );
78 if( aItem.HasDropDown() )
80 int dropdownWidth = GetElementSize( wxAUI_TBART_DROPDOWN_SIZE );
81 width += dropdownWidth + aWindow->FromDIP( 4 );
84 return wxSize( width, height );
92 int bmpX = 0, bmpY = 0;
93 int textX = 0, textY = 0;
95 const wxBitmap& bmp = aItem.GetCurrentBitmapFor( aWindow );
96 const wxSize bmpSize = bmp.IsOk() ? bmp.GetLogicalSize() : wxSize( 0, 0 );
98 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
100 aDc.SetFont( m_font );
102 int textWidth = 0, textHeight = 0;
105 aDc.GetTextExtent( wxT(
"ABCDHgj" ), &tx, &textHeight );
106 aDc.GetTextExtent( aItem.GetLabel(), &textWidth, &ty );
108 if( m_textOrientation == wxAUI_TBTOOL_TEXT_BOTTOM )
110 bmpX = aRect.x + ( aRect.width / 2 ) - ( bmpSize.x / 2 );
112 bmpY = aRect.y + ( ( aRect.height - textHeight ) / 2 ) - ( bmpSize.y / 2 );
114 textX = aRect.x + ( aRect.width / 2 ) - ( textWidth / 2 ) + 1;
115 textY = aRect.y + aRect.height - textHeight - 1;
117 else if( m_textOrientation == wxAUI_TBTOOL_TEXT_RIGHT )
119 bmpX = aRect.x + aWindow->FromDIP( 3 );
121 bmpY = aRect.y + ( aRect.height / 2 ) - ( bmpSize.y / 2 );
123 textX = bmpX + aWindow->FromDIP( 3 ) + bmpSize.x;
124 textY = aRect.y + ( aRect.height / 2 ) - ( textHeight / 2 );
129 bmpX = aRect.x + ( aRect.width / 2 ) - ( bmpSize.x / 2 );
130 bmpY = aRect.y + ( aRect.height / 2 ) - ( bmpSize.y / 2 );
135 if( !( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED ) )
137 if( aItem.GetState() & wxAUI_BUTTON_STATE_PRESSED )
139 aDc.SetPen( wxPen( m_highlightColour ) );
140 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 20 : 150 ) ) );
141 aDc.DrawRectangle( aRect );
143 else if( ( aItem.GetState() & wxAUI_BUTTON_STATE_HOVER ) || aItem.IsSticky() )
145 aDc.SetPen( wxPen( m_highlightColour ) );
146 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
150 if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
152 wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 50 : 180 ) ) );
154 aDc.DrawRectangle( aRect );
156 else if( aItem.GetState() & wxAUI_BUTTON_STATE_CHECKED )
160 aDc.SetPen( wxPen( m_highlightColour ) );
161 aDc.SetBrush( wxBrush( m_highlightColour.ChangeLightness( isThemeDark ? 40 : 170 ) ) );
162 aDc.DrawRectangle( aRect );
167 aDc.DrawBitmap( bmp, bmpX, bmpY,
true );
170 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
172 if( aItem.GetState() & wxAUI_BUTTON_STATE_DISABLED )
174 aDc.SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT ) );
177 if( ( m_flags & wxAUI_TB_TEXT ) && !aItem.GetLabel().empty() )
179 aDc.DrawText( aItem.GetLabel(), textX, textY );
229 bool skipNextSeparator =
true;
231 size_t i, count = items.GetCount();
232 for( i = 0; i < count; ++i )
234 wxAuiToolBarItem& item = items.Item( i );
236 if( item.GetKind() == wxITEM_SEPARATOR )
238 if( !skipNextSeparator )
240 menuPopup.AppendSeparator();
241 skipNextSeparator =
true;
244 else if( item.GetKind() == wxITEM_NORMAL || item.GetKind() == wxITEM_CHECK || item.GetKind() == wxITEM_RADIO )
246 wxString
text = item.GetShortHelp();
249 text = item.GetLabel();
254 wxString firstLine =
text.BeforeFirst(
'\n' );
256 wxString label = firstLine.BeforeFirst(
'\t', &accel );
263 if( accel.starts_with(
"(" ) && accel.ends_with(
")" ) )
264 accel = accel.Mid( 1, accel.size() - 2 );
266 text <<
"\t" << accel;
269 bool checked = item.GetState() & wxAUI_BUTTON_STATE_CHECKED;
270 wxItemKind menuKind = wxITEM_NORMAL;
272 if( ( item.GetKind() == wxITEM_CHECK || item.GetKind() == wxITEM_RADIO ) && checked )
273 menuKind =
static_cast<wxItemKind
>( item.GetKind() );
275 wxMenuItem* m =
new wxMenuItem( &menuPopup, item.GetId(),
text, item.GetShortHelp(), menuKind );
277 if( !m->IsCheckable() )
278 m->SetBitmap( item.GetBitmapBundle() );
280 menuPopup.Append( m );
282 if( m->IsCheckable() )
285 skipNextSeparator =
false;
290 wxPoint pt = ::wxGetMousePosition();
291 pt = wnd->ScreenToClient( pt );
294 wxRect cli_rect = wnd->GetClientRect();
295 pt.y = cli_rect.y + cli_rect.height;
298 wnd->PushEventHandler( cc );
299 wnd->PopupMenu( &menuPopup, pt );
301 wnd->PopEventHandler(
true );
308 wxAuiDefaultDockArt()
312 m_captionFont = *wxNORMAL_FONT;
315 m_captionSize = ( wxNORMAL_FONT->GetPointSize() * 7 ) / 4 + 6;
318 SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
319 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
320 SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
321 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
324 m_gradientType = wxAUI_GRADIENT_NONE;
329 int close_button_state, wxRect* out_tab_rect, wxRect* out_button_rect,
335 close_button_state = wxAUI_BUTTON_STATE_HIDDEN;
337 return wxAuiGenericTabArt::DrawTab( dc, wnd, page, in_rect, close_button_state, out_tab_rect,
338 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