void SetColumns( int n = 1 );
void SetSelection( int n );
void SetStringSelection( const wxString &string );
+
void SetFont( const wxFont &font );
};
void SetEditable(bool editable);
void SetFont( const wxFont &font );
+ void OnSize( wxSizeEvent &event );
// implementation
private:
wxList m_clientData;
+
+ GtkWidget* GetConnectWidget(void);
+ bool IsOwnGtkWindow( GdkWindow *window );
- GtkWidget* GetConnectWidget(void);
+ DECLARE_EVENT_TABLE()
};
#endif // __GTKCOMBOBOXH__
void SetStringSelection( const wxString &string, bool select = TRUE );
void SetFont( const wxFont &font );
- virtual GtkWidget *GetConnectWidget(void);
-
+ // implementation
+
+ int GetIndex( GtkWidget *item ) const;
+ GtkWidget *GetConnectWidget(void);
+
private:
GtkList *m_list;
wxList m_clientData;
- public:
-
- int GetIndex( GtkWidget *item ) const;
};
#endif // __GTKLISTBOXH__
// implementation
+ bool IsOwnGtkWindow( GdkWindow *window );
+
bool m_alreadySent;
private:
void SetObjectLength( int objectLength );
void SetViewLength( int viewLength );
- public:
+ // implementation
+
+ bool IsOwnGtkWindow( GdkWindow *window );
GtkAdjustment *m_adjust;
float m_oldPos;
int GetThumbLength(void) const;
void SetTick( int tickPos );
- public:
-
+ // implementation
+
+ bool IsOwnGtkWindow( GdkWindow *window );
+
GtkAdjustment *m_adjust;
float m_oldPos;
// implementation
- virtual GtkWidget* GetConnectWidget(void);
- virtual bool IsOwnGtkWindow( GdkWindow *window );
+ GtkWidget* GetConnectWidget(void);
+ bool IsOwnGtkWindow( GdkWindow *window );
private:
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
+ void ConnectWidget( GtkWidget *widget );
bool HasVMT();
virtual void ImplementSetSize();
virtual void ImplementSetPosition();
void SetColumns( int n = 1 );
void SetSelection( int n );
void SetStringSelection( const wxString &string );
+
void SetFont( const wxFont &font );
};
void SetEditable(bool editable);
void SetFont( const wxFont &font );
+ void OnSize( wxSizeEvent &event );
// implementation
private:
wxList m_clientData;
+
+ GtkWidget* GetConnectWidget(void);
+ bool IsOwnGtkWindow( GdkWindow *window );
- GtkWidget* GetConnectWidget(void);
+ DECLARE_EVENT_TABLE()
};
#endif // __GTKCOMBOBOXH__
void SetStringSelection( const wxString &string, bool select = TRUE );
void SetFont( const wxFont &font );
- virtual GtkWidget *GetConnectWidget(void);
-
+ // implementation
+
+ int GetIndex( GtkWidget *item ) const;
+ GtkWidget *GetConnectWidget(void);
+
private:
GtkList *m_list;
wxList m_clientData;
- public:
-
- int GetIndex( GtkWidget *item ) const;
};
#endif // __GTKLISTBOXH__
// implementation
+ bool IsOwnGtkWindow( GdkWindow *window );
+
bool m_alreadySent;
private:
void SetObjectLength( int objectLength );
void SetViewLength( int viewLength );
- public:
+ // implementation
+
+ bool IsOwnGtkWindow( GdkWindow *window );
GtkAdjustment *m_adjust;
float m_oldPos;
int GetThumbLength(void) const;
void SetTick( int tickPos );
- public:
-
+ // implementation
+
+ bool IsOwnGtkWindow( GdkWindow *window );
+
GtkAdjustment *m_adjust;
float m_oldPos;
// implementation
- virtual GtkWidget* GetConnectWidget(void);
- virtual bool IsOwnGtkWindow( GdkWindow *window );
+ GtkWidget* GetConnectWidget(void);
+ bool IsOwnGtkWindow( GdkWindow *window );
private:
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
+ void ConnectWidget( GtkWidget *widget );
bool HasVMT();
virtual void ImplementSetSize();
virtual void ImplementSetPosition();
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(170,-1), 4, choices );
+ m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 4, choices );
(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) );
combo->GetEventHandler()->ProcessEvent(event);
}
-//-----------------------------------------------------------------------------
-// size
-
-/*
-static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
-{
- if (!win->HasVMT()) return FALSE;
- if (g_blockEventsOnDrag) return FALSE;
- if (!widget->button) return FALSE;
-
- widget->button->allocation.x =
- alloc->width - widget->button->allocation.width;
-
- return FALSE;
-}
-*/
-
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
+BEGIN_EVENT_TABLE(wxComboBox, wxControl)
+ EVT_SIZE(wxComboBox::OnSize)
+END_EVENT_TABLE()
+
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
PostCreation();
-/*
- gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
-*/
-
+ ConnectWidget( GTK_COMBO(m_widget)->button );
+
if (!value.IsNull()) SetValue( value );
Show( TRUE );
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{
+ wxFAIL_MSG( "wxComboBox::SetSelection not implemented" );
}
void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{
+ wxFAIL_MSG( "wxComboBox::SetEditable not implemented" );
+}
+
+void wxComboBox::OnSize( wxSizeEvent &event )
+{
+ wxControl::OnSize( event );
+
+ int w = 22;
+
+ gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
+
+ gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y );
+ gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
}
void wxComboBox::SetFont( const wxFont &font )
child = child->next;
}
}
-
+
GtkWidget* wxComboBox::GetConnectWidget(void)
{
return GTK_COMBO(m_widget)->entry;
}
+bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
+{
+ return ( (window == GTK_ENTRY( GTK_COMBO(m_widget)->entry )->text_area) ||
+ (window == GTK_COMBO(m_widget)->button->window ) );
+}
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
-// wxRadioBox
+// "clicked"
//-----------------------------------------------------------------------------
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
rb->GetEventHandler()->ProcessEvent(event);
}
+//-----------------------------------------------------------------------------
+// wxRadioBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
+ ConnectWidget( GTK_WIDGET(m_radio) );
+
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
return TRUE;
}
-void wxRadioBox::OnSize( wxSizeEvent &WXUNUSED(event) )
+void wxRadioBox::OnSize( wxSizeEvent &event )
{
+ wxControl::OnSize( event );
+
int x = m_x+5;
int y = m_y+15;
item = item->next;
}
}
+
+bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
+{
+ if (window == m_widget->window) return TRUE;
+
+ GSList *item = gtk_radio_button_group( m_radio );
+ while (item)
+ {
+ GtkWidget *button = GTK_WIDGET( item->data );
+ if (window == button->window) return TRUE;
+ item = item->next;
+ }
+
+ return FALSE;
+}
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
-// wxScrollBar
+// "value_changed"
//-----------------------------------------------------------------------------
static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
*/
}
+//-----------------------------------------------------------------------------
+// wxScrollBar
+//-----------------------------------------------------------------------------
+
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
wxScrollBar::~wxScrollBar(void)
SetScrollbar( pos, thumb, viewLength, page );
}
+bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
+{
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
+}
{
}
+bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
+{
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
+}
+
+
PreCreation( parent, id, pos, size, style, name );
- SetLabel(label);
m_widget = gtk_frame_new(m_label);
PostCreation();
+ SetLabel(label);
+
Show( TRUE );
return TRUE;
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
- printf( "Hallo.\n" );
if (GetEventHandler()->ProcessEvent(event)) return;
}
else if (key_event.KeyCode() == WXK_TAB)
#include "wx/menu.h"
#include "wx/notebook.h"
#include "wx/statusbr.h"
-#include <wx/intl.h>
-#include "gdk/gdkkeysyms.h"
-#include <math.h>
+#include "wx/intl.h"
#include "wx/gtk/win_gtk.h"
#include "gdk/gdkprivate.h"
+#include "gdk/gdkkeysyms.h"
+
+#include <math.h>
//-----------------------------------------------------------------------------
// documentation on internals
return TRUE;
}
+//-----------------------------------------------------------------------------
+// "enter_notify_event"
+//-----------------------------------------------------------------------------
+
+static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+{
+ if (widget->window != gdk_event->window) return TRUE;
+ if (g_blockEventsOnDrag) return TRUE;
+ if (!win->HasVMT()) return TRUE;
+
+ if (widget->window)
+ gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
+
+ wxMouseEvent event( wxEVT_ENTER_WINDOW );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" );
+
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------------
+// "leave_notify_event"
+//-----------------------------------------------------------------------------
+
+static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+{
+ if (widget->window != gdk_event->window) return TRUE;
+ if (!win->HasVMT()) return TRUE;
+ if (g_blockEventsOnDrag) return TRUE;
+
+ if (widget->window)
+ gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
+
+ wxMouseEvent event( wxEVT_LEAVE_WINDOW );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" );
+
+ return TRUE;
+}
+
//-----------------------------------------------------------------------------
// "value_changed" from m_vAdjust
//-----------------------------------------------------------------------------
*/
}
-//-----------------------------------------------------------------------------
-// "enter_notify_event"
-//-----------------------------------------------------------------------------
-
-static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
-{
- if (widget->window != gdk_event->window) return TRUE;
- if (g_blockEventsOnDrag) return TRUE;
- if (!win->HasVMT()) return TRUE;
-
- if (widget->window)
- gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
-
- wxMouseEvent event( wxEVT_ENTER_WINDOW );
- event.SetEventObject( win );
- return win->GetEventHandler()->ProcessEvent( event );
-}
-
-//-----------------------------------------------------------------------------
-// "leave_notify_event"
-//-----------------------------------------------------------------------------
-
-static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
-{
- if (widget->window != gdk_event->window) return TRUE;
- if (!win->HasVMT()) return TRUE;
- if (g_blockEventsOnDrag) return TRUE;
-
- if (widget->window)
- gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
-
- wxMouseEvent event( wxEVT_LEAVE_WINDOW );
- event.SetEventObject( win );
- return win->GetEventHandler()->ProcessEvent( event );
-}
-
//-----------------------------------------------------------------------------
// wxWindow
//-----------------------------------------------------------------------------
{
if (m_parent) m_parent->AddChild( this );
-// GtkStyle *style = m_widget->style;
-// style->font = m_font.GetInternalFont( 1.0 ); // destroy old font ?
-
- GtkWidget *connect_widget = GetConnectWidget();
-
if (m_wxwindow)
{
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
}
- gtk_signal_connect( GTK_OBJECT(connect_widget), "key_press_event",
+ ConnectWidget( GetConnectWidget() );
+
+ if (m_widget && m_parent) gtk_widget_realize( m_widget );
+
+ if (m_wxwindow)
+ {
+ gtk_widget_realize( m_wxwindow );
+ gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE );
+ }
+
+ SetCursor( wxSTANDARD_CURSOR );
+
+ m_hasVMT = TRUE;
+}
+
+void wxWindow::ConnectWidget( GtkWidget *widget )
+{
+ gtk_signal_connect( GTK_OBJECT(widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_window_key_press_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "button_press_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "button_press_event",
GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "button_release_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "button_release_event",
GTK_SIGNAL_FUNC(gtk_window_button_release_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "motion_notify_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event",
GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_in_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_out_event",
GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
- // Only for cursor handling
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event",
GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "leave_notify_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "leave_notify_event",
GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
-
- if (m_wxwindow)
- {
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "enter_notify_event",
- GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );
-
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "leave_notify_event",
- GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
- }
-
- if (m_widget && m_parent) gtk_widget_realize( m_widget );
-
- if (m_wxwindow)
- {
- gtk_widget_realize( m_wxwindow );
- gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE );
- }
-
- SetCursor( wxSTANDARD_CURSOR );
-
- m_hasVMT = TRUE;
}
bool wxWindow::HasVMT(void)
combo->GetEventHandler()->ProcessEvent(event);
}
-//-----------------------------------------------------------------------------
-// size
-
-/*
-static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
-{
- if (!win->HasVMT()) return FALSE;
- if (g_blockEventsOnDrag) return FALSE;
- if (!widget->button) return FALSE;
-
- widget->button->allocation.x =
- alloc->width - widget->button->allocation.width;
-
- return FALSE;
-}
-*/
-
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
+BEGIN_EVENT_TABLE(wxComboBox, wxControl)
+ EVT_SIZE(wxComboBox::OnSize)
+END_EVENT_TABLE()
+
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
PostCreation();
-/*
- gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
- GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
-*/
-
+ ConnectWidget( GTK_COMBO(m_widget)->button );
+
if (!value.IsNull()) SetValue( value );
Show( TRUE );
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{
+ wxFAIL_MSG( "wxComboBox::SetSelection not implemented" );
}
void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{
+ wxFAIL_MSG( "wxComboBox::SetEditable not implemented" );
+}
+
+void wxComboBox::OnSize( wxSizeEvent &event )
+{
+ wxControl::OnSize( event );
+
+ int w = 22;
+
+ gtk_widget_set_usize( GTK_COMBO(m_widget)->entry, m_width-w-1, m_height );
+
+ gtk_widget_set_uposition( GTK_COMBO(m_widget)->button, m_x+m_width-w, m_y );
+ gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
}
void wxComboBox::SetFont( const wxFont &font )
child = child->next;
}
}
-
+
GtkWidget* wxComboBox::GetConnectWidget(void)
{
return GTK_COMBO(m_widget)->entry;
}
+bool wxComboBox::IsOwnGtkWindow( GdkWindow *window )
+{
+ return ( (window == GTK_ENTRY( GTK_COMBO(m_widget)->entry )->text_area) ||
+ (window == GTK_COMBO(m_widget)->button->window ) );
+}
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
-// wxRadioBox
+// "clicked"
//-----------------------------------------------------------------------------
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
rb->GetEventHandler()->ProcessEvent(event);
}
+//-----------------------------------------------------------------------------
+// wxRadioBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
+ ConnectWidget( GTK_WIDGET(m_radio) );
+
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
return TRUE;
}
-void wxRadioBox::OnSize( wxSizeEvent &WXUNUSED(event) )
+void wxRadioBox::OnSize( wxSizeEvent &event )
{
+ wxControl::OnSize( event );
+
int x = m_x+5;
int y = m_y+15;
item = item->next;
}
}
+
+bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window )
+{
+ if (window == m_widget->window) return TRUE;
+
+ GSList *item = gtk_radio_button_group( m_radio );
+ while (item)
+ {
+ GtkWidget *button = GTK_WIDGET( item->data );
+ if (window == button->window) return TRUE;
+ item = item->next;
+ }
+
+ return FALSE;
+}
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
-// wxScrollBar
+// "value_changed"
//-----------------------------------------------------------------------------
static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
*/
}
+//-----------------------------------------------------------------------------
+// wxScrollBar
+//-----------------------------------------------------------------------------
+
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
wxScrollBar::~wxScrollBar(void)
SetScrollbar( pos, thumb, viewLength, page );
}
+bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window )
+{
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
+}
{
}
+bool wxSlider::IsOwnGtkWindow( GdkWindow *window )
+{
+ GtkRange *range = GTK_RANGE(m_widget);
+ return ( (window == GTK_WIDGET(range)->window) ||
+ (window == range->trough) ||
+ (window == range->slider) ||
+ (window == range->step_forw) ||
+ (window == range->step_back) );
+}
+
+
PreCreation( parent, id, pos, size, style, name );
- SetLabel(label);
m_widget = gtk_frame_new(m_label);
PostCreation();
+ SetLabel(label);
+
Show( TRUE );
return TRUE;
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
- printf( "Hallo.\n" );
if (GetEventHandler()->ProcessEvent(event)) return;
}
else if (key_event.KeyCode() == WXK_TAB)
#include "wx/menu.h"
#include "wx/notebook.h"
#include "wx/statusbr.h"
-#include <wx/intl.h>
-#include "gdk/gdkkeysyms.h"
-#include <math.h>
+#include "wx/intl.h"
#include "wx/gtk/win_gtk.h"
#include "gdk/gdkprivate.h"
+#include "gdk/gdkkeysyms.h"
+
+#include <math.h>
//-----------------------------------------------------------------------------
// documentation on internals
return TRUE;
}
+//-----------------------------------------------------------------------------
+// "enter_notify_event"
+//-----------------------------------------------------------------------------
+
+static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+{
+ if (widget->window != gdk_event->window) return TRUE;
+ if (g_blockEventsOnDrag) return TRUE;
+ if (!win->HasVMT()) return TRUE;
+
+ if (widget->window)
+ gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
+
+ wxMouseEvent event( wxEVT_ENTER_WINDOW );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" );
+
+ return TRUE;
+}
+
+//-----------------------------------------------------------------------------
+// "leave_notify_event"
+//-----------------------------------------------------------------------------
+
+static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
+{
+ if (widget->window != gdk_event->window) return TRUE;
+ if (!win->HasVMT()) return TRUE;
+ if (g_blockEventsOnDrag) return TRUE;
+
+ if (widget->window)
+ gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
+
+ wxMouseEvent event( wxEVT_LEAVE_WINDOW );
+ event.SetEventObject( win );
+
+ if (win->GetEventHandler()->ProcessEvent( event ))
+ gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" );
+
+ return TRUE;
+}
+
//-----------------------------------------------------------------------------
// "value_changed" from m_vAdjust
//-----------------------------------------------------------------------------
*/
}
-//-----------------------------------------------------------------------------
-// "enter_notify_event"
-//-----------------------------------------------------------------------------
-
-static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
-{
- if (widget->window != gdk_event->window) return TRUE;
- if (g_blockEventsOnDrag) return TRUE;
- if (!win->HasVMT()) return TRUE;
-
- if (widget->window)
- gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
-
- wxMouseEvent event( wxEVT_ENTER_WINDOW );
- event.SetEventObject( win );
- return win->GetEventHandler()->ProcessEvent( event );
-}
-
-//-----------------------------------------------------------------------------
-// "leave_notify_event"
-//-----------------------------------------------------------------------------
-
-static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
-{
- if (widget->window != gdk_event->window) return TRUE;
- if (!win->HasVMT()) return TRUE;
- if (g_blockEventsOnDrag) return TRUE;
-
- if (widget->window)
- gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
-
- wxMouseEvent event( wxEVT_LEAVE_WINDOW );
- event.SetEventObject( win );
- return win->GetEventHandler()->ProcessEvent( event );
-}
-
//-----------------------------------------------------------------------------
// wxWindow
//-----------------------------------------------------------------------------
{
if (m_parent) m_parent->AddChild( this );
-// GtkStyle *style = m_widget->style;
-// style->font = m_font.GetInternalFont( 1.0 ); // destroy old font ?
-
- GtkWidget *connect_widget = GetConnectWidget();
-
if (m_wxwindow)
{
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
}
- gtk_signal_connect( GTK_OBJECT(connect_widget), "key_press_event",
+ ConnectWidget( GetConnectWidget() );
+
+ if (m_widget && m_parent) gtk_widget_realize( m_widget );
+
+ if (m_wxwindow)
+ {
+ gtk_widget_realize( m_wxwindow );
+ gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE );
+ }
+
+ SetCursor( wxSTANDARD_CURSOR );
+
+ m_hasVMT = TRUE;
+}
+
+void wxWindow::ConnectWidget( GtkWidget *widget )
+{
+ gtk_signal_connect( GTK_OBJECT(widget), "key_press_event",
GTK_SIGNAL_FUNC(gtk_window_key_press_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "button_press_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "button_press_event",
GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "button_release_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "button_release_event",
GTK_SIGNAL_FUNC(gtk_window_button_release_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "motion_notify_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event",
GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_in_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(connect_widget), "focus_out_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "focus_out_event",
GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
- // Only for cursor handling
-
- gtk_signal_connect( GTK_OBJECT(m_widget), "enter_notify_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event",
GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );
- gtk_signal_connect( GTK_OBJECT(m_widget), "leave_notify_event",
+ gtk_signal_connect( GTK_OBJECT(widget), "leave_notify_event",
GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
-
- if (m_wxwindow)
- {
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "enter_notify_event",
- GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );
-
- gtk_signal_connect( GTK_OBJECT(m_wxwindow), "leave_notify_event",
- GTK_SIGNAL_FUNC(gtk_window_leave_callback), (gpointer)this );
- }
-
- if (m_widget && m_parent) gtk_widget_realize( m_widget );
-
- if (m_wxwindow)
- {
- gtk_widget_realize( m_wxwindow );
- gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE );
- }
-
- SetCursor( wxSTANDARD_CURSOR );
-
- m_hasVMT = TRUE;
}
bool wxWindow::HasVMT(void)