From a260fe6a435f318c386b2da660fd30a7a2b02ce5 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 14 Apr 1999 12:58:23 +0000 Subject: [PATCH] added wxCB_READONLY fixed MDI bug fixed GTK 1.2.0 compilation in wxMenu::something git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2157 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/controls/controls.cpp | 2 +- src/gtk/combobox.cpp | 3 +++ src/gtk/mdi.cpp | 6 +++++- src/gtk/menu.cpp | 2 +- src/gtk1/combobox.cpp | 3 +++ src/gtk1/mdi.cpp | 6 +++++- src/gtk1/menu.cpp | 2 +- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index ae3aa14b97..9b02248738 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -484,7 +484,7 @@ m_text(NULL), m_notebook(NULL) m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice); panel = new wxPanel(m_notebook); - m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 5, choices ); + m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 5, choices, wxCB_READONLY ); (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) ); diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 98b3ba7b82..efbb27e187 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -136,6 +136,9 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_realize( GTK_COMBO(m_widget)->entry ); gtk_widget_realize( GTK_COMBO(m_widget)->button ); + if (style & wxCB_READONLY) + gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE ); + gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed", GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 5df3bbfd17..3eb711da9d 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -112,6 +112,7 @@ void wxMDIParentFrame::OnInternalIdle() wxFrame::OnInternalIdle(); wxMDIChildFrame *active_child_frame = GetActiveChild(); + bool visible_child_menu = FALSE; wxNode *node = m_clientWindow->m_children.First(); while (node) @@ -120,7 +121,10 @@ void wxMDIParentFrame::OnInternalIdle() if (child_frame->m_menuBar) { if (child_frame == active_child_frame) + { gtk_widget_show( child_frame->m_menuBar->m_widget ); + visible_child_menu = TRUE; + } else gtk_widget_hide( child_frame->m_menuBar->m_widget ); } @@ -128,7 +132,7 @@ void wxMDIParentFrame::OnInternalIdle() } /* show/hide parent menu bar as required */ - if (m_frameMenuBar) m_frameMenuBar->Show( (active_child_frame == NULL) ); + if (m_frameMenuBar) m_frameMenuBar->Show( !visible_child_menu ); } void wxMDIParentFrame::GetClientSize(int *width, int *height ) const diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index cf3cf9a8dc..860adb822d 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -552,7 +552,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool s << *pc; } - GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, s ); + GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s ); #else diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 98b3ba7b82..efbb27e187 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -136,6 +136,9 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_realize( GTK_COMBO(m_widget)->entry ); gtk_widget_realize( GTK_COMBO(m_widget)->button ); + if (style & wxCB_READONLY) + gtk_entry_set_editable( GTK_ENTRY( GTK_COMBO(m_widget)->entry ), FALSE ); + gtk_signal_connect( GTK_OBJECT(GTK_COMBO(m_widget)->entry), "changed", GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 5df3bbfd17..3eb711da9d 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -112,6 +112,7 @@ void wxMDIParentFrame::OnInternalIdle() wxFrame::OnInternalIdle(); wxMDIChildFrame *active_child_frame = GetActiveChild(); + bool visible_child_menu = FALSE; wxNode *node = m_clientWindow->m_children.First(); while (node) @@ -120,7 +121,10 @@ void wxMDIParentFrame::OnInternalIdle() if (child_frame->m_menuBar) { if (child_frame == active_child_frame) + { gtk_widget_show( child_frame->m_menuBar->m_widget ); + visible_child_menu = TRUE; + } else gtk_widget_hide( child_frame->m_menuBar->m_widget ); } @@ -128,7 +132,7 @@ void wxMDIParentFrame::OnInternalIdle() } /* show/hide parent menu bar as required */ - if (m_frameMenuBar) m_frameMenuBar->Show( (active_child_frame == NULL) ); + if (m_frameMenuBar) m_frameMenuBar->Show( !visible_child_menu ); } void wxMDIParentFrame::GetClientSize(int *width, int *height ) const diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index cf3cf9a8dc..860adb822d 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -552,7 +552,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool s << *pc; } - GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, s ); + GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s ); #else