// 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
// 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)
{
// wxWin macros
// ----------------------------------------------------------------------------
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
// ============================================================================
// implementation
}
}
- 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 );
+ }
+ }
}
//-----------------------------------------------------------------------------
m_bg = (GdkColor *)NULL;
m_toolbar = (GtkToolbar *)NULL;
m_blockEvent = FALSE;
+ m_defaultWidth = 32;
+ m_defaultHeight = 32;
}
wxToolBar::~wxToolBar()
m_parent->DoAddChild( this );
- PostCreation();
-
- Show( TRUE );
+ PostCreation(size);
return TRUE;
}
if ( tool->IsRadio() )
{
- wxToolBarToolsList::Node *node = pos ? m_tools.Item(pos - 1)
- : NULL;
+ wxToolBarToolsList::compatibility_iterator node
+ = wxToolBarToolsList::compatibility_iterator();
+ if ( pos ) node = m_tools.Item(pos - 1);
+
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
}
- wxToolBarToolsList::Node *node = m_tools.GetFirst();
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
while ( node )
{
wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
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