Clipboard update
menuitem->SetName() -> SetText() (or other raound) GetChildren() returns reference this still doesn't compile, I'm waiting git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5523168ef1
commit
db1b496176
@ -48,9 +48,9 @@ public:
|
||||
int GetId() const { return m_id; }
|
||||
bool IsSeparator() const { return m_id == ID_SEPARATOR; }
|
||||
|
||||
// the item's text
|
||||
void SetText(const wxString& str);
|
||||
const wxString& GetText() const { return m_text; }
|
||||
// the item's text = name
|
||||
void SetName(const wxString& str);
|
||||
const wxString& GetName() const { return m_text; }
|
||||
|
||||
// what kind of menu item we are
|
||||
void SetCheckable(bool checkable) { m_isCheckMenu = checkable; }
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
virtual bool OnClose();
|
||||
|
||||
virtual void AddChild( wxWindow *child );
|
||||
wxList *GetChildren();
|
||||
wxList& GetChildren() const;
|
||||
virtual void RemoveChild( wxWindow *child );
|
||||
void SetReturnCode( int retCode );
|
||||
int GetReturnCode();
|
||||
|
@ -48,9 +48,9 @@ public:
|
||||
int GetId() const { return m_id; }
|
||||
bool IsSeparator() const { return m_id == ID_SEPARATOR; }
|
||||
|
||||
// the item's text
|
||||
void SetText(const wxString& str);
|
||||
const wxString& GetText() const { return m_text; }
|
||||
// the item's text = name
|
||||
void SetName(const wxString& str);
|
||||
const wxString& GetName() const { return m_text; }
|
||||
|
||||
// what kind of menu item we are
|
||||
void SetCheckable(bool checkable) { m_isCheckMenu = checkable; }
|
||||
|
@ -155,7 +155,7 @@ public:
|
||||
virtual bool OnClose();
|
||||
|
||||
virtual void AddChild( wxWindow *child );
|
||||
wxList *GetChildren();
|
||||
wxList& GetChildren() const;
|
||||
virtual void RemoveChild( wxWindow *child );
|
||||
void SetReturnCode( int retCode );
|
||||
int GetReturnCode();
|
||||
|
@ -134,22 +134,26 @@ selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data
|
||||
|
||||
if (!data_object) return;
|
||||
|
||||
if (data_object->GetDataSize() == 0) return;
|
||||
if (data_object->GetDataSize() == 0) return;
|
||||
|
||||
|
||||
|
||||
gint len = data_object->GetDataSize();
|
||||
guchar *bin_data = (guchar*) malloc( len );
|
||||
data_object->GetDataHere( (void*)bin_data );
|
||||
|
||||
if (selection_data->target == GDK_SELECTION_TYPE_STRING)
|
||||
if (selection_data->target == GDK_TARGET_STRING)
|
||||
{
|
||||
gtk_selection_data_set(
|
||||
selection_data, GDK_SELECTION_TYPE_STRING, 8*sizeof(gchar), bin_data, len );
|
||||
}
|
||||
/*
|
||||
else if (selection_data->target == g_textAtom)
|
||||
{
|
||||
gtk_selection_data_set(
|
||||
selection_data, g_textAtom, 8*sizeof(gchar), bin_data, len );
|
||||
}
|
||||
*/
|
||||
free( bin_data );
|
||||
}
|
||||
|
||||
@ -162,8 +166,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
|
||||
wxClipboard::wxClipboard()
|
||||
{
|
||||
m_data = (wxDataObject*) NULL;
|
||||
m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
|
||||
gtk_widget_realize( m_clipboardWidget );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
|
||||
"selection_clear_event",
|
||||
@ -194,8 +196,13 @@ void wxClipboard::Clear()
|
||||
|
||||
if (m_data)
|
||||
{
|
||||
if (gdk_selection_owner_get( g_clipboardAtom) == m_clipboardWidget->window)
|
||||
{
|
||||
gtk_selection_owner_set( (GtkWidget*) NULL, g_clipboardAtom, GDK_CURRENT_TIME );
|
||||
}
|
||||
|
||||
delete m_data;
|
||||
gtk_selection_owner_set( (GtkWidget*) NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME );
|
||||
m_data = (wxDataObject*) NULL;
|
||||
}
|
||||
|
||||
m_receivedSize = 0;
|
||||
@ -213,6 +220,20 @@ void wxClipboard::Clear()
|
||||
|
||||
void wxClipboard::SetData( wxDataObject *data )
|
||||
{
|
||||
Clear();
|
||||
|
||||
/*
|
||||
GTK 1.0.X cannot remove a target from a widget so if a widget
|
||||
at first offers text and then a bitmap (and no longer text) to
|
||||
the clipboard, we seem too have to delete it.
|
||||
*/
|
||||
|
||||
if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
|
||||
|
||||
m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
|
||||
gtk_widget_realize( m_clipboardWidget );
|
||||
|
||||
|
||||
if (m_data) delete m_data;
|
||||
m_data = data;
|
||||
if (!m_data) return;
|
||||
@ -231,7 +252,8 @@ void wxClipboard::SetData( wxDataObject *data )
|
||||
case wxDF_TEXT:
|
||||
gtk_selection_add_handler( m_clipboardWidget,
|
||||
g_clipboardAtom,
|
||||
g_textAtom,
|
||||
// g_textAtom,
|
||||
GDK_TARGET_STRING,
|
||||
selection_handler,
|
||||
NULL );
|
||||
break;
|
||||
|
@ -254,11 +254,11 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
else
|
||||
{
|
||||
// no child: go out !
|
||||
if (!GetChildren()->First()) return;
|
||||
if (!GetChildren().First()) return;
|
||||
|
||||
// do we have exactly one child?
|
||||
wxWindow *child = (wxWindow *) NULL;
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
for(wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
|
||||
|
@ -455,11 +455,11 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
else
|
||||
{
|
||||
// no child: go out !
|
||||
if (!GetChildren()->First()) return;
|
||||
if (!GetChildren().First()) return;
|
||||
|
||||
// do we have exactly one child?
|
||||
wxWindow *child = (wxWindow *) NULL;
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
for(wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
|
||||
@ -537,7 +537,7 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam
|
||||
|
||||
m_frameToolBar = OnCreateToolBar( style, id, name );
|
||||
|
||||
GetChildren()->DeleteObject( m_frameToolBar );
|
||||
GetChildren().DeleteObject( m_frameToolBar );
|
||||
|
||||
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
|
||||
|
@ -203,7 +203,7 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
// wxMenuItem
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject)
|
||||
@ -218,19 +218,28 @@ wxMenuItem::wxMenuItem()
|
||||
m_menuItem = (GtkWidget *) NULL;
|
||||
}
|
||||
|
||||
void wxMenuItem::SetText(const wxString& str)
|
||||
void wxMenuItem::SetName(const wxString& str)
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
m_text = "";
|
||||
for ( const char *pc = str; *pc != '\0'; pc++ ) {
|
||||
for ( const char *pc = str; *pc != '\0'; pc++ )
|
||||
{
|
||||
if ( *pc == '&' )
|
||||
pc++; // skip it
|
||||
|
||||
m_text << *pc;
|
||||
}
|
||||
|
||||
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
|
||||
|
||||
gtk_label_set( label, m_text.c_str());
|
||||
}
|
||||
|
||||
void wxMenuItem::Check( bool check )
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" )
|
||||
|
||||
m_isChecked = check;
|
||||
@ -239,12 +248,16 @@ void wxMenuItem::Check( bool check )
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
gtk_widget_set_sensitive( m_menuItem, enable );
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
{
|
||||
wxCHECK_MSG( m_menuItem, FALSE, "invalid menu item" );
|
||||
|
||||
wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item!
|
||||
|
||||
bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
||||
@ -254,6 +267,10 @@ bool wxMenuItem::IsChecked() const
|
||||
return bIsChecked;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenuItem
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
|
||||
|
||||
wxMenu::wxMenu( const wxString& title, const wxFunction func )
|
||||
|
@ -395,7 +395,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
@ -468,7 +468,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
@ -531,7 +531,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
@ -1308,17 +1308,14 @@ bool wxWindow::Destroy()
|
||||
|
||||
bool wxWindow::DestroyChildren()
|
||||
{
|
||||
if (GetChildren())
|
||||
wxNode *node;
|
||||
while ((node = m_children.First()) != (wxNode *)NULL)
|
||||
{
|
||||
wxNode *node;
|
||||
while ((node = GetChildren()->First()) != (wxNode *)NULL)
|
||||
wxWindow *child;
|
||||
if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL)
|
||||
{
|
||||
wxWindow *child;
|
||||
if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL)
|
||||
{
|
||||
delete child;
|
||||
if (GetChildren()->Member(child)) delete node;
|
||||
}
|
||||
delete child;
|
||||
if (m_children.Member(child)) delete node;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -1658,7 +1655,7 @@ void wxWindow::Fit()
|
||||
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_childrenFirst();
|
||||
while ( node )
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
@ -1806,9 +1803,9 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
m_children.Append( child );
|
||||
}
|
||||
|
||||
wxList *wxWindow::GetChildren()
|
||||
wxList& wxWindow::GetChildren() const
|
||||
{
|
||||
return (&m_children);
|
||||
return m_children;
|
||||
}
|
||||
|
||||
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||
@ -1830,7 +1827,7 @@ wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||
|
||||
void wxWindow::RemoveChild( wxWindow *child )
|
||||
{
|
||||
if (GetChildren()) GetChildren()->DeleteObject( child );
|
||||
m_children.DeleteObject( child );
|
||||
child->m_parent = (wxWindow *) NULL;
|
||||
}
|
||||
|
||||
@ -2140,7 +2137,7 @@ bool wxWindow::Validate()
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2155,7 +2152,7 @@ bool wxWindow::TransferDataToWindow()
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2174,7 +2171,7 @@ bool wxWindow::TransferDataFromWindow()
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2798,7 +2795,7 @@ bool wxWindow::DoPhase(int phase)
|
||||
{
|
||||
noChanges = 0;
|
||||
noFailures = 0;
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.first();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2843,7 +2840,7 @@ void wxWindow::ResetConstraints()
|
||||
constr->centreX.SetDone(FALSE);
|
||||
constr->centreY.SetDone(FALSE);
|
||||
}
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
@ -2902,7 +2899,7 @@ void wxWindow::SetConstraintSizes(bool recurse)
|
||||
|
||||
if (recurse)
|
||||
{
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
|
@ -134,22 +134,26 @@ selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data
|
||||
|
||||
if (!data_object) return;
|
||||
|
||||
if (data_object->GetDataSize() == 0) return;
|
||||
if (data_object->GetDataSize() == 0) return;
|
||||
|
||||
|
||||
|
||||
gint len = data_object->GetDataSize();
|
||||
guchar *bin_data = (guchar*) malloc( len );
|
||||
data_object->GetDataHere( (void*)bin_data );
|
||||
|
||||
if (selection_data->target == GDK_SELECTION_TYPE_STRING)
|
||||
if (selection_data->target == GDK_TARGET_STRING)
|
||||
{
|
||||
gtk_selection_data_set(
|
||||
selection_data, GDK_SELECTION_TYPE_STRING, 8*sizeof(gchar), bin_data, len );
|
||||
}
|
||||
/*
|
||||
else if (selection_data->target == g_textAtom)
|
||||
{
|
||||
gtk_selection_data_set(
|
||||
selection_data, g_textAtom, 8*sizeof(gchar), bin_data, len );
|
||||
}
|
||||
*/
|
||||
free( bin_data );
|
||||
}
|
||||
|
||||
@ -162,8 +166,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
|
||||
wxClipboard::wxClipboard()
|
||||
{
|
||||
m_data = (wxDataObject*) NULL;
|
||||
m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
|
||||
gtk_widget_realize( m_clipboardWidget );
|
||||
|
||||
gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
|
||||
"selection_clear_event",
|
||||
@ -194,8 +196,13 @@ void wxClipboard::Clear()
|
||||
|
||||
if (m_data)
|
||||
{
|
||||
if (gdk_selection_owner_get( g_clipboardAtom) == m_clipboardWidget->window)
|
||||
{
|
||||
gtk_selection_owner_set( (GtkWidget*) NULL, g_clipboardAtom, GDK_CURRENT_TIME );
|
||||
}
|
||||
|
||||
delete m_data;
|
||||
gtk_selection_owner_set( (GtkWidget*) NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME );
|
||||
m_data = (wxDataObject*) NULL;
|
||||
}
|
||||
|
||||
m_receivedSize = 0;
|
||||
@ -213,6 +220,20 @@ void wxClipboard::Clear()
|
||||
|
||||
void wxClipboard::SetData( wxDataObject *data )
|
||||
{
|
||||
Clear();
|
||||
|
||||
/*
|
||||
GTK 1.0.X cannot remove a target from a widget so if a widget
|
||||
at first offers text and then a bitmap (and no longer text) to
|
||||
the clipboard, we seem too have to delete it.
|
||||
*/
|
||||
|
||||
if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
|
||||
|
||||
m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
|
||||
gtk_widget_realize( m_clipboardWidget );
|
||||
|
||||
|
||||
if (m_data) delete m_data;
|
||||
m_data = data;
|
||||
if (!m_data) return;
|
||||
@ -231,7 +252,8 @@ void wxClipboard::SetData( wxDataObject *data )
|
||||
case wxDF_TEXT:
|
||||
gtk_selection_add_handler( m_clipboardWidget,
|
||||
g_clipboardAtom,
|
||||
g_textAtom,
|
||||
// g_textAtom,
|
||||
GDK_TARGET_STRING,
|
||||
selection_handler,
|
||||
NULL );
|
||||
break;
|
||||
|
@ -254,11 +254,11 @@ void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
else
|
||||
{
|
||||
// no child: go out !
|
||||
if (!GetChildren()->First()) return;
|
||||
if (!GetChildren().First()) return;
|
||||
|
||||
// do we have exactly one child?
|
||||
wxWindow *child = (wxWindow *) NULL;
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
for(wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
|
||||
|
@ -455,11 +455,11 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
|
||||
else
|
||||
{
|
||||
// no child: go out !
|
||||
if (!GetChildren()->First()) return;
|
||||
if (!GetChildren().First()) return;
|
||||
|
||||
// do we have exactly one child?
|
||||
wxWindow *child = (wxWindow *) NULL;
|
||||
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
|
||||
for(wxNode *node = GetChildren().First(); node; node = node->Next())
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog)
|
||||
@ -537,7 +537,7 @@ wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& nam
|
||||
|
||||
m_frameToolBar = OnCreateToolBar( style, id, name );
|
||||
|
||||
GetChildren()->DeleteObject( m_frameToolBar );
|
||||
GetChildren().DeleteObject( m_frameToolBar );
|
||||
|
||||
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
|
||||
|
||||
|
@ -203,7 +203,7 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenu
|
||||
// wxMenuItem
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject)
|
||||
@ -218,19 +218,28 @@ wxMenuItem::wxMenuItem()
|
||||
m_menuItem = (GtkWidget *) NULL;
|
||||
}
|
||||
|
||||
void wxMenuItem::SetText(const wxString& str)
|
||||
void wxMenuItem::SetName(const wxString& str)
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
m_text = "";
|
||||
for ( const char *pc = str; *pc != '\0'; pc++ ) {
|
||||
for ( const char *pc = str; *pc != '\0'; pc++ )
|
||||
{
|
||||
if ( *pc == '&' )
|
||||
pc++; // skip it
|
||||
|
||||
m_text << *pc;
|
||||
}
|
||||
|
||||
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
|
||||
|
||||
gtk_label_set( label, m_text.c_str());
|
||||
}
|
||||
|
||||
void wxMenuItem::Check( bool check )
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" )
|
||||
|
||||
m_isChecked = check;
|
||||
@ -239,12 +248,16 @@ void wxMenuItem::Check( bool check )
|
||||
|
||||
void wxMenuItem::Enable( bool enable )
|
||||
{
|
||||
wxCHECK_RET( m_menuItem, "invalid menu item" );
|
||||
|
||||
gtk_widget_set_sensitive( m_menuItem, enable );
|
||||
m_isEnabled = enable;
|
||||
}
|
||||
|
||||
bool wxMenuItem::IsChecked() const
|
||||
{
|
||||
wxCHECK_MSG( m_menuItem, FALSE, "invalid menu item" );
|
||||
|
||||
wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item!
|
||||
|
||||
bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0;
|
||||
@ -254,6 +267,10 @@ bool wxMenuItem::IsChecked() const
|
||||
return bIsChecked;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxMenuItem
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
|
||||
|
||||
wxMenu::wxMenu( const wxString& title, const wxFunction func )
|
||||
|
@ -395,7 +395,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
@ -468,7 +468,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
@ -531,7 +531,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
|
||||
|
||||
if (!g_capturing)
|
||||
{
|
||||
wxNode *node = win->GetChildren()->First();
|
||||
wxNode *node = win->GetChildren().First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow*)node->Data();
|
||||
@ -1308,17 +1308,14 @@ bool wxWindow::Destroy()
|
||||
|
||||
bool wxWindow::DestroyChildren()
|
||||
{
|
||||
if (GetChildren())
|
||||
wxNode *node;
|
||||
while ((node = m_children.First()) != (wxNode *)NULL)
|
||||
{
|
||||
wxNode *node;
|
||||
while ((node = GetChildren()->First()) != (wxNode *)NULL)
|
||||
wxWindow *child;
|
||||
if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL)
|
||||
{
|
||||
wxWindow *child;
|
||||
if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL)
|
||||
{
|
||||
delete child;
|
||||
if (GetChildren()->Member(child)) delete node;
|
||||
}
|
||||
delete child;
|
||||
if (m_children.Member(child)) delete node;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
@ -1658,7 +1655,7 @@ void wxWindow::Fit()
|
||||
|
||||
int maxX = 0;
|
||||
int maxY = 0;
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_childrenFirst();
|
||||
while ( node )
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
@ -1806,9 +1803,9 @@ void wxWindow::AddChild( wxWindow *child )
|
||||
m_children.Append( child );
|
||||
}
|
||||
|
||||
wxList *wxWindow::GetChildren()
|
||||
wxList& wxWindow::GetChildren() const
|
||||
{
|
||||
return (&m_children);
|
||||
return m_children;
|
||||
}
|
||||
|
||||
wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||
@ -1830,7 +1827,7 @@ wxWindow *wxWindow::ReParent( wxWindow *newParent )
|
||||
|
||||
void wxWindow::RemoveChild( wxWindow *child )
|
||||
{
|
||||
if (GetChildren()) GetChildren()->DeleteObject( child );
|
||||
m_children.DeleteObject( child );
|
||||
child->m_parent = (wxWindow *) NULL;
|
||||
}
|
||||
|
||||
@ -2140,7 +2137,7 @@ bool wxWindow::Validate()
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2155,7 +2152,7 @@ bool wxWindow::TransferDataToWindow()
|
||||
{
|
||||
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
|
||||
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2174,7 +2171,7 @@ bool wxWindow::TransferDataFromWindow()
|
||||
{
|
||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2798,7 +2795,7 @@ bool wxWindow::DoPhase(int phase)
|
||||
{
|
||||
noChanges = 0;
|
||||
noFailures = 0;
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.first();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *child = (wxWindow *)node->Data();
|
||||
@ -2843,7 +2840,7 @@ void wxWindow::ResetConstraints()
|
||||
constr->centreX.SetDone(FALSE);
|
||||
constr->centreY.SetDone(FALSE);
|
||||
}
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
@ -2902,7 +2899,7 @@ void wxWindow::SetConstraintSizes(bool recurse)
|
||||
|
||||
if (recurse)
|
||||
{
|
||||
wxNode *node = GetChildren()->First();
|
||||
wxNode *node = m_children.First();
|
||||
while (node)
|
||||
{
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
|
Loading…
Reference in New Issue
Block a user