From 3502e687e29f46c747be16a58d39fe79e7b1c7bc Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 10 Feb 1999 23:08:27 +0000 Subject: [PATCH] distribution things implemented native docking for menus and toolbars (see toolbar sample) someone may have to create the new wxMenuBar constructor corrected wxFileDlg appearance and made it i18n implemented defaults buttons improved look of all common dlgs except print setup corrected forty's player dlg added wxMB_DOCKABLE and wxTB_DOCKABLE flags augmented BETA_VERSION to 4 prevent wxListBox from sending a list_item_selected event when adding the first item to a list that is a single selection list using AppendXX() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1673 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/gtk.rsp | 2 +- distrib/msw/motif.rsp | 2 +- docs/gtk/install.txt | 12 +++++++++++- docs/gtk/makewxgtk | 2 +- docs/gtk/readme.txt | 2 +- docs/gtk/todo.txt | 7 +++++-- include/wx/defs.h | 17 +++++++++-------- include/wx/gtk/menu.h | 1 + include/wx/gtk1/menu.h | 1 + include/wx/version.h | 2 +- samples/forty/playerdg.cpp | 4 +--- samples/toolbar/test.cpp | 4 ++-- src/generic/choicdgg.cpp | 5 +++-- src/generic/colrdlgg.cpp | 4 ++-- src/generic/dirdlgg.cpp | 14 +++++++------- src/generic/fontdlgg.cpp | 6 +++--- src/generic/msgdlgg.cpp | 9 +++++---- src/generic/textdlgg.cpp | 5 +++-- src/gtk/bmpbuttn.cpp | 4 ++-- src/gtk/button.cpp | 8 ++++---- src/gtk/filedlg.cpp | 9 ++++++++- src/gtk/listbox.cpp | 4 ++-- src/gtk/menu.cpp | 28 +++++++++++++++++++++++++++- src/gtk/tbargtk.cpp | 13 +++++++++++-- src/gtk/window.cpp | 23 ++++++++++++++++++----- src/gtk1/bmpbuttn.cpp | 4 ++-- src/gtk1/button.cpp | 8 ++++---- src/gtk1/filedlg.cpp | 9 ++++++++- src/gtk1/listbox.cpp | 4 ++-- src/gtk1/menu.cpp | 28 +++++++++++++++++++++++++++- src/gtk1/tbargtk.cpp | 13 +++++++++++-- src/gtk1/window.cpp | 23 ++++++++++++++++++----- 32 files changed, 202 insertions(+), 75 deletions(-) diff --git a/distrib/msw/gtk.rsp b/distrib/msw/gtk.rsp index 53c4ef8ea5..6c53a637c5 100644 --- a/distrib/msw/gtk.rsp +++ b/distrib/msw/gtk.rsp @@ -20,7 +20,7 @@ include/install-sh src/Makefile src/Makefile.in -src/*.inc +src/gtk.inc src/make.env src/makelib.env src/makeprog.env diff --git a/distrib/msw/motif.rsp b/distrib/msw/motif.rsp index 70e619436e..9af44964c0 100644 --- a/distrib/msw/motif.rsp +++ b/distrib/msw/motif.rsp @@ -16,7 +16,7 @@ src/makelib.env src/Makefile src/Makefile.in -src/*.inc +src/motif.inc src/motif/*.cpp src/motif/*.c diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index cc9979e03d..6aa0cd9fa1 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -17,6 +17,12 @@ installed it, but you also have another version of the GTK installed, which you may need to removed including other versions of glib (and its headers). +You get errors during compilation. The reason is that you +probably have a broken compiler, which includes almost +everything that is called gcc. If there is just any way +for you to use egcs, use egcs. We are sorry, but we cannot +fix gcc for the moment. + * The most simple program ------------------------- @@ -48,7 +54,7 @@ this has no effect, but I tried... wxWindows/GTK requires the GTK+ library to be installed on your system. It has to be a stable version, preferebly version 1.0.6. When using -a version previous to 1.0.6 you'll get crashes here and there. +a version previous to 1.0.6 you'll might get crashes here and there. wxWindows/GTK does NOT work with the 1.1.X versions of the GTK+ library and we will wait until the 1.2 version comes out and has stabilized @@ -93,6 +99,10 @@ problem will disappear in the near future when all major Linux Variants have moved to glibc 2. Also, the Linux Base Standard will include glibc 2 and Posix threads. +NB: DO NOT COMPILE WXGTK WITH GCC AND THREADS, SINCE +ALL PROGRAMS WILL CRASH UPON START-UP. Just always +use egcs and be happy. + * Create your configuration ----------------------------- diff --git a/docs/gtk/makewxgtk b/docs/gtk/makewxgtk index 71971a3621..8956a8fe05 100644 --- a/docs/gtk/makewxgtk +++ b/docs/gtk/makewxgtk @@ -6,6 +6,6 @@ # if you're feeling brave, you may wish to compile with threads. # -- Julian Smart chmod a+x configure config.sub config.guess setup/general/* setup/shared/* -./configure --with-shared --with-gtk --with-debug_flag --with-debug_info --without-threads -without-odbc +./configure --with-shared --with-gtk --with-debug_flag --with-debug_info --without-threads make makefiles make diff --git a/docs/gtk/readme.txt b/docs/gtk/readme.txt index e8e4f3c9cb..25c561571b 100644 --- a/docs/gtk/readme.txt +++ b/docs/gtk/readme.txt @@ -1,5 +1,5 @@ - Welcome to wxWindows/Gtk 2.01 (beta 3), + Welcome to wxWindows/Gtk 2.01 (beta 4), you have downloaded version 2.01 of the GTK+ 1.0 port of the wxWindows GUI library. diff --git a/docs/gtk/todo.txt b/docs/gtk/todo.txt index 05ba0e3afd..798af17b33 100644 --- a/docs/gtk/todo.txt +++ b/docs/gtk/todo.txt @@ -7,7 +7,7 @@ OwnerDraw for wxListCtrl and others -> Postponed. DnD - -> Must be rewritten for GTK+ 1.1.3 + -> Must be rewritten for GTK+ 1.2 wxDebugContext <-> wxLogXXX functions -> Remove either @@ -15,8 +15,11 @@ wxDebugContext <-> wxLogXXX functions Implement wxPalette -> I never understood that. Postponed. +Implement different visuals and displays + -> I never understood that. Postponed. + Show accelerator in menus - -> Changed in GTK 1.1.X. Postponed. + -> Changed in GTK 1.2. Postponed. Cooperation with Qt -> Would be nice. diff --git a/include/wx/defs.h b/include/wx/defs.h index 63f75b9e60..ce89fa76a8 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -437,17 +437,24 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); /* * wxToolBar style flags */ - #define wxTB_3DBUTTONS 0x8000 #define wxTB_HORIZONTAL 0x0002 #define wxTB_VERTICAL 0x0004 // Flatbar/Coolbar under Win98 #define wxTB_FLAT 0x0008 +// use native docking +#define wxTB_DOCKABLE 0x0010 /* - * Apply to all panel items + * wxMenuBar style flags */ +// use native docking +#define wxMB_DOCKABLE 0x0001 + +/* + * Apply to all panel items + */ #define wxCOLOURED 0x0800 // Alignment for panel item labels: replaces characters with zeros // when creating label, so spaces can be included in string for alignment. @@ -460,7 +467,6 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); /* * Styles for wxListBox */ - #define wxLB_SORT 0x0010 #define wxLB_SINGLE 0x0020 #define wxLB_MULTIPLE 0x0040 @@ -516,7 +522,6 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); /* * wxSlider flags */ - #define wxSL_HORIZONTAL wxHORIZONTAL #define wxSL_VERTICAL wxVERTICAL // The next one is obsolete - use scroll events instead @@ -534,21 +539,18 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); /* * wxScrollBar flags */ - #define wxSB_HORIZONTAL wxHORIZONTAL #define wxSB_VERTICAL wxVERTICAL /* * wxButton flags */ - #define wxBU_AUTODRAW 0x0004 #define wxBU_NOAUTODRAW 0x0000 /* * wxTreeCtrl flags */ - #define wxTR_HAS_BUTTONS 0x0004 #define wxTR_EDIT_LABELS 0x0008 #define wxTR_LINES_AT_ROOT 0x0010 @@ -556,7 +558,6 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); /* * wxListCtrl flags */ - #define wxLC_ICON 0x0004 #define wxLC_SMALL_ICON 0x0008 #define wxLC_LIST 0x0010 diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 347acf3340..08a63b914e 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -44,6 +44,7 @@ class wxMenuBar: public wxWindow DECLARE_DYNAMIC_CLASS(wxMenuBar) public: + wxMenuBar( long style ); wxMenuBar(); void Append( wxMenu *menu, const wxString &title ); diff --git a/include/wx/gtk1/menu.h b/include/wx/gtk1/menu.h index 347acf3340..08a63b914e 100644 --- a/include/wx/gtk1/menu.h +++ b/include/wx/gtk1/menu.h @@ -44,6 +44,7 @@ class wxMenuBar: public wxWindow DECLARE_DYNAMIC_CLASS(wxMenuBar) public: + wxMenuBar( long style ); wxMenuBar(); void Append( wxMenu *menu, const wxString &title ); diff --git a/include/wx/version.h b/include/wx/version.h index 0c765e7493..155118e34e 100644 --- a/include/wx/version.h +++ b/include/wx/version.h @@ -18,7 +18,7 @@ #define wxRELEASE_NUMBER 1 #define wxVERSION_STRING "wxWindows 2.0.1" #define wxVERSION_NUMBER (wxMAJOR_VERSION * 1000) + (wxMINOR_VERSION * 100) + wxRELEASE_NUMBER -#define wxBETA_NUMBER 3 +#define wxBETA_NUMBER 4 #define wxVERSION_FLOAT wxMAJOR_VERSION + (wxMINOR_VERSION/10.0) + (wxRELEASE_NUMBER/100.0) + (wxBETA_NUMBER/10000.0) #endif diff --git a/samples/forty/playerdg.cpp b/samples/forty/playerdg.cpp index dc04b7f4c7..2b221ecd4a 100644 --- a/samples/forty/playerdg.cpp +++ b/samples/forty/playerdg.cpp @@ -153,9 +153,7 @@ void PlayerSelectionDialog::SelectCallback(wxCommandEvent& event) { if (event.GetEventType() == wxEVT_COMMAND_LISTBOX_SELECTED) { -#ifdef __WXGTK__ - if (event.IsSelection()) -#endif +// if (event.IsSelection()) m_textField->SetValue(event.GetString()); } } diff --git a/samples/toolbar/test.cpp b/samples/toolbar/test.cpp index 9d6232483a..298851bbc7 100644 --- a/samples/toolbar/test.cpp +++ b/samples/toolbar/test.cpp @@ -61,7 +61,7 @@ bool MyApp::OnInit(void) wxMenu *helpMenu = new wxMenu; helpMenu->Append(wxID_HELP, "&About", "About toolbar sample"); - wxMenuBar* menuBar = new wxMenuBar; + wxMenuBar* menuBar = new wxMenuBar( wxMB_DOCKABLE ); menuBar->Append(fileMenu, "&File"); menuBar->Append(helpMenu, "&Help"); @@ -70,7 +70,7 @@ bool MyApp::OnInit(void) frame->SetMenuBar(menuBar); // Create the toolbar - frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR); + frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT|wxTB_DOCKABLE, ID_TOOLBAR); frame->GetToolBar()->SetMargins( 2, 2 ); diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index e9f54e59f9..4fd5d33454 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -284,6 +284,7 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& m // Insert a sizer for the buttons wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); buttonSizer->SetName("buttonSizer"); + buttonSizer->SetSpacing(12,0); // Specify constraints for the button sizer wxLayoutConstraints *c = new wxLayoutConstraints; @@ -297,12 +298,12 @@ bool wxSingleChoiceDialog::Create( wxWindow *WXUNUSED(parent), const wxString& m wxButton *cancel = NULL; if (style & wxOK) { - ok = new wxButton(this, wxID_OK, _("OK")); + ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) ); buttonSizer->AddSizerChild(ok); } if (style & wxCANCEL) { - cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); + cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1)); buttonSizer->AddSizerChild(cancel); } diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index 192fbbcddb..7f71b2bc75 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -228,11 +228,11 @@ void wxGenericColourDialog::CreateWidgets(void) { wxBeginBusyCursor(); - wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(okButtonX, buttonY)); + wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(okButtonX, buttonY), wxSize(75,-1) ); int bw, bh; okButton->GetSize(&bw, &bh); - (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(okButtonX + bw + 20, buttonY)); + (void) new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(okButtonX + bw + 20, buttonY), wxSize(75,-1)); (void) new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours"), wxPoint(customButtonX, buttonY)); diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index da985fa3af..49a60b6337 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -338,7 +338,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, m_input = new wxTextCtrl( this, ID_TEXTCTRL, m_path, wxDefaultPosition ); // m_check = new wxCheckBox( this, ID_CHECK, _("Show hidden") ); m_ok = new wxButton( this, ID_OK, _("OK") ); - m_cancel = new wxButton( this, ID_CANCEL, _("Cancel") ); + m_cancel = new wxButton( this, ID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1) ); m_new = new wxButton( this, ID_NEW, _("New...") ); // m_check->SetValue(TRUE); @@ -364,7 +364,7 @@ void wxDirDialog::doSize() m_input->GetSize(&w,&h2); h -= h2; m_ok->GetSize(&w, &h2); h -= h2; //m_check->GetSize(&w, &h2); h -= h2; - h -= 20; + h -= 30; wxLayoutConstraints *c = new wxLayoutConstraints; c->left.SameAs (this, wxLeft,5); @@ -390,14 +390,14 @@ void wxDirDialog::doSize() c = new wxLayoutConstraints; c->width.SameAs (m_cancel, wxWidth); c->height.AsIs (); - c->top.Below (m_input,5); - c->centreX.PercentOf (this, wxWidth, 25); + c->top.Below (m_input,10); + c->centreX.PercentOf (this, wxWidth, 20); m_ok->SetConstraints(c); c = new wxLayoutConstraints; c->width.SameAs (m_cancel, wxWidth); c->height.AsIs (); - c->top.Below (m_input,5); + c->top.Below (m_input,10); c->bottom.SameAs (this, wxBottom, 5); c->centreX.PercentOf (this, wxWidth, 50); m_new->SetConstraints(c); @@ -405,8 +405,8 @@ void wxDirDialog::doSize() c = new wxLayoutConstraints; c->width.AsIs (); c->height.AsIs (); - c->top.Below (m_input,5); - c->centreX.PercentOf (this, wxWidth, 75); + c->top.Below (m_input,10); + c->centreX.PercentOf (this, wxWidth, 80); m_cancel->SetConstraints(c); Layout(); diff --git a/src/generic/fontdlgg.cpp b/src/generic/fontdlgg.cpp index 7991fef481..d08904e7ac 100644 --- a/src/generic/fontdlgg.cpp +++ b/src/generic/fontdlgg.cpp @@ -255,10 +255,10 @@ void wxGenericFontDialog::CreateWidgets(void) fontRect.y+=y+5; //NL mod - int by = (fontRect.y + fontRect.height + 10); + int by = (fontRect.y + fontRect.height + 15); - wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(220, by), wxSize(100,-1)); - (void) new wxButton(this, wxID_OK, _("Cancel"), wxPoint(340, by), wxSize(100,-1)); + wxButton *okButton = new wxButton(this, wxID_OK, _("OK"), wxPoint(230, by), wxSize(75,-1)); + (void) new wxButton(this, wxID_OK, _("Cancel"), wxPoint(330, by), wxSize(75,-1)); familyChoice->SetStringSelection( wxFontFamilyIntToString(dialogFont.GetFamily()) ); styleChoice->SetStringSelection(wxFontStyleIntToString(dialogFont.GetStyle())); diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index 498dccc0b6..9ad504ce94 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -111,6 +111,7 @@ wxGenericMessageDialog::wxGenericMessageDialog(wxWindow *parent, const wxString& wxRowColSizer *buttonSizer = new wxRowColSizer(topSizer, wxSIZER_ROWS); buttonSizer->SetName("buttonSizer"); + buttonSizer->SetSpacing(12,0); // Specify constraints for the button sizer wxLayoutConstraints *c = new wxLayoutConstraints; @@ -126,20 +127,20 @@ wxGenericMessageDialog::wxGenericMessageDialog(wxWindow *parent, const wxString& wxButton *no = (wxButton *) NULL; if (style & wxYES_NO) { - yes = new wxButton(this, wxID_YES, _("Yes")); - no = new wxButton(this, wxID_NO, _("No")); + yes = new wxButton(this, wxID_YES, _("Yes"), wxDefaultPosition, wxSize(75,-1) ); + no = new wxButton(this, wxID_NO, _("No"), wxDefaultPosition, wxSize(75,-1) ); buttonSizer->AddSizerChild(yes); buttonSizer->AddSizerChild(no); } if (style & wxOK) { - ok = new wxButton(this, wxID_OK, _("OK")); + ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1) ); buttonSizer->AddSizerChild(ok); } if (style & wxCANCEL) { - cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); + cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1) ); buttonSizer->AddSizerChild(cancel); } diff --git a/src/generic/textdlgg.cpp b/src/generic/textdlgg.cpp index c582cc875f..d4ce2cdc1d 100644 --- a/src/generic/textdlgg.cpp +++ b/src/generic/textdlgg.cpp @@ -127,17 +127,18 @@ wxTextEntryDialog::wxTextEntryDialog(wxWindow *parent, const wxString& message, c->top.Below (spacingSizer2); c->centreX.SameAs (textSizer, wxCentreX); buttonSizer->SetConstraints(c); + buttonSizer->SetSpacing(12,0); wxButton *ok = NULL; wxButton *cancel = NULL; if (style & wxOK) { - ok = new wxButton(this, wxID_OK, _("OK")); + ok = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(75,-1)); buttonSizer->AddSizerChild(ok); } if (style & wxCANCEL) { - cancel = new wxButton(this, wxID_CANCEL, _("Cancel")); + cancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(75,-1)); buttonSizer->AddSizerChild(cancel); } diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 49f84d1698..0984b03302 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -163,10 +163,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi void wxBitmapButton::SetDefault() { -/* GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); -*/ + + SetSize( m_x, m_y, m_width, m_height ); } void wxBitmapButton::SetLabel( const wxString &label ) diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 8c91ec2adc..42716b5b40 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -97,10 +97,10 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, void wxButton::SetDefault(void) { -/* - GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); - gtk_widget_grab_default( m_widget ); -*/ + GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); + gtk_widget_grab_default( m_widget ); + + SetSize( m_x, m_y, m_width, m_height ); } void wxButton::SetLabel( const wxString &label ) diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 1667ec8e07..fce41fad7e 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -110,6 +110,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_widget_set_uposition( m_widget, x, y ); GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); + gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway m_path.Append(m_dir); if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); @@ -120,9 +121,15 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); + // strange way to internationalize + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), _("OK") ); + gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); - + + // strange way to internationalize + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), _("Cancel") ); + gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); } diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 436ae7f1d6..5028599776 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -316,6 +316,8 @@ void wxListBox::AppendCommon( const wxString &item ) list_item = gtk_list_item_new_with_label( item ); } + gtk_container_add( GTK_CONTAINER(m_list), list_item ); + gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); @@ -323,8 +325,6 @@ void wxListBox::AppendCommon( const wxString &item ) gtk_signal_connect( GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); - gtk_container_add( GTK_CONTAINER(m_list), list_item ); - if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT(list_item), diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 7f42dd5e94..aff2211922 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -26,6 +26,32 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow) +wxMenuBar::wxMenuBar( long style ) +{ + m_needParent = FALSE; // hmmm + + PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); + + m_menus.DeleteContents( TRUE ); + + m_menubar = gtk_menu_bar_new(); + + if (style & wxMB_DOCKABLE) + { + m_widget = gtk_handle_box_new(); + gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_menubar) ); + gtk_widget_show( GTK_WIDGET(m_menubar) ); + } + else + { + m_widget = GTK_WIDGET(m_menubar); + } + + PostCreation(); + + Show( TRUE ); +} + wxMenuBar::wxMenuBar() { m_needParent = FALSE; // hmmm @@ -36,7 +62,7 @@ wxMenuBar::wxMenuBar() m_menubar = gtk_menu_bar_new(); - m_widget = GTK_WIDGET(m_menubar); + m_widget = GTK_WIDGET(m_menubar); PostCreation(); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index df1b967d1d..5712f800d3 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -123,8 +123,17 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_separation = 5; gtk_toolbar_set_space_size( m_toolbar, m_separation ); m_hasToolAlready = FALSE; - - m_widget = GTK_WIDGET(m_toolbar); + + 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) ); + } + else + { + m_widget = GTK_WIDGET(m_toolbar); + } gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index d450141f21..f60a748ecf 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1828,11 +1828,24 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - wxPoint pt( m_parent->GetClientAreaOrigin() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); - - if ((old_width != m_width) || (old_height != m_height)) - gtk_widget_set_usize( m_widget, m_width, m_height ); + if (GTK_WIDGET_HAS_DEFAULT(m_widget)) + { + /* the default button has a border around it */ + int border = 5; + + wxPoint pt( m_parent->GetClientAreaOrigin() ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x-border, m_y+pt.y-border ); + + gtk_widget_set_usize( m_widget, m_width+2*border, m_height+2*border ); + } + else + { + wxPoint pt( m_parent->GetClientAreaOrigin() ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); + + if ((old_width != m_width) || (old_height != m_height)) + gtk_widget_set_usize( m_widget, m_width, m_height ); + } } m_sizeSet = TRUE; diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 49f84d1698..0984b03302 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -163,10 +163,10 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi void wxBitmapButton::SetDefault() { -/* GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); gtk_widget_grab_default( m_widget ); -*/ + + SetSize( m_x, m_y, m_width, m_height ); } void wxBitmapButton::SetLabel( const wxString &label ) diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 8c91ec2adc..42716b5b40 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -97,10 +97,10 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, void wxButton::SetDefault(void) { -/* - GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); - gtk_widget_grab_default( m_widget ); -*/ + GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT ); + gtk_widget_grab_default( m_widget ); + + SetSize( m_x, m_y, m_width, m_height ); } void wxButton::SetLabel( const wxString &label ) diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 1667ec8e07..fce41fad7e 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -110,6 +110,7 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_widget_set_uposition( m_widget, x, y ); GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); + gtk_file_selection_hide_fileop_buttons( sel ); // they don't work anyway m_path.Append(m_dir); if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); @@ -120,9 +121,15 @@ wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); + // strange way to internationalize + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->ok_button)->child ), _("OK") ); + gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); - + + // strange way to internationalize + gtk_label_set( GTK_LABEL( GTK_BUTTON(sel->cancel_button)->child ), _("Cancel") ); + gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", GTK_SIGNAL_FUNC(gtk_filedialog_delete_callback), (gpointer)this ); } diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 436ae7f1d6..5028599776 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -316,6 +316,8 @@ void wxListBox::AppendCommon( const wxString &item ) list_item = gtk_list_item_new_with_label( item ); } + gtk_container_add( GTK_CONTAINER(m_list), list_item ); + gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); @@ -323,8 +325,6 @@ void wxListBox::AppendCommon( const wxString &item ) gtk_signal_connect( GTK_OBJECT(list_item), "deselect", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); - gtk_container_add( GTK_CONTAINER(m_list), list_item ); - if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT(list_item), diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 7f42dd5e94..aff2211922 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -26,6 +26,32 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow) +wxMenuBar::wxMenuBar( long style ) +{ + m_needParent = FALSE; // hmmm + + PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); + + m_menus.DeleteContents( TRUE ); + + m_menubar = gtk_menu_bar_new(); + + if (style & wxMB_DOCKABLE) + { + m_widget = gtk_handle_box_new(); + gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_menubar) ); + gtk_widget_show( GTK_WIDGET(m_menubar) ); + } + else + { + m_widget = GTK_WIDGET(m_menubar); + } + + PostCreation(); + + Show( TRUE ); +} + wxMenuBar::wxMenuBar() { m_needParent = FALSE; // hmmm @@ -36,7 +62,7 @@ wxMenuBar::wxMenuBar() m_menubar = gtk_menu_bar_new(); - m_widget = GTK_WIDGET(m_menubar); + m_widget = GTK_WIDGET(m_menubar); PostCreation(); diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index df1b967d1d..5712f800d3 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -123,8 +123,17 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_separation = 5; gtk_toolbar_set_space_size( m_toolbar, m_separation ); m_hasToolAlready = FALSE; - - m_widget = GTK_WIDGET(m_toolbar); + + 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) ); + } + else + { + m_widget = GTK_WIDGET(m_toolbar); + } gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index d450141f21..f60a748ecf 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1828,11 +1828,24 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags ) if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight; - wxPoint pt( m_parent->GetClientAreaOrigin() ); - gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); - - if ((old_width != m_width) || (old_height != m_height)) - gtk_widget_set_usize( m_widget, m_width, m_height ); + if (GTK_WIDGET_HAS_DEFAULT(m_widget)) + { + /* the default button has a border around it */ + int border = 5; + + wxPoint pt( m_parent->GetClientAreaOrigin() ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x-border, m_y+pt.y-border ); + + gtk_widget_set_usize( m_widget, m_width+2*border, m_height+2*border ); + } + else + { + wxPoint pt( m_parent->GetClientAreaOrigin() ); + gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); + + if ((old_width != m_width) || (old_height != m_height)) + gtk_widget_set_usize( m_widget, m_width, m_height ); + } } m_sizeSet = TRUE; -- 2.45.2