Added graying out of menus and buttons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@551 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d5c462fd20
commit
a9c96bcce9
@ -59,6 +59,7 @@ class wxButton: public wxControl
|
||||
const wxString& name = wxButtonNameStr);
|
||||
void SetDefault(void);
|
||||
void SetLabel( const wxString &label );
|
||||
void Enable( bool enable );
|
||||
};
|
||||
|
||||
#endif // __GTKBUTTONH__
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
bool IsSubMenu() const { return m_subMenu != NULL; }
|
||||
|
||||
// state
|
||||
void Enable(bool enable = TRUE) { m_isEnabled = enable; }
|
||||
void Enable( bool enable = TRUE );
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
void Check( bool check = TRUE );
|
||||
bool IsChecked() const;
|
||||
|
@ -59,6 +59,7 @@ class wxButton: public wxControl
|
||||
const wxString& name = wxButtonNameStr);
|
||||
void SetDefault(void);
|
||||
void SetLabel( const wxString &label );
|
||||
void Enable( bool enable );
|
||||
};
|
||||
|
||||
#endif // __GTKBUTTONH__
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
bool IsSubMenu() const { return m_subMenu != NULL; }
|
||||
|
||||
// state
|
||||
void Enable(bool enable = TRUE) { m_isEnabled = enable; }
|
||||
void Enable( bool enable = TRUE );
|
||||
bool IsEnabled() const { return m_isEnabled; }
|
||||
void Check( bool check = TRUE );
|
||||
bool IsChecked() const;
|
||||
|
@ -93,3 +93,11 @@ void wxButton::SetLabel( const wxString &label )
|
||||
gtk_label_set( g_label, GetLabel() );
|
||||
}
|
||||
|
||||
void wxButton::Enable( bool enable )
|
||||
{
|
||||
wxControl::Enable( enable );
|
||||
GtkButton *bin = GTK_BUTTON( m_widget );
|
||||
GtkWidget *label = bin->child;
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,12 @@ void wxMenuItem::Check( bool check )
|
||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||
}
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
gtk_widget_set_sensitive( m_menuItem, enable );
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
{
|
||||
wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item!
|
||||
@ -259,6 +265,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
|
||||
const char *text = mitem->GetText();
|
||||
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
|
||||
: gtk_menu_item_new_with_label(text);
|
||||
|
||||
mitem->SetMenuItem(menuItem);
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
|
||||
|
@ -93,3 +93,11 @@ void wxButton::SetLabel( const wxString &label )
|
||||
gtk_label_set( g_label, GetLabel() );
|
||||
}
|
||||
|
||||
void wxButton::Enable( bool enable )
|
||||
{
|
||||
wxControl::Enable( enable );
|
||||
GtkButton *bin = GTK_BUTTON( m_widget );
|
||||
GtkWidget *label = bin->child;
|
||||
gtk_widget_set_sensitive( label, enable );
|
||||
}
|
||||
|
||||
|
@ -208,6 +208,12 @@ void wxMenuItem::Check( bool check )
|
||||
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
|
||||
}
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
gtk_widget_set_sensitive( m_menuItem, enable );
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
{
|
||||
wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item!
|
||||
@ -259,6 +265,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
|
||||
const char *text = mitem->GetText();
|
||||
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
|
||||
: gtk_menu_item_new_with_label(text);
|
||||
|
||||
mitem->SetMenuItem(menuItem);
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
|
||||
|
Loading…
Reference in New Issue
Block a user