diff --git a/docs/latex/wx/checkbox.tex b/docs/latex/wx/checkbox.tex index 0f76ec31f3..396a731764 100644 --- a/docs/latex/wx/checkbox.tex +++ b/docs/latex/wx/checkbox.tex @@ -99,7 +99,8 @@ Returns TRUE if it is checked, FALSE otherwise. \func{void}{SetValue}{\param{const bool}{ state}} -Sets the checkbox to the given state. +Sets the checkbox to the given state. This does not cause a +wxEVT\_COMMAND\_CHECKBOX\_CLICKED event to get emitted. \wxheading{Parameters} diff --git a/docs/latex/wx/choice.tex b/docs/latex/wx/choice.tex index 7a505b8118..11f02c3b5f 100644 --- a/docs/latex/wx/choice.tex +++ b/docs/latex/wx/choice.tex @@ -183,7 +183,8 @@ This is implemented for Motif only. \func{void}{SetSelection}{\param{int}{ n}} -Sets the choice by passing the desired string position. +Sets the choice by passing the desired string position. This does not cause +a wxEVT\_COMMAND\_CHOICE\_SELECTED event to get emitted. \wxheading{Parameters} @@ -197,7 +198,8 @@ Sets the choice by passing the desired string position. \func{void}{SetStringSelection}{\param{const wxString\& }{ string}} -Sets the choice by passing the desired string. +Sets the choice by passing the desired string. This does not cause +a wxEVT\_COMMAND\_CHOICE\_SELECTED event to get emitted. \wxheading{Parameters} diff --git a/docs/latex/wx/combobox.tex b/docs/latex/wx/combobox.tex index 52d509551a..f30c6a53c3 100644 --- a/docs/latex/wx/combobox.tex +++ b/docs/latex/wx/combobox.tex @@ -295,7 +295,8 @@ Sets the insertion point at the end of the combobox text field. \func{void}{SetSelection}{\param{int}{ n}} -Selects the given item in the combobox list. +Selects the given item in the combobox list. This does not cause a +wxEVT\_COMMAND\_COMBOBOX\_SELECTED event to get emitted. \func{void}{SetSelection}{\param{long}{ from}, \param{long}{ to}} diff --git a/docs/latex/wx/listbox.tex b/docs/latex/wx/listbox.tex index c992c8387b..506d4cbe04 100644 --- a/docs/latex/wx/listbox.tex +++ b/docs/latex/wx/listbox.tex @@ -338,7 +338,7 @@ Associates the given client data pointer with the given item. \func{void}{SetFirstItem}{\param{const wxString\& }{string}} -Set the specified item to be the first visible item. +Set the specified item to be the first visible item. Windows only. \wxheading{Parameters} @@ -350,7 +350,8 @@ Set the specified item to be the first visible item. \func{void}{SetSelection}{\param{int}{ n}, \param{const bool }{select = TRUE}} -Selects or deselects the given item. +Selects or deselects the given item. This does not cause a +wxEVT\_COMMAND\_LISTBOX\_SELECT event to get emitted. \wxheading{Parameters} @@ -374,7 +375,8 @@ Sets the string value of an item. \func{void}{SetStringSelection}{\param{const wxString\& }{ string}, \param{const bool}{ select = TRUE}} -Sets the current selection. +Sets the current selection. This does not cause a +wxEVT\_COMMAND\_LISTBOX\_SELECT event to get emitted. \wxheading{Parameters} diff --git a/docs/latex/wx/node.tex b/docs/latex/wx/node.tex index 389c874644..c718a7220e 100644 --- a/docs/latex/wx/node.tex +++ b/docs/latex/wx/node.tex @@ -34,7 +34,7 @@ Retrieves the client data pointer associated with the node. Retrieves the next node (NULL if at end of list). -\membersection{wxNodeBase::Previous} +\membersection{wxNodeBase::GetPrevious} \func{wxNodeBase *}{GetPrevious}{\void} diff --git a/docs/latex/wx/radiobox.tex b/docs/latex/wx/radiobox.tex index da55b879f2..9b1d9be5a2 100644 --- a/docs/latex/wx/radiobox.tex +++ b/docs/latex/wx/radiobox.tex @@ -219,7 +219,8 @@ implements the following methods:\par \func{void}{SetSelection}{\param{int}{ n}} -Sets a button by passing the desired string position. +Sets a button by passing the desired string position. This does not cause +a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. \wxheading{Parameters} @@ -229,7 +230,8 @@ Sets a button by passing the desired string position. \func{void}{SetStringSelection}{\param{const wxString\& }{string}} -Sets a button by passing the desired string. +Sets the selection to a button by passing the desired string. This does not cause +a wxEVT\_COMMAND\_RADIOBOX\_SELECTED event to get emitted. \wxheading{Parameters} diff --git a/docs/latex/wx/radiobut.tex b/docs/latex/wx/radiobut.tex index 48cae42ab5..9146afe3c0 100644 --- a/docs/latex/wx/radiobut.tex +++ b/docs/latex/wx/radiobut.tex @@ -16,7 +16,10 @@ exclusive options. It has a text label next to a (usually) round button. \wxheading{Window styles} -There are no specific styles for this class. +\twocolwidtha{5cm} +\begin{twocollist}\itemsep=0pt +\twocolitem{\windowstyle{wxRB\_GROUP}}{Marks the beginning of a new group of radio buttons.} +\end{twocollist} See also \helpref{window styles overview}{windowstyles}. @@ -98,7 +101,8 @@ Returns TRUE if the radio button is depressed, FALSE otherwise. \func{void}{SetValue}{\param{const bool}{ value}} -Sets the radio button to selected or deselected status. +Sets the radio button to selected or deselected status. This does not cause a +wxEVT\_COMMAND\_RADIOBUTTON\_SELECTED event to get emitted. \wxheading{Parameters} diff --git a/include/wx/Makefile.am b/include/wx/Makefile.am index 65d7d52479..8d69600bf1 100644 --- a/include/wx/Makefile.am +++ b/include/wx/Makefile.am @@ -128,7 +128,6 @@ wx_include_HEADERS = \ resource.h \ sashwin.h \ sckaddr.h \ - sckint.h \ sckipc.h \ sckstrm.h \ scrolbar.h \ diff --git a/include/wx/defs.h b/include/wx/defs.h index 1fc466a7dc..bfa0d45da7 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -1421,6 +1421,7 @@ typedef int gint; typedef unsigned guint; typedef unsigned long gulong; typedef void* gpointer; +typedef struct _GSList GSList; /* Stand-ins for GDK types */ typedef gulong GdkAtom; diff --git a/include/wx/gtk/checkbox.h b/include/wx/gtk/checkbox.h index edd5cf3dd0..f26be094c8 100644 --- a/include/wx/gtk/checkbox.h +++ b/include/wx/gtk/checkbox.h @@ -71,7 +71,6 @@ public: // implementation void ApplyWidgetStyle(); - bool m_blockFirstEvent; GtkWidget *m_widgetCheckbox; GtkWidget *m_widgetLabel; }; diff --git a/include/wx/gtk/choice.h b/include/wx/gtk/choice.h index acd0324c00..54102db5b0 100644 --- a/include/wx/gtk/choice.h +++ b/include/wx/gtk/choice.h @@ -93,6 +93,8 @@ public: wxList m_clientDataList; wxList m_clientObjectList; + void DisableEvents(); + void EnableEvents(); void AppendCommon( const wxString &item ); void ApplyWidgetStyle(); }; diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index d1787f8ca0..4fda5e81b8 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -117,6 +117,8 @@ public: wxList m_clientDataList; wxList m_clientObjectList; + void DisableEvents(); + void EnableEvents(); void AppendCommon( const wxString &item ); GtkWidget* GetConnectWidget(); bool IsOwnGtkWindow( GdkWindow *window ); diff --git a/include/wx/gtk/listbox.h b/include/wx/gtk/listbox.h index 993a9b64c9..9b9e436289 100644 --- a/include/wx/gtk/listbox.h +++ b/include/wx/gtk/listbox.h @@ -109,6 +109,8 @@ public: // implementation + void DisableEvents(); + void EnableEvents(); void AppendCommon( const wxString &item ); int GetIndex( GtkWidget *item ) const; GtkWidget *GetConnectWidget(); diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index b28499448e..0999008254 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -96,6 +96,8 @@ public: // implementation + void DisableEvents(); + void EnableEvents(); bool IsOwnGtkWindow( GdkWindow *window ); void ApplyWidgetStyle(); wxSize LayoutItems(); diff --git a/include/wx/gtk/radiobut.h b/include/wx/gtk/radiobut.h index bbe2112a89..16aa5fa328 100644 --- a/include/wx/gtk/radiobut.h +++ b/include/wx/gtk/radiobut.h @@ -41,36 +41,34 @@ extern const char* wxRadioButtonNameStr; class wxRadioButton: public wxControl { - DECLARE_DYNAMIC_CLASS(wxRadioButton) +DECLARE_DYNAMIC_CLASS(wxRadioButton) - public: - inline wxRadioButton() {} - inline wxRadioButton( wxWindow *parent, wxWindowID id, +public: + inline wxRadioButton() {} + inline wxRadioButton( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxRadioButtonNameStr ) - { + { Create( parent, id, label, pos, size, style, validator, name ); - } - bool Create(wxWindow *parent, wxWindowID id, + } + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxRadioButtonNameStr ); - virtual void SetLabel(const wxString& label); - virtual void SetValue(bool val); - virtual bool GetValue() const; - bool Enable( bool enable ); + virtual void SetLabel(const wxString& label); + virtual void SetValue(bool val); + virtual bool GetValue() const; + bool Enable( bool enable ); // implementation - void ApplyWidgetStyle(); - - bool m_blockFirstEvent; - GtkWidget* m_theOtherRadioButtton; + GSList *m_radioButtonGroup; + void ApplyWidgetStyle(); }; #endif diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index bf99cd47e7..fbbc2b18c1 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -187,6 +187,7 @@ public: bool m_sizeSet:1; bool m_resizing:1; bool m_isStaticBox:1; /* faster than IS_KIND_OF */ + bool m_isRadioButton:1; /* faster than IS_KIND_OF */ bool m_isFrame:1; /* faster than IS_KIND_OF */ bool m_acceptsFocus:1; /* ! wxStaticBox etc. */ diff --git a/include/wx/gtk1/checkbox.h b/include/wx/gtk1/checkbox.h index edd5cf3dd0..f26be094c8 100644 --- a/include/wx/gtk1/checkbox.h +++ b/include/wx/gtk1/checkbox.h @@ -71,7 +71,6 @@ public: // implementation void ApplyWidgetStyle(); - bool m_blockFirstEvent; GtkWidget *m_widgetCheckbox; GtkWidget *m_widgetLabel; }; diff --git a/include/wx/gtk1/choice.h b/include/wx/gtk1/choice.h index acd0324c00..54102db5b0 100644 --- a/include/wx/gtk1/choice.h +++ b/include/wx/gtk1/choice.h @@ -93,6 +93,8 @@ public: wxList m_clientDataList; wxList m_clientObjectList; + void DisableEvents(); + void EnableEvents(); void AppendCommon( const wxString &item ); void ApplyWidgetStyle(); }; diff --git a/include/wx/gtk1/combobox.h b/include/wx/gtk1/combobox.h index d1787f8ca0..4fda5e81b8 100644 --- a/include/wx/gtk1/combobox.h +++ b/include/wx/gtk1/combobox.h @@ -117,6 +117,8 @@ public: wxList m_clientDataList; wxList m_clientObjectList; + void DisableEvents(); + void EnableEvents(); void AppendCommon( const wxString &item ); GtkWidget* GetConnectWidget(); bool IsOwnGtkWindow( GdkWindow *window ); diff --git a/include/wx/gtk1/listbox.h b/include/wx/gtk1/listbox.h index 993a9b64c9..9b9e436289 100644 --- a/include/wx/gtk1/listbox.h +++ b/include/wx/gtk1/listbox.h @@ -109,6 +109,8 @@ public: // implementation + void DisableEvents(); + void EnableEvents(); void AppendCommon( const wxString &item ); int GetIndex( GtkWidget *item ) const; GtkWidget *GetConnectWidget(); diff --git a/include/wx/gtk1/radiobox.h b/include/wx/gtk1/radiobox.h index b28499448e..0999008254 100644 --- a/include/wx/gtk1/radiobox.h +++ b/include/wx/gtk1/radiobox.h @@ -96,6 +96,8 @@ public: // implementation + void DisableEvents(); + void EnableEvents(); bool IsOwnGtkWindow( GdkWindow *window ); void ApplyWidgetStyle(); wxSize LayoutItems(); diff --git a/include/wx/gtk1/radiobut.h b/include/wx/gtk1/radiobut.h index bbe2112a89..16aa5fa328 100644 --- a/include/wx/gtk1/radiobut.h +++ b/include/wx/gtk1/radiobut.h @@ -41,36 +41,34 @@ extern const char* wxRadioButtonNameStr; class wxRadioButton: public wxControl { - DECLARE_DYNAMIC_CLASS(wxRadioButton) +DECLARE_DYNAMIC_CLASS(wxRadioButton) - public: - inline wxRadioButton() {} - inline wxRadioButton( wxWindow *parent, wxWindowID id, +public: + inline wxRadioButton() {} + inline wxRadioButton( wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxRadioButtonNameStr ) - { + { Create( parent, id, label, pos, size, style, validator, name ); - } - bool Create(wxWindow *parent, wxWindowID id, + } + bool Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxRadioButtonNameStr ); - virtual void SetLabel(const wxString& label); - virtual void SetValue(bool val); - virtual bool GetValue() const; - bool Enable( bool enable ); + virtual void SetLabel(const wxString& label); + virtual void SetValue(bool val); + virtual bool GetValue() const; + bool Enable( bool enable ); // implementation - void ApplyWidgetStyle(); - - bool m_blockFirstEvent; - GtkWidget* m_theOtherRadioButtton; + GSList *m_radioButtonGroup; + void ApplyWidgetStyle(); }; #endif diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index bf99cd47e7..fbbc2b18c1 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -187,6 +187,7 @@ public: bool m_sizeSet:1; bool m_resizing:1; bool m_isStaticBox:1; /* faster than IS_KIND_OF */ + bool m_isRadioButton:1; /* faster than IS_KIND_OF */ bool m_isFrame:1; /* faster than IS_KIND_OF */ bool m_acceptsFocus:1; /* ! wxStaticBox etc. */ diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 12a60a156c..9f6486ab65 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -398,13 +398,16 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (void)new wxButton( panel, ID_CHOICE_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) ); (void)new wxCheckBox( panel, ID_CHOICE_ENABLE, "Disable", wxPoint(20,130), wxSize(140,30) ); +/* wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION); wxSize sizeIcon = wxSize(icon.GetWidth(), icon.GetHeight()); - - wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60), sizeIcon); - - // this doesn't work under wxGTK - bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60), sizeIcon); + (void)new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60), sizeIcon); + wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60), sizeIcon); + bitmap->SetBitmap(icon); +*/ + wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION); + (void)new wxStaticBitmap( panel, -1, icon, wxPoint(50, 60) ); + wxStaticBitmap *bitmap = new wxStaticBitmap( panel, -1, wxNullBitmap, wxPoint(10, 60) ); bitmap->SetBitmap(icon); m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice); @@ -494,8 +497,8 @@ void MyPanel::OnPageChanging( wxNotebookEvent &event ) if ( selOld == 2 && selNew == 4 ) { wxMessageBox("This demonstrates how a program may prevent the " - "page change from taking place - the current page will " - "stay the third one", "Conntrol sample", + "page change from taking place - \n the current page will " + "stay the third one", "Control sample", wxICON_INFORMATION | wxOK); event.Veto(); diff --git a/src/common/imagbmp.cpp b/src/common/imagbmp.cpp index 05796710b4..6884aab544 100644 --- a/src/common/imagbmp.cpp +++ b/src/common/imagbmp.cpp @@ -341,7 +341,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream ) ptr[poffset + 1] = cmap[aByte].g; ptr[poffset + 2] = cmap[aByte].b; column++; - linepos += size; + // linepos += size; seems to be wrong, RR } } } diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 946a09a413..75cf233c65 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -42,12 +42,6 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB if (!cb->m_hasVMT) return; - if (cb->m_blockFirstEvent) - { - cb->m_blockFirstEvent = FALSE; - return; - } - if (g_blockEventsOnDrag) return; wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); @@ -80,8 +74,6 @@ bool wxCheckBox::Create(wxWindow *parent, PreCreation( parent, id, pos, size, style, name ); - m_blockFirstEvent = FALSE; - #if wxUSE_VALIDATORS SetValidator( validator ); #endif @@ -102,7 +94,6 @@ bool wxCheckBox::Create(wxWindow *parent, gtk_box_pack_start(GTK_BOX(m_widget), m_widgetLabel, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(m_widget), m_widgetCheckbox, FALSE, FALSE, 3); - // VZ: why do I have to do this to make them appear? gtk_widget_show( m_widgetLabel ); gtk_widget_show( m_widgetCheckbox ); } @@ -146,14 +137,19 @@ void wxCheckBox::SetValue( bool state ) { wxCHECK_RET( m_widgetCheckbox != NULL, _T("invalid checkbox") ); - if ( state == GetValue() ) + if (state == GetValue()) return; - // for compatibility with wxMSW don't send notification when the check box - // state is changed programmatically - m_blockFirstEvent = TRUE; + gtk_signal_disconnect_by_func( GTK_OBJECT(m_widgetCheckbox), + GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), + (gpointer *)this ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widgetCheckbox), state ); + + gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox), + "clicked", + GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), + (gpointer *)this ); } bool wxCheckBox::GetValue() const diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index bd63c5e3f8..f8801312bd 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -355,8 +355,6 @@ void wxChoice::SetSelection( int n ) int tmp = n; gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); - - gtk_choice_clicked_callback( (GtkWidget *) NULL, this ); } void wxChoice::SetStringSelection( const wxString &string ) @@ -367,6 +365,36 @@ void wxChoice::SetStringSelection( const wxString &string ) if (n != -1) SetSelection( n ); } +void wxChoice::DisableEvents() +{ +/* + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + GList *child = menu_shell->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT( child->data ), + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); + + child = child->next; + } +*/ +} + +void wxChoice::EnableEvents() +{ +/* + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + GList *child = menu_shell->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT( child->data ), "activate", + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); + + child = child->next; + } +*/ +} + void wxChoice::ApplyWidgetStyle() { SetWidgetStyle(); diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 366ea1b8e1..20718dfae3 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -422,8 +422,12 @@ void wxComboBox::SetSelection( int n ) { wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); + DisableEvents(); + GtkWidget *list = GTK_COMBO(m_widget)->list; gtk_list_select_item( GTK_LIST(list), n ); + + EnableEvents(); } void wxComboBox::SetStringSelection( const wxString &string ) @@ -586,6 +590,32 @@ void wxComboBox::OnChar( wxKeyEvent &event ) event.Skip(); } +void wxComboBox::DisableEvents() +{ + GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); + GList *child = list->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); + + child = child->next; + } +} + +void wxComboBox::EnableEvents() +{ + GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); + GList *child = list->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT(child->data), "select", + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); + + child = child->next; + } +} + void wxComboBox::OnSize( wxSizeEvent &event ) { event.Skip(); diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 6505cb6786..a28165297c 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -939,6 +939,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) } } +#if (GTK_MINOR_VERSION > 0) if (req_dash && req_nb_dash) { char *real_req_dash = new char[req_nb_dash]; @@ -955,6 +956,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) gdk_gc_set_dashes( m_penGC, 0, (char*)req_dash, req_nb_dash ); } } +#endif GdkCapStyle capStyle = GDK_CAP_ROUND; switch (m_pen.GetCap()) diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 4c496c67a0..0b62dcb261 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -640,7 +640,11 @@ void wxListBox::Deselect( int n ) { wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); + DisableEvents(); + gtk_list_unselect_item( m_list, n ); + + EnableEvents(); } int wxListBox::FindString( const wxString &item ) const @@ -799,10 +803,14 @@ void wxListBox::SetSelection( int n, bool select ) { wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); + DisableEvents(); + if (select) gtk_list_select_item( m_list, n ); else gtk_list_unselect_item( m_list, n ); + + EnableEvents(); } void wxListBox::SetString( int n, const wxString &string ) @@ -859,7 +867,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) GList *child = m_list->children; while (child) { - gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvCurrent->cWX2MB(tip), (gchar*) NULL ); child = child->next; } } @@ -898,6 +906,38 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) } #endif +void wxListBox::DisableEvents() +{ + GList *child = m_list->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + if (HasFlag(wxLB_MULTIPLE)) + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + child = child->next; + } +} + +void wxListBox::EnableEvents() +{ + GList *child = m_list->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT(child->data), "select", + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + if (HasFlag(wxLB_MULTIPLE)) + gtk_signal_connect( GTK_OBJECT(child->data), "deselect", + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + child = child->next; + } +} + GtkWidget *wxListBox::GetConnectWidget() { return GTK_WIDGET(m_list); diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 3e2dc3124c..cb60031d25 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -328,7 +328,11 @@ void wxRadioBox::SetSelection( int n ) GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() ); + DisableEvents(); + gtk_toggle_button_set_state( button, 1 ); + + EnableEvents(); } int wxRadioBox::GetSelection(void) const @@ -494,6 +498,30 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) wxFAIL_MSG(_T("wxRadioBox::SetNumberOfRowsOrCols not implemented.")); } +void wxRadioBox::DisableEvents() +{ + wxNode *node = m_boxes.First(); + while (node) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(node->Data()), + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + + node = node->Next(); + } +} + +void wxRadioBox::EnableEvents() +{ + wxNode *node = m_boxes.First(); + while (node) + { + gtk_signal_connect( GTK_OBJECT(node->Data()), "clicked", + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + + node = node->Next(); + } +} + void wxRadioBox::ApplyWidgetStyle() { SetWidgetStyle(); diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index 6b6cd98694..294820894f 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -43,12 +43,6 @@ void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButto if (!rb->m_hasVMT) return; - if (rb->m_blockFirstEvent) - { - rb->m_blockFirstEvent = FALSE; - return; - } - if (g_blockEventsOnDrag) return; wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId()); @@ -73,22 +67,50 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab wxSize newSize = size; PreCreation( parent, id, pos, newSize, style, name ); + + m_isRadioButton = TRUE; #if wxUSE_VALIDATORS SetValidator( validator ); #endif - m_widget = gtk_radio_button_new_with_label( (GSList *) NULL, label.mbc_str() ); + + if (HasFlag(wxRB_GROUP)) + { + /* start a new group */ + m_radioButtonGroup = (GSList*) NULL; + } + else + { + /* search backward for last group start */ + wxRadioButton *chief = (wxRadioButton*) NULL; + wxWindowList::Node *node = parent->GetChildren().GetLast(); + while (node) + { + wxWindow *child = node->GetData(); + if (child->m_isRadioButton) + { + chief = (wxRadioButton*) child; + if (child->HasFlag(wxRB_GROUP)) break; + } + if (chief) + { + /* we are part of the group started by chief */ + m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) ); + } + else + { + /* start a new group */ + m_radioButtonGroup = (GSList*) NULL; + } + node = node->GetPrevious(); + } + } + + m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() ); - m_theOtherRadioButtton = - gtk_radio_button_new_with_label( - gtk_radio_button_group( GTK_RADIO_BUTTON(m_widget) ), - "button2" ); - SetLabel(label); - m_blockFirstEvent = FALSE; - if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); @@ -123,15 +145,23 @@ void wxRadioButton::SetValue( bool val ) { wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") ); - if ( val == GetValue() ) + if (val == GetValue()) return; - m_blockFirstEvent = TRUE; - + gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + if (val) + { gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE ); + } else - gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE ); + { + // should give an assert + } + + gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); } bool wxRadioButton::GetValue() const diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index 8027044d5a..bcc8025927 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -44,6 +44,11 @@ void wxStaticBitmap::CreatePixmapWidget() mask = m_bitmap.GetMask()->GetBitmap(); m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); + /* insert GTK representation */ + (*m_parent->m_insertCallback)(m_parent, this); + + gtk_widget_show( m_widget ); + PostCreation(); } @@ -61,7 +66,10 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi if (m_bitmap.Ok()) { - CreatePixmapWidget(); + GdkBitmap *mask = (GdkBitmap *) NULL; + if ( m_bitmap.GetMask() ) + mask = m_bitmap.GetMask()->GetBitmap(); + m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); if (newSize.x == -1) newSize.x = m_bitmap.GetWidth(); if (newSize.y == -1) newSize.y = m_bitmap.GetHeight(); @@ -70,9 +78,9 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi else { m_widget = gtk_label_new( "Bitmap" ); - } - PostCreation(); + PostCreation(); + } m_parent->DoAddChild( this ); @@ -88,18 +96,22 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) if (m_bitmap.Ok()) { - if ( !hasWidget ) + if (!hasWidget) { gtk_widget_destroy( m_widget ); - // recreate m_widget because we'd created a label and not a bitmap - // above + /* recreate m_widget because we've created a label + and not a bitmap above */ CreatePixmapWidget(); } - - GdkBitmap *mask = (GdkBitmap *) NULL; - if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); - gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); + else + { + GdkBitmap *mask = (GdkBitmap *) NULL; + if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); + gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); + } + + SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() ); } } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 24823403c3..7e01371333 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1799,6 +1799,7 @@ void wxWindow::Init() m_insertCallback = (wxInsertChildFunction) NULL; m_isStaticBox = FALSE; + m_isRadioButton = FALSE; m_acceptsFocus = FALSE; } diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 946a09a413..75cf233c65 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -42,12 +42,6 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB if (!cb->m_hasVMT) return; - if (cb->m_blockFirstEvent) - { - cb->m_blockFirstEvent = FALSE; - return; - } - if (g_blockEventsOnDrag) return; wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); @@ -80,8 +74,6 @@ bool wxCheckBox::Create(wxWindow *parent, PreCreation( parent, id, pos, size, style, name ); - m_blockFirstEvent = FALSE; - #if wxUSE_VALIDATORS SetValidator( validator ); #endif @@ -102,7 +94,6 @@ bool wxCheckBox::Create(wxWindow *parent, gtk_box_pack_start(GTK_BOX(m_widget), m_widgetLabel, FALSE, FALSE, 3); gtk_box_pack_start(GTK_BOX(m_widget), m_widgetCheckbox, FALSE, FALSE, 3); - // VZ: why do I have to do this to make them appear? gtk_widget_show( m_widgetLabel ); gtk_widget_show( m_widgetCheckbox ); } @@ -146,14 +137,19 @@ void wxCheckBox::SetValue( bool state ) { wxCHECK_RET( m_widgetCheckbox != NULL, _T("invalid checkbox") ); - if ( state == GetValue() ) + if (state == GetValue()) return; - // for compatibility with wxMSW don't send notification when the check box - // state is changed programmatically - m_blockFirstEvent = TRUE; + gtk_signal_disconnect_by_func( GTK_OBJECT(m_widgetCheckbox), + GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), + (gpointer *)this ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widgetCheckbox), state ); + + gtk_signal_connect( GTK_OBJECT(m_widgetCheckbox), + "clicked", + GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), + (gpointer *)this ); } bool wxCheckBox::GetValue() const diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index bd63c5e3f8..f8801312bd 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -355,8 +355,6 @@ void wxChoice::SetSelection( int n ) int tmp = n; gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); - - gtk_choice_clicked_callback( (GtkWidget *) NULL, this ); } void wxChoice::SetStringSelection( const wxString &string ) @@ -367,6 +365,36 @@ void wxChoice::SetStringSelection( const wxString &string ) if (n != -1) SetSelection( n ); } +void wxChoice::DisableEvents() +{ +/* + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + GList *child = menu_shell->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT( child->data ), + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); + + child = child->next; + } +*/ +} + +void wxChoice::EnableEvents() +{ +/* + GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); + GList *child = menu_shell->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT( child->data ), "activate", + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); + + child = child->next; + } +*/ +} + void wxChoice::ApplyWidgetStyle() { SetWidgetStyle(); diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 366ea1b8e1..20718dfae3 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -422,8 +422,12 @@ void wxComboBox::SetSelection( int n ) { wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); + DisableEvents(); + GtkWidget *list = GTK_COMBO(m_widget)->list; gtk_list_select_item( GTK_LIST(list), n ); + + EnableEvents(); } void wxComboBox::SetStringSelection( const wxString &string ) @@ -586,6 +590,32 @@ void wxComboBox::OnChar( wxKeyEvent &event ) event.Skip(); } +void wxComboBox::DisableEvents() +{ + GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); + GList *child = list->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); + + child = child->next; + } +} + +void wxComboBox::EnableEvents() +{ + GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); + GList *child = list->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT(child->data), "select", + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); + + child = child->next; + } +} + void wxComboBox::OnSize( wxSizeEvent &event ) { event.Skip(); diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 6505cb6786..a28165297c 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -939,6 +939,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) } } +#if (GTK_MINOR_VERSION > 0) if (req_dash && req_nb_dash) { char *real_req_dash = new char[req_nb_dash]; @@ -955,6 +956,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) gdk_gc_set_dashes( m_penGC, 0, (char*)req_dash, req_nb_dash ); } } +#endif GdkCapStyle capStyle = GDK_CAP_ROUND; switch (m_pen.GetCap()) diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 4c496c67a0..0b62dcb261 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -640,7 +640,11 @@ void wxListBox::Deselect( int n ) { wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); + DisableEvents(); + gtk_list_unselect_item( m_list, n ); + + EnableEvents(); } int wxListBox::FindString( const wxString &item ) const @@ -799,10 +803,14 @@ void wxListBox::SetSelection( int n, bool select ) { wxCHECK_RET( m_list != NULL, _T("invalid listbox") ); + DisableEvents(); + if (select) gtk_list_select_item( m_list, n ); else gtk_list_unselect_item( m_list, n ); + + EnableEvents(); } void wxListBox::SetString( int n, const wxString &string ) @@ -859,7 +867,7 @@ void wxListBox::ApplyToolTip( GtkTooltips *tips, const wxChar *tip ) GList *child = m_list->children; while (child) { - gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvLocal.cWX2MB(tip), (gchar*) NULL ); + gtk_tooltips_set_tip( tips, GTK_WIDGET( child->data ), wxConvCurrent->cWX2MB(tip), (gchar*) NULL ); child = child->next; } } @@ -898,6 +906,38 @@ void wxListBox::SetDropTarget( wxDropTarget *dropTarget ) } #endif +void wxListBox::DisableEvents() +{ + GList *child = m_list->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + if (HasFlag(wxLB_MULTIPLE)) + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + child = child->next; + } +} + +void wxListBox::EnableEvents() +{ + GList *child = m_list->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT(child->data), "select", + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + if (HasFlag(wxLB_MULTIPLE)) + gtk_signal_connect( GTK_OBJECT(child->data), "deselect", + GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); + + child = child->next; + } +} + GtkWidget *wxListBox::GetConnectWidget() { return GTK_WIDGET(m_list); diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 3e2dc3124c..cb60031d25 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -328,7 +328,11 @@ void wxRadioBox::SetSelection( int n ) GtkToggleButton *button = GTK_TOGGLE_BUTTON( node->Data() ); + DisableEvents(); + gtk_toggle_button_set_state( button, 1 ); + + EnableEvents(); } int wxRadioBox::GetSelection(void) const @@ -494,6 +498,30 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) wxFAIL_MSG(_T("wxRadioBox::SetNumberOfRowsOrCols not implemented.")); } +void wxRadioBox::DisableEvents() +{ + wxNode *node = m_boxes.First(); + while (node) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(node->Data()), + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + + node = node->Next(); + } +} + +void wxRadioBox::EnableEvents() +{ + wxNode *node = m_boxes.First(); + while (node) + { + gtk_signal_connect( GTK_OBJECT(node->Data()), "clicked", + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + + node = node->Next(); + } +} + void wxRadioBox::ApplyWidgetStyle() { SetWidgetStyle(); diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index 6b6cd98694..294820894f 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -43,12 +43,6 @@ void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButto if (!rb->m_hasVMT) return; - if (rb->m_blockFirstEvent) - { - rb->m_blockFirstEvent = FALSE; - return; - } - if (g_blockEventsOnDrag) return; wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId()); @@ -73,22 +67,50 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab wxSize newSize = size; PreCreation( parent, id, pos, newSize, style, name ); + + m_isRadioButton = TRUE; #if wxUSE_VALIDATORS SetValidator( validator ); #endif - m_widget = gtk_radio_button_new_with_label( (GSList *) NULL, label.mbc_str() ); + + if (HasFlag(wxRB_GROUP)) + { + /* start a new group */ + m_radioButtonGroup = (GSList*) NULL; + } + else + { + /* search backward for last group start */ + wxRadioButton *chief = (wxRadioButton*) NULL; + wxWindowList::Node *node = parent->GetChildren().GetLast(); + while (node) + { + wxWindow *child = node->GetData(); + if (child->m_isRadioButton) + { + chief = (wxRadioButton*) child; + if (child->HasFlag(wxRB_GROUP)) break; + } + if (chief) + { + /* we are part of the group started by chief */ + m_radioButtonGroup = gtk_radio_button_group( GTK_RADIO_BUTTON(chief->m_widget) ); + } + else + { + /* start a new group */ + m_radioButtonGroup = (GSList*) NULL; + } + node = node->GetPrevious(); + } + } + + m_widget = gtk_radio_button_new_with_label( m_radioButtonGroup, label.mbc_str() ); - m_theOtherRadioButtton = - gtk_radio_button_new_with_label( - gtk_radio_button_group( GTK_RADIO_BUTTON(m_widget) ), - "button2" ); - SetLabel(label); - m_blockFirstEvent = FALSE; - if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); @@ -123,15 +145,23 @@ void wxRadioButton::SetValue( bool val ) { wxCHECK_RET( m_widget != NULL, _T("invalid radiobutton") ); - if ( val == GetValue() ) + if (val == GetValue()) return; - m_blockFirstEvent = TRUE; - + gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget), + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); + if (val) + { gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), TRUE ); + } else - gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_theOtherRadioButtton), TRUE ); + { + // should give an assert + } + + gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", + GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this ); } bool wxRadioButton::GetValue() const diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp index 8027044d5a..bcc8025927 100644 --- a/src/gtk1/statbmp.cpp +++ b/src/gtk1/statbmp.cpp @@ -44,6 +44,11 @@ void wxStaticBitmap::CreatePixmapWidget() mask = m_bitmap.GetMask()->GetBitmap(); m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); + /* insert GTK representation */ + (*m_parent->m_insertCallback)(m_parent, this); + + gtk_widget_show( m_widget ); + PostCreation(); } @@ -61,7 +66,10 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi if (m_bitmap.Ok()) { - CreatePixmapWidget(); + GdkBitmap *mask = (GdkBitmap *) NULL; + if ( m_bitmap.GetMask() ) + mask = m_bitmap.GetMask()->GetBitmap(); + m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask ); if (newSize.x == -1) newSize.x = m_bitmap.GetWidth(); if (newSize.y == -1) newSize.y = m_bitmap.GetHeight(); @@ -70,9 +78,9 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi else { m_widget = gtk_label_new( "Bitmap" ); - } - PostCreation(); + PostCreation(); + } m_parent->DoAddChild( this ); @@ -88,18 +96,22 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) if (m_bitmap.Ok()) { - if ( !hasWidget ) + if (!hasWidget) { gtk_widget_destroy( m_widget ); - // recreate m_widget because we'd created a label and not a bitmap - // above + /* recreate m_widget because we've created a label + and not a bitmap above */ CreatePixmapWidget(); } - - GdkBitmap *mask = (GdkBitmap *) NULL; - if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); - gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); + else + { + GdkBitmap *mask = (GdkBitmap *) NULL; + if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); + gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); + } + + SetSize( m_bitmap.GetWidth(), m_bitmap.GetHeight() ); } } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 24823403c3..7e01371333 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1799,6 +1799,7 @@ void wxWindow::Init() m_insertCallback = (wxInsertChildFunction) NULL; m_isStaticBox = FALSE; + m_isRadioButton = FALSE; m_acceptsFocus = FALSE; }