wxMenuBar();
wxMenuBar(long style);
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
+ ~wxMenuBar();
// menubar construction
void Append( wxMenu *menu, const wxString &title );
wxMenuItem* FindMenuItemById( int id ) const { return FindItem(id); }
#endif // WXWIN_COMPATIBILITY
- // implementation
+ // implementation only
wxList& GetMenus() { return m_menus; }
-protected:
- wxList m_menus;
- GtkWidget *m_menubar;
+ GtkAccelGroup *m_accel;
+ GtkItemFactory *m_factory;
+
+private:
+ wxList m_menus;
+ GtkWidget *m_menubar;
};
//-----------------------------------------------------------------------------
void SetInvokingWindow( wxWindow *win );
wxWindow *GetInvokingWindow();
- // implementation only
+ // implementation GTK only
GtkWidget *m_menu; // GtkMenu
GtkWidget *m_owner;
-
GtkAccelGroup *m_accel;
GtkItemFactory *m_factory;
private:
+
wxString m_title;
wxList m_items;
wxWindow *m_invokingWindow;
wxMenuBar();
wxMenuBar(long style);
wxMenuBar(int n, wxMenu *menus[], const wxString titles[]);
+ ~wxMenuBar();
// menubar construction
void Append( wxMenu *menu, const wxString &title );
wxMenuItem* FindMenuItemById( int id ) const { return FindItem(id); }
#endif // WXWIN_COMPATIBILITY
- // implementation
+ // implementation only
wxList& GetMenus() { return m_menus; }
-protected:
- wxList m_menus;
- GtkWidget *m_menubar;
+ GtkAccelGroup *m_accel;
+ GtkItemFactory *m_factory;
+
+private:
+ wxList m_menus;
+ GtkWidget *m_menubar;
};
//-----------------------------------------------------------------------------
void SetInvokingWindow( wxWindow *win );
wxWindow *GetInvokingWindow();
- // implementation only
+ // implementation GTK only
GtkWidget *m_menu; // GtkMenu
GtkWidget *m_owner;
-
GtkAccelGroup *m_accel;
GtkItemFactory *m_factory;
private:
+
wxString m_title;
wxList m_items;
wxWindow *m_invokingWindow;
return FALSE;
wxString str;
- str.Printf("Sash position = %d", newSashPosition);
+ str.Printf( _T("Sash position = %d"), newSashPosition);
m_frame->SetStatusText(str);
return TRUE;
void MyFrame::SetMinSize(wxCommandEvent& WXUNUSED(event) )
{
wxString str;
- str.Printf("%d", m_splitter->GetMinimumPaneSize());
+ str.Printf( _T("%d"), m_splitter->GetMinimumPaneSize());
str = wxGetTextFromUser("Enter minimal size for panes:", "", str, this);
if ( str.IsEmpty() )
return;
+/*
+ What is atoi in Unicode?
+
int minsize = atoi(str);
m_splitter->SetMinimumPaneSize(minsize);
- str.Printf("Min pane size = %d", minsize);
+ str.Printf( _T("Min pane size = %d"), minsize);
SetStatusText(str, 1);
+*/
}
void MyFrame::UpdateUIHorizontal(wxUpdateUIEvent& event)
void MyFrame::UpdatePosition()
{
wxString str;
- str.Printf("Sash position = %d", m_splitter->GetSashPosition());
+ str.Printf( _("Sash position = %d"), m_splitter->GetSashPosition());
SetStatusText(str);
}
m_owner = (wxWindow *)NULL;
if (!window) return;
+
GtkWidget *widget = window->m_wxwindow;
if (!widget) return;
+
m_window = widget->window;
+
+ /* not realized ? */
+ if (!m_window)
+ {
+ /* force realization */
+ gtk_widget_realize( widget );
+ m_window = widget->window;
+ }
+
+ /* still not realized ? */
if (!m_window) return;
+
if (window->m_wxwindow)
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
/* resize on OnInternalIdle */
parent->m_sizeSet = FALSE;
-
- if (parent->m_windowStyle & wxTAB_TRAVERSAL)
- {
- /* we now allow a window to get the focus as long as it
- doesn't have any children. */
- GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
- }
}
//-----------------------------------------------------------------------------
/* m_wxwindow only represents the client area without toolbar and menubar */
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
- GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
+
+ /* we allow the frame to get the focus as otherwise no
+ keye vents will get sent to it. the point with this is
+ that the menu's key accelerators work by interceting
+ key events here */
+ GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+ GTK_WIDGET_SET_FLAGS (m_wxwindow, GTK_HAS_FOCUS);
if (m_parent) m_parent->AddChild( this );
if (m_frameMenuBar)
{
+ /* support for native key accelerators indicated by underscroes */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ gtk_accel_group_attach( m_frameMenuBar->m_accel, GTK_OBJECT(m_wxwindow));
+#endif
+
wxNode *node = m_frameMenuBar->GetMenus().First();
while (node)
{
}
}
+ /* resize window in OnInternalIdle */
m_sizeSet = FALSE;
}
wxMenuBar::wxMenuBar( long style )
{
- m_needParent = FALSE; // hmmm
+ /* the parent window is known after wxFrame::SetMenu() */
+ m_needParent = FALSE;
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, style, "menu" );
m_menus.DeleteContents( TRUE );
+ /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ m_accel = gtk_accel_group_new();
+ m_factory = gtk_item_factory_new( GTK_TYPE_MENU_BAR, "<main>", m_accel );
+ m_menubar = gtk_item_factory_get_widget( m_factory, "<main>" );
+#else
m_menubar = gtk_menu_bar_new();
+#endif
if (style & wxMB_DOCKABLE)
{
wxMenuBar::wxMenuBar()
{
- m_needParent = FALSE; // hmmm
+ /* the parent window is known after wxFrame::SetMenu() */
+ m_needParent = FALSE;
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" );
m_menus.DeleteContents( TRUE );
+ /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ m_accel = gtk_accel_group_new();
+ m_factory = gtk_item_factory_new( GTK_TYPE_MENU_BAR, "<main>", m_accel );
+ m_menubar = gtk_item_factory_get_widget( m_factory, "<main>" );
+#else
m_menubar = gtk_menu_bar_new();
+#endif
m_widget = GTK_WIDGET(m_menubar);
Show( TRUE );
}
+wxMenuBar::~wxMenuBar()
+{
+ // how to destroy a GtkItemFactory ?
+}
+
void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
m_menus.Append( menu );
- wxString s = _T("");
+ /* GTK 1.2 wants to have "_" instead of "&" for accelerators */
+ wxString str;
for ( const wxChar *pc = title; *pc != _T('\0'); pc++ )
{
if (*pc == _T('&'))
{
pc++; /* skip it */
-#if (GTK_MINOR_VERSION > 0)
- // s << '_'; not yet
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ str << _T('_');
#endif
}
- s << *pc;
+ str << *pc;
}
- menu->SetTitle(s);
- menu->m_owner = gtk_menu_item_new_with_label( MBSTRINGCAST s.mbc_str() );
+ /* this doesn't have much effect right now */
+ menu->SetTitle( str );
+
+ /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+
+ /* local buffer in multibyte form */
+ char buf[200];
+ strcpy( buf, "/" );
+ strcat( buf, str.mb_str() );
+
+ GtkItemFactoryEntry entry;
+ entry.path = buf;
+ entry.accelerator = (gchar*) NULL;
+ entry.callback = (GtkItemFactoryCallback) NULL;
+ entry.callback_action = 0;
+ entry.item_type = "<Branch>";
+
+ 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 tmp = _T("<main>/");
+ for ( const wxChar *pc = str; *pc != _T('\0'); pc++ )
+ {
+ if (*pc == _T('_')) pc++; /* skip it */
+ tmp << *pc;
+ }
+
+ menu->m_owner = gtk_item_factory_get_item( m_factory, tmp.mb_str() );
+
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
+
+#else
+
+ menu->m_owner = gtk_menu_item_new_with_label( str.mb_str() );
gtk_widget_show( menu->m_owner );
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), menu->m_owner );
+
+#endif
}
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
if (m_menuItem)
{
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
- gtk_label_set( label, m_text.mbc_str());
+ gtk_label_set( label, m_text.mb_str());
}
}
mitem->SetText(item);
mitem->SetHelp(helpStr);
mitem->SetCheckable(checkable);
- const wxChar *text = mitem->GetText();
#if (GTK_MINOR_VERSION > 0)
- wxChar buf[100];
- wxStrcpy( buf, _T("/") );
- wxStrcat( buf, text );
+ /* text has "_" instead of "&" after mitem->SetText() */
+ wxString text( mitem->GetText() );
+
+ /* local buffer in multibyte form */
+ char buf[200];
+ strcpy( buf, "/" );
+ strcat( buf, text.mb_str() );
- const wxWX2MBbuf pbuf = wxConv_current->cWX2MB(buf);
GtkItemFactoryEntry entry;
- entry.path = MBSTRINGCAST pbuf;
+ entry.path = buf;
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
entry.callback_action = 0;
s << *pc;
}
- GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s.mbc_str() );
+ GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s.mb_str() );
#else
- GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
- : gtk_menu_item_new_with_label(text);
+ GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label( item.mb_str() )
+ : gtk_menu_item_new_with_label( item.mb_str() );
gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
if (g_blockEventsOnDrag) return FALSE;
/*
- printf( "OnKeyPress from " );
+ wxPrintf( _T("OnKeyPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
-
long key_code = 0;
switch (gdk_event->keyval)
{
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
+/*
+ wxPrintf( _T("1) OnButtonPress from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
+*/
+
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
gtk_widget_grab_focus (win->m_wxwindow);
/*
- printf( "GrabFocus from " );
+ wxPrintf( _T("GrabFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
}
+/*
+ else
+ {
+ wxPrintf( _T("No GrabFocus from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
+ wxPrintf( _T(" because it already has") );
+ wxPrintf( _T(".\n") );
+ }
+*/
}
/*
- printf( "OnButtonPress from " );
+ wxPrintf( _T("2) OnButtonPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
wxEventType event_type = wxEVT_LEFT_DOWN;
/*
- printf( "OnSetFocus from " );
+ wxPrintf( _T("OnSetFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( " " );
- printf( WXSTRINGCAST win->GetLabel() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(" ") );
+ wxPrintf( win->GetLabel() );
+ wxPrintf( _T(".\n") );
*/
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
}
/*
- printf( "OnKillFocus from " );
+ wxPrintf( _T("OnKillFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(" ") );
+ wxPrintf( win->GetLabel() );
+ wxPrintf( _T(".\n") );
*/
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
{
wxColour bg( win->m_backgroundColour );
- win->SetBackgroundColour( wxNullColour );
+ win->m_backgroundColour = wxNullColour;
win->SetBackgroundColour( bg );
}
if (win->m_foregroundColour != *wxBLACK)
{
wxColour fg( win->m_foregroundColour );
- win->SetForegroundColour( wxNullColour );
+ win->m_foregroundColour = wxNullColour;
win->SetForegroundColour( fg );
}
#endif
}
- ConnectWidget( GetConnectWidget() );
+ GtkWidget *connect_widget = GetConnectWidget();
+
+ ConnectWidget( connect_widget );
-/* we cannot set colours, fonts and cursors before the widget has
- been realized, so we do this directly after realization */
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
+ /* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
m_hasVMT = TRUE;
m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return;
- if (!m_widget->window) return;
-
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return;
+
if (m_wxwindow && m_wxwindow->window)
{
/* wxMSW doesn't clear the window here. I don't do that
m_owner = (wxWindow *)NULL;
if (!window) return;
+
GtkWidget *widget = window->m_wxwindow;
if (!widget) return;
+
m_window = widget->window;
+
+ /* not realized ? */
+ if (!m_window)
+ {
+ /* force realization */
+ gtk_widget_realize( widget );
+ m_window = widget->window;
+ }
+
+ /* still not realized ? */
if (!m_window) return;
+
if (window->m_wxwindow)
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
/* resize on OnInternalIdle */
parent->m_sizeSet = FALSE;
-
- if (parent->m_windowStyle & wxTAB_TRAVERSAL)
- {
- /* we now allow a window to get the focus as long as it
- doesn't have any children. */
- GTK_WIDGET_UNSET_FLAGS( parent->m_wxwindow, GTK_CAN_FOCUS );
- }
}
//-----------------------------------------------------------------------------
/* m_wxwindow only represents the client area without toolbar and menubar */
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
- GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_mainWidget), m_wxwindow );
+
+ /* we allow the frame to get the focus as otherwise no
+ keye vents will get sent to it. the point with this is
+ that the menu's key accelerators work by interceting
+ key events here */
+ GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+ GTK_WIDGET_SET_FLAGS (m_wxwindow, GTK_HAS_FOCUS);
if (m_parent) m_parent->AddChild( this );
if (m_frameMenuBar)
{
+ /* support for native key accelerators indicated by underscroes */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ gtk_accel_group_attach( m_frameMenuBar->m_accel, GTK_OBJECT(m_wxwindow));
+#endif
+
wxNode *node = m_frameMenuBar->GetMenus().First();
while (node)
{
}
}
+ /* resize window in OnInternalIdle */
m_sizeSet = FALSE;
}
wxMenuBar::wxMenuBar( long style )
{
- m_needParent = FALSE; // hmmm
+ /* the parent window is known after wxFrame::SetMenu() */
+ m_needParent = FALSE;
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, style, "menu" );
m_menus.DeleteContents( TRUE );
+ /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ m_accel = gtk_accel_group_new();
+ m_factory = gtk_item_factory_new( GTK_TYPE_MENU_BAR, "<main>", m_accel );
+ m_menubar = gtk_item_factory_get_widget( m_factory, "<main>" );
+#else
m_menubar = gtk_menu_bar_new();
+#endif
if (style & wxMB_DOCKABLE)
{
wxMenuBar::wxMenuBar()
{
- m_needParent = FALSE; // hmmm
+ /* the parent window is known after wxFrame::SetMenu() */
+ m_needParent = FALSE;
PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" );
m_menus.DeleteContents( TRUE );
+ /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ m_accel = gtk_accel_group_new();
+ m_factory = gtk_item_factory_new( GTK_TYPE_MENU_BAR, "<main>", m_accel );
+ m_menubar = gtk_item_factory_get_widget( m_factory, "<main>" );
+#else
m_menubar = gtk_menu_bar_new();
+#endif
m_widget = GTK_WIDGET(m_menubar);
Show( TRUE );
}
+wxMenuBar::~wxMenuBar()
+{
+ // how to destroy a GtkItemFactory ?
+}
+
void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
m_menus.Append( menu );
- wxString s = _T("");
+ /* GTK 1.2 wants to have "_" instead of "&" for accelerators */
+ wxString str;
for ( const wxChar *pc = title; *pc != _T('\0'); pc++ )
{
if (*pc == _T('&'))
{
pc++; /* skip it */
-#if (GTK_MINOR_VERSION > 0)
- // s << '_'; not yet
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+ str << _T('_');
#endif
}
- s << *pc;
+ str << *pc;
}
- menu->SetTitle(s);
- menu->m_owner = gtk_menu_item_new_with_label( MBSTRINGCAST s.mbc_str() );
+ /* this doesn't have much effect right now */
+ menu->SetTitle( str );
+
+ /* GTK 1.2.0 doesn't have gtk_item_factory_get_item(), but GTK 1.2.1 has. */
+#if (GTK_MINOR_VERSION > 0) && (GTK_MICRO_VERSION > 0)
+
+ /* local buffer in multibyte form */
+ char buf[200];
+ strcpy( buf, "/" );
+ strcat( buf, str.mb_str() );
+
+ GtkItemFactoryEntry entry;
+ entry.path = buf;
+ entry.accelerator = (gchar*) NULL;
+ entry.callback = (GtkItemFactoryCallback) NULL;
+ entry.callback_action = 0;
+ entry.item_type = "<Branch>";
+
+ 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 tmp = _T("<main>/");
+ for ( const wxChar *pc = str; *pc != _T('\0'); pc++ )
+ {
+ if (*pc == _T('_')) pc++; /* skip it */
+ tmp << *pc;
+ }
+
+ menu->m_owner = gtk_item_factory_get_item( m_factory, tmp.mb_str() );
+
+ gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
+
+#else
+
+ menu->m_owner = gtk_menu_item_new_with_label( str.mb_str() );
gtk_widget_show( menu->m_owner );
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), menu->m_owner );
+
+#endif
}
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
if (m_menuItem)
{
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
- gtk_label_set( label, m_text.mbc_str());
+ gtk_label_set( label, m_text.mb_str());
}
}
mitem->SetText(item);
mitem->SetHelp(helpStr);
mitem->SetCheckable(checkable);
- const wxChar *text = mitem->GetText();
#if (GTK_MINOR_VERSION > 0)
- wxChar buf[100];
- wxStrcpy( buf, _T("/") );
- wxStrcat( buf, text );
+ /* text has "_" instead of "&" after mitem->SetText() */
+ wxString text( mitem->GetText() );
+
+ /* local buffer in multibyte form */
+ char buf[200];
+ strcpy( buf, "/" );
+ strcat( buf, text.mb_str() );
- const wxWX2MBbuf pbuf = wxConv_current->cWX2MB(buf);
GtkItemFactoryEntry entry;
- entry.path = MBSTRINGCAST pbuf;
+ entry.path = buf;
entry.accelerator = (gchar*) NULL;
entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
entry.callback_action = 0;
s << *pc;
}
- GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s.mbc_str() );
+ GtkWidget *menuItem = gtk_item_factory_get_widget( m_factory, s.mb_str() );
#else
- GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
- : gtk_menu_item_new_with_label(text);
+ GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label( item.mb_str() )
+ : gtk_menu_item_new_with_label( item.mb_str() );
gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
if (g_blockEventsOnDrag) return FALSE;
/*
- printf( "OnKeyPress from " );
+ wxPrintf( _T("OnKeyPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
-
long key_code = 0;
switch (gdk_event->keyval)
{
static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
{
+/*
+ wxPrintf( _T("1) OnButtonPress from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
+*/
+
if (!win->HasVMT()) return FALSE;
if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE;
gtk_widget_grab_focus (win->m_wxwindow);
/*
- printf( "GrabFocus from " );
+ wxPrintf( _T("GrabFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
}
+/*
+ else
+ {
+ wxPrintf( _T("No GrabFocus from ") );
+ if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
+ wxPrintf( _T(" because it already has") );
+ wxPrintf( _T(".\n") );
+ }
+*/
}
/*
- printf( "OnButtonPress from " );
+ wxPrintf( _T("2) OnButtonPress from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(".\n") );
*/
wxEventType event_type = wxEVT_LEFT_DOWN;
/*
- printf( "OnSetFocus from " );
+ wxPrintf( _T("OnSetFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( " " );
- printf( WXSTRINGCAST win->GetLabel() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(" ") );
+ wxPrintf( win->GetLabel() );
+ wxPrintf( _T(".\n") );
*/
wxFocusEvent event( wxEVT_SET_FOCUS, win->GetId() );
}
/*
- printf( "OnKillFocus from " );
+ wxPrintf( _T("OnKillFocus from ") );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
- printf( win->GetClassInfo()->GetClassName() );
- printf( ".\n" );
+ wxPrintf( win->GetClassInfo()->GetClassName() );
+ wxPrintf( _T(" ") );
+ wxPrintf( win->GetLabel() );
+ wxPrintf( _T(".\n") );
*/
wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
if (win->m_backgroundColour != wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ))
{
wxColour bg( win->m_backgroundColour );
- win->SetBackgroundColour( wxNullColour );
+ win->m_backgroundColour = wxNullColour;
win->SetBackgroundColour( bg );
}
if (win->m_foregroundColour != *wxBLACK)
{
wxColour fg( win->m_foregroundColour );
- win->SetForegroundColour( wxNullColour );
+ win->m_foregroundColour = wxNullColour;
win->SetForegroundColour( fg );
}
#endif
}
- ConnectWidget( GetConnectWidget() );
+ GtkWidget *connect_widget = GetConnectWidget();
+
+ ConnectWidget( connect_widget );
-/* we cannot set colours, fonts and cursors before the widget has
- been realized, so we do this directly after realization */
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "realize",
+ /* we cannot set colours, fonts and cursors before the widget has
+ been realized, so we do this directly after realization */
+ gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
m_hasVMT = TRUE;
m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return;
- if (!m_widget->window) return;
-
+ GtkWidget *connect_widget = GetConnectWidget();
+ if (!connect_widget->window) return;
+
if (m_wxwindow && m_wxwindow->window)
{
/* wxMSW doesn't clear the window here. I don't do that