Disabled bitmaps of toolbar tools are now rendered at the correct position if using GTK3. Extend toolbar sample to include a button with a custom disabled bitmap.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76802 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -209,6 +209,7 @@ enum
|
|||||||
IDM_TOOLBAR_OTHER_1,
|
IDM_TOOLBAR_OTHER_1,
|
||||||
IDM_TOOLBAR_OTHER_2,
|
IDM_TOOLBAR_OTHER_2,
|
||||||
IDM_TOOLBAR_OTHER_3,
|
IDM_TOOLBAR_OTHER_3,
|
||||||
|
IDM_TOOLBAR_OTHER_4,
|
||||||
|
|
||||||
// tools menu items
|
// tools menu items
|
||||||
IDM_TOOLBAR_ENABLEPRINT,
|
IDM_TOOLBAR_ENABLEPRINT,
|
||||||
@@ -300,7 +301,7 @@ bool MyApp::OnInit()
|
|||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
|
MyFrame* frame = new MyFrame((wxFrame *) NULL, wxID_ANY,
|
||||||
wxT("wxToolBar Sample"),
|
wxT("wxToolBar Sample"),
|
||||||
wxPoint(100, 100), wxSize(650, 300));
|
wxPoint(100, 100), wxSize(650, 350));
|
||||||
|
|
||||||
frame->Show(true);
|
frame->Show(true);
|
||||||
|
|
||||||
@@ -739,6 +740,8 @@ void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event))
|
|||||||
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, wxT("Third"), wxBITMAP(save));
|
m_tbar->AddRadioTool(IDM_TOOLBAR_OTHER_3, wxT("Third"), wxBITMAP(save));
|
||||||
m_tbar->AddSeparator();
|
m_tbar->AddSeparator();
|
||||||
m_tbar->AddTool(wxID_HELP, wxT("Help"), wxBITMAP(help));
|
m_tbar->AddTool(wxID_HELP, wxT("Help"), wxBITMAP(help));
|
||||||
|
m_tbar->AddTool(IDM_TOOLBAR_OTHER_4, wxT("Disabled"), wxBITMAP(cut), wxBITMAP(paste));
|
||||||
|
m_tbar->EnableTool(IDM_TOOLBAR_OTHER_4, false);
|
||||||
|
|
||||||
m_tbar->Realize();
|
m_tbar->Realize();
|
||||||
}
|
}
|
||||||
|
@@ -189,11 +189,13 @@ image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
|
|||||||
gtk_widget_get_allocation(widget, &alloc);
|
gtk_widget_get_allocation(widget, &alloc);
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
gtk_widget_get_requisition(widget, &req);
|
gtk_widget_get_requisition(widget, &req);
|
||||||
const int x = alloc.x + (alloc.width - req.width) / 2;
|
|
||||||
const int y = alloc.y + (alloc.height - req.height) / 2;
|
|
||||||
#ifdef __WXGTK3__
|
#ifdef __WXGTK3__
|
||||||
|
const int x = (alloc.width - req.width) / 2;
|
||||||
|
const int y = (alloc.height - req.height) / 2;
|
||||||
bitmap.Draw(cr, x, y);
|
bitmap.Draw(cr, x, y);
|
||||||
#else
|
#else
|
||||||
|
const int x = alloc.x + (alloc.width - req.width) / 2;
|
||||||
|
const int y = alloc.y + (alloc.height - req.height) / 2;
|
||||||
gdk_draw_pixbuf(
|
gdk_draw_pixbuf(
|
||||||
gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(),
|
gtk_widget_get_window(widget), gtk_widget_get_style(widget)->black_gc, bitmap.GetPixbuf(),
|
||||||
0, 0, x, y,
|
0, 0, x, y,
|
||||||
|
Reference in New Issue
Block a user