~wxMenuItem();
// implement base class virtuals
- virtual void SetText( const wxString& str ) { DoSetText(str); }
+ virtual void SetText( const wxString& str );
virtual void Enable( bool enable = TRUE );
virtual void Check( bool check = TRUE );
virtual bool IsChecked() const;
// implementation
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
GtkWidget *GetMenuItem() const { return m_menuItem; }
+ wxString GetFactoryPath() const;
wxString GetHotKey() const { return m_hotKey; }
~wxMenuItem();
// implement base class virtuals
- virtual void SetText( const wxString& str ) { DoSetText(str); }
+ virtual void SetText( const wxString& str );
virtual void Enable( bool enable = TRUE );
virtual void Check( bool check = TRUE );
virtual bool IsChecked() const;
// implementation
void SetMenuItem(GtkWidget *menuItem) { m_menuItem = menuItem; }
GtkWidget *GetMenuItem() const { return m_menuItem; }
+ wxString GetFactoryPath() const;
wxString GetHotKey() const { return m_hotKey; }
wxPanel *panel = new wxPanel(m_notebook);
m_listbox = new wxListBox( panel, ID_LISTBOX,
wxPoint(10,10), wxSize(120,70),
- 5, choices, wxLB_ALWAYS_SB | wxLB_MULTIPLE );
+ 5, choices, wxLB_ALWAYS_SB );
m_listboxSorted = new wxListBox( panel, ID_LISTBOX_SORTED,
wxPoint(10,90), wxSize(120,70),
- 5, choices, wxLB_SORT | wxLB_EXTENDED );
+ 5, choices, wxLB_SORT );
SetControlClientData("listbox", m_listbox);
SetControlClientData("listbox", m_listboxSorted);
{
// start drag operation
wxTextDataObject textData(m_strText);
- wxDropSource source(textData, this,
- wxCURSOR_PENCIL, // for copy
+ wxDropSource source(textData, this
+#ifdef __WXMSW__
+ ,wxCURSOR_PENCIL, // for copy
wxCURSOR_SPRAYCAN, // for move
- wxCURSOR_QUESTION_ARROW); // for nothing
+ wxCURSOR_QUESTION_ARROW // for nothing
+#endif
+ );
const char *pc;
frame->SetSize(-1, -1, x, y);
#endif
frame->Show(TRUE);
+ Activate(TRUE);
return TRUE;
}
class MyCanvas: public wxScrolledWindow
{
- public:
+public:
wxView *view;
MyCanvas(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);
virtual void OnDraw(wxDC& dc);
void OnMouseEvent(wxMouseEvent& event);
-DECLARE_EVENT_TABLE()
+private:
+ DECLARE_EVENT_TABLE()
};
class MyTextWindow: public wxTextCtrl
{
- public:
+public:
wxView *view;
MyTextWindow(wxView *v, wxFrame *frame, const wxPoint& pos, const wxSize& size, long style);
class DrawingView: public wxView
{
- DECLARE_DYNAMIC_CLASS(DrawingView)
- private:
- public:
- wxFrame *frame;
- MyCanvas *canvas;
+public:
+ wxFrame *frame;
+ MyCanvas *canvas;
- DrawingView(void) { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; };
- ~DrawingView(void) {};
+ DrawingView() { canvas = (MyCanvas *) NULL; frame = (wxFrame *) NULL; }
+ ~DrawingView() {}
- bool OnCreate(wxDocument *doc, long flags);
- void OnDraw(wxDC *dc);
- void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
- bool OnClose(bool deleteWindow = TRUE);
+ bool OnCreate(wxDocument *doc, long flags);
+ void OnDraw(wxDC *dc);
+ void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
+ bool OnClose(bool deleteWindow = TRUE);
- void OnCut(wxCommandEvent& event);
+ void OnCut(wxCommandEvent& event);
-DECLARE_EVENT_TABLE()
+private:
+ DECLARE_DYNAMIC_CLASS(DrawingView)
+ DECLARE_EVENT_TABLE()
};
class TextEditView: public wxView
{
- DECLARE_DYNAMIC_CLASS(TextEditView)
- private:
- public:
- wxFrame *frame;
- MyTextWindow *textsw;
+public:
+ wxFrame *frame;
+ MyTextWindow *textsw;
- TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; }
- ~TextEditView(void) {}
+ TextEditView(): wxView() { frame = (wxFrame *) NULL; textsw = (MyTextWindow *) NULL; }
+ ~TextEditView() {}
- bool OnCreate(wxDocument *doc, long flags);
- void OnDraw(wxDC *dc);
- void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
- bool OnClose(bool deleteWindow = TRUE);
+ bool OnCreate(wxDocument *doc, long flags);
+ void OnDraw(wxDC *dc);
+ void OnUpdate(wxView *sender, wxObject *hint = (wxObject *) NULL);
+ bool OnClose(bool deleteWindow = TRUE);
+
+private:
+ DECLARE_DYNAMIC_CLASS(TextEditView)
};
#endif
return FALSE;
}
-
- m_widget = gtk_button_new_with_label( "" );
+/*
+ wxString label2( label );
+ for (size_t i = 0; i < label2.Len(); i++)
+ {
+ if (label2.GetChar(i) == wxT('&'))
+ label2.SetChar(i,wxT('_'));
+ }
+
+ GtkWidget *accel_label = gtk_accel_label_new( label2.mb_str() );
+ gtk_widget_show( accel_label );
+
+ m_widget = gtk_button_new();
+ gtk_container_add( GTK_CONTAINER(m_widget), accel_label );
+
+ gtk_accel_label_set_accel_widget( GTK_ACCEL_LABEL(accel_label), m_widget );
+ guint accel_key = gtk_label_parse_uline (GTK_LABEL(accel_label), label2.mb_str() );
+ gtk_accel_label_refetch( GTK_ACCEL_LABEL(accel_label) );
+
+ wxControl::SetLabel( label );
+*/
+
+ m_widget = gtk_button_new_with_label("");
+
+ SetLabel( label );
+
#if (GTK_MINOR_VERSION > 0)
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
#endif
- SetLabel(label);
-
int x = 0; int y = 0;
wxFont new_font( parent->GetFont() );
GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font );
#include "wx/tooltip.h"
#endif
-#if wxUSE_DRAG_AND_DROP
-#include "wx/dnd.h"
-#endif
-
#include "gdk/gdk.h"
#include "gtk/gtk.h"
+#include "gdk/gdkkeysyms.h"
//-----------------------------------------------------------------------------
// idle system
// "key_press_event"
//-----------------------------------------------------------------------------
-#if wxUSE_CHECKLISTBOX
static gint
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
{
- if (g_isIdle) wxapp_install_idle_handler();
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- if (g_blockEventsOnDrag) return FALSE;
+ if (g_blockEventsOnDrag)
+ return FALSE;
- if (!listbox->m_hasVMT) return FALSE;
+ bool ret = FALSE;
- if (gdk_event->keyval != ' ') return FALSE;
+ if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
+ {
+ wxNavigationKeyEvent new_event;
+ /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
+ new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
+ new_event.SetCurrentFocus( listbox );
+ ret = listbox->GetEventHandler()->ProcessEvent( new_event );
+ }
+
+#if wxUSE_CHECKLISTBOX
+ if ((gdk_event->keyval != ' ') && (listbox->m_hasCheckBoxes) && (!ret))
+ {
+ int sel = listbox->GtkGetIndex( widget );
- int sel = listbox->GtkGetIndex( widget );
+ wxCheckListBox *clb = (wxCheckListBox *)listbox;
- wxCheckListBox *clb = (wxCheckListBox *)listbox;
+ clb->Check( sel, !clb->IsChecked(sel) );
- clb->Check( sel, !clb->IsChecked(sel) );
+ wxCommandEvent new_event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
+ new_event.SetEventObject( listbox );
+ new_event.SetInt( sel );
+ ret = listbox->GetEventHandler()->ProcessEvent( new_event );
+ }
+#endif // wxUSE_CHECKLISTBOX
- wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
- event.SetEventObject( listbox );
- event.SetInt( sel );
- listbox->GetEventHandler()->ProcessEvent( event );
+ if (ret)
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+ return TRUE;
+ }
return FALSE;
}
-#endif // wxUSE_CHECKLISTBOX
//-----------------------------------------------------------------------------
// "select" and "deselect"
(GtkSignalFunc)gtk_listbox_button_release_callback,
(gpointer) this );
-#if wxUSE_CHECKLISTBOX
- if (m_hasCheckBoxes)
- {
- gtk_signal_connect( GTK_OBJECT(list_item),
+ gtk_signal_connect( GTK_OBJECT(list_item),
"key_press_event",
(GtkSignalFunc)gtk_listbox_key_press_callback,
(gpointer)this );
- }
-#endif // wxUSE_CHECKLISTBOX
gtk_widget_show( list_item );
m_menuItem = (GtkWidget *) NULL;
- // call it after initializing m_menuItem to NULL
DoSetText(text);
}
// don't delete menu items, the menus take care of that
}
+void wxMenuItem::SetText( const wxString& str )
+{
+ DoSetText(str);
+
+ if (m_menuItem)
+ {
+ GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
+
+ /* set new text */
+ gtk_label_set( label, m_text.mb_str());
+
+ /* reparse key accel */
+ guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), m_text.mb_str() );
+ gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) );
+ }
+}
+
// it's valid for this function to be called even if m_menuItem == NULL
void wxMenuItem::DoSetText( const wxString& str )
{
#endif
}
else
- m_text << *pc;
+ m_text << *pc;
}
/* only GTK 1.2 knows about hot keys */
m_hotKey = pc;
}
#endif
-
- if (m_menuItem)
- {
- GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
- gtk_label_set( label, m_text.mb_str());
- }
}
void wxMenuItem::Check( bool check )
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
}
+wxString wxMenuItem::GetFactoryPath() const
+{
+ /* in order to get the pointer to the item we need the item text _without_ underscores */
+ wxString path( wxT("<main>/") );
+ for ( const wxChar *pc = m_text; *pc != wxT('\0'); pc++ )
+ {
+ while (*pc == wxT('_')) pc++; /* skip it */
+ path << *pc;
+ }
+
+ return path;
+}
+
//-----------------------------------------------------------------------------
// wxMenu
//-----------------------------------------------------------------------------
strncpy(s_accel, GetHotKey(*mitem).mb_str(), WXSIZEOF(s_accel));
entry.accelerator = s_accel;
#else
- entry.accelerator = NULL;
+ entry.accelerator = (char*) NULL;
#endif
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
- /* in order to get the pointer to the item we need the item text _without_ underscores */
- wxString s = wxT("<main>/");
- for ( const wxChar *pc = text; *pc != wxT('\0'); pc++ )
- {
- while (*pc == wxT('_')) pc++; /* skip it */
- s << *pc;
- }
-
- GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s.mb_str() );
+ wxString path( mitem->GetFactoryPath() );
+ GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, path.mb_str() );
#else
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
- /* in order to get the pointer to the item we need the item text _without_ underscores */
- wxString s = wxT("<main>/");
- for ( const wxChar *pc = text; *pc != wxT('\0'); pc++ )
- {
- if (*pc == wxT('_')) pc++; /* skip it */
- s << *pc;
- }
-
- GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, s.mb_str() );
+ wxString path( mitem->GetFactoryPath() );
+ GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, path.mb_str() );
#else
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->GetId() == id)
{
+ /* TODO: this code doesn't delete the item factory item and
+ this seems impossible as of GTK 1.2.6. */
gtk_widget_destroy( item->GetMenuItem() );
m_items.DeleteNode( node );
return;
#include "gdk/gdk.h"
#include "gtk/gtk.h"
+#include "gdk/gdkkeysyms.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
- GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
+ GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
gtk_pizza_put( GTK_PIZZA(m_parent->m_wxwindow),
GTK_WIDGET(m_radio),
const wxString& name)
{
m_needParent = TRUE;
+ m_acceptsFocus = TRUE;
wxSize new_size = size;
if (new_size.y == -1)
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
- GtkWidget *connect_widget = GetConnectWidget();
- if (connect_widget)
+ wxNode *node = m_children.First();
+ while (node)
+ {
+ wxWindow *child = (wxWindow*) node->Data();
+ if (child->AcceptsFocus())
+ {
+ child->SetFocus();
+ return;
+ }
+ node = node->Next();
+ }
+
+ if (m_wxwindow)
+ {
+ gtk_widget_grab_focus (m_wxwindow);
+ return;
+ }
+
+ if (m_widget)
{
- if (GTK_WIDGET_CAN_FOCUS(connect_widget) /*&& !GTK_WIDGET_HAS_FOCUS (connect_widget)*/ )
+ if (GTK_WIDGET_CAN_FOCUS(m_widget) /*&& !GTK_WIDGET_HAS_FOCUS (connect_widget)*/ )
{
- gtk_widget_grab_focus (connect_widget);
+ gtk_widget_grab_focus (m_widget);
}
- else if (GTK_IS_CONTAINER(connect_widget))
+ else if (GTK_IS_CONTAINER(m_widget))
{
- gtk_container_focus( GTK_CONTAINER(connect_widget), GTK_DIR_TAB_FORWARD );
+ gtk_container_focus( GTK_CONTAINER(m_widget), GTK_DIR_TAB_FORWARD );
}
else
{
+ // ?
}
}
}
return FALSE;
}
-
- m_widget = gtk_button_new_with_label( "" );
+/*
+ wxString label2( label );
+ for (size_t i = 0; i < label2.Len(); i++)
+ {
+ if (label2.GetChar(i) == wxT('&'))
+ label2.SetChar(i,wxT('_'));
+ }
+
+ GtkWidget *accel_label = gtk_accel_label_new( label2.mb_str() );
+ gtk_widget_show( accel_label );
+
+ m_widget = gtk_button_new();
+ gtk_container_add( GTK_CONTAINER(m_widget), accel_label );
+
+ gtk_accel_label_set_accel_widget( GTK_ACCEL_LABEL(accel_label), m_widget );
+ guint accel_key = gtk_label_parse_uline (GTK_LABEL(accel_label), label2.mb_str() );
+ gtk_accel_label_refetch( GTK_ACCEL_LABEL(accel_label) );
+
+ wxControl::SetLabel( label );
+*/
+
+ m_widget = gtk_button_new_with_label("");
+
+ SetLabel( label );
+
#if (GTK_MINOR_VERSION > 0)
if (style & wxNO_BORDER)
gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );
#endif
- SetLabel(label);
-
int x = 0; int y = 0;
wxFont new_font( parent->GetFont() );
GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font );
#include "wx/tooltip.h"
#endif
-#if wxUSE_DRAG_AND_DROP
-#include "wx/dnd.h"
-#endif
-
#include "gdk/gdk.h"
#include "gtk/gtk.h"
+#include "gdk/gdkkeysyms.h"
//-----------------------------------------------------------------------------
// idle system
// "key_press_event"
//-----------------------------------------------------------------------------
-#if wxUSE_CHECKLISTBOX
static gint
gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
{
- if (g_isIdle) wxapp_install_idle_handler();
+ if (g_isIdle)
+ wxapp_install_idle_handler();
- if (g_blockEventsOnDrag) return FALSE;
+ if (g_blockEventsOnDrag)
+ return FALSE;
- if (!listbox->m_hasVMT) return FALSE;
+ bool ret = FALSE;
- if (gdk_event->keyval != ' ') return FALSE;
+ if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
+ {
+ wxNavigationKeyEvent new_event;
+ /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
+ new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
+ /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
+ new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
+ new_event.SetCurrentFocus( listbox );
+ ret = listbox->GetEventHandler()->ProcessEvent( new_event );
+ }
+
+#if wxUSE_CHECKLISTBOX
+ if ((gdk_event->keyval != ' ') && (listbox->m_hasCheckBoxes) && (!ret))
+ {
+ int sel = listbox->GtkGetIndex( widget );
- int sel = listbox->GtkGetIndex( widget );
+ wxCheckListBox *clb = (wxCheckListBox *)listbox;
- wxCheckListBox *clb = (wxCheckListBox *)listbox;
+ clb->Check( sel, !clb->IsChecked(sel) );
- clb->Check( sel, !clb->IsChecked(sel) );
+ wxCommandEvent new_event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
+ new_event.SetEventObject( listbox );
+ new_event.SetInt( sel );
+ ret = listbox->GetEventHandler()->ProcessEvent( new_event );
+ }
+#endif // wxUSE_CHECKLISTBOX
- wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
- event.SetEventObject( listbox );
- event.SetInt( sel );
- listbox->GetEventHandler()->ProcessEvent( event );
+ if (ret)
+ {
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+ return TRUE;
+ }
return FALSE;
}
-#endif // wxUSE_CHECKLISTBOX
//-----------------------------------------------------------------------------
// "select" and "deselect"
(GtkSignalFunc)gtk_listbox_button_release_callback,
(gpointer) this );
-#if wxUSE_CHECKLISTBOX
- if (m_hasCheckBoxes)
- {
- gtk_signal_connect( GTK_OBJECT(list_item),
+ gtk_signal_connect( GTK_OBJECT(list_item),
"key_press_event",
(GtkSignalFunc)gtk_listbox_key_press_callback,
(gpointer)this );
- }
-#endif // wxUSE_CHECKLISTBOX
gtk_widget_show( list_item );
m_menuItem = (GtkWidget *) NULL;
- // call it after initializing m_menuItem to NULL
DoSetText(text);
}
// don't delete menu items, the menus take care of that
}
+void wxMenuItem::SetText( const wxString& str )
+{
+ DoSetText(str);
+
+ if (m_menuItem)
+ {
+ GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
+
+ /* set new text */
+ gtk_label_set( label, m_text.mb_str());
+
+ /* reparse key accel */
+ guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), m_text.mb_str() );
+ gtk_accel_label_refetch( GTK_ACCEL_LABEL(label) );
+ }
+}
+
// it's valid for this function to be called even if m_menuItem == NULL
void wxMenuItem::DoSetText( const wxString& str )
{
#endif
}
else
- m_text << *pc;
+ m_text << *pc;
}
/* only GTK 1.2 knows about hot keys */
m_hotKey = pc;
}
#endif
-
- if (m_menuItem)
- {
- GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
- gtk_label_set( label, m_text.mb_str());
- }
}
void wxMenuItem::Check( bool check )
return ((GtkCheckMenuItem*)m_menuItem)->active != 0;
}
+wxString wxMenuItem::GetFactoryPath() const
+{
+ /* in order to get the pointer to the item we need the item text _without_ underscores */
+ wxString path( wxT("<main>/") );
+ for ( const wxChar *pc = m_text; *pc != wxT('\0'); pc++ )
+ {
+ while (*pc == wxT('_')) pc++; /* skip it */
+ path << *pc;
+ }
+
+ return path;
+}
+
//-----------------------------------------------------------------------------
// wxMenu
//-----------------------------------------------------------------------------
strncpy(s_accel, GetHotKey(*mitem).mb_str(), WXSIZEOF(s_accel));
entry.accelerator = s_accel;
#else
- entry.accelerator = NULL;
+ entry.accelerator = (char*) NULL;
#endif
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
- /* in order to get the pointer to the item we need the item text _without_ underscores */
- wxString s = wxT("<main>/");
- for ( const wxChar *pc = text; *pc != wxT('\0'); pc++ )
- {
- while (*pc == wxT('_')) pc++; /* skip it */
- s << *pc;
- }
-
- GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s.mb_str() );
+ wxString path( mitem->GetFactoryPath() );
+ GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, path.mb_str() );
#else
gtk_item_factory_create_item( m_factory, &entry, (gpointer) this, 2 ); /* what is 2 ? */
- /* in order to get the pointer to the item we need the item text _without_ underscores */
- wxString s = wxT("<main>/");
- for ( const wxChar *pc = text; *pc != wxT('\0'); pc++ )
- {
- if (*pc == wxT('_')) pc++; /* skip it */
- s << *pc;
- }
-
- GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, s.mb_str() );
+ wxString path( mitem->GetFactoryPath() );
+ GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, path.mb_str() );
#else
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->GetId() == id)
{
+ /* TODO: this code doesn't delete the item factory item and
+ this seems impossible as of GTK 1.2.6. */
gtk_widget_destroy( item->GetMenuItem() );
m_items.DeleteNode( node );
return;
#include "gdk/gdk.h"
#include "gtk/gtk.h"
+#include "gdk/gdkkeysyms.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
- GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
+ GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
gtk_pizza_put( GTK_PIZZA(m_parent->m_wxwindow),
GTK_WIDGET(m_radio),
const wxString& name)
{
m_needParent = TRUE;
+ m_acceptsFocus = TRUE;
wxSize new_size = size;
if (new_size.y == -1)
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
- GtkWidget *connect_widget = GetConnectWidget();
- if (connect_widget)
+ wxNode *node = m_children.First();
+ while (node)
+ {
+ wxWindow *child = (wxWindow*) node->Data();
+ if (child->AcceptsFocus())
+ {
+ child->SetFocus();
+ return;
+ }
+ node = node->Next();
+ }
+
+ if (m_wxwindow)
+ {
+ gtk_widget_grab_focus (m_wxwindow);
+ return;
+ }
+
+ if (m_widget)
{
- if (GTK_WIDGET_CAN_FOCUS(connect_widget) /*&& !GTK_WIDGET_HAS_FOCUS (connect_widget)*/ )
+ if (GTK_WIDGET_CAN_FOCUS(m_widget) /*&& !GTK_WIDGET_HAS_FOCUS (connect_widget)*/ )
{
- gtk_widget_grab_focus (connect_widget);
+ gtk_widget_grab_focus (m_widget);
}
- else if (GTK_IS_CONTAINER(connect_widget))
+ else if (GTK_IS_CONTAINER(m_widget))
{
- gtk_container_focus( GTK_CONTAINER(connect_widget), GTK_DIR_TAB_FORWARD );
+ gtk_container_focus( GTK_CONTAINER(m_widget), GTK_DIR_TAB_FORWARD );
}
else
{
+ // ?
}
}
}