X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2eb10e2a17a02acaaa32a41304243999f3a862a1..6fd864d1591eca9ccd0cb2ccad5a92d9e15f893b:/src/gtk/tbargtk.cpp diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index b3ab910bfd..daa9378a13 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -16,10 +16,13 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "tbargtk.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/toolbar.h" #if wxUSE_TOOLBAR_NATIVE @@ -47,7 +50,7 @@ extern wxCursor g_globalCursor; // private functions // ---------------------------------------------------------------------------- -// translate wxWindows toolbar style flags to GTK orientation and style +// translate wxWidgets toolbar style flags to GTK orientation and style static void GetGtkStyle(long style, GtkOrientation *orient, GtkToolbarStyle *gtkStyle) { @@ -181,7 +184,22 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), } } - tbar->OnLeftClick( tool->GetId(), tool->IsToggled() ); + if( !tbar->OnLeftClick( tool->GetId(), tool->IsToggled() ) && tool->CanBeToggled() ) + { + // revert back + tool->Toggle(); + + wxBitmap bitmap = tool->GetBitmap(); + if ( bitmap.Ok() ) + { + GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap ); + + GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap() + : (GdkBitmap *)NULL; + + gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask ); + } + } } //----------------------------------------------------------------------------- @@ -255,6 +273,8 @@ void wxToolBar::Init() m_bg = (GdkColor *)NULL; m_toolbar = (GtkToolbar *)NULL; m_blockEvent = FALSE; + m_defaultWidth = 32; + m_defaultHeight = 32; } wxToolBar::~wxToolBar() @@ -353,9 +373,7 @@ bool wxToolBar::Create( wxWindow *parent, m_parent->DoAddChild( this ); - PostCreation(); - - Show( TRUE ); + PostCreation(size); return TRUE; } @@ -685,4 +703,22 @@ void wxToolBar::OnInternalIdle() UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } + +// ---------------------------------------------------------------------------- + +// static +wxVisualAttributes +wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ +#ifdef __WXGTK20__ + return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new); +#else + wxVisualAttributes attr; + GtkWidget* widget = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); + attr = GetDefaultAttributesFromGTKWidget(widget); + gtk_widget_destroy(widget); + return attr; +#endif +} + #endif // wxUSE_TOOLBAR_NATIVE