]> git.saurik.com Git - wxWidgets.git/commitdiff
Much more aggressive for intercepting events and
authorRobert Roebling <robert@roebling.de>
Mon, 7 Sep 1998 12:29:07 +0000 (12:29 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 7 Sep 1998 12:29:07 +0000 (12:29 +0000)
    (not) redirecting them to wxWindows or GTK
    All widgets work now in DialogEd

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

31 files changed:
include/wx/gtk/choice.h
include/wx/gtk/combobox.h
include/wx/gtk/listbox.h
include/wx/gtk/radiobox.h
include/wx/gtk/scrolbar.h
include/wx/gtk/slider.h
include/wx/gtk/textctrl.h
include/wx/gtk/window.h
include/wx/gtk1/choice.h
include/wx/gtk1/combobox.h
include/wx/gtk1/listbox.h
include/wx/gtk1/radiobox.h
include/wx/gtk1/scrolbar.h
include/wx/gtk1/slider.h
include/wx/gtk1/textctrl.h
include/wx/gtk1/window.h
samples/controls/controls.cpp
src/gtk/combobox.cpp
src/gtk/radiobox.cpp
src/gtk/scrolbar.cpp
src/gtk/slider.cpp
src/gtk/statbox.cpp
src/gtk/textctrl.cpp
src/gtk/window.cpp
src/gtk1/combobox.cpp
src/gtk1/radiobox.cpp
src/gtk1/scrolbar.cpp
src/gtk1/slider.cpp
src/gtk1/statbox.cpp
src/gtk1/textctrl.cpp
src/gtk1/window.cpp

index 6849cec905da2b8cd57c863ca3a5659999249b96..9929a37fef33e3d50ee5f20ea8d3421e24d47ae3 100644 (file)
@@ -73,6 +73,7 @@ class wxChoice: public wxControl
     void SetColumns( int n = 1 );
     void SetSelection( int n );
     void SetStringSelection( const wxString &string );
+    
     void SetFont( const wxFont &font );
 };
 
index d8105773729dbc130c666bec3116c07ab2424090..c7d7b7064bcd59f92a585d3062e4bcd60aed18bf 100644 (file)
@@ -94,6 +94,7 @@ class wxComboBox: public wxControl
   void SetEditable(bool editable);
   
   void SetFont( const wxFont &font );
+  void OnSize( wxSizeEvent &event );
   
   // implementation
 
@@ -102,8 +103,11 @@ class wxComboBox: public wxControl
   private:
   
     wxList   m_clientData;
+
+  GtkWidget* GetConnectWidget(void);
+  bool IsOwnGtkWindow( GdkWindow *window );
   
-    GtkWidget* GetConnectWidget(void);
+  DECLARE_EVENT_TABLE()
 };
 
 #endif // __GTKCOMBOBOXH__
index 44f4d5aa19480a942af60fd3c3ab2a09c517eccb..1a6b810396291fa60e87b9434fb3648b31f53b4a 100644 (file)
@@ -84,16 +84,16 @@ class wxListBox: public wxControl
     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__
index 3ba68d40d989822e4429c7dc7b378e7e4c03f20c..5fb8792ba24ecb406dced7085a381f895dcf56a8 100644 (file)
@@ -84,6 +84,8 @@ class wxRadioBox: public wxControl
     
   // implementation    
     
+    bool IsOwnGtkWindow( GdkWindow *window );
+    
     bool            m_alreadySent;
     
   private:
index 27941a616b54f1355da0741f941728a9f7dc2213..f4a50694d0454c2b1602d0a58d2e0ed776f2c5a8 100644 (file)
@@ -77,7 +77,9 @@ class wxScrollBar: public wxControl
     void SetObjectLength( int objectLength );
     void SetViewLength( int viewLength );
 
-  public:
+  // implementation    
+    
+    bool IsOwnGtkWindow( GdkWindow *window );
   
     GtkAdjustment  *m_adjust;
     float           m_oldPos;
index 2915e8380fc328af75d26610ea7717612ea37e71..f6839196420d722080bc7e373d241146a0a2dd99 100644 (file)
@@ -84,8 +84,10 @@ class wxSlider: public wxControl
     int GetThumbLength(void) const;
     void SetTick( int tickPos );
 
-  public:
-  
+  // implementation    
+    
+    bool IsOwnGtkWindow( GdkWindow *window );
+    
     GtkAdjustment  *m_adjust;
     float           m_oldPos;
     
index e477a54675d87fd5b07b3de81e30e9f666116a96..e4bdb022c31acb7dfa313ec519f3e4c839566c18 100644 (file)
@@ -105,8 +105,8 @@ class wxTextCtrl: public wxControl, public streambuf
     
   // implementation    
     
-    virtual GtkWidget* GetConnectWidget(void);
-    virtual bool IsOwnGtkWindow( GdkWindow *window );
+    GtkWidget* GetConnectWidget(void);
+    bool IsOwnGtkWindow( GdkWindow *window );
     
   private:
   
index a029a5dc16aff5cbc37cc23d15e68743311c4fc0..ae7e532f27ed1eb786fc707197bb55149cc252c7 100644 (file)
@@ -236,6 +236,7 @@ public:         // cannot get private going yet
   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();
index 6849cec905da2b8cd57c863ca3a5659999249b96..9929a37fef33e3d50ee5f20ea8d3421e24d47ae3 100644 (file)
@@ -73,6 +73,7 @@ class wxChoice: public wxControl
     void SetColumns( int n = 1 );
     void SetSelection( int n );
     void SetStringSelection( const wxString &string );
+    
     void SetFont( const wxFont &font );
 };
 
index d8105773729dbc130c666bec3116c07ab2424090..c7d7b7064bcd59f92a585d3062e4bcd60aed18bf 100644 (file)
@@ -94,6 +94,7 @@ class wxComboBox: public wxControl
   void SetEditable(bool editable);
   
   void SetFont( const wxFont &font );
+  void OnSize( wxSizeEvent &event );
   
   // implementation
 
@@ -102,8 +103,11 @@ class wxComboBox: public wxControl
   private:
   
     wxList   m_clientData;
+
+  GtkWidget* GetConnectWidget(void);
+  bool IsOwnGtkWindow( GdkWindow *window );
   
-    GtkWidget* GetConnectWidget(void);
+  DECLARE_EVENT_TABLE()
 };
 
 #endif // __GTKCOMBOBOXH__
index 44f4d5aa19480a942af60fd3c3ab2a09c517eccb..1a6b810396291fa60e87b9434fb3648b31f53b4a 100644 (file)
@@ -84,16 +84,16 @@ class wxListBox: public wxControl
     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__
index 3ba68d40d989822e4429c7dc7b378e7e4c03f20c..5fb8792ba24ecb406dced7085a381f895dcf56a8 100644 (file)
@@ -84,6 +84,8 @@ class wxRadioBox: public wxControl
     
   // implementation    
     
+    bool IsOwnGtkWindow( GdkWindow *window );
+    
     bool            m_alreadySent;
     
   private:
index 27941a616b54f1355da0741f941728a9f7dc2213..f4a50694d0454c2b1602d0a58d2e0ed776f2c5a8 100644 (file)
@@ -77,7 +77,9 @@ class wxScrollBar: public wxControl
     void SetObjectLength( int objectLength );
     void SetViewLength( int viewLength );
 
-  public:
+  // implementation    
+    
+    bool IsOwnGtkWindow( GdkWindow *window );
   
     GtkAdjustment  *m_adjust;
     float           m_oldPos;
index 2915e8380fc328af75d26610ea7717612ea37e71..f6839196420d722080bc7e373d241146a0a2dd99 100644 (file)
@@ -84,8 +84,10 @@ class wxSlider: public wxControl
     int GetThumbLength(void) const;
     void SetTick( int tickPos );
 
-  public:
-  
+  // implementation    
+    
+    bool IsOwnGtkWindow( GdkWindow *window );
+    
     GtkAdjustment  *m_adjust;
     float           m_oldPos;
     
index e477a54675d87fd5b07b3de81e30e9f666116a96..e4bdb022c31acb7dfa313ec519f3e4c839566c18 100644 (file)
@@ -105,8 +105,8 @@ class wxTextCtrl: public wxControl, public streambuf
     
   // implementation    
     
-    virtual GtkWidget* GetConnectWidget(void);
-    virtual bool IsOwnGtkWindow( GdkWindow *window );
+    GtkWidget* GetConnectWidget(void);
+    bool IsOwnGtkWindow( GdkWindow *window );
     
   private:
   
index a029a5dc16aff5cbc37cc23d15e68743311c4fc0..ae7e532f27ed1eb786fc707197bb55149cc252c7 100644 (file)
@@ -236,6 +236,7 @@ public:         // cannot get private going yet
   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();
index 04c892b4c34b2c293029ec8ec87c7f276e7a3a2d..64ef002f2969d60adf10d4422c41bcc6d9f7dea0 100644 (file)
@@ -270,7 +270,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   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) );
index 11799f3b608934e0037f21a472eb6c8f5014d769..f6a53acda16464c8d9016e3b6ce947e83f12eae5 100644 (file)
@@ -46,29 +46,16 @@ static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox
   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[],
@@ -107,11 +94,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
   
   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 );
@@ -375,10 +359,24 @@ void wxComboBox::Remove(long from, long to)
 
 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 )
@@ -404,10 +402,15 @@ 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 ) );
+}
 
index 96e417570fc41676b802b2ff3d68ecf54a560ede..ec26307409e22c4d89311c350befde294841c677 100644 (file)
@@ -25,7 +25,7 @@
 extern bool   g_blockEventsOnDrag;
 
 //-----------------------------------------------------------------------------
-// wxRadioBox
+// "clicked"
 //-----------------------------------------------------------------------------
 
 static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
@@ -49,6 +49,8 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
   rb->GetEventHandler()->ProcessEvent(event);
 }
 
+//-----------------------------------------------------------------------------
+// wxRadioBox
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
@@ -90,6 +92,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
       
       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", 
@@ -122,8 +126,10 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
   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;
   
@@ -371,3 +377,18 @@ void wxRadioBox::SetFont( const wxFont &font )
     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;
+}
index de1cb7a8883167eca45051ee75ea3736b21eab11..210b60fce7ba1a8c1a6f732746e56d1d864a4ceb 100644 (file)
@@ -23,7 +23,7 @@
 extern bool   g_blockEventsOnDrag;
 
 //-----------------------------------------------------------------------------
-// wxScrollBar
+// "value_changed"
 //-----------------------------------------------------------------------------
 
 static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
@@ -61,6 +61,10 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
 */
 }
 
+//-----------------------------------------------------------------------------
+// wxScrollBar
+//-----------------------------------------------------------------------------
+
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
 
 wxScrollBar::~wxScrollBar(void)
@@ -209,3 +213,12 @@ void wxScrollBar::SetViewLength( int viewLength )
   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) );
+}
index 74449d7641e5834f92a863a8d38aa1f7f936366c..e9997178d24361fd4855272ccd6e1294269ea532 100644 (file)
@@ -238,3 +238,14 @@ void wxSlider::ClearSel(void)
 {
 }
 
+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) );
+}
+
+
index abf8e8ce574a69eca0f9a70ada6c4d551b92ee13..009f4a5865bed45e0b5bf438e2778bcdc485004f 100644 (file)
@@ -39,11 +39,12 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
 
   PreCreation( parent, id, pos, size, style, name );
 
-  SetLabel(label);
   m_widget = gtk_frame_new(m_label);
 
   PostCreation();
 
+  SetLabel(label);
+  
   Show( TRUE );
 
   return TRUE;
index 7405f2df26f7c1996a1c671d666af8305067ef42..44c3429337f1a184ec398f1eb6a3713193812341 100644 (file)
@@ -324,7 +324,6 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
   {
     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) 
index 70c53851a70b840e5a97ff5b5cce88b4d1ac560b..1d121ea4c0752c8bc5b7355960c6bba9d3c5ac5f 100644 (file)
 #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
@@ -591,6 +592,50 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
   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
 //-----------------------------------------------------------------------------
@@ -739,42 +784,6 @@ static void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWind
 */
 }
 
-//-----------------------------------------------------------------------------
-// "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
 //-----------------------------------------------------------------------------
@@ -1019,11 +1028,6 @@ void wxWindow::PostCreation(void)
 {
   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", 
@@ -1033,52 +1037,46 @@ void wxWindow::PostCreation(void)
       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)
index 11799f3b608934e0037f21a472eb6c8f5014d769..f6a53acda16464c8d9016e3b6ce947e83f12eae5 100644 (file)
@@ -46,29 +46,16 @@ static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox
   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[],
@@ -107,11 +94,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
   
   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 );
@@ -375,10 +359,24 @@ void wxComboBox::Remove(long from, long to)
 
 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 )
@@ -404,10 +402,15 @@ 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 ) );
+}
 
index 96e417570fc41676b802b2ff3d68ecf54a560ede..ec26307409e22c4d89311c350befde294841c677 100644 (file)
@@ -25,7 +25,7 @@
 extern bool   g_blockEventsOnDrag;
 
 //-----------------------------------------------------------------------------
-// wxRadioBox
+// "clicked"
 //-----------------------------------------------------------------------------
 
 static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
@@ -49,6 +49,8 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
   rb->GetEventHandler()->ProcessEvent(event);
 }
 
+//-----------------------------------------------------------------------------
+// wxRadioBox
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
@@ -90,6 +92,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
       
       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", 
@@ -122,8 +126,10 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
   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;
   
@@ -371,3 +377,18 @@ void wxRadioBox::SetFont( const wxFont &font )
     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;
+}
index de1cb7a8883167eca45051ee75ea3736b21eab11..210b60fce7ba1a8c1a6f732746e56d1d864a4ceb 100644 (file)
@@ -23,7 +23,7 @@
 extern bool   g_blockEventsOnDrag;
 
 //-----------------------------------------------------------------------------
-// wxScrollBar
+// "value_changed"
 //-----------------------------------------------------------------------------
 
 static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
@@ -61,6 +61,10 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
 */
 }
 
+//-----------------------------------------------------------------------------
+// wxScrollBar
+//-----------------------------------------------------------------------------
+
 IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
 
 wxScrollBar::~wxScrollBar(void)
@@ -209,3 +213,12 @@ void wxScrollBar::SetViewLength( int viewLength )
   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) );
+}
index 74449d7641e5834f92a863a8d38aa1f7f936366c..e9997178d24361fd4855272ccd6e1294269ea532 100644 (file)
@@ -238,3 +238,14 @@ void wxSlider::ClearSel(void)
 {
 }
 
+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) );
+}
+
+
index abf8e8ce574a69eca0f9a70ada6c4d551b92ee13..009f4a5865bed45e0b5bf438e2778bcdc485004f 100644 (file)
@@ -39,11 +39,12 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
 
   PreCreation( parent, id, pos, size, style, name );
 
-  SetLabel(label);
   m_widget = gtk_frame_new(m_label);
 
   PostCreation();
 
+  SetLabel(label);
+  
   Show( TRUE );
 
   return TRUE;
index 7405f2df26f7c1996a1c671d666af8305067ef42..44c3429337f1a184ec398f1eb6a3713193812341 100644 (file)
@@ -324,7 +324,6 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
   {
     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) 
index 70c53851a70b840e5a97ff5b5cce88b4d1ac560b..1d121ea4c0752c8bc5b7355960c6bba9d3c5ac5f 100644 (file)
 #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
@@ -591,6 +592,50 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
   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
 //-----------------------------------------------------------------------------
@@ -739,42 +784,6 @@ static void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWind
 */
 }
 
-//-----------------------------------------------------------------------------
-// "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
 //-----------------------------------------------------------------------------
@@ -1019,11 +1028,6 @@ void wxWindow::PostCreation(void)
 {
   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", 
@@ -1033,52 +1037,46 @@ void wxWindow::PostCreation(void)
       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)