bool wxToolBar::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { if ( !PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxToolBar creation failed") ); return false; } FixupStyle(); m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() ); #if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED) if (gtk_check_version(2, 12, 0)) { m_tooltips = gtk_tooltips_new(); g_object_ref(m_tooltips); gtk_object_sink(GTK_OBJECT(m_tooltips)); } #endif GtkSetStyle(); if (style & wxTB_DOCKABLE) { m_widget = gtk_handle_box_new(); g_signal_connect(m_widget, "child_detached", G_CALLBACK(child_detached), NULL); g_signal_connect(m_widget, "child_attached", G_CALLBACK(child_attached), NULL); if (style & wxTB_FLAT) gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE ); } else { m_widget = gtk_event_box_new(); ConnectWidget( m_widget ); } g_object_ref(m_widget); gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar)); gtk_widget_show(GTK_WIDGET(m_toolbar)); m_parent->DoAddChild( this ); PostCreation(size); g_signal_connect_after(m_toolbar, "size_request", G_CALLBACK(size_request), this); return true; }
bool wxToolBar::Create( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { m_needParent = true; m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar; if ( !PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxToolBar creation failed") ); return false; } FixupStyle(); GtkOrientation orient; GtkToolbarStyle gtkStyle; GetGtkStyle(style, &orient, >kStyle); m_toolbar = GTK_TOOLBAR( gtk_toolbar_new(orient, gtkStyle) ); SetToolSeparation(7); if (style & wxTB_DOCKABLE) { m_widget = gtk_handle_box_new(); gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) ); gtk_widget_show( GTK_WIDGET(m_toolbar) ); if (style & wxTB_FLAT) gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE ); } else { m_widget = gtk_event_box_new(); gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) ); ConnectWidget( m_widget ); gtk_widget_show(GTK_WIDGET(m_toolbar)); } gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); if (style & wxTB_FLAT) gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE ); m_parent->DoAddChild( this ); PostCreation(size); return true; }
bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if( !wxControl::CreateControl( parent, id, pos, size, style, wxDefaultValidator, name ) ) return false; PreCreation(); FixupStyle(); Widget parentWidget = (Widget) parent->GetClientWidget(); Widget toolbar = XtVaCreateManagedWidget("toolbar", xmBulletinBoardWidgetClass, (Widget) parentWidget, XmNmarginWidth, 0, XmNmarginHeight, 0, XmNresizePolicy, XmRESIZE_NONE, NULL); /* Widget toolbar = XtVaCreateManagedWidget("toolbar", xmFormWidgetClass, (Widget) m_clientWidget, XmNtraversalOn, False, XmNhorizontalSpacing, 0, XmNverticalSpacing, 0, XmNleftOffset, 0, XmNrightOffset, 0, XmNmarginWidth, 0, XmNmarginHeight, 0, NULL); */ m_mainWidget = (WXWidget) toolbar; wxPoint rPos = pos; wxSize rSize = size; if( rPos.x == -1 ) rPos.x = 0; if( rPos.y == -1 ) rPos.y = 0; if( rSize.x == -1 && GetParent() ) rSize.x = GetParent()->GetSize().x; PostCreation(); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, rPos.x, rPos.y, rSize.x, rSize.y); return true; }