1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk/toolbar.cpp
3 // Purpose: GTK toolbar
4 // Author: Robert Roebling
5 // Modified: 13.12.99 by VZ to derive from wxToolBarBase
7 // Copyright: (c) Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
14 #if wxUSE_TOOLBAR_NATIVE
16 #include "wx/toolbar.h"
18 #include "wx/gtk/private.h"
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
25 extern bool g_blockEventsOnDrag
;
26 extern wxCursor g_globalCursor
;
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 class wxToolBarTool
: public wxToolBarToolBase
35 wxToolBarTool(wxToolBar
*tbar
,
37 const wxString
& label
,
38 const wxBitmap
& bitmap1
,
39 const wxBitmap
& bitmap2
,
42 const wxString
& shortHelpString
,
43 const wxString
& longHelpString
)
44 : wxToolBarToolBase(tbar
, id
, label
, bitmap1
, bitmap2
, kind
,
45 clientData
, shortHelpString
, longHelpString
)
50 wxToolBarTool(wxToolBar
*tbar
, wxControl
*control
, const wxString
& label
)
51 : wxToolBarToolBase(tbar
, control
, label
)
57 void CreateDropDown();
58 void ShowDropdown(GtkToggleButton
* button
);
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxControl
)
69 // ============================================================================
71 // ============================================================================
73 //-----------------------------------------------------------------------------
74 // "clicked" from m_item
75 //-----------------------------------------------------------------------------
78 static void item_clicked(GtkToolButton
*, wxToolBarTool
* tool
)
80 if (g_blockEventsOnDrag
) return;
82 tool
->GetToolBar()->OnLeftClick(tool
->GetId(), false);
86 //-----------------------------------------------------------------------------
87 // "toggled" from m_item
88 //-----------------------------------------------------------------------------
91 static void item_toggled(GtkToggleToolButton
* button
, wxToolBarTool
* tool
)
93 if (g_blockEventsOnDrag
) return;
95 const bool active
= gtk_toggle_tool_button_get_active(button
) != 0;
97 if (!active
&& tool
->GetKind() == wxITEM_RADIO
)
100 if (!tool
->GetToolBar()->OnLeftClick(tool
->GetId(), active
))
108 //-----------------------------------------------------------------------------
109 // "button_press_event" from m_item child
110 //-----------------------------------------------------------------------------
114 button_press_event(GtkWidget
*, GdkEventButton
* event
, wxToolBarTool
* tool
)
116 if (event
->button
!= 3)
119 if (g_blockEventsOnDrag
) return TRUE
;
121 tool
->GetToolBar()->OnRightClick(
122 tool
->GetId(), int(event
->x
), int(event
->y
));
128 //-----------------------------------------------------------------------------
129 // "child_detached" from m_widget
130 //-----------------------------------------------------------------------------
133 static void child_detached(GtkWidget
*, GtkToolbar
* toolbar
, void*)
135 // disable showing overflow arrow when toolbar is detached,
136 // otherwise toolbar collapses to just an arrow
137 gtk_toolbar_set_show_arrow(toolbar
, false);
141 //-----------------------------------------------------------------------------
142 // "child_attached" from m_widget
143 //-----------------------------------------------------------------------------
146 static void child_attached(GtkWidget
*, GtkToolbar
* toolbar
, void*)
148 gtk_toolbar_set_show_arrow(toolbar
, true);
152 //-----------------------------------------------------------------------------
153 // "enter_notify_event" / "leave_notify_event" from m_item
154 //-----------------------------------------------------------------------------
158 enter_notify_event(GtkWidget
*, GdkEventCrossing
* event
, wxToolBarTool
* tool
)
160 if (g_blockEventsOnDrag
) return TRUE
;
163 if (event
->type
== GDK_ENTER_NOTIFY
)
165 tool
->GetToolBar()->OnMouseEnter(id
);
171 //-----------------------------------------------------------------------------
172 // "size_request" from m_toolbar
173 //-----------------------------------------------------------------------------
177 size_request(GtkWidget
*, GtkRequisition
* req
, wxToolBar
* win
)
179 const wxSize margins
= win
->GetMargins();
180 req
->width
+= margins
.x
;
181 req
->height
+= 2 * margins
.y
;
185 //-----------------------------------------------------------------------------
186 // "expose_event" from GtkImage inside m_item
187 //-----------------------------------------------------------------------------
191 image_expose_event(GtkWidget
* widget
, GdkEventExpose
*, wxToolBarTool
* tool
)
193 const wxBitmap
& bitmap
= tool
->GetDisabledBitmap();
194 if (tool
->IsEnabled() || !bitmap
.IsOk())
197 // draw disabled bitmap ourselves, GtkImage has no way to specify it
199 gtk_widget_get_allocation(widget
, &alloc
);
201 gtk_widget_get_requisition(widget
, &req
);
203 gtk_widget_get_window(widget
), gtk_widget_get_style(widget
)->black_gc
, bitmap
.GetPixbuf(),
205 alloc
.x
+ (alloc
.width
- req
.width
) / 2,
206 alloc
.y
+ (alloc
.height
- req
.height
) / 2,
207 -1, -1, GDK_RGB_DITHER_NORMAL
, 0, 0);
212 //-----------------------------------------------------------------------------
213 // "toggled" from dropdown menu button
214 //-----------------------------------------------------------------------------
217 static void arrow_toggled(GtkToggleButton
* button
, wxToolBarTool
* tool
)
219 if (gtk_toggle_button_get_active(button
))
221 tool
->ShowDropdown(button
);
222 gtk_toggle_button_set_active(button
, false);
227 //-----------------------------------------------------------------------------
228 // "button_press_event" from dropdown menu button
229 //-----------------------------------------------------------------------------
233 arrow_button_press_event(GtkToggleButton
* button
, GdkEventButton
* event
, wxToolBarTool
* tool
)
235 if (event
->button
== 1)
237 g_signal_handlers_block_by_func(button
, (void*)arrow_toggled
, tool
);
238 gtk_toggle_button_set_active(button
, true);
239 tool
->ShowDropdown(button
);
240 gtk_toggle_button_set_active(button
, false);
241 g_signal_handlers_unblock_by_func(button
, (void*)arrow_toggled
, tool
);
248 void wxToolBar::AddChildGTK(wxWindowGTK
* child
)
250 GtkWidget
* align
= gtk_alignment_new(0.5, 0.5, 0, 0);
251 gtk_widget_show(align
);
252 gtk_container_add(GTK_CONTAINER(align
), child
->m_widget
);
253 GtkToolItem
* item
= gtk_tool_item_new();
254 gtk_container_add(GTK_CONTAINER(item
), align
);
255 // position will be corrected in DoInsertTool if necessary
256 gtk_toolbar_insert(GTK_TOOLBAR(gtk_bin_get_child(GTK_BIN(m_widget
))), item
, -1);
259 // ----------------------------------------------------------------------------
261 // ----------------------------------------------------------------------------
263 void wxToolBarTool::SetImage()
265 const wxBitmap
& bitmap
= GetNormalBitmap();
266 wxCHECK_RET(bitmap
.IsOk(), "invalid bitmap for wxToolBar icon");
268 GtkWidget
* image
= gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(m_item
));
269 // always use pixbuf, because pixmap mask does not
270 // work with disabled images in some themes
271 gtk_image_set_from_pixbuf(GTK_IMAGE(image
), bitmap
.GetPixbuf());
274 // helper to create a dropdown menu item
275 void wxToolBarTool::CreateDropDown()
277 gtk_tool_item_set_homogeneous(m_item
, false);
280 if (GetToolBar()->HasFlag(wxTB_LEFT
| wxTB_RIGHT
))
282 box
= gtk_vbox_new(false, 0);
283 arrow
= gtk_arrow_new(GTK_ARROW_RIGHT
, GTK_SHADOW_NONE
);
287 box
= gtk_hbox_new(false, 0);
288 arrow
= gtk_arrow_new(GTK_ARROW_DOWN
, GTK_SHADOW_NONE
);
290 GtkWidget
* tool_button
= gtk_bin_get_child(GTK_BIN(m_item
));
291 gtk_widget_reparent(tool_button
, box
);
292 GtkWidget
* arrow_button
= gtk_toggle_button_new();
293 gtk_button_set_relief(GTK_BUTTON(arrow_button
),
294 gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item
)));
295 gtk_container_add(GTK_CONTAINER(arrow_button
), arrow
);
296 gtk_container_add(GTK_CONTAINER(box
), arrow_button
);
297 gtk_widget_show_all(box
);
298 gtk_container_add(GTK_CONTAINER(m_item
), box
);
300 g_signal_connect(arrow_button
, "toggled", G_CALLBACK(arrow_toggled
), this);
301 g_signal_connect(arrow_button
, "button_press_event",
302 G_CALLBACK(arrow_button_press_event
), this);
305 void wxToolBarTool::ShowDropdown(GtkToggleButton
* button
)
307 wxToolBarBase
* toolbar
= GetToolBar();
308 wxCommandEvent
event(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED
, GetId());
309 if (!toolbar
->HandleWindowEvent(event
))
311 wxMenu
* menu
= GetDropdownMenu();
315 gtk_widget_get_allocation(GTK_WIDGET(button
), &alloc
);
318 if (toolbar
->HasFlag(wxTB_LEFT
| wxTB_RIGHT
))
322 toolbar
->PopupMenu(menu
, x
, y
);
327 wxToolBarToolBase
*wxToolBar::CreateTool(int id
,
328 const wxString
& text
,
329 const wxBitmap
& bitmap1
,
330 const wxBitmap
& bitmap2
,
332 wxObject
*clientData
,
333 const wxString
& shortHelpString
,
334 const wxString
& longHelpString
)
336 return new wxToolBarTool(this, id
, text
, bitmap1
, bitmap2
, kind
,
337 clientData
, shortHelpString
, longHelpString
);
341 wxToolBar::CreateTool(wxControl
*control
, const wxString
& label
)
343 return new wxToolBarTool(this, control
, label
);
346 //-----------------------------------------------------------------------------
347 // wxToolBar construction
348 //-----------------------------------------------------------------------------
350 void wxToolBar::Init()
356 wxToolBar::~wxToolBar()
358 if (m_tooltips
) // always NULL if GTK >= 2.12
360 gtk_object_destroy(GTK_OBJECT(m_tooltips
));
361 g_object_unref(m_tooltips
);
365 bool wxToolBar::Create( wxWindow
*parent
,
370 const wxString
& name
)
372 if ( !PreCreation( parent
, pos
, size
) ||
373 !CreateBase( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
))
375 wxFAIL_MSG( wxT("wxToolBar creation failed") );
382 m_toolbar
= GTK_TOOLBAR( gtk_toolbar_new() );
383 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
384 if (gtk_check_version(2, 12, 0))
386 m_tooltips
= gtk_tooltips_new();
387 g_object_ref(m_tooltips
);
388 gtk_object_sink(GTK_OBJECT(m_tooltips
));
393 if (style
& wxTB_DOCKABLE
)
395 m_widget
= gtk_handle_box_new();
397 g_signal_connect(m_widget
, "child_detached",
398 G_CALLBACK(child_detached
), NULL
);
399 g_signal_connect(m_widget
, "child_attached",
400 G_CALLBACK(child_attached
), NULL
);
402 if (style
& wxTB_FLAT
)
403 gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget
), GTK_SHADOW_NONE
);
407 m_widget
= gtk_event_box_new();
408 ConnectWidget( m_widget
);
410 g_object_ref(m_widget
);
411 gtk_container_add(GTK_CONTAINER(m_widget
), GTK_WIDGET(m_toolbar
));
412 gtk_widget_show(GTK_WIDGET(m_toolbar
));
414 m_parent
->DoAddChild( this );
418 g_signal_connect_after(m_toolbar
, "size_request",
419 G_CALLBACK(size_request
), this);
424 GdkWindow
*wxToolBar::GTKGetWindow(wxArrayGdkWindows
& WXUNUSED(windows
)) const
426 return gtk_widget_get_window(GTK_WIDGET(m_toolbar
));
429 void wxToolBar::GtkSetStyle()
431 GtkOrientation orient
= GTK_ORIENTATION_HORIZONTAL
;
432 if (HasFlag(wxTB_LEFT
| wxTB_RIGHT
))
433 orient
= GTK_ORIENTATION_VERTICAL
;
435 GtkToolbarStyle style
= GTK_TOOLBAR_ICONS
;
436 if (HasFlag(wxTB_NOICONS
))
437 style
= GTK_TOOLBAR_TEXT
;
438 else if (HasFlag(wxTB_TEXT
))
440 style
= GTK_TOOLBAR_BOTH
;
441 if (HasFlag(wxTB_HORZ_LAYOUT
))
442 style
= GTK_TOOLBAR_BOTH_HORIZ
;
445 #if GTK_CHECK_VERSION(3,0,0) || defined(GTK_DISABLE_DEPRECATED)
446 gtk_orientable_set_orientation(GTK_ORIENTABLE(m_toolbar
), orient
);
448 gtk_toolbar_set_orientation(m_toolbar
, orient
);
450 gtk_toolbar_set_style(m_toolbar
, style
);
453 void wxToolBar::SetWindowStyleFlag( long style
)
455 wxToolBarBase::SetWindowStyleFlag(style
);
461 bool wxToolBar::Realize()
463 if ( !wxToolBarBase::Realize() )
466 // bring the initial state of all the toolbar items in line with the
467 // internal state if the latter was changed by calling wxToolBarTool::
468 // Enable(): this works under MSW, where the toolbar items are only created
469 // in Realize() which uses the internal state to determine the initial
470 // button state, so make it work under GTK too
471 for ( wxToolBarToolsList::const_iterator i
= m_tools
.begin();
475 // by default the toolbar items are enabled and not toggled, so we only
476 // have to do something if their internal state doesn't correspond to
478 if ( !(*i
)->IsEnabled() )
479 DoEnableTool(*i
, false);
480 if ( (*i
)->IsToggled() )
481 DoToggleTool(*i
, true);
487 bool wxToolBar::DoInsertTool(size_t pos
, wxToolBarToolBase
*toolBase
)
489 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(toolBase
);
492 GtkWidget
* bin_child
;
493 switch ( tool
->GetStyle() )
495 case wxTOOL_STYLE_BUTTON
:
496 switch (tool
->GetKind())
499 tool
->m_item
= gtk_toggle_tool_button_new();
500 g_signal_connect(tool
->m_item
, "toggled",
501 G_CALLBACK(item_toggled
), tool
);
504 radioGroup
= GetRadioGroup(pos
);
507 // this is the first button in the radio button group,
508 // it will be toggled automatically by GTK so bring the
509 // internal flag in sync
512 tool
->m_item
= gtk_radio_tool_button_new(radioGroup
);
513 g_signal_connect(tool
->m_item
, "toggled",
514 G_CALLBACK(item_toggled
), tool
);
517 wxFAIL_MSG("unknown toolbar child type");
519 case wxITEM_DROPDOWN
:
521 tool
->m_item
= gtk_tool_button_new(NULL
, "");
522 g_signal_connect(tool
->m_item
, "clicked",
523 G_CALLBACK(item_clicked
), tool
);
526 if (!HasFlag(wxTB_NOICONS
))
528 GtkWidget
* image
= gtk_image_new();
529 gtk_tool_button_set_icon_widget(
530 GTK_TOOL_BUTTON(tool
->m_item
), image
);
532 gtk_widget_show(image
);
533 g_signal_connect(image
, "expose_event",
534 G_CALLBACK(image_expose_event
), tool
);
536 if (!tool
->GetLabel().empty())
538 gtk_tool_button_set_label(
539 GTK_TOOL_BUTTON(tool
->m_item
), wxGTK_CONV(tool
->GetLabel()));
540 // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
541 gtk_tool_item_set_is_important(tool
->m_item
, true);
543 if (!HasFlag(wxTB_NO_TOOLTIPS
) && !tool
->GetShortHelp().empty())
545 #if GTK_CHECK_VERSION(2, 12, 0)
546 if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL
)
548 gtk_tool_item_set_tooltip_text(tool
->m_item
,
549 wxGTK_CONV(tool
->GetShortHelp()));
554 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
555 gtk_tool_item_set_tooltip(tool
->m_item
,
556 m_tooltips
, wxGTK_CONV(tool
->GetShortHelp()), "");
560 bin_child
= gtk_bin_get_child(GTK_BIN(tool
->m_item
));
561 g_signal_connect(bin_child
, "button_press_event",
562 G_CALLBACK(button_press_event
), tool
);
563 g_signal_connect(bin_child
, "enter_notify_event",
564 G_CALLBACK(enter_notify_event
), tool
);
565 g_signal_connect(bin_child
, "leave_notify_event",
566 G_CALLBACK(enter_notify_event
), tool
);
568 if (tool
->GetKind() == wxITEM_DROPDOWN
)
569 tool
->CreateDropDown();
570 gtk_toolbar_insert(m_toolbar
, tool
->m_item
, int(pos
));
573 case wxTOOL_STYLE_SEPARATOR
:
574 tool
->m_item
= gtk_separator_tool_item_new();
575 if ( tool
->IsStretchable() )
577 gtk_separator_tool_item_set_draw
579 GTK_SEPARATOR_TOOL_ITEM(tool
->m_item
),
582 gtk_tool_item_set_expand(tool
->m_item
, TRUE
);
584 gtk_toolbar_insert(m_toolbar
, tool
->m_item
, int(pos
));
587 case wxTOOL_STYLE_CONTROL
:
588 wxWindow
* control
= tool
->GetControl();
589 if (gtk_widget_get_parent(control
->m_widget
) == NULL
)
590 AddChildGTK(control
);
591 tool
->m_item
= GTK_TOOL_ITEM(gtk_widget_get_parent(gtk_widget_get_parent(control
->m_widget
)));
592 if (gtk_toolbar_get_item_index(m_toolbar
, tool
->m_item
) != int(pos
))
594 g_object_ref(tool
->m_item
);
595 gtk_container_remove(
596 GTK_CONTAINER(m_toolbar
), GTK_WIDGET(tool
->m_item
));
597 gtk_toolbar_insert(m_toolbar
, tool
->m_item
, int(pos
));
598 g_object_unref(tool
->m_item
);
600 // Inserted items "slide" into place using an animated effect that
601 // causes multiple size events on the item. Must set size request
602 // to keep item size from getting permanently set too small by the
603 // first of these size events.
604 const wxSize size
= control
->GetSize();
605 gtk_widget_set_size_request(control
->m_widget
, size
.x
, size
.y
);
608 gtk_widget_show(GTK_WIDGET(tool
->m_item
));
610 InvalidateBestSize();
615 bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase
* toolBase
)
617 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(toolBase
);
619 if (tool
->GetStyle() == wxTOOL_STYLE_CONTROL
)
621 // don't destroy the control here as we can be called from
622 // RemoveTool() and then we need to keep the control alive;
623 // while if we're called from DeleteTool() the control will
624 // be destroyed when wxToolBarToolBase itself is deleted
625 GtkWidget
* widget
= tool
->GetControl()->m_widget
;
626 gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(widget
)), widget
);
628 gtk_object_destroy(GTK_OBJECT(tool
->m_item
));
631 InvalidateBestSize();
635 GSList
* wxToolBar::GetRadioGroup(size_t pos
)
637 GSList
* radioGroup
= NULL
;
638 GtkToolItem
* item
= NULL
;
641 item
= gtk_toolbar_get_nth_item(m_toolbar
, int(pos
) - 1);
642 if (!GTK_IS_RADIO_TOOL_BUTTON(item
))
645 if (item
== NULL
&& pos
< m_tools
.size())
647 item
= gtk_toolbar_get_nth_item(m_toolbar
, int(pos
));
648 if (!GTK_IS_RADIO_TOOL_BUTTON(item
))
652 radioGroup
= gtk_radio_tool_button_get_group((GtkRadioToolButton
*)item
);
656 // ----------------------------------------------------------------------------
657 // wxToolBar tools state
658 // ----------------------------------------------------------------------------
660 void wxToolBar::DoEnableTool(wxToolBarToolBase
*toolBase
, bool enable
)
662 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(toolBase
);
665 gtk_widget_set_sensitive(GTK_WIDGET(tool
->m_item
), enable
);
668 void wxToolBar::DoToggleTool( wxToolBarToolBase
*toolBase
, bool toggle
)
670 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(toolBase
);
674 g_signal_handlers_block_by_func(tool
->m_item
, (void*)item_toggled
, tool
);
676 gtk_toggle_tool_button_set_active(
677 GTK_TOGGLE_TOOL_BUTTON(tool
->m_item
), toggle
);
679 g_signal_handlers_unblock_by_func(tool
->m_item
, (void*)item_toggled
, tool
);
683 void wxToolBar::DoSetToggle(wxToolBarToolBase
* WXUNUSED(tool
),
684 bool WXUNUSED(toggle
))
686 // VZ: absolutely no idea about how to do it
687 wxFAIL_MSG( wxT("not implemented") );
690 // ----------------------------------------------------------------------------
691 // wxToolBar geometry
692 // ----------------------------------------------------------------------------
694 wxSize
wxToolBar::DoGetBestSize() const
696 // Unfortunately, if overflow arrow is enabled GtkToolbar only reports size
697 // of arrow. To get the real size, the arrow is temporarily disabled here.
698 // This is gross, since it will cause a queue_resize, and could potentially
699 // lead to an infinite loop. But there seems to be no alternative, short of
700 // disabling the arrow entirely.
701 gtk_toolbar_set_show_arrow(m_toolbar
, false);
702 const wxSize size
= wxToolBarBase::DoGetBestSize();
703 gtk_toolbar_set_show_arrow(m_toolbar
, true);
707 wxToolBarToolBase
*wxToolBar::FindToolForPosition(wxCoord
WXUNUSED(x
),
708 wxCoord
WXUNUSED(y
)) const
710 // VZ: GTK+ doesn't seem to have such thing
711 wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") );
716 void wxToolBar::SetToolShortHelp( int id
, const wxString
& helpString
)
718 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(FindById(id
));
722 (void)tool
->SetShortHelp(helpString
);
725 #if GTK_CHECK_VERSION(2, 12, 0)
726 if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL
)
728 gtk_tool_item_set_tooltip_text(tool
->m_item
,
729 wxGTK_CONV(helpString
));
734 #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
735 gtk_tool_item_set_tooltip(tool
->m_item
,
736 m_tooltips
, wxGTK_CONV(helpString
), "");
743 void wxToolBar::SetToolNormalBitmap( int id
, const wxBitmap
& bitmap
)
745 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(FindById(id
));
748 wxCHECK_RET( tool
->IsButton(), wxT("Can only set bitmap on button tools."));
750 tool
->SetNormalBitmap(bitmap
);
755 void wxToolBar::SetToolDisabledBitmap( int id
, const wxBitmap
& bitmap
)
757 wxToolBarTool
* tool
= static_cast<wxToolBarTool
*>(FindById(id
));
760 wxCHECK_RET( tool
->IsButton(), wxT("Can only set bitmap on button tools."));
762 tool
->SetDisabledBitmap(bitmap
);
766 // ----------------------------------------------------------------------------
770 wxToolBar::GetClassDefaultAttributes(wxWindowVariant
WXUNUSED(variant
))
772 return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new
);
775 #endif // wxUSE_TOOLBAR_NATIVE