]> git.saurik.com Git - wxWidgets.git/commitdiff
Here it comes:
authorRobert Roebling <robert@roebling.de>
Fri, 9 Apr 1999 18:01:17 +0000 (18:01 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 9 Apr 1999 18:01:17 +0000 (18:01 +0000)
  Doc updates
  Makefile doesn't strip anylonger
  Makefile adapted to /src/unix etc
  Added wxLB_ALWAYS_SB
  Added MWM window manager hints
  Fixed event handling bugs that (among others) caused
    the wxListBox misbeahiour
  Rwwrote GtkmyFixed for GTK 1.2
  Made data requests etc in wxClipboadr asynchronous
  Added underscores to menus (some)
  Tried in vain to make wxTextCtrl (and its GtkTable)
    behave correctly. The bottom text control in the
    controls samples still misbehaves upon start-up.
  did I change notebook.cpp ?

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

40 files changed:
distrib/gtk/copy_src
docs/gtk/install.txt
docs/gtk/readme.txt
docs/gtk/todo.txt
include/wx/defs.h
include/wx/gtk/clipbrd.h
include/wx/gtk/menu.h
include/wx/gtk/win_gtk.h
include/wx/gtk/window.h
include/wx/gtk1/clipbrd.h
include/wx/gtk1/menu.h
include/wx/gtk1/win_gtk.h
include/wx/gtk1/window.h
samples/controls/controls.cpp
src/Makefile.in
src/gtk/choice.cpp
src/gtk/clipbrd.cpp
src/gtk/control.cpp
src/gtk/dataobj.cpp
src/gtk/dialog.cpp
src/gtk/frame.cpp
src/gtk/listbox.cpp
src/gtk/menu.cpp
src/gtk/notebook.cpp
src/gtk/textctrl.cpp
src/gtk/win_gtk.c
src/gtk/window.cpp
src/gtk1/choice.cpp
src/gtk1/clipbrd.cpp
src/gtk1/control.cpp
src/gtk1/dataobj.cpp
src/gtk1/dialog.cpp
src/gtk1/frame.cpp
src/gtk1/listbox.cpp
src/gtk1/menu.cpp
src/gtk1/notebook.cpp
src/gtk1/textctrl.cpp
src/gtk1/win_gtk.c
src/gtk1/window.cpp
wxGTK.spec

index 7b8de3ba0ee8938c68dd046fe5bceb0aeacecfd4..12c2f54f7e5b3a75eb89fc225d599a1259a1807e 100755 (executable)
@@ -54,6 +54,11 @@ cd generic
 cp *.h ~/wxgtk_dist/wxGTK/include/wx/generic
 cd ..
 
+mkdir ~/wxgtk_dist/wxGTK/include/wx/unix
+cd unix
+cp *.h ~/wxgtk_dist/wxGTK/include/wx/unix
+cd ..
+
 mkdir ~/wxgtk_dist/wxGTK/include/wx/gtk
 cd gtk
 cp *.h ~/wxgtk_dist/wxGTK/include/wx/gtk
@@ -152,6 +157,11 @@ cp *.inc ~/wxgtk_dist/wxGTK/src/gtk
 cp *.cpp ~/wxgtk_dist/wxGTK/src/gtk
 cd ..
 
+cd unix
+mkdir ~/wxgtk_dist/wxGTK/src/unix
+cp *.cpp ~/wxgtk_dist/wxGTK/src/unix
+cd ..
+
 cd generic
 mkdir ~/wxgtk_dist/wxGTK/src/generic
 cp *.cpp ~/wxgtk_dist/wxGTK/src/generic
index e73c31dda6ffffd10c0d249f6147cf4a9f947cbc..b0eb9dfff28f89a98834df1bde09811bd809ffe4 100644 (file)
@@ -6,12 +6,16 @@ like to read install instructions just do (in the base dir):
 
 ./configure
 make
+su <type root password>
 make install
+ldconfig
+exit
+
 
 * The most simple errors
 ------------------------
 
-configure reports, that you don't have GTK 1.0.X installed
+configure reports, that you don't have GTK 1.X installed
 although you are certainly sure you have. Well, you have
 installed it, but you also have another version of the
 GTK installed, which you may need to removed including
@@ -53,18 +57,16 @@ this has no effect, but I tried...
 -----------------------
 
 wxWindows/GTK requires the GTK+ library to be installed on your system.
-It has to be a stable version, preferebly version 1.0.6. When using
-a version previous to 1.0.6 you'll might get crashes here and there.
+It has to be a stable version, preferebly version 1.2.1. It might also
+work with the 1.0 series, but I didn't test that any longer.
 
-wxWindows/GTK does NOT work with the 1.1.X versions of the GTK+ library
-and we will wait until the 1.2 version comes out and has stabilized
-until we'll work with that library.
+wxWindows/GTK does NOT work with the 1.1.X versions of the GTK+ library.
 
 You can get the newest version of the GTK+ from the GTK homepage
 at
   http://www.gtk.org
   
-We also mirror GTK+ 1.0.6 at my ftp site. You'll find information
+We also mirror GTK+ 1.2.1 at my ftp site. You'll find information
 about downloading at my homepage.
   
 * Additional libraries
@@ -92,7 +94,10 @@ You can enable thread support by running
 ./configure "--with-threads"
 make clean
 make
+su <type root password>
 make install
+ldconfig
+exit
   
 NB: I included thread support in wxWindows/Gtk, as this 
 problem will disappear in the near future when all major 
index ca749bbb3f773ee336818b2fb15ac7e7ee2acdca..0268ca3eafc4c80ab94547df14dfc9ca5154cbe0 100644 (file)
@@ -1,8 +1,11 @@
 
-  Welcome to wxWindows/Gtk 2.0.1,
+  Welcome to wxWindows/Gtk 2.1 beta 1,
 
-you have downloaded version 2.0.1 of the GTK+ 1.0 port of 
-the wxWindows GUI library.
+you have downloaded version 2.1 of the GTK+ 1.2 port of 
+the wxWindows GUI library. This is a developers release
+and is it not suited for production development. Beware
+that major changes can happen before a final release -
+Particularly the makefile system will change entirly.
  
 More information is available from my homepage at:
 
@@ -20,7 +23,10 @@ all systems
 
 ./configure
 make
+su <type root password>
+ldconfig
 make install
+exit
 
 Type the following to make the samples
 
@@ -42,7 +48,7 @@ DISTRIBUTION YOU USE AND WHAT ERROR WAS REPORTED. I know
 this has no effect, but I tried...
 
 The library produced by the install process will be called 
-libwx_gtk2.a (static) and libwx_gtk2.so.0.1 (shared) so that 
+libwx_gtk2.a (static) and libwx_gtk2.so.1.0 (shared) so that 
 once a binary incompatible version of wxWindows/Gtk comes out 
 we'll augment library version number to avoid linking problems.
 
index 6b3e08305c09e896e97b77c11cffd3f67bf7c464..92462df4e5601623a5ab0098b99f4271ec158ff0 100644 (file)
@@ -1,10 +1,13 @@
 
 -------------------- High priority ---------------------
 
+DnD
+  -> Must be rewritten for GTK+ 1.2
 -------------------- Medium priority ---------------------
 
-Show accelerator in menus and control labels and actually implement them
-  -> Changed in GTK 1.2 (so let's do it for 1.2). Postponed.
+Show accelerator control labels and actually implement them
+  -> Changed in GTK 1.2 (so let's do it for 1.2). Difficult.
   
 -------------------- Low priority ---------------------
     
@@ -13,9 +16,6 @@ Right aligned checkboxes: focus highlighting is wrong, tooltips can't be set
 OwnerDraw for wxListCtrl and others
   -> Postponed.
   
-DnD
-  -> Must be rewritten for GTK+ 1.2
 Implement wxPalette
   -> I never understood that. Postponed.
   
index baf3c4acca5e04892d04d067c2d36133bb7eb543..7a7d2dc2fc88d0b3e7345ee4e671a39793f62377 100644 (file)
@@ -1132,6 +1132,8 @@ typedef struct _GtkToolbar      GtkToolbar;
 typedef struct _GtkTooltips     GtkTooltips;
 typedef struct _GtkNotebook     GtkNotebook;
 typedef struct _GtkNotebookPage GtkNotebookPage;
+typedef struct _GtkAccelGroup   GtkAccelGroup;
+typedef        struct _GtkItemFactory  GtkItemFactory;
 
 #endif
 
index 2a4f2bd8a5a7a7b582be406bca1a7fffda8c2903..508a3b0dd7fe2c5237dfd7fe7417a5d7aac4e9ab 100644 (file)
@@ -79,7 +79,9 @@ public:
     bool              m_ownsPrimarySelection;
 
     wxDataBroker     *m_dataBroker;
-    GtkWidget        *m_clipboardWidget;
+    GtkWidget        *m_clipboardWidget;  /* for getting and offering data */
+    GtkWidget        *m_targetsWidget;    /* for getting list of supported formats */
+    bool              m_waiting;          /* querying data or formats is asynchronous */
 
     bool              m_formatSupported;
     GdkAtom           m_targetRequested;
index e68ca2236091917c8d791a79e2f693d97c9f20fb..fdf148ba7534ddfd4ea37e6df9b04295e0d9f7b4 100644 (file)
@@ -105,9 +105,9 @@ class wxMenu : public wxEvtHandler
     DECLARE_DYNAMIC_CLASS(wxMenu)
 
 public:
-    // construction
     wxMenu( const wxString& title = wxEmptyString,
             const wxFunction func = (wxFunction) NULL );
+    ~wxMenu();
 
     // operations
         // title
@@ -171,8 +171,11 @@ public:
     wxWindow *GetInvokingWindow();
 
     // implementation only
-    GtkWidget     *m_menu;  // GtkMenu
-    GtkWidget     *m_owner;
+    GtkWidget       *m_menu;  // GtkMenu
+    GtkWidget       *m_owner;
+    
+    GtkAccelGroup   *m_accel;
+    GtkItemFactory  *m_factory;
 
 private:
     wxString       m_title;
index 16acb8d30589222dd42a5c65e532fd2137b8a7c9..90afdf4b79af942f7f53eaeaafc5c2bc7347e85e 100644 (file)
 #ifndef __GTK_MYFIXED_H__
 #define __GTK_MYFIXED_H__
 
-
 #include <gdk/gdk.h>
 #include <gtk/gtkcontainer.h>
-
+#include <gtk/gtkadjustment.h>
+#include <gtk/gtkfeatures.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,13 +33,21 @@ typedef struct _GtkMyFixedChild   GtkMyFixedChild;
 struct _GtkMyFixed
 {
   GtkContainer container;
-
   GList *children;
+#if (GTK_MINOR_VERSION > 0)
+  GtkShadowType shadow_type;
+#endif
 };
 
 struct _GtkMyFixedClass
 {
   GtkContainerClass parent_class;
+
+#if (GTK_MINOR_VERSION > 0)
+  void  (*set_scroll_adjustments)   (GtkMyFixed     *myfixed,
+                                    GtkAdjustment  *hadjustment,
+                                    GtkAdjustment  *vadjustment);
+#endif
 };
 
 struct _GtkMyFixedChild
@@ -51,6 +59,10 @@ struct _GtkMyFixedChild
 
 guint      gtk_myfixed_get_type        (void);
 GtkWidget* gtk_myfixed_new             (void);
+#if (GTK_MINOR_VERSION > 0)
+void       gtk_myfixed_set_shadow_type (GtkMyFixed     *myfixed,
+                                       GtkShadowType  type);
+#endif
 void       gtk_myfixed_put             (GtkMyFixed     *myfixed,
                                         GtkWidget      *widget,
                                         gint16         x,
@@ -59,7 +71,6 @@ void       gtk_myfixed_move            (GtkMyFixed     *myfixed,
                                         GtkWidget      *widget,
                                         gint16         x,
                                         gint16         y);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index e63d825e613d4c4db9cccdf361e5af99948d27c0..f2a65b8fa1a6d903777a54d087fa424c309a33fa 100644 (file)
@@ -98,16 +98,6 @@ private:
     wxString  m_data;
 };
 
-//-----------------------------------------------------------------------------
-// (debug)
-//-----------------------------------------------------------------------------
-
-#ifdef __WXDEBUG__
-
-void debug_focus_in( GtkWidget* widget, const char* name, const char* window );
-
-#endif
-
 //-----------------------------------------------------------------------------
 // wxWindow
 //-----------------------------------------------------------------------------
@@ -485,7 +475,7 @@ public:
     GtkAdjustment       *m_hAdjust,*m_vAdjust;
     float                m_oldHorizontalPos;
     float                m_oldVerticalPos;
-    bool                 m_needParent;
+    bool                 m_needParent;    /* ! wxFrame, wxDialog, wxNotebookPage ?  */
     bool                 m_hasScrolling;
     bool                 m_isScrolling;
     bool                 m_hasVMT;
@@ -493,8 +483,9 @@ public:
     bool                 m_resizing;
     GdkGC               *m_scrollGC;
     GtkStyle            *m_widgetStyle;
-    bool                 m_isStaticBox;
-    bool                 m_acceptsFocus;
+    bool                 m_isStaticBox;   /* faster than IS_KIND_OF */
+    bool                 m_isFrame;       /* faster than IS_KIND_OF */
+    bool                 m_acceptsFocus;  /* ! wxStaticBox etc.  */
 
     wxInsertChildFunction  m_insertCallback;
 
index 2a4f2bd8a5a7a7b582be406bca1a7fffda8c2903..508a3b0dd7fe2c5237dfd7fe7417a5d7aac4e9ab 100644 (file)
@@ -79,7 +79,9 @@ public:
     bool              m_ownsPrimarySelection;
 
     wxDataBroker     *m_dataBroker;
-    GtkWidget        *m_clipboardWidget;
+    GtkWidget        *m_clipboardWidget;  /* for getting and offering data */
+    GtkWidget        *m_targetsWidget;    /* for getting list of supported formats */
+    bool              m_waiting;          /* querying data or formats is asynchronous */
 
     bool              m_formatSupported;
     GdkAtom           m_targetRequested;
index e68ca2236091917c8d791a79e2f693d97c9f20fb..fdf148ba7534ddfd4ea37e6df9b04295e0d9f7b4 100644 (file)
@@ -105,9 +105,9 @@ class wxMenu : public wxEvtHandler
     DECLARE_DYNAMIC_CLASS(wxMenu)
 
 public:
-    // construction
     wxMenu( const wxString& title = wxEmptyString,
             const wxFunction func = (wxFunction) NULL );
+    ~wxMenu();
 
     // operations
         // title
@@ -171,8 +171,11 @@ public:
     wxWindow *GetInvokingWindow();
 
     // implementation only
-    GtkWidget     *m_menu;  // GtkMenu
-    GtkWidget     *m_owner;
+    GtkWidget       *m_menu;  // GtkMenu
+    GtkWidget       *m_owner;
+    
+    GtkAccelGroup   *m_accel;
+    GtkItemFactory  *m_factory;
 
 private:
     wxString       m_title;
index 16acb8d30589222dd42a5c65e532fd2137b8a7c9..90afdf4b79af942f7f53eaeaafc5c2bc7347e85e 100644 (file)
 #ifndef __GTK_MYFIXED_H__
 #define __GTK_MYFIXED_H__
 
-
 #include <gdk/gdk.h>
 #include <gtk/gtkcontainer.h>
-
+#include <gtk/gtkadjustment.h>
+#include <gtk/gtkfeatures.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -33,13 +33,21 @@ typedef struct _GtkMyFixedChild   GtkMyFixedChild;
 struct _GtkMyFixed
 {
   GtkContainer container;
-
   GList *children;
+#if (GTK_MINOR_VERSION > 0)
+  GtkShadowType shadow_type;
+#endif
 };
 
 struct _GtkMyFixedClass
 {
   GtkContainerClass parent_class;
+
+#if (GTK_MINOR_VERSION > 0)
+  void  (*set_scroll_adjustments)   (GtkMyFixed     *myfixed,
+                                    GtkAdjustment  *hadjustment,
+                                    GtkAdjustment  *vadjustment);
+#endif
 };
 
 struct _GtkMyFixedChild
@@ -51,6 +59,10 @@ struct _GtkMyFixedChild
 
 guint      gtk_myfixed_get_type        (void);
 GtkWidget* gtk_myfixed_new             (void);
+#if (GTK_MINOR_VERSION > 0)
+void       gtk_myfixed_set_shadow_type (GtkMyFixed     *myfixed,
+                                       GtkShadowType  type);
+#endif
 void       gtk_myfixed_put             (GtkMyFixed     *myfixed,
                                         GtkWidget      *widget,
                                         gint16         x,
@@ -59,7 +71,6 @@ void       gtk_myfixed_move            (GtkMyFixed     *myfixed,
                                         GtkWidget      *widget,
                                         gint16         x,
                                         gint16         y);
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index e63d825e613d4c4db9cccdf361e5af99948d27c0..f2a65b8fa1a6d903777a54d087fa424c309a33fa 100644 (file)
@@ -98,16 +98,6 @@ private:
     wxString  m_data;
 };
 
-//-----------------------------------------------------------------------------
-// (debug)
-//-----------------------------------------------------------------------------
-
-#ifdef __WXDEBUG__
-
-void debug_focus_in( GtkWidget* widget, const char* name, const char* window );
-
-#endif
-
 //-----------------------------------------------------------------------------
 // wxWindow
 //-----------------------------------------------------------------------------
@@ -485,7 +475,7 @@ public:
     GtkAdjustment       *m_hAdjust,*m_vAdjust;
     float                m_oldHorizontalPos;
     float                m_oldVerticalPos;
-    bool                 m_needParent;
+    bool                 m_needParent;    /* ! wxFrame, wxDialog, wxNotebookPage ?  */
     bool                 m_hasScrolling;
     bool                 m_isScrolling;
     bool                 m_hasVMT;
@@ -493,8 +483,9 @@ public:
     bool                 m_resizing;
     GdkGC               *m_scrollGC;
     GtkStyle            *m_widgetStyle;
-    bool                 m_isStaticBox;
-    bool                 m_acceptsFocus;
+    bool                 m_isStaticBox;   /* faster than IS_KIND_OF */
+    bool                 m_isFrame;       /* faster than IS_KIND_OF */
+    bool                 m_acceptsFocus;  /* ! wxStaticBox etc.  */
 
     wxInsertChildFunction  m_insertCallback;
 
index ee93bcf6d7d634c2b47a3eb17f214dd3df6b4730..ae3aa14b97b5f560e961ab4a4b1ddf658de266e7 100644 (file)
@@ -449,7 +449,7 @@ m_text(NULL), m_notebook(NULL)
     wxPanel *panel = (wxPanel*) NULL;
 
     panel = new wxPanel(m_notebook);
-    m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 5, choices );
+    m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 5, choices, wxLB_ALWAYS_SB );
     m_listbox->SetCursor(*wxCROSS_CURSOR);
 #if wxUSE_TOOLTIPS
     m_listbox->SetToolTip( "This is a list box" );
@@ -460,7 +460,7 @@ m_text(NULL), m_notebook(NULL)
     (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) );
     (void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(340,80), wxSize(140,30) );
     (void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
-    button = new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(340,130), wxSize(140,30) );
+    button = new wxButton( panel, ID_LISTBOX_FONT, "Set &Italic font", wxPoint(340,130), wxSize(140,30) );
 #if wxUSE_TOOLTIPS
     button->SetToolTip( "Press here to set italic font" );
 #endif // wxUSE_TOOLTIPS
index d27e7585408eb1eafeee484ccd78f0ffcc1f45f3..a46ddf7abc86ee1b838a9c11c447e9933bbdb535 100644 (file)
@@ -104,7 +104,7 @@ install::
           $(includedir)/wx \
           $(includedir)/wx/gtk \
           $(includedir)/wx/motif \
-          $(includedir)/wx/common \
+          $(includedir)/wx/unix \
           $(includedir)/wx/generic \
           $(includedir)/wx/protocol \
           $(libdir)/wx/include/wx/gtk \
@@ -152,6 +152,12 @@ install::
          rm -f $(includedir)/wx/protocol/$$f ; \
          $(INSTALL_DATA) $$f $(includedir)/wx/protocol/$$f ; \
        done
+       @echo "  Copying headers from /include/wx/unix"
+       @cd $(WXBASEDIR)/include/wx/unix ; \
+       for f in *.h ; do \
+         rm -f $(includedir)/wx/unix/$$f ; \
+         $(INSTALL_DATA) $$f $(includedir)/wx/unix/$$f ; \
+       done
        @echo "  Moving setup.h to library path"
        @if test "@TOOLKIT@" = "GTK" ; then \
          cd $(WXBASEDIR)/src ; \
@@ -172,12 +178,11 @@ install::
        @cd $(WXBASEDIR)/src ; \
          rm -f $(libdir)/$(STATIC_LIBRARY) ; \
          $(INSTALL_DATA) $(WXBASEDIR)/lib/$(OS)/$(STATIC_LIBRARY) $(libdir)/$(STATIC_LIBRARY)
-         $(STRIP) $(libdir)/$(STATIC_LIBRARY)
        @if test -f $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) ; then \
          echo "  Copying shared library" ; \
            rm -f $(libdir)/lib$(LIB_TARGET).so* ; \
            $(INSTALL_PROGRAM) $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) ; \
-           $(STRIP) $(libdir)/$(SHARED_LIBRARY)
+           $(STRIP) $(libdir)/$(SHARED_LIBRARY) ; \
            $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so.$(LIB_MAJOR) ; \
            $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so ; \
            echo " " ; \
index 1385c3c8aeeb46c6169ecf11032417a190a78980..248123389a49edf160fdb59089f32c925a78c77b 100644 (file)
@@ -58,6 +58,9 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
                        long style, const wxValidator& validator, const wxString &name )
 {
     m_needParent = TRUE;
+#if (GTK_MINOR_VERSION > 0)
+    m_acceptsFocus = TRUE;
+#endif
 
     PreCreation( parent, id, pos, size, style, name );
 
index 9dd96f96b63cf7e1a131cf24cdb8859281bd7bad..f6ad2415f2fc2f64ca943096c8e2a3d27acdc66b 100644 (file)
@@ -15,6 +15,8 @@
 
 #if wxUSE_CLIPBOARD
 
+#include "wx/utils.h"
+
 #include "glib.h"
 #include "gdk/gdk.h"
 #include "gtk/gtk.h"
@@ -60,30 +62,49 @@ struct _GtkSelectionData
 static void
 targets_selection_received( GtkWidget *WXUNUSED(widget), 
                             GtkSelectionData *selection_data, 
+#if (GTK_MINOR_VERSION > 0)
+                            guint32 WXUNUSED(time),
+#endif
                            wxClipboard *clipboard )
 {
-    if (!wxTheClipboard) return;
-  
-    if (selection_data->length <= 0) return;
+    if (!wxTheClipboard)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
-    // make sure we got the data in the correct form 
-    if (selection_data->type != GDK_SELECTION_TYPE_ATOM) return;
+    if (selection_data->length <= 0)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
+    
+    /* make sure we got the data in the correct form */
+    if (selection_data->type != GDK_SELECTION_TYPE_ATOM)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
     // the atoms we received, holding a list of targets (= formats) 
     GdkAtom *atoms = (GdkAtom *)selection_data->data;
 
     for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++)
     {
-      char *name = gdk_atom_name (atoms[i]);
-      if (name) printf( "Format available: %s.\n", name );
+/*
+        char *name = gdk_atom_name (atoms[i]);
+        if (name) printf( "Format available: %s.\n", name );
+*/
       
         if (atoms[i] == clipboard->m_targetRequested)
         {
+            clipboard->m_waiting = FALSE;
             clipboard->m_formatSupported = TRUE;
             return;
         }
     }
 
+    clipboard->m_waiting = FALSE;
     return;
 }
 
@@ -94,28 +115,50 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
 static void 
 selection_received( GtkWidget *WXUNUSED(widget), 
                     GtkSelectionData *selection_data, 
+#if (GTK_MINOR_VERSION > 0)
+                    guint32 WXUNUSED(time),
+#endif
                    wxClipboard *clipboard )
 {
-    if (!wxTheClipboard) return;
+    if (!wxTheClipboard)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
     wxDataObject *data_object = clipboard->m_receivedData;
     
-    if (!data_object) return;
+    if (!data_object)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
     
-    if (selection_data->length <= 0) return;
+    if (selection_data->length <= 0)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
-    // make sure we got the data in the correct format
-    
-    if (data_object->GetFormat().GetAtom() != selection_data->target) return;
+    /* make sure we got the data in the correct format */
+    if (data_object->GetFormat().GetAtom() != selection_data->target)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
     
-    // make sure we got the data in the correct form (selection type).
-    // if so, copy data to target object
+    /* make sure we got the data in the correct form (selection type).
+       if so, copy data to target object */
     
     switch (data_object->GetFormat().GetType())
     {
         case wxDF_TEXT:
        {
-            if (selection_data->type != GDK_SELECTION_TYPE_STRING) return;
+            if (selection_data->type != GDK_SELECTION_TYPE_STRING)
+            {
+                clipboard->m_waiting = FALSE;
+                return;
+            }
            
            wxTextDataObject *text_object = (wxTextDataObject *) data_object;
            
@@ -128,16 +171,22 @@ selection_received( GtkWidget *WXUNUSED(widget),
        
        case wxDF_BITMAP:
        {
-            if (selection_data->type != GDK_SELECTION_TYPE_BITMAP) return;
-           
-           return;
+            if (selection_data->type != GDK_SELECTION_TYPE_BITMAP)
+            {
+                clipboard->m_waiting = FALSE;
+                return;
+            }
            
            break;
        }
        
        case wxDF_PRIVATE:
        {
-            if (selection_data->type != GDK_SELECTION_TYPE_STRING) return;
+            if (selection_data->type != GDK_SELECTION_TYPE_STRING)
+            {
+                clipboard->m_waiting = FALSE;
+                return;
+            }
            
            wxPrivateDataObject *private_object = (wxPrivateDataObject *) data_object;
            
@@ -148,11 +197,13 @@ selection_received( GtkWidget *WXUNUSED(widget),
        
        default:
        {
+            clipboard->m_waiting = FALSE;
            return;
        }
     }
     
     wxTheClipboard->m_formatSupported = TRUE;
+    clipboard->m_waiting = FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -285,9 +336,26 @@ wxClipboard::wxClipboard()
   
     m_receivedData = (wxDataObject*) NULL;
 
+    /* we use m_targetsWidget to query what formats are available */
+    
+    m_targetsWidget = gtk_window_new( GTK_WINDOW_POPUP );
+    gtk_widget_realize( m_targetsWidget );
+
+    gtk_signal_connect( GTK_OBJECT(m_targetsWidget), 
+                        "selection_received",
+                       GTK_SIGNAL_FUNC( targets_selection_received ), 
+                       (gpointer) this );
+                       
+    /* we use m_clipboardWidget to get and to offer data */
+    
     m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
     gtk_widget_realize( m_clipboardWidget );
 
+    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
+                        "selection_received",
+                       GTK_SIGNAL_FUNC( selection_received ), 
+                       (gpointer) this );
+
     gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
                         "selection_clear_event",
                        GTK_SIGNAL_FUNC( selection_clear_clip ), 
@@ -305,6 +373,7 @@ wxClipboard::~wxClipboard()
     Clear();  
   
     if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
+    if (m_targetsWidget) gtk_widget_destroy( m_targetsWidget );
 }
 
 void wxClipboard::Clear()
@@ -454,27 +523,25 @@ bool wxClipboard::IsSupported( wxDataFormat format )
   
     wxCHECK_MSG( m_targetRequested, FALSE, "invalid clipboard format" );
     
-    /* add handler for target (= format) query */
-
-    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
-                        "selection_received",
-                       GTK_SIGNAL_FUNC( targets_selection_received ), 
-                       (gpointer) this );
-  
     m_formatSupported = FALSE;
   
     /* perform query. this will set m_formatSupported to 
-     * TRUE if m_targetRequested is supported */
-    
-    gtk_selection_convert( m_clipboardWidget,
+       TRUE if m_targetRequested is supported.
+       alsom we have to wait for the "answer" from the 
+       clipboard owner which is an asynchronous process.
+       therefore we set m_waiting = TRUE here and wait
+       until the callback "targets_selection_received" 
+       sets it to FALSE */
+
+    m_waiting = TRUE;
+      
+    gtk_selection_convert( m_targetsWidget,
                           g_clipboardAtom, 
                           g_targetsAtom,
                           GDK_CURRENT_TIME );
-
-    gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), 
-                                  GTK_SIGNAL_FUNC( targets_selection_received ),
-                                  (gpointer) this );
-  
+                          
+    while (m_waiting) gtk_main_iteration();
+    
     if (!m_formatSupported) return FALSE;
     
     return TRUE;
@@ -502,21 +569,23 @@ bool wxClipboard::GetData( wxDataObject *data )
     
     m_formatSupported = FALSE;
   
-    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
-                        "selection_received",
-                       GTK_SIGNAL_FUNC( selection_received ), 
-                       (gpointer) this );
+    /* ask for clipboard contents.  this will set 
+       m_formatSupported to TRUE if m_targetRequested 
+       is supported.
+       also, we have to wait for the "answer" from the 
+       clipboard owner which is an asynchronous process.
+       therefore we set m_waiting = TRUE here and wait
+       until the callback "targets_selection_received" 
+       sets it to FALSE */
 
-    /* ask for clipboard contents */
+    m_waiting = TRUE;
 
     gtk_selection_convert( m_clipboardWidget,
                           g_clipboardAtom, 
                           m_targetRequested,
                           GDK_CURRENT_TIME );
   
-    gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), 
-                                  GTK_SIGNAL_FUNC( selection_received ),
-                                  (gpointer) this );
+    while (m_waiting) gtk_main_iteration();
 
     /* this is a true error as we checked for the presence of such data before */
 
index 4b04d0bb37627694bda679c1dee9c49c3ff549b3..ce57fdf9a64d53689f0f00d5025c8b5b6da98007 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "wx/control.h"
 
+#include "gtk/gtkfeatures.h"
+
 //-----------------------------------------------------------------------------
 // wxControl
 //-----------------------------------------------------------------------------
index 831a9122f1b973c2af9a22bd72a791597846d74c..e495bfd98a22a1494f83ef22c44aca6620c9f9f6 100644 (file)
@@ -32,7 +32,7 @@ IMPLEMENT_CLASS(wxDataFormat, wxObject)
 
 wxDataFormat::wxDataFormat()
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     m_type = wxDF_INVALID;
     m_hasAtom = FALSE;
     m_atom = (GdkAtom) 0;
@@ -40,19 +40,19 @@ wxDataFormat::wxDataFormat()
 
 wxDataFormat::wxDataFormat( wxDataType type )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     SetType( type );
 }
 
 wxDataFormat::wxDataFormat( const wxString &id )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     SetId( id );
 }
 
 wxDataFormat::wxDataFormat( wxDataFormat &format )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     m_type = format.GetType();
     m_id = format.GetId();
     m_hasAtom = TRUE;
@@ -61,7 +61,7 @@ wxDataFormat::wxDataFormat( wxDataFormat &format )
 
 wxDataFormat::wxDataFormat( const GdkAtom atom )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     m_hasAtom = TRUE;
     
     m_atom = atom;
@@ -91,7 +91,7 @@ void wxDataFormat::SetType( wxDataType type )
     
     if (m_type == wxDF_TEXT)
     {
-        m_id = "text/plain";
+        m_id = "STRING";
     } 
     else
     if (m_type == wxDF_BITMAP)
index 822015862d24be615ad48589ae3bfa07b84f37a0..6f8cefcb3c812da30a296195b52bcaec8a373760 100644 (file)
@@ -145,6 +145,27 @@ bool wxDialog::Create( wxWindow *parent,
 
     gtk_widget_realize( m_widget );
 
+      long decor = (long) GDK_DECOR_ALL;
+      long func = (long) GDK_FUNC_ALL;
+      
+      if ((m_windowStyle & wxCAPTION) == 0)
+       decor |= GDK_DECOR_TITLE;
+      if ((m_windowStyle & wxMINIMIZE) == 0)
+       func |= GDK_FUNC_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE) == 0)
+       func |= GDK_FUNC_MAXIMIZE;
+      if ((m_windowStyle & wxSYSTEM_MENU) == 0)
+       decor |= GDK_DECOR_MENU;
+      if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MAXIMIZE;
+      if ((m_windowStyle & wxRESIZE_BORDER) == 0)
+       func |= GDK_FUNC_RESIZE;
+
+      gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
+      gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
+      
     gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
         GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
 
index c018c5b1637979b8f07d53bef6296fe7cd5d804e..bfa0f65baa849b2b71c9c7a6452ed30b770510b6 100644 (file)
@@ -171,6 +171,27 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
 
     gtk_widget_realize( m_widget );
     
+      long decor = (long) GDK_DECOR_ALL;
+      long func = (long) GDK_FUNC_ALL;
+      
+      if ((m_windowStyle & wxCAPTION) == 0)
+       decor |= GDK_DECOR_TITLE;
+      if ((m_windowStyle & wxMINIMIZE) == 0)
+       func |= GDK_FUNC_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE) == 0)
+       func |= GDK_FUNC_MAXIMIZE;
+      if ((m_windowStyle & wxSYSTEM_MENU) == 0)
+       decor |= GDK_DECOR_MENU;
+      if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MAXIMIZE;
+      if ((m_windowStyle & wxRESIZE_BORDER) == 0)
+       func |= GDK_FUNC_RESIZE;
+
+      gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
+      gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
+      
     gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
         GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
 
index 818775ee732b711ab18e00b7cf69e01b3bc3bf29..8c24f8b8110ec5b81ae0cec62aa92592d263660f 100644 (file)
@@ -192,8 +192,16 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     SetValidator( validator );
 
     m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
-    gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
-      GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+    if (style & wxLB_ALWAYS_SB)
+    {
+      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
+        GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
+    }
+    else
+    {
+      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
+        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+    }
 
     m_list = GTK_LIST( gtk_list_new() );
 
@@ -211,25 +219,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
 #endif
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, "wxListBox::m_widget", name );
-
-    debug_focus_in( GTK_WIDGET(m_list), "wxListBox::m_list", name );
-
-    GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
-
-    debug_focus_in( s_window->hscrollbar, "wxWindow::hsrcollbar", name );
-    debug_focus_in( s_window->vscrollbar, "wxWindow::vsrcollbar", name );
-
-#ifdef NEW_GTK_SCROLL_CODE
-    GtkViewport *viewport = GTK_VIEWPORT( GTK_BIN(s_window)->child );
-#else
-    GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
-#endif
-
-    debug_focus_in( GTK_WIDGET(viewport), "wxWindow::viewport", name );
-#endif
-
     gtk_widget_show( GTK_WIDGET(m_list) );
 
     wxSize newSize = size;
@@ -252,10 +241,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
         list_item = gtk_list_item_new_with_label( str );
 
-#ifdef __WXDEBUG__
-        debug_focus_in( list_item, "wxListBox::list_item", name );
-#endif
-
         gtk_container_add( GTK_CONTAINER(m_list), list_item );
 
         gtk_signal_connect( GTK_OBJECT(list_item), "select",
index 90abef63048be29680aaecdbdc4282a22b6ce3e3..cf3cf9a8dc9b4bf918a753fbe9e6725b596b1cd2 100644 (file)
@@ -72,19 +72,22 @@ wxMenuBar::wxMenuBar()
 void wxMenuBar::Append( wxMenu *menu, const wxString &title )
 {
     m_menus.Append( menu );
-    wxString title2 = title;
-
-    int pos;
-    do
+    
+    wxString s = "";
+    for ( const char *pc = title; *pc != '\0'; pc++ )
     {
-        pos = title2.First( '&' );
-        if (pos != wxNOT_FOUND)
-            title2.Remove( pos, 1 );
-    } while (pos != wxNOT_FOUND);
-
-    menu->SetTitle(title2);
+        if (*pc == '&')
+       {
+           pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+    //      s << '_';  not yet
+#endif
+        }
+        s << *pc;
+    }
 
-    menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(title2) );
+    menu->SetTitle(s);
+    menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(s) );
     gtk_widget_show( menu->m_owner );
     gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
 
@@ -404,7 +407,13 @@ void wxMenuItem::SetName( const wxString& str )
     m_text = "";
     for ( const char *pc = str; *pc != '\0'; pc++ )
     {
-        if (*pc == '&') pc++; /* skip it */
+        if (*pc == '&')
+       {
+           pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+            m_text << '_';
+#endif
+        }
         m_text << *pc;
     }
 
@@ -457,7 +466,14 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
     m_title = title;
     m_items.DeleteContents( TRUE );
     m_invokingWindow = (wxWindow *) NULL;
+    
+#if (GTK_MINOR_VERSION > 0)
+    m_accel = gtk_accel_group_new();
+    m_factory = gtk_item_factory_new( GTK_TYPE_MENU, "<main>", m_accel );
+    m_menu = gtk_item_factory_get_widget( m_factory, "<main>" );
+#else    
     m_menu = gtk_menu_new();  // Do not show!
+#endif
 
     m_callback = func;
     m_eventHandler = this;
@@ -473,6 +489,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
     m_owner = (GtkWidget*) NULL;
 }
 
+wxMenu::~wxMenu()
+{
+    /* how do we delete an item-factory ? */
+}
+
 void wxMenu::SetTitle( const wxString& title )
 {
     // TODO Waiting for something better
@@ -492,6 +513,7 @@ void wxMenu::AppendSeparator()
     GtkWidget *menuItem = gtk_menu_item_new();
     gtk_menu_append( GTK_MENU(m_menu), menuItem );
     gtk_widget_show( menuItem );
+    
     mitem->SetMenuItem(menuItem);
     m_items.Append( mitem );
 }
@@ -504,25 +526,58 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
     mitem->SetHelp(helpStr);
     mitem->SetCheckable(checkable);
     const char *text = mitem->GetText();
+    
+#if (GTK_MINOR_VERSION > 0)
+    char buf[100];
+    strcpy( buf, "/" );
+    strcat( buf, text );
+    
+    GtkItemFactoryEntry entry;
+    entry.path = buf;
+    entry.accelerator = (gchar*) NULL;
+    entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
+    entry.callback_action = 0;
+    if (checkable)
+        entry.item_type = "<CheckItem>";
+    else
+        entry.item_type = "<Item>";
+    
+    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 = "<main>/";
+    for ( const char *pc = text; *pc != '\0'; pc++ )
+    {
+        if (*pc == '_') pc++; /* skip it */
+        s << *pc;
+    }
+    
+    GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, s );
+    
+#else
+
     GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
                                     : gtk_menu_item_new_with_label(text);
-
-    mitem->SetMenuItem(menuItem);
-
+                                   
     gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
                         GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
-                        (gpointer*)this );
+                        (gpointer)this );
+                       
+    gtk_menu_append( GTK_MENU(m_menu), menuItem );
+    gtk_widget_show( menuItem );
+    
+#endif
 
     gtk_signal_connect( GTK_OBJECT(menuItem), "select",
                         GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
-                        (gpointer*)this );
+                        (gpointer)this );
 
     gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
                         GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
-                        (gpointer*)this );
+                        (gpointer)this );
+
+    mitem->SetMenuItem(menuItem);
 
-    gtk_menu_append( GTK_MENU(m_menu), menuItem );
-    gtk_widget_show( menuItem );
     m_items.Append( mitem );
 }
 
@@ -590,14 +645,18 @@ void wxMenu::Append( wxMenuItem *item )
 
 int wxMenu::FindItem( const wxString itemString ) const
 {
-    wxString s( itemString );
-
-    int pos;
-    do
+    wxString s = "";
+    for ( const char *pc = itemString; *pc != '\0'; pc++ )
     {
-        pos = s.First( '&' );
-        if (pos != -1) s.Remove( pos, 1 );
-    } while (pos != -1);
+        if (*pc == '&')
+       {
+           pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+            s << '_';
+#endif
+        }
+        s << *pc;
+    }
 
     wxNode *node = m_items.First();
     while (node)
index ea57e8c4338a1137c224680f52c3dc19fc1faece..6a43c84730f5d7fb16bb21c1a5827d6c1f3d66d1 100644 (file)
@@ -233,10 +233,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_notebook_new();
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, "wxNotebook::m_widget", name );
-#endif
-
     gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
 
     m_idHandler = gtk_signal_connect (
index 5fd1f455a198de10eaaabd5b16d0b84ef6b30c01..96070607d3e6079a7cbdf6c6787b14d8a294b879 100644 (file)
@@ -37,9 +37,9 @@ extern bool   g_blockEventsOnDrag;
 static void
 gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
 {
-    win->SetModified();
+    if (!win->m_hasVMT) return;
 
-    win->CalculateScrollbar();
+    win->SetModified();
 
     wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
     event.SetString( win->GetValue() );
@@ -48,12 +48,14 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
 }
 
 //-----------------------------------------------------------------------------
-// "size_allocate"
+// "changed" from vertical scrollbar
 //-----------------------------------------------------------------------------
 
 static void
-gtk_text_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* WXUNUSED(alloc), wxTextCtrl *win )
+gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
 {
+    if (!win->m_hasVMT) return;
+    
     win->CalculateScrollbar();
 }
 
@@ -124,19 +126,19 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
 
     SetValidator( validator );
 
-    m_vScrollbarVisible = TRUE;
+    m_vScrollbarVisible = FALSE;
 
     bool multi_line = (style & wxTE_MULTILINE) != 0;
     if ( multi_line )
     {
-        // a multi-line edit control: create a vertical scrollbar by default and
-        // horizontal if requested
+        /* a multi-line edit control: create a vertical scrollbar by default and
+           horizontal if requested */
         bool bHasHScrollbar = (style & wxHSCROLL) != 0;
 
-        // create our control...
+        /* create our control ... */
         m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
 
-        // ... and put into the upper left hand corner of the table
+        /* ... and put into the upper left hand corner of the table */
         m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
         GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
        
@@ -145,7 +147,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
                       (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
                        0, 0);
 
-        // put the horizontal scrollbar in the lower left hand corner
+        /* put the horizontal scrollbar in the lower left hand corner */
         if (bHasHScrollbar)
         {
             GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
@@ -158,22 +160,13 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
             gtk_widget_show(hscrollbar);
         }
 
-        // finally, put the vertical scrollbar in the upper right corner
-        m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
-        GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
-       
-        gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
-                     GTK_FILL,
-                     (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
-                     0, 0);
-        gtk_widget_show( m_vScrollbar );
+        /* we create the vertical scrollbar on demand */
+       m_vScrollbar = (GtkWidget*) NULL;
 
-        gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
-          GTK_SIGNAL_FUNC(gtk_text_size_callback), (gpointer)this );
     }
     else
     {
-        // a single-line text control: no need for scrollbars
+        /* a single-line text control: no need for scrollbars */
         m_widget =
           m_text = gtk_entry_new();
     }
@@ -195,7 +188,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
         gtk_widget_show(m_text);
     }
 
-    // we want to be notified about text changes
+    /* we want to be notified about text changes */
     gtk_signal_connect( GTK_OBJECT(m_text), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
@@ -228,11 +221,17 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
         if (multi_line)
             gtk_text_set_editable( GTK_TEXT(m_text), 1 );
     }
+    
+    SetBackgroundColour( parent->GetBackgroundColour() );
+    SetForegroundColour( parent->GetForegroundColour() );
 
     Show( TRUE );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
+    if (multi_line)
+    {
+        gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
+          (GtkSignalFunc) gtk_scrollbar_changed_callback, (gpointer) this );
+    }
 
     return TRUE;
 }
@@ -247,18 +246,30 @@ void wxTextCtrl::CalculateScrollbar()
     {
         if (m_vScrollbarVisible)
         {
-        gtk_widget_hide( m_vScrollbar );
+            gtk_widget_hide( m_vScrollbar );
 
-        m_vScrollbarVisible = FALSE;
+            m_vScrollbarVisible = FALSE;
         }
     }
     else
     {
         if (!m_vScrollbarVisible)
         {
-        gtk_widget_show( m_vScrollbar );
+           if (!m_vScrollbar)
+           {
+                /* finally, put the vertical scrollbar in the upper right corner */
+                m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
+                GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
+       
+                gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
+                     GTK_FILL,
+                     (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
+                     0, 0);
+           }
+           
+            gtk_widget_show( m_vScrollbar );
 
-        m_vScrollbarVisible = TRUE;
+            m_vScrollbarVisible = TRUE;
         }
     }
 }
index ebbcadb5ac8efb8fa78411f732541e11b17596f9..31b638fb6fa48e0ee5488b836d959c8f82e01aed 100644 (file)
@@ -8,15 +8,7 @@
 /////////////////////////////////////////////////////////////////////////// */
 
 #include "wx/gtk/win_gtk.h"
-#include <gtk/gtkfeatures.h>
-
-/*-------------------------------------------------------------------------
-// conditional compilation
-//------------------------------------------------------------------------- */
-
-#if (GTK_MINOR_VERSION > 0)
-#define NEW_GTK_CONSTRUCT_CODE
-#endif
+#include "gtk/gtksignal.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -25,7 +17,7 @@ extern "C" {
 static void gtk_myfixed_class_init    (GtkMyFixedClass    *klass);
 static void gtk_myfixed_init          (GtkMyFixed         *myfixed);
 static void gtk_myfixed_map           (GtkWidget        *widget);
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
 static void gtk_myfixed_unmap         (GtkWidget        *widget);
 #endif
 static void gtk_myfixed_realize       (GtkWidget        *widget);
@@ -49,14 +41,20 @@ static void gtk_myfixed_foreach       (GtkContainer     *container,
 #endif
                                     GtkCallback      callback,
                                     gpointer         callback_data);
-#ifdef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION > 0)
 static GtkType gtk_myfixed_child_type (GtkContainer     *container);
 #endif
 
+#if (GTK_MINOR_VERSION > 0)
+static void  gtk_myfixed_scroll_set_adjustments    (GtkMyFixed   *myfixed,
+                                              GtkAdjustment *hadj,
+                                              GtkAdjustment *vadj);
+#endif
 
-static GtkContainerClass *parent_class = NULL;
 
 
+static GtkContainerClass *parent_class = NULL;
+
 guint
 gtk_myfixed_get_type ()
 {
@@ -71,13 +69,13 @@ gtk_myfixed_get_type ()
        sizeof (GtkMyFixedClass),
        (GtkClassInitFunc) gtk_myfixed_class_init,
        (GtkObjectInitFunc) gtk_myfixed_init,
-#ifndef NEW_GTK_CONSTRUCT_CODE 
-        (GtkArgSetFunc) NULL,
-        (GtkArgGetFunc) NULL,
-#else
+#if (GTK_MINOR_VERSION > 0)
        /* reserved_1 */ NULL,
         /* reserved_2 */ NULL,
         (GtkClassInitFunc) NULL,
+#else
+        (GtkArgSetFunc) NULL,
+        (GtkArgGetFunc) NULL,
 #endif
       };
 
@@ -98,14 +96,14 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
   widget_class = (GtkWidgetClass*) klass;
   container_class = (GtkContainerClass*) klass;
   
-#ifndef NEW_GTK_CONSTRUCT_CODE
-  parent_class = gtk_type_class (gtk_container_get_type ());
-#else
+#if (GTK_MINOR_VERSION > 0)
   parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
+#else
+  parent_class = gtk_type_class (gtk_container_get_type ());
 #endif
 
   widget_class->map = gtk_myfixed_map;
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
   widget_class->unmap = gtk_myfixed_unmap;
 #endif
   widget_class->realize = gtk_myfixed_realize;
@@ -122,12 +120,24 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
   container_class->foreach = gtk_myfixed_foreach;
 #endif
 
-#ifdef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION > 0)
   container_class->child_type = gtk_myfixed_child_type;
 #endif
+
+#if (GTK_MINOR_VERSION > 0)
+  klass->set_scroll_adjustments = gtk_myfixed_scroll_set_adjustments;
+
+  widget_class->set_scroll_adjustments_signal =
+    gtk_signal_new ("set_scroll_adjustments",
+                   GTK_RUN_LAST,
+                   object_class->type,
+                   GTK_SIGNAL_OFFSET (GtkMyFixedClass, set_scroll_adjustments),
+                   gtk_marshal_NONE__POINTER_POINTER,
+                   GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
+#endif
 }
 
-#ifdef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION > 0)
 static GtkType
 gtk_myfixed_child_type (GtkContainer     *container)
 {
@@ -140,10 +150,14 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
 {
   GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
   
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
   GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
 #endif
 
+#if (GTK_MINOR_VERSION > 0)
+  myfixed->shadow_type = GTK_SHADOW_NONE;
+#endif
+
   myfixed->children = NULL;
 }
 
@@ -157,8 +171,36 @@ gtk_myfixed_new ()
   return GTK_WIDGET (myfixed);
 }
 
+#if (GTK_MINOR_VERSION > 0)
+void  gtk_myfixed_scroll_set_adjustments (GtkMyFixed     *myfixed,
+                                              GtkAdjustment *hadj,
+                                              GtkAdjustment *vadj)
+{
+   /* OK, this is embarassing, but this function has to be here */
+}
+
+void 
+gtk_myfixed_set_shadow_type (GtkMyFixed   *myfixed,
+                             GtkShadowType  type)
+{
+  g_return_if_fail (myfixed != NULL);
+  g_return_if_fail (GTK_IS_MYFIXED (myfixed));
+
+  if ((GtkShadowType) myfixed->shadow_type != type)
+    {
+      myfixed->shadow_type = type;
+
+      if (GTK_WIDGET_VISIBLE (myfixed))
+       {
+         gtk_widget_size_allocate (GTK_WIDGET (myfixed), &(GTK_WIDGET (myfixed)->allocation));
+         gtk_widget_queue_draw (GTK_WIDGET (myfixed));
+       }
+    }
+}
+#endif
+
 void
-gtk_myfixed_put (GtkMyFixed       *myfixed,
+gtk_myfixed_put (GtkMyFixed   *myfixed,
                GtkWidget      *widget,
                gint16         x,
                gint16         y)
@@ -249,7 +291,7 @@ gtk_myfixed_map (GtkWidget *widget)
     }
 }
 
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
 static void
 gtk_myfixed_unmap (GtkWidget *widget)
 {
@@ -275,10 +317,26 @@ gtk_myfixed_realize (GtkWidget *widget)
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
   attributes.window_type = GDK_WINDOW_CHILD;
+  
+#if (GTK_MINOR_VERSION > 0)
+  if (myfixed->shadow_type != GTK_SHADOW_NONE)
+    {
+      attributes.x = 2;
+      attributes.y = 2;
+    }
+  else
+    {
+      attributes.x = 0;
+      attributes.y = 0;
+    }
+  attributes.width = MAX (1, (gint)widget->allocation.width - attributes.x * 2 );
+  attributes.height = MAX (1, (gint)widget->allocation.height - attributes.y * 2 );
+#else
   attributes.x = widget->allocation.x;
   attributes.y = widget->allocation.y;
   attributes.width = 32000;
   attributes.height = 32000;
+#endif
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
   attributes.colormap = gtk_widget_get_colormap (widget);
@@ -344,10 +402,10 @@ gtk_myfixed_size_allocate (GtkWidget     *widget,
                         GtkAllocation *allocation)
 {
   GtkMyFixed *myfixed;
+  gint border;
   GtkMyFixedChild *child;
-  GtkAllocation child_allocation;
-  GList *children;
-  guint16 border_width;
+  GtkAllocation child_allocation; 
+  GList *children; 
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_MYFIXED(widget));
@@ -355,12 +413,23 @@ gtk_myfixed_size_allocate (GtkWidget     *widget,
 
   myfixed = GTK_MYFIXED (widget);
 
+  if (myfixed->shadow_type == GTK_SHADOW_NONE)
+    border = 0;
+  else
+    border = 2;
+
   widget->allocation = *allocation;
   if (GTK_WIDGET_REALIZED (widget))
-    gdk_window_move_resize (widget->window, allocation->x, allocation->y, 32000, 32000 );
+  {
+    gdk_window_move_resize( widget->window, 
+                            allocation->x+border, allocation->y+border, 
+#if (GTK_MINOR_VERSION > 0)
+                           allocation->width-border*2, allocation->height-border*2 );
+#else
+                           32000, 32000 );
+#endif
+  }
 
-  border_width = GTK_CONTAINER (myfixed)->border_width;
-  
   children = myfixed->children;
   while (children)
     {
@@ -369,8 +438,8 @@ gtk_myfixed_size_allocate (GtkWidget     *widget,
       
       if (GTK_WIDGET_VISIBLE (child->widget))
        {
-         child_allocation.x = child->x + border_width;
-         child_allocation.y = child->y + border_width;
+         child_allocation.x = child->x;
+         child_allocation.y = child->y;
          child_allocation.width = child->widget->requisition.width;
          child_allocation.height = child->widget->requisition.height;
          gtk_widget_size_allocate (child->widget, &child_allocation);
index e3a3a49f5d3279ce3b0578802970e25f8b4415a3..a83c1944391f5cc95b06103b8939f41c0e03ee29 100644 (file)
 */
 
 //-------------------------------------------------------------------------
-// conditional compilation
+// constants
 //-------------------------------------------------------------------------
 
-#if (GTK_MINOR_VERSION > 0)
-#define NEW_GTK_SCROLL_CODE
-#endif
+#define FRAME_BORDER_WIDTH 2
 
 //-----------------------------------------------------------------------------
-// (debug)
+// data
 //-----------------------------------------------------------------------------
 
-#ifdef __WXDEBUG__
+extern wxList     wxPendingDelete;
+extern bool       g_blockEventsOnDrag;
+extern bool       g_blockEventsOnScroll;
+static bool       g_capturing = FALSE;
+static wxWindow  *g_focusWindow = (wxWindow*) NULL;
 
-static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
-                                         GdkEvent *WXUNUSED(event),
-                                         const char *name )
-{
-    printf( "FOCUS NOW AT: " );
-    printf( name );
-    printf( "\n" );
+/* hack: we need something to pass to gtk_menu_popup, so we store the time of
+   the last click here */
+static guint32 gs_timeLastClick = 0;
 
-    return FALSE;
-}
+//-----------------------------------------------------------------------------
+// local code (see below)
+//-----------------------------------------------------------------------------
 
-void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
+static void draw_frame( GtkWidget *widget, wxWindow *win )
 {
-    return;
+    if (!win->HasVMT()) return;
 
-    wxString tmp = name;
-    tmp += " FROM ";
-    tmp += window;
+    int dw = 0;
+    int dh = 0;
+    
+    if (win->m_hasScrolling)
+    {
+        GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
+        GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
 
-    char *s = new char[tmp.Length()+1];
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+           
+           we use this instead:  range.slider_width = 11 + 2*2pts edge 
+*/
 
-    strcpy( s, WXSTRINGCAST tmp );
+        if (scroll_window->vscrollbar_visible)
+        {
+            dw += 15;   /* dw += vscrollbar->allocation.width; */
+            dw += scroll_class->scrollbar_spacing;
+        }
 
-    gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
-      GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
+        if (scroll_window->hscrollbar_visible)
+        {
+            dh += 15;   /* dh += hscrollbar->allocation.height; */
+            dw += scroll_class->scrollbar_spacing;
+        }
+    }
+    
+    int dx = 0;
+    int dy = 0;
+    if (GTK_WIDGET_NO_WINDOW (widget))
+    {
+        dx += widget->allocation.x;
+        dy += widget->allocation.y;
+    }
+    else
+    if (win->m_parent)
+    {
+        wxPoint pt(win->m_parent->GetClientAreaOrigin());
+        dx += pt.x;
+        dy += pt.y;
+    }
+    
+    if (win->m_windowStyle & wxRAISED_BORDER)
+    {
+        gtk_draw_shadow( widget->style, 
+                         widget->window,
+                        GTK_STATE_NORMAL,
+                        GTK_SHADOW_OUT,
+                        dx, dy,
+                        win->m_width-dw, win->m_height-dh );
+       return;
+    } 
+    
+    if (win->m_windowStyle & wxSUNKEN_BORDER)
+    {
+        gtk_draw_shadow( widget->style, 
+                         widget->window,
+                        GTK_STATE_NORMAL,
+                        GTK_SHADOW_IN,
+                        dx, dy, 
+                        win->m_width-dw, win->m_height-dh );
+       return;
+    }
 }
 
-#endif
-
 //-----------------------------------------------------------------------------
-// data
+// "expose_event" of m_widget
 //-----------------------------------------------------------------------------
 
-extern wxList     wxPendingDelete;
-extern bool       g_blockEventsOnDrag;
-extern bool       g_blockEventsOnScroll;
-static bool       g_capturing = FALSE;
-static wxWindow  *g_focusWindow = (wxWindow*) NULL;
+static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+{
+    if (gdk_event->count > 0) return;
+    draw_frame( widget, win );
+}
 
-// hack: we need something to pass to gtk_menu_popup, so we store the time of
-// the last click here
-static guint32 gs_timeLastClick = 0;
+//-----------------------------------------------------------------------------
+// "draw" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
+{
+    draw_frame( widget, win );
+}
 
 //-----------------------------------------------------------------------------
-// "expose_event" (of m_wxwindow, not of m_widget)
+// "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
 
 static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
@@ -208,7 +264,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
 }
 
 //-----------------------------------------------------------------------------
-// "draw" (of m_wxwindow, not of m_widget)
+// "draw" of m_wxwindow
 //-----------------------------------------------------------------------------
 
 static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
@@ -397,9 +453,10 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
     if (ret)
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+       return TRUE;
     }
 
-    return ret;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -509,14 +566,13 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
     event.m_y = 0;
     event.SetEventObject( win );
 
-    bool ret = win->GetEventHandler()->ProcessEvent( event );
-
-    if (ret)
+    if (win->GetEventHandler()->ProcessEvent( event ))
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" );
+       return TRUE;
     }
 
-    return ret;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -525,11 +581,12 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
 
 static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
 {
-    if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
-
+    if (!win->HasVMT()) return FALSE;
     if (g_blockEventsOnDrag) return TRUE;
     if (g_blockEventsOnScroll) return TRUE;
 
+    if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
+
     if (win->m_wxwindow)
     {
         if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
@@ -546,8 +603,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
         }
     }
 
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnButtonPress from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -660,9 +715,12 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
     gs_timeLastClick = gdk_event->time;
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
+       return TRUE;
+    }
 
-    return TRUE;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -671,12 +729,11 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
 
 static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
 {
-    if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
-
-    if (g_blockEventsOnDrag) return TRUE;
-    if (g_blockEventsOnScroll) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    if (g_blockEventsOnScroll) return FALSE;
 
-    if (!win->HasVMT()) return TRUE;
+    if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
 
 /*
     printf( "OnButtonRelease from " );
@@ -766,9 +823,12 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
+       return TRUE;
+    }
 
-    return TRUE;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -777,6 +837,12 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
 
 static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
 {
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    if (g_blockEventsOnScroll) return FALSE;
+
+    if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
+
     if (gdk_event->is_hint)
     {
        int x = 0;
@@ -788,13 +854,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
        gdk_event->state = state;
     }
 
-    if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
-
-    if (g_blockEventsOnDrag) return TRUE;
-    if (g_blockEventsOnScroll) return TRUE;
-
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnMotion from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -875,9 +934,12 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "motion_notify_event" );
+       return TRUE;
+    }
 
-    return TRUE;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -886,7 +948,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
 
 static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
 
     g_focusWindow = win;
 
@@ -904,7 +967,6 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
         }
     }
 
-    if (!win->HasVMT()) return TRUE;
 
 /*
     printf( "OnSetFocus from " );
@@ -919,9 +981,12 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
-
-    return TRUE;
+        return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -930,15 +995,15 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
 
 static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    
     if (win->m_wxwindow)
     {
       if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
           GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
     }
 
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnKillFocus from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -950,9 +1015,12 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
-
-    return TRUE;
+        return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -961,15 +1029,14 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
 
 static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    
+    if (widget->window != gdk_event->window) return FALSE;
 
     if ((widget->window) && (win->m_cursor))
         gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
 
-    if (widget->window != gdk_event->window) return TRUE;
-
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnEnter from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -1002,9 +1069,12 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
     event.m_y -= pt.y;
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
        gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" );
-
-    return TRUE;
+       return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -1013,15 +1083,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
 
 static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
 
+    if (widget->window != gdk_event->window) return FALSE;
+    
     if ((widget->window) && (win->m_cursor))
         gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
 
-    if (widget->window != gdk_event->window) return TRUE;
-
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnLeave from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -1054,9 +1123,12 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
     event.m_y -= pt.y;
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" );
-
-    return TRUE;
+        return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -1403,17 +1475,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
     GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, "wxWindow::m_widget", name );
-#endif
-
     GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
 
-#ifdef __WXDEBUG__
-    debug_focus_in( s_window->hscrollbar, "wxWindow::hsrcollbar", name );
-    debug_focus_in( s_window->vscrollbar, "wxWindow::vsrcollbar", name );
-#endif
-
     GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
     scroll_class->scrollbar_spacing = 0;
 
@@ -1427,21 +1490,25 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
 
     m_wxwindow = gtk_myfixed_new();
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_wxwindow, "wxWindow::m_wxwindow", name );
-#endif
+    gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
+    
+#if (GTK_MINOR_VERSION > 0)
+    GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
 
-#ifdef NEW_GTK_SCROLL_CODE
-    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), m_wxwindow );
-    GtkViewport *viewport = GTK_VIEWPORT( GTK_BIN(s_window)->child );
+    if (m_windowStyle & wxRAISED_BORDER)
+    {
+        gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_OUT );
+    }
+    else if (m_windowStyle & wxSUNKEN_BORDER)
+    {
+        gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_IN );
+    }
+    else
+    {
+        gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_NONE );
+    }
 #else
-    gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
     GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
-#endif
-
-#ifdef __WXDEBUG__
-    debug_focus_in( GTK_WIDGET(viewport), "wxWindow::viewport", name );
-#endif
 
     if (m_windowStyle & wxRAISED_BORDER)
     {
@@ -1455,6 +1522,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     {
         gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
     }
+#endif
 
     if (m_windowStyle & wxTAB_TRAVERSAL)
     {
@@ -1469,9 +1537,11 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
         m_acceptsFocus = TRUE;
     }
 
+#if (GTK_MINOR_VERSION == 0)
     // shut the viewport up
     gtk_viewport_set_hadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
     gtk_viewport_set_vadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
+#endif
 
     // I _really_ don't want scrollbars in the beginning
     m_vAdjust->lower = 0.0;
@@ -1505,7 +1575,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
           (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
 
-    // these handers het notified when screen updates are required either when
+    // these handlers get notified when screen updates are required either when
     // scrolling or when the window size (and therefore scrollbar configuration)
     // has changed
 
@@ -1695,11 +1765,19 @@ void wxWindow::PostCreation()
     
     if (m_wxwindow)
     {
+        /* these get reported to wxWindows -> wxPaintEvent */
         gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
           GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
 
         gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
           GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+         
+       /* these are called when the "sunken" or "raised" borders are drawn */
+        gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
+          GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
+
+        gtk_signal_connect( GTK_OBJECT(m_widget), "draw",
+          GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
     }
 
     ConnectWidget( GetConnectWidget() );
@@ -1928,38 +2006,39 @@ void wxWindow::DoSetClientSize( int width, int height )
             GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
             GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
 
-#ifdef NEW_GTK_SCROLL_CODE
-            GtkWidget *viewport = GTK_BIN(scroll_window)->child;
-#else
+#if (GTK_MINOR_VERSION == 0)
             GtkWidget *viewport = scroll_window->viewport;
-#endif
-
             GtkStyleClass *viewport_class = viewport->style->klass;
 
-            GtkWidget *hscrollbar = scroll_window->hscrollbar;
-            GtkWidget *vscrollbar = scroll_window->vscrollbar;
-
             if ((m_windowStyle & wxRAISED_BORDER) ||
                 (m_windowStyle & wxSUNKEN_BORDER))
             {
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
+#endif
+
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+           
+           we use this instead:  range.slider_width = 11 + 2*2pts edge 
+*/
 
             if (scroll_window->vscrollbar_visible)
             {
-                dw += vscrollbar->allocation.width;
+                dw += 15;   /* dw += vscrollbar->allocation.width; */
                 dw += scroll_class->scrollbar_spacing;
             }
 
             if (scroll_window->hscrollbar_visible)
             {
-                dh += hscrollbar->allocation.height;
+                dh += 15;   /* dh += hscrollbar->allocation.height; */
                 dw += scroll_class->scrollbar_spacing;
             }
        }
 
-      SetSize( width+dw, height+dh );
+       SetSize( width+dw, height+dh );
     }
 }
 
@@ -1993,12 +2072,8 @@ void wxWindow::GetClientSize( int *width, int *height ) const
             GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
             GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
 
-#ifdef NEW_GTK_SCROLL_CODE
-            GtkWidget *viewport = GTK_BIN(scroll_window)->child;
-#else
+#if (GTK_MINOR_VERSION == 0)
             GtkWidget *viewport = scroll_window->viewport;
-#endif
-
             GtkStyleClass *viewport_class = viewport->style->klass;
 
             if ((m_windowStyle & wxRAISED_BORDER) ||
@@ -2007,18 +2082,23 @@ void wxWindow::GetClientSize( int *width, int *height ) const
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
+#endif
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+           
+           we use this instead:  range.slider_width = 11 + 2*2pts edge 
+*/
 
             if (scroll_window->vscrollbar_visible)
             {
-//              dw += vscrollbar->allocation.width;
-                dw += 15;                               // range.slider_width = 11 + 2*2pts edge
+                dw += 15;   /* dw += vscrollbar->allocation.width; */
                 dw += scroll_class->scrollbar_spacing;
             }
 
             if (scroll_window->hscrollbar_visible)
             {
-//              dh += hscrollbar->allocation.height;
-                dh += 15;
+                dh += 15;   /* dh += hscrollbar->allocation.height; */
                 dh += scroll_class->scrollbar_spacing;
             }
         }
index 1385c3c8aeeb46c6169ecf11032417a190a78980..248123389a49edf160fdb59089f32c925a78c77b 100644 (file)
@@ -58,6 +58,9 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
                        long style, const wxValidator& validator, const wxString &name )
 {
     m_needParent = TRUE;
+#if (GTK_MINOR_VERSION > 0)
+    m_acceptsFocus = TRUE;
+#endif
 
     PreCreation( parent, id, pos, size, style, name );
 
index 9dd96f96b63cf7e1a131cf24cdb8859281bd7bad..f6ad2415f2fc2f64ca943096c8e2a3d27acdc66b 100644 (file)
@@ -15,6 +15,8 @@
 
 #if wxUSE_CLIPBOARD
 
+#include "wx/utils.h"
+
 #include "glib.h"
 #include "gdk/gdk.h"
 #include "gtk/gtk.h"
@@ -60,30 +62,49 @@ struct _GtkSelectionData
 static void
 targets_selection_received( GtkWidget *WXUNUSED(widget), 
                             GtkSelectionData *selection_data, 
+#if (GTK_MINOR_VERSION > 0)
+                            guint32 WXUNUSED(time),
+#endif
                            wxClipboard *clipboard )
 {
-    if (!wxTheClipboard) return;
-  
-    if (selection_data->length <= 0) return;
+    if (!wxTheClipboard)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
-    // make sure we got the data in the correct form 
-    if (selection_data->type != GDK_SELECTION_TYPE_ATOM) return;
+    if (selection_data->length <= 0)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
+    
+    /* make sure we got the data in the correct form */
+    if (selection_data->type != GDK_SELECTION_TYPE_ATOM)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
     // the atoms we received, holding a list of targets (= formats) 
     GdkAtom *atoms = (GdkAtom *)selection_data->data;
 
     for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++)
     {
-      char *name = gdk_atom_name (atoms[i]);
-      if (name) printf( "Format available: %s.\n", name );
+/*
+        char *name = gdk_atom_name (atoms[i]);
+        if (name) printf( "Format available: %s.\n", name );
+*/
       
         if (atoms[i] == clipboard->m_targetRequested)
         {
+            clipboard->m_waiting = FALSE;
             clipboard->m_formatSupported = TRUE;
             return;
         }
     }
 
+    clipboard->m_waiting = FALSE;
     return;
 }
 
@@ -94,28 +115,50 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
 static void 
 selection_received( GtkWidget *WXUNUSED(widget), 
                     GtkSelectionData *selection_data, 
+#if (GTK_MINOR_VERSION > 0)
+                    guint32 WXUNUSED(time),
+#endif
                    wxClipboard *clipboard )
 {
-    if (!wxTheClipboard) return;
+    if (!wxTheClipboard)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
     wxDataObject *data_object = clipboard->m_receivedData;
     
-    if (!data_object) return;
+    if (!data_object)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
     
-    if (selection_data->length <= 0) return;
+    if (selection_data->length <= 0)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
   
-    // make sure we got the data in the correct format
-    
-    if (data_object->GetFormat().GetAtom() != selection_data->target) return;
+    /* make sure we got the data in the correct format */
+    if (data_object->GetFormat().GetAtom() != selection_data->target)
+    {
+        clipboard->m_waiting = FALSE;
+        return;
+    }
     
-    // make sure we got the data in the correct form (selection type).
-    // if so, copy data to target object
+    /* make sure we got the data in the correct form (selection type).
+       if so, copy data to target object */
     
     switch (data_object->GetFormat().GetType())
     {
         case wxDF_TEXT:
        {
-            if (selection_data->type != GDK_SELECTION_TYPE_STRING) return;
+            if (selection_data->type != GDK_SELECTION_TYPE_STRING)
+            {
+                clipboard->m_waiting = FALSE;
+                return;
+            }
            
            wxTextDataObject *text_object = (wxTextDataObject *) data_object;
            
@@ -128,16 +171,22 @@ selection_received( GtkWidget *WXUNUSED(widget),
        
        case wxDF_BITMAP:
        {
-            if (selection_data->type != GDK_SELECTION_TYPE_BITMAP) return;
-           
-           return;
+            if (selection_data->type != GDK_SELECTION_TYPE_BITMAP)
+            {
+                clipboard->m_waiting = FALSE;
+                return;
+            }
            
            break;
        }
        
        case wxDF_PRIVATE:
        {
-            if (selection_data->type != GDK_SELECTION_TYPE_STRING) return;
+            if (selection_data->type != GDK_SELECTION_TYPE_STRING)
+            {
+                clipboard->m_waiting = FALSE;
+                return;
+            }
            
            wxPrivateDataObject *private_object = (wxPrivateDataObject *) data_object;
            
@@ -148,11 +197,13 @@ selection_received( GtkWidget *WXUNUSED(widget),
        
        default:
        {
+            clipboard->m_waiting = FALSE;
            return;
        }
     }
     
     wxTheClipboard->m_formatSupported = TRUE;
+    clipboard->m_waiting = FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -285,9 +336,26 @@ wxClipboard::wxClipboard()
   
     m_receivedData = (wxDataObject*) NULL;
 
+    /* we use m_targetsWidget to query what formats are available */
+    
+    m_targetsWidget = gtk_window_new( GTK_WINDOW_POPUP );
+    gtk_widget_realize( m_targetsWidget );
+
+    gtk_signal_connect( GTK_OBJECT(m_targetsWidget), 
+                        "selection_received",
+                       GTK_SIGNAL_FUNC( targets_selection_received ), 
+                       (gpointer) this );
+                       
+    /* we use m_clipboardWidget to get and to offer data */
+    
     m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
     gtk_widget_realize( m_clipboardWidget );
 
+    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
+                        "selection_received",
+                       GTK_SIGNAL_FUNC( selection_received ), 
+                       (gpointer) this );
+
     gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
                         "selection_clear_event",
                        GTK_SIGNAL_FUNC( selection_clear_clip ), 
@@ -305,6 +373,7 @@ wxClipboard::~wxClipboard()
     Clear();  
   
     if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
+    if (m_targetsWidget) gtk_widget_destroy( m_targetsWidget );
 }
 
 void wxClipboard::Clear()
@@ -454,27 +523,25 @@ bool wxClipboard::IsSupported( wxDataFormat format )
   
     wxCHECK_MSG( m_targetRequested, FALSE, "invalid clipboard format" );
     
-    /* add handler for target (= format) query */
-
-    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
-                        "selection_received",
-                       GTK_SIGNAL_FUNC( targets_selection_received ), 
-                       (gpointer) this );
-  
     m_formatSupported = FALSE;
   
     /* perform query. this will set m_formatSupported to 
-     * TRUE if m_targetRequested is supported */
-    
-    gtk_selection_convert( m_clipboardWidget,
+       TRUE if m_targetRequested is supported.
+       alsom we have to wait for the "answer" from the 
+       clipboard owner which is an asynchronous process.
+       therefore we set m_waiting = TRUE here and wait
+       until the callback "targets_selection_received" 
+       sets it to FALSE */
+
+    m_waiting = TRUE;
+      
+    gtk_selection_convert( m_targetsWidget,
                           g_clipboardAtom, 
                           g_targetsAtom,
                           GDK_CURRENT_TIME );
-
-    gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), 
-                                  GTK_SIGNAL_FUNC( targets_selection_received ),
-                                  (gpointer) this );
-  
+                          
+    while (m_waiting) gtk_main_iteration();
+    
     if (!m_formatSupported) return FALSE;
     
     return TRUE;
@@ -502,21 +569,23 @@ bool wxClipboard::GetData( wxDataObject *data )
     
     m_formatSupported = FALSE;
   
-    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), 
-                        "selection_received",
-                       GTK_SIGNAL_FUNC( selection_received ), 
-                       (gpointer) this );
+    /* ask for clipboard contents.  this will set 
+       m_formatSupported to TRUE if m_targetRequested 
+       is supported.
+       also, we have to wait for the "answer" from the 
+       clipboard owner which is an asynchronous process.
+       therefore we set m_waiting = TRUE here and wait
+       until the callback "targets_selection_received" 
+       sets it to FALSE */
 
-    /* ask for clipboard contents */
+    m_waiting = TRUE;
 
     gtk_selection_convert( m_clipboardWidget,
                           g_clipboardAtom, 
                           m_targetRequested,
                           GDK_CURRENT_TIME );
   
-    gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), 
-                                  GTK_SIGNAL_FUNC( selection_received ),
-                                  (gpointer) this );
+    while (m_waiting) gtk_main_iteration();
 
     /* this is a true error as we checked for the presence of such data before */
 
index 4b04d0bb37627694bda679c1dee9c49c3ff549b3..ce57fdf9a64d53689f0f00d5025c8b5b6da98007 100644 (file)
@@ -13,6 +13,8 @@
 
 #include "wx/control.h"
 
+#include "gtk/gtkfeatures.h"
+
 //-----------------------------------------------------------------------------
 // wxControl
 //-----------------------------------------------------------------------------
index 831a9122f1b973c2af9a22bd72a791597846d74c..e495bfd98a22a1494f83ef22c44aca6620c9f9f6 100644 (file)
@@ -32,7 +32,7 @@ IMPLEMENT_CLASS(wxDataFormat, wxObject)
 
 wxDataFormat::wxDataFormat()
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     m_type = wxDF_INVALID;
     m_hasAtom = FALSE;
     m_atom = (GdkAtom) 0;
@@ -40,19 +40,19 @@ wxDataFormat::wxDataFormat()
 
 wxDataFormat::wxDataFormat( wxDataType type )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     SetType( type );
 }
 
 wxDataFormat::wxDataFormat( const wxString &id )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     SetId( id );
 }
 
 wxDataFormat::wxDataFormat( wxDataFormat &format )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     m_type = format.GetType();
     m_id = format.GetId();
     m_hasAtom = TRUE;
@@ -61,7 +61,7 @@ wxDataFormat::wxDataFormat( wxDataFormat &format )
 
 wxDataFormat::wxDataFormat( const GdkAtom atom )
 {
-    if (!g_textAtom) g_textAtom = gdk_atom_intern( "text/plain", FALSE );
+    if (!g_textAtom) g_textAtom = gdk_atom_intern( "STRING", FALSE );
     m_hasAtom = TRUE;
     
     m_atom = atom;
@@ -91,7 +91,7 @@ void wxDataFormat::SetType( wxDataType type )
     
     if (m_type == wxDF_TEXT)
     {
-        m_id = "text/plain";
+        m_id = "STRING";
     } 
     else
     if (m_type == wxDF_BITMAP)
index 822015862d24be615ad48589ae3bfa07b84f37a0..6f8cefcb3c812da30a296195b52bcaec8a373760 100644 (file)
@@ -145,6 +145,27 @@ bool wxDialog::Create( wxWindow *parent,
 
     gtk_widget_realize( m_widget );
 
+      long decor = (long) GDK_DECOR_ALL;
+      long func = (long) GDK_FUNC_ALL;
+      
+      if ((m_windowStyle & wxCAPTION) == 0)
+       decor |= GDK_DECOR_TITLE;
+      if ((m_windowStyle & wxMINIMIZE) == 0)
+       func |= GDK_FUNC_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE) == 0)
+       func |= GDK_FUNC_MAXIMIZE;
+      if ((m_windowStyle & wxSYSTEM_MENU) == 0)
+       decor |= GDK_DECOR_MENU;
+      if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MAXIMIZE;
+      if ((m_windowStyle & wxRESIZE_BORDER) == 0)
+       func |= GDK_FUNC_RESIZE;
+
+      gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
+      gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
+      
     gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
         GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
 
index c018c5b1637979b8f07d53bef6296fe7cd5d804e..bfa0f65baa849b2b71c9c7a6452ed30b770510b6 100644 (file)
@@ -171,6 +171,27 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
 
     gtk_widget_realize( m_widget );
     
+      long decor = (long) GDK_DECOR_ALL;
+      long func = (long) GDK_FUNC_ALL;
+      
+      if ((m_windowStyle & wxCAPTION) == 0)
+       decor |= GDK_DECOR_TITLE;
+      if ((m_windowStyle & wxMINIMIZE) == 0)
+       func |= GDK_FUNC_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE) == 0)
+       func |= GDK_FUNC_MAXIMIZE;
+      if ((m_windowStyle & wxSYSTEM_MENU) == 0)
+       decor |= GDK_DECOR_MENU;
+      if ((m_windowStyle & wxMINIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MINIMIZE;
+      if ((m_windowStyle & wxMAXIMIZE_BOX) == 0)
+       decor |= GDK_DECOR_MAXIMIZE;
+      if ((m_windowStyle & wxRESIZE_BORDER) == 0)
+       func |= GDK_FUNC_RESIZE;
+
+      gdk_window_set_decorations(m_widget->window, (GdkWMDecoration)decor);
+      gdk_window_set_functions(m_widget->window, (GdkWMFunction)func);
+      
     gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
         GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
 
index 818775ee732b711ab18e00b7cf69e01b3bc3bf29..8c24f8b8110ec5b81ae0cec62aa92592d263660f 100644 (file)
@@ -192,8 +192,16 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     SetValidator( validator );
 
     m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
-    gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
-      GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+    if (style & wxLB_ALWAYS_SB)
+    {
+      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
+        GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS );
+    }
+    else
+    {
+      gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
+        GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+    }
 
     m_list = GTK_LIST( gtk_list_new() );
 
@@ -211,25 +219,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
     gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
 #endif
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, "wxListBox::m_widget", name );
-
-    debug_focus_in( GTK_WIDGET(m_list), "wxListBox::m_list", name );
-
-    GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
-
-    debug_focus_in( s_window->hscrollbar, "wxWindow::hsrcollbar", name );
-    debug_focus_in( s_window->vscrollbar, "wxWindow::vsrcollbar", name );
-
-#ifdef NEW_GTK_SCROLL_CODE
-    GtkViewport *viewport = GTK_VIEWPORT( GTK_BIN(s_window)->child );
-#else
-    GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
-#endif
-
-    debug_focus_in( GTK_WIDGET(viewport), "wxWindow::viewport", name );
-#endif
-
     gtk_widget_show( GTK_WIDGET(m_list) );
 
     wxSize newSize = size;
@@ -252,10 +241,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
         list_item = gtk_list_item_new_with_label( str );
 
-#ifdef __WXDEBUG__
-        debug_focus_in( list_item, "wxListBox::list_item", name );
-#endif
-
         gtk_container_add( GTK_CONTAINER(m_list), list_item );
 
         gtk_signal_connect( GTK_OBJECT(list_item), "select",
index 90abef63048be29680aaecdbdc4282a22b6ce3e3..cf3cf9a8dc9b4bf918a753fbe9e6725b596b1cd2 100644 (file)
@@ -72,19 +72,22 @@ wxMenuBar::wxMenuBar()
 void wxMenuBar::Append( wxMenu *menu, const wxString &title )
 {
     m_menus.Append( menu );
-    wxString title2 = title;
-
-    int pos;
-    do
+    
+    wxString s = "";
+    for ( const char *pc = title; *pc != '\0'; pc++ )
     {
-        pos = title2.First( '&' );
-        if (pos != wxNOT_FOUND)
-            title2.Remove( pos, 1 );
-    } while (pos != wxNOT_FOUND);
-
-    menu->SetTitle(title2);
+        if (*pc == '&')
+       {
+           pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+    //      s << '_';  not yet
+#endif
+        }
+        s << *pc;
+    }
 
-    menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(title2) );
+    menu->SetTitle(s);
+    menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(s) );
     gtk_widget_show( menu->m_owner );
     gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu );
 
@@ -404,7 +407,13 @@ void wxMenuItem::SetName( const wxString& str )
     m_text = "";
     for ( const char *pc = str; *pc != '\0'; pc++ )
     {
-        if (*pc == '&') pc++; /* skip it */
+        if (*pc == '&')
+       {
+           pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+            m_text << '_';
+#endif
+        }
         m_text << *pc;
     }
 
@@ -457,7 +466,14 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
     m_title = title;
     m_items.DeleteContents( TRUE );
     m_invokingWindow = (wxWindow *) NULL;
+    
+#if (GTK_MINOR_VERSION > 0)
+    m_accel = gtk_accel_group_new();
+    m_factory = gtk_item_factory_new( GTK_TYPE_MENU, "<main>", m_accel );
+    m_menu = gtk_item_factory_get_widget( m_factory, "<main>" );
+#else    
     m_menu = gtk_menu_new();  // Do not show!
+#endif
 
     m_callback = func;
     m_eventHandler = this;
@@ -473,6 +489,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
     m_owner = (GtkWidget*) NULL;
 }
 
+wxMenu::~wxMenu()
+{
+    /* how do we delete an item-factory ? */
+}
+
 void wxMenu::SetTitle( const wxString& title )
 {
     // TODO Waiting for something better
@@ -492,6 +513,7 @@ void wxMenu::AppendSeparator()
     GtkWidget *menuItem = gtk_menu_item_new();
     gtk_menu_append( GTK_MENU(m_menu), menuItem );
     gtk_widget_show( menuItem );
+    
     mitem->SetMenuItem(menuItem);
     m_items.Append( mitem );
 }
@@ -504,25 +526,58 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
     mitem->SetHelp(helpStr);
     mitem->SetCheckable(checkable);
     const char *text = mitem->GetText();
+    
+#if (GTK_MINOR_VERSION > 0)
+    char buf[100];
+    strcpy( buf, "/" );
+    strcat( buf, text );
+    
+    GtkItemFactoryEntry entry;
+    entry.path = buf;
+    entry.accelerator = (gchar*) NULL;
+    entry.callback = (GtkItemFactoryCallback) gtk_menu_clicked_callback;
+    entry.callback_action = 0;
+    if (checkable)
+        entry.item_type = "<CheckItem>";
+    else
+        entry.item_type = "<Item>";
+    
+    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 = "<main>/";
+    for ( const char *pc = text; *pc != '\0'; pc++ )
+    {
+        if (*pc == '_') pc++; /* skip it */
+        s << *pc;
+    }
+    
+    GtkWidget *menuItem = gtk_item_factory_get_item( m_factory, s );
+    
+#else
+
     GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
                                     : gtk_menu_item_new_with_label(text);
-
-    mitem->SetMenuItem(menuItem);
-
+                                   
     gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
                         GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
-                        (gpointer*)this );
+                        (gpointer)this );
+                       
+    gtk_menu_append( GTK_MENU(m_menu), menuItem );
+    gtk_widget_show( menuItem );
+    
+#endif
 
     gtk_signal_connect( GTK_OBJECT(menuItem), "select",
                         GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
-                        (gpointer*)this );
+                        (gpointer)this );
 
     gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
                         GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
-                        (gpointer*)this );
+                        (gpointer)this );
+
+    mitem->SetMenuItem(menuItem);
 
-    gtk_menu_append( GTK_MENU(m_menu), menuItem );
-    gtk_widget_show( menuItem );
     m_items.Append( mitem );
 }
 
@@ -590,14 +645,18 @@ void wxMenu::Append( wxMenuItem *item )
 
 int wxMenu::FindItem( const wxString itemString ) const
 {
-    wxString s( itemString );
-
-    int pos;
-    do
+    wxString s = "";
+    for ( const char *pc = itemString; *pc != '\0'; pc++ )
     {
-        pos = s.First( '&' );
-        if (pos != -1) s.Remove( pos, 1 );
-    } while (pos != -1);
+        if (*pc == '&')
+       {
+           pc++; /* skip it */
+#if (GTK_MINOR_VERSION > 0)
+            s << '_';
+#endif
+        }
+        s << *pc;
+    }
 
     wxNode *node = m_items.First();
     while (node)
index ea57e8c4338a1137c224680f52c3dc19fc1faece..6a43c84730f5d7fb16bb21c1a5827d6c1f3d66d1 100644 (file)
@@ -233,10 +233,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
 
     m_widget = gtk_notebook_new();
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, "wxNotebook::m_widget", name );
-#endif
-
     gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
 
     m_idHandler = gtk_signal_connect (
index 5fd1f455a198de10eaaabd5b16d0b84ef6b30c01..96070607d3e6079a7cbdf6c6787b14d8a294b879 100644 (file)
@@ -37,9 +37,9 @@ extern bool   g_blockEventsOnDrag;
 static void
 gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
 {
-    win->SetModified();
+    if (!win->m_hasVMT) return;
 
-    win->CalculateScrollbar();
+    win->SetModified();
 
     wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
     event.SetString( win->GetValue() );
@@ -48,12 +48,14 @@ gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
 }
 
 //-----------------------------------------------------------------------------
-// "size_allocate"
+// "changed" from vertical scrollbar
 //-----------------------------------------------------------------------------
 
 static void
-gtk_text_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* WXUNUSED(alloc), wxTextCtrl *win )
+gtk_scrollbar_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
 {
+    if (!win->m_hasVMT) return;
+    
     win->CalculateScrollbar();
 }
 
@@ -124,19 +126,19 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
 
     SetValidator( validator );
 
-    m_vScrollbarVisible = TRUE;
+    m_vScrollbarVisible = FALSE;
 
     bool multi_line = (style & wxTE_MULTILINE) != 0;
     if ( multi_line )
     {
-        // a multi-line edit control: create a vertical scrollbar by default and
-        // horizontal if requested
+        /* a multi-line edit control: create a vertical scrollbar by default and
+           horizontal if requested */
         bool bHasHScrollbar = (style & wxHSCROLL) != 0;
 
-        // create our control...
+        /* create our control ... */
         m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
 
-        // ... and put into the upper left hand corner of the table
+        /* ... and put into the upper left hand corner of the table */
         m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
         GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
        
@@ -145,7 +147,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
                       (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
                        0, 0);
 
-        // put the horizontal scrollbar in the lower left hand corner
+        /* put the horizontal scrollbar in the lower left hand corner */
         if (bHasHScrollbar)
         {
             GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
@@ -158,22 +160,13 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
             gtk_widget_show(hscrollbar);
         }
 
-        // finally, put the vertical scrollbar in the upper right corner
-        m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
-        GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
-       
-        gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
-                     GTK_FILL,
-                     (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
-                     0, 0);
-        gtk_widget_show( m_vScrollbar );
+        /* we create the vertical scrollbar on demand */
+       m_vScrollbar = (GtkWidget*) NULL;
 
-        gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
-          GTK_SIGNAL_FUNC(gtk_text_size_callback), (gpointer)this );
     }
     else
     {
-        // a single-line text control: no need for scrollbars
+        /* a single-line text control: no need for scrollbars */
         m_widget =
           m_text = gtk_entry_new();
     }
@@ -195,7 +188,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
         gtk_widget_show(m_text);
     }
 
-    // we want to be notified about text changes
+    /* we want to be notified about text changes */
     gtk_signal_connect( GTK_OBJECT(m_text), "changed",
       GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
 
@@ -228,11 +221,17 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
         if (multi_line)
             gtk_text_set_editable( GTK_TEXT(m_text), 1 );
     }
+    
+    SetBackgroundColour( parent->GetBackgroundColour() );
+    SetForegroundColour( parent->GetForegroundColour() );
 
     Show( TRUE );
 
-    SetBackgroundColour( parent->GetBackgroundColour() );
-    SetForegroundColour( parent->GetForegroundColour() );
+    if (multi_line)
+    {
+        gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
+          (GtkSignalFunc) gtk_scrollbar_changed_callback, (gpointer) this );
+    }
 
     return TRUE;
 }
@@ -247,18 +246,30 @@ void wxTextCtrl::CalculateScrollbar()
     {
         if (m_vScrollbarVisible)
         {
-        gtk_widget_hide( m_vScrollbar );
+            gtk_widget_hide( m_vScrollbar );
 
-        m_vScrollbarVisible = FALSE;
+            m_vScrollbarVisible = FALSE;
         }
     }
     else
     {
         if (!m_vScrollbarVisible)
         {
-        gtk_widget_show( m_vScrollbar );
+           if (!m_vScrollbar)
+           {
+                /* finally, put the vertical scrollbar in the upper right corner */
+                m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
+                GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
+       
+                gtk_table_attach(GTK_TABLE(m_widget), m_vScrollbar, 1, 2, 0, 1,
+                     GTK_FILL,
+                     (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK),
+                     0, 0);
+           }
+           
+            gtk_widget_show( m_vScrollbar );
 
-        m_vScrollbarVisible = TRUE;
+            m_vScrollbarVisible = TRUE;
         }
     }
 }
index ebbcadb5ac8efb8fa78411f732541e11b17596f9..31b638fb6fa48e0ee5488b836d959c8f82e01aed 100644 (file)
@@ -8,15 +8,7 @@
 /////////////////////////////////////////////////////////////////////////// */
 
 #include "wx/gtk/win_gtk.h"
-#include <gtk/gtkfeatures.h>
-
-/*-------------------------------------------------------------------------
-// conditional compilation
-//------------------------------------------------------------------------- */
-
-#if (GTK_MINOR_VERSION > 0)
-#define NEW_GTK_CONSTRUCT_CODE
-#endif
+#include "gtk/gtksignal.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -25,7 +17,7 @@ extern "C" {
 static void gtk_myfixed_class_init    (GtkMyFixedClass    *klass);
 static void gtk_myfixed_init          (GtkMyFixed         *myfixed);
 static void gtk_myfixed_map           (GtkWidget        *widget);
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
 static void gtk_myfixed_unmap         (GtkWidget        *widget);
 #endif
 static void gtk_myfixed_realize       (GtkWidget        *widget);
@@ -49,14 +41,20 @@ static void gtk_myfixed_foreach       (GtkContainer     *container,
 #endif
                                     GtkCallback      callback,
                                     gpointer         callback_data);
-#ifdef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION > 0)
 static GtkType gtk_myfixed_child_type (GtkContainer     *container);
 #endif
 
+#if (GTK_MINOR_VERSION > 0)
+static void  gtk_myfixed_scroll_set_adjustments    (GtkMyFixed   *myfixed,
+                                              GtkAdjustment *hadj,
+                                              GtkAdjustment *vadj);
+#endif
 
-static GtkContainerClass *parent_class = NULL;
 
 
+static GtkContainerClass *parent_class = NULL;
+
 guint
 gtk_myfixed_get_type ()
 {
@@ -71,13 +69,13 @@ gtk_myfixed_get_type ()
        sizeof (GtkMyFixedClass),
        (GtkClassInitFunc) gtk_myfixed_class_init,
        (GtkObjectInitFunc) gtk_myfixed_init,
-#ifndef NEW_GTK_CONSTRUCT_CODE 
-        (GtkArgSetFunc) NULL,
-        (GtkArgGetFunc) NULL,
-#else
+#if (GTK_MINOR_VERSION > 0)
        /* reserved_1 */ NULL,
         /* reserved_2 */ NULL,
         (GtkClassInitFunc) NULL,
+#else
+        (GtkArgSetFunc) NULL,
+        (GtkArgGetFunc) NULL,
 #endif
       };
 
@@ -98,14 +96,14 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
   widget_class = (GtkWidgetClass*) klass;
   container_class = (GtkContainerClass*) klass;
   
-#ifndef NEW_GTK_CONSTRUCT_CODE
-  parent_class = gtk_type_class (gtk_container_get_type ());
-#else
+#if (GTK_MINOR_VERSION > 0)
   parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
+#else
+  parent_class = gtk_type_class (gtk_container_get_type ());
 #endif
 
   widget_class->map = gtk_myfixed_map;
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
   widget_class->unmap = gtk_myfixed_unmap;
 #endif
   widget_class->realize = gtk_myfixed_realize;
@@ -122,12 +120,24 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
   container_class->foreach = gtk_myfixed_foreach;
 #endif
 
-#ifdef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION > 0)
   container_class->child_type = gtk_myfixed_child_type;
 #endif
+
+#if (GTK_MINOR_VERSION > 0)
+  klass->set_scroll_adjustments = gtk_myfixed_scroll_set_adjustments;
+
+  widget_class->set_scroll_adjustments_signal =
+    gtk_signal_new ("set_scroll_adjustments",
+                   GTK_RUN_LAST,
+                   object_class->type,
+                   GTK_SIGNAL_OFFSET (GtkMyFixedClass, set_scroll_adjustments),
+                   gtk_marshal_NONE__POINTER_POINTER,
+                   GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
+#endif
 }
 
-#ifdef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION > 0)
 static GtkType
 gtk_myfixed_child_type (GtkContainer     *container)
 {
@@ -140,10 +150,14 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
 {
   GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
   
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
   GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
 #endif
 
+#if (GTK_MINOR_VERSION > 0)
+  myfixed->shadow_type = GTK_SHADOW_NONE;
+#endif
+
   myfixed->children = NULL;
 }
 
@@ -157,8 +171,36 @@ gtk_myfixed_new ()
   return GTK_WIDGET (myfixed);
 }
 
+#if (GTK_MINOR_VERSION > 0)
+void  gtk_myfixed_scroll_set_adjustments (GtkMyFixed     *myfixed,
+                                              GtkAdjustment *hadj,
+                                              GtkAdjustment *vadj)
+{
+   /* OK, this is embarassing, but this function has to be here */
+}
+
+void 
+gtk_myfixed_set_shadow_type (GtkMyFixed   *myfixed,
+                             GtkShadowType  type)
+{
+  g_return_if_fail (myfixed != NULL);
+  g_return_if_fail (GTK_IS_MYFIXED (myfixed));
+
+  if ((GtkShadowType) myfixed->shadow_type != type)
+    {
+      myfixed->shadow_type = type;
+
+      if (GTK_WIDGET_VISIBLE (myfixed))
+       {
+         gtk_widget_size_allocate (GTK_WIDGET (myfixed), &(GTK_WIDGET (myfixed)->allocation));
+         gtk_widget_queue_draw (GTK_WIDGET (myfixed));
+       }
+    }
+}
+#endif
+
 void
-gtk_myfixed_put (GtkMyFixed       *myfixed,
+gtk_myfixed_put (GtkMyFixed   *myfixed,
                GtkWidget      *widget,
                gint16         x,
                gint16         y)
@@ -249,7 +291,7 @@ gtk_myfixed_map (GtkWidget *widget)
     }
 }
 
-#ifndef NEW_GTK_CONSTRUCT_CODE
+#if (GTK_MINOR_VERSION == 0)
 static void
 gtk_myfixed_unmap (GtkWidget *widget)
 {
@@ -275,10 +317,26 @@ gtk_myfixed_realize (GtkWidget *widget)
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
 
   attributes.window_type = GDK_WINDOW_CHILD;
+  
+#if (GTK_MINOR_VERSION > 0)
+  if (myfixed->shadow_type != GTK_SHADOW_NONE)
+    {
+      attributes.x = 2;
+      attributes.y = 2;
+    }
+  else
+    {
+      attributes.x = 0;
+      attributes.y = 0;
+    }
+  attributes.width = MAX (1, (gint)widget->allocation.width - attributes.x * 2 );
+  attributes.height = MAX (1, (gint)widget->allocation.height - attributes.y * 2 );
+#else
   attributes.x = widget->allocation.x;
   attributes.y = widget->allocation.y;
   attributes.width = 32000;
   attributes.height = 32000;
+#endif
   attributes.wclass = GDK_INPUT_OUTPUT;
   attributes.visual = gtk_widget_get_visual (widget);
   attributes.colormap = gtk_widget_get_colormap (widget);
@@ -344,10 +402,10 @@ gtk_myfixed_size_allocate (GtkWidget     *widget,
                         GtkAllocation *allocation)
 {
   GtkMyFixed *myfixed;
+  gint border;
   GtkMyFixedChild *child;
-  GtkAllocation child_allocation;
-  GList *children;
-  guint16 border_width;
+  GtkAllocation child_allocation; 
+  GList *children; 
 
   g_return_if_fail (widget != NULL);
   g_return_if_fail (GTK_IS_MYFIXED(widget));
@@ -355,12 +413,23 @@ gtk_myfixed_size_allocate (GtkWidget     *widget,
 
   myfixed = GTK_MYFIXED (widget);
 
+  if (myfixed->shadow_type == GTK_SHADOW_NONE)
+    border = 0;
+  else
+    border = 2;
+
   widget->allocation = *allocation;
   if (GTK_WIDGET_REALIZED (widget))
-    gdk_window_move_resize (widget->window, allocation->x, allocation->y, 32000, 32000 );
+  {
+    gdk_window_move_resize( widget->window, 
+                            allocation->x+border, allocation->y+border, 
+#if (GTK_MINOR_VERSION > 0)
+                           allocation->width-border*2, allocation->height-border*2 );
+#else
+                           32000, 32000 );
+#endif
+  }
 
-  border_width = GTK_CONTAINER (myfixed)->border_width;
-  
   children = myfixed->children;
   while (children)
     {
@@ -369,8 +438,8 @@ gtk_myfixed_size_allocate (GtkWidget     *widget,
       
       if (GTK_WIDGET_VISIBLE (child->widget))
        {
-         child_allocation.x = child->x + border_width;
-         child_allocation.y = child->y + border_width;
+         child_allocation.x = child->x;
+         child_allocation.y = child->y;
          child_allocation.width = child->widget->requisition.width;
          child_allocation.height = child->widget->requisition.height;
          gtk_widget_size_allocate (child->widget, &child_allocation);
index e3a3a49f5d3279ce3b0578802970e25f8b4415a3..a83c1944391f5cc95b06103b8939f41c0e03ee29 100644 (file)
 */
 
 //-------------------------------------------------------------------------
-// conditional compilation
+// constants
 //-------------------------------------------------------------------------
 
-#if (GTK_MINOR_VERSION > 0)
-#define NEW_GTK_SCROLL_CODE
-#endif
+#define FRAME_BORDER_WIDTH 2
 
 //-----------------------------------------------------------------------------
-// (debug)
+// data
 //-----------------------------------------------------------------------------
 
-#ifdef __WXDEBUG__
+extern wxList     wxPendingDelete;
+extern bool       g_blockEventsOnDrag;
+extern bool       g_blockEventsOnScroll;
+static bool       g_capturing = FALSE;
+static wxWindow  *g_focusWindow = (wxWindow*) NULL;
 
-static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
-                                         GdkEvent *WXUNUSED(event),
-                                         const char *name )
-{
-    printf( "FOCUS NOW AT: " );
-    printf( name );
-    printf( "\n" );
+/* hack: we need something to pass to gtk_menu_popup, so we store the time of
+   the last click here */
+static guint32 gs_timeLastClick = 0;
 
-    return FALSE;
-}
+//-----------------------------------------------------------------------------
+// local code (see below)
+//-----------------------------------------------------------------------------
 
-void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
+static void draw_frame( GtkWidget *widget, wxWindow *win )
 {
-    return;
+    if (!win->HasVMT()) return;
 
-    wxString tmp = name;
-    tmp += " FROM ";
-    tmp += window;
+    int dw = 0;
+    int dh = 0;
+    
+    if (win->m_hasScrolling)
+    {
+        GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
+        GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
 
-    char *s = new char[tmp.Length()+1];
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+           
+           we use this instead:  range.slider_width = 11 + 2*2pts edge 
+*/
 
-    strcpy( s, WXSTRINGCAST tmp );
+        if (scroll_window->vscrollbar_visible)
+        {
+            dw += 15;   /* dw += vscrollbar->allocation.width; */
+            dw += scroll_class->scrollbar_spacing;
+        }
 
-    gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
-      GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
+        if (scroll_window->hscrollbar_visible)
+        {
+            dh += 15;   /* dh += hscrollbar->allocation.height; */
+            dw += scroll_class->scrollbar_spacing;
+        }
+    }
+    
+    int dx = 0;
+    int dy = 0;
+    if (GTK_WIDGET_NO_WINDOW (widget))
+    {
+        dx += widget->allocation.x;
+        dy += widget->allocation.y;
+    }
+    else
+    if (win->m_parent)
+    {
+        wxPoint pt(win->m_parent->GetClientAreaOrigin());
+        dx += pt.x;
+        dy += pt.y;
+    }
+    
+    if (win->m_windowStyle & wxRAISED_BORDER)
+    {
+        gtk_draw_shadow( widget->style, 
+                         widget->window,
+                        GTK_STATE_NORMAL,
+                        GTK_SHADOW_OUT,
+                        dx, dy,
+                        win->m_width-dw, win->m_height-dh );
+       return;
+    } 
+    
+    if (win->m_windowStyle & wxSUNKEN_BORDER)
+    {
+        gtk_draw_shadow( widget->style, 
+                         widget->window,
+                        GTK_STATE_NORMAL,
+                        GTK_SHADOW_IN,
+                        dx, dy, 
+                        win->m_width-dw, win->m_height-dh );
+       return;
+    }
 }
 
-#endif
-
 //-----------------------------------------------------------------------------
-// data
+// "expose_event" of m_widget
 //-----------------------------------------------------------------------------
 
-extern wxList     wxPendingDelete;
-extern bool       g_blockEventsOnDrag;
-extern bool       g_blockEventsOnScroll;
-static bool       g_capturing = FALSE;
-static wxWindow  *g_focusWindow = (wxWindow*) NULL;
+static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+{
+    if (gdk_event->count > 0) return;
+    draw_frame( widget, win );
+}
 
-// hack: we need something to pass to gtk_menu_popup, so we store the time of
-// the last click here
-static guint32 gs_timeLastClick = 0;
+//-----------------------------------------------------------------------------
+// "draw" of m_wxwindow
+//-----------------------------------------------------------------------------
+
+static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
+{
+    draw_frame( widget, win );
+}
 
 //-----------------------------------------------------------------------------
-// "expose_event" (of m_wxwindow, not of m_widget)
+// "expose_event" of m_wxwindow
 //-----------------------------------------------------------------------------
 
 static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win )
@@ -208,7 +264,7 @@ static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExp
 }
 
 //-----------------------------------------------------------------------------
-// "draw" (of m_wxwindow, not of m_widget)
+// "draw" of m_wxwindow
 //-----------------------------------------------------------------------------
 
 static void gtk_window_draw_callback( GtkWidget *WXUNUSED(widget), GdkRectangle *rect, wxWindow *win )
@@ -397,9 +453,10 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_e
     if (ret)
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
+       return TRUE;
     }
 
-    return ret;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -509,14 +566,13 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
     event.m_y = 0;
     event.SetEventObject( win );
 
-    bool ret = win->GetEventHandler()->ProcessEvent( event );
-
-    if (ret)
+    if (win->GetEventHandler()->ProcessEvent( event ))
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_event" );
+       return TRUE;
     }
 
-    return ret;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -525,11 +581,12 @@ static gint gtk_window_key_release_callback( GtkWidget *widget, GdkEventKey *gdk
 
 static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
 {
-    if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
-
+    if (!win->HasVMT()) return FALSE;
     if (g_blockEventsOnDrag) return TRUE;
     if (g_blockEventsOnScroll) return TRUE;
 
+    if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
+
     if (win->m_wxwindow)
     {
         if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (win->m_wxwindow) )
@@ -546,8 +603,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
         }
     }
 
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnButtonPress from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -660,9 +715,12 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
     gs_timeLastClick = gdk_event->time;
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
+       return TRUE;
+    }
 
-    return TRUE;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -671,12 +729,11 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
 
 static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxWindow *win )
 {
-    if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
-
-    if (g_blockEventsOnDrag) return TRUE;
-    if (g_blockEventsOnScroll) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    if (g_blockEventsOnScroll) return FALSE;
 
-    if (!win->HasVMT()) return TRUE;
+    if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
 
 /*
     printf( "OnButtonRelease from " );
@@ -766,9 +823,12 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_event" );
+       return TRUE;
+    }
 
-    return TRUE;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -777,6 +837,12 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
 
 static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxWindow *win )
 {
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    if (g_blockEventsOnScroll) return FALSE;
+
+    if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
+
     if (gdk_event->is_hint)
     {
        int x = 0;
@@ -788,13 +854,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
        gdk_event->state = state;
     }
 
-    if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
-
-    if (g_blockEventsOnDrag) return TRUE;
-    if (g_blockEventsOnScroll) return TRUE;
-
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnMotion from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -875,9 +934,12 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "motion_notify_event" );
+       return TRUE;
+    }
 
-    return TRUE;
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -886,7 +948,8 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
 
 static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
 
     g_focusWindow = win;
 
@@ -904,7 +967,6 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
         }
     }
 
-    if (!win->HasVMT()) return TRUE;
 
 /*
     printf( "OnSetFocus from " );
@@ -919,9 +981,12 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_event" );
-
-    return TRUE;
+        return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -930,15 +995,15 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
 
 static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    
     if (win->m_wxwindow)
     {
       if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
           GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
     }
 
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnKillFocus from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -950,9 +1015,12 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
     event.SetEventObject( win );
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_event" );
-
-    return TRUE;
+        return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -961,15 +1029,14 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
 
 static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
+    
+    if (widget->window != gdk_event->window) return FALSE;
 
     if ((widget->window) && (win->m_cursor))
         gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() );
 
-    if (widget->window != gdk_event->window) return TRUE;
-
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnEnter from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -1002,9 +1069,12 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
     event.m_y -= pt.y;
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
        gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_event" );
-
-    return TRUE;
+       return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -1013,15 +1083,14 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
 
 static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win )
 {
-    if (g_blockEventsOnDrag) return TRUE;
+    if (!win->HasVMT()) return FALSE;
+    if (g_blockEventsOnDrag) return FALSE;
 
+    if (widget->window != gdk_event->window) return FALSE;
+    
     if ((widget->window) && (win->m_cursor))
         gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
 
-    if (widget->window != gdk_event->window) return TRUE;
-
-    if (!win->HasVMT()) return TRUE;
-
 /*
     printf( "OnLeave from " );
     if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -1054,9 +1123,12 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
     event.m_y -= pt.y;
 
     if (win->GetEventHandler()->ProcessEvent( event ))
+    {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_event" );
-
-    return TRUE;
+        return TRUE;
+    }
+    
+    return FALSE;
 }
 
 //-----------------------------------------------------------------------------
@@ -1403,17 +1475,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
     GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_widget, "wxWindow::m_widget", name );
-#endif
-
     GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
 
-#ifdef __WXDEBUG__
-    debug_focus_in( s_window->hscrollbar, "wxWindow::hsrcollbar", name );
-    debug_focus_in( s_window->vscrollbar, "wxWindow::vsrcollbar", name );
-#endif
-
     GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
     scroll_class->scrollbar_spacing = 0;
 
@@ -1427,21 +1490,25 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
 
     m_wxwindow = gtk_myfixed_new();
 
-#ifdef __WXDEBUG__
-    debug_focus_in( m_wxwindow, "wxWindow::m_wxwindow", name );
-#endif
+    gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
+    
+#if (GTK_MINOR_VERSION > 0)
+    GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
 
-#ifdef NEW_GTK_SCROLL_CODE
-    gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW(m_widget), m_wxwindow );
-    GtkViewport *viewport = GTK_VIEWPORT( GTK_BIN(s_window)->child );
+    if (m_windowStyle & wxRAISED_BORDER)
+    {
+        gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_OUT );
+    }
+    else if (m_windowStyle & wxSUNKEN_BORDER)
+    {
+        gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_IN );
+    }
+    else
+    {
+        gtk_myfixed_set_shadow_type( myfixed, GTK_SHADOW_NONE );
+    }
 #else
-    gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
     GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
-#endif
-
-#ifdef __WXDEBUG__
-    debug_focus_in( GTK_WIDGET(viewport), "wxWindow::viewport", name );
-#endif
 
     if (m_windowStyle & wxRAISED_BORDER)
     {
@@ -1455,6 +1522,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     {
         gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
     }
+#endif
 
     if (m_windowStyle & wxTAB_TRAVERSAL)
     {
@@ -1469,9 +1537,11 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
         m_acceptsFocus = TRUE;
     }
 
+#if (GTK_MINOR_VERSION == 0)
     // shut the viewport up
     gtk_viewport_set_hadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
     gtk_viewport_set_vadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
+#endif
 
     // I _really_ don't want scrollbars in the beginning
     m_vAdjust->lower = 0.0;
@@ -1505,7 +1575,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
     gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
           (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
 
-    // these handers het notified when screen updates are required either when
+    // these handlers get notified when screen updates are required either when
     // scrolling or when the window size (and therefore scrollbar configuration)
     // has changed
 
@@ -1695,11 +1765,19 @@ void wxWindow::PostCreation()
     
     if (m_wxwindow)
     {
+        /* these get reported to wxWindows -> wxPaintEvent */
         gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
           GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
 
         gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
           GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this );
+         
+       /* these are called when the "sunken" or "raised" borders are drawn */
+        gtk_signal_connect( GTK_OBJECT(m_widget), "expose_event",
+          GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );
+
+        gtk_signal_connect( GTK_OBJECT(m_widget), "draw",
+          GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );
     }
 
     ConnectWidget( GetConnectWidget() );
@@ -1928,38 +2006,39 @@ void wxWindow::DoSetClientSize( int width, int height )
             GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
             GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
 
-#ifdef NEW_GTK_SCROLL_CODE
-            GtkWidget *viewport = GTK_BIN(scroll_window)->child;
-#else
+#if (GTK_MINOR_VERSION == 0)
             GtkWidget *viewport = scroll_window->viewport;
-#endif
-
             GtkStyleClass *viewport_class = viewport->style->klass;
 
-            GtkWidget *hscrollbar = scroll_window->hscrollbar;
-            GtkWidget *vscrollbar = scroll_window->vscrollbar;
-
             if ((m_windowStyle & wxRAISED_BORDER) ||
                 (m_windowStyle & wxSUNKEN_BORDER))
             {
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
+#endif
+
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+           
+           we use this instead:  range.slider_width = 11 + 2*2pts edge 
+*/
 
             if (scroll_window->vscrollbar_visible)
             {
-                dw += vscrollbar->allocation.width;
+                dw += 15;   /* dw += vscrollbar->allocation.width; */
                 dw += scroll_class->scrollbar_spacing;
             }
 
             if (scroll_window->hscrollbar_visible)
             {
-                dh += hscrollbar->allocation.height;
+                dh += 15;   /* dh += hscrollbar->allocation.height; */
                 dw += scroll_class->scrollbar_spacing;
             }
        }
 
-      SetSize( width+dw, height+dh );
+       SetSize( width+dw, height+dh );
     }
 }
 
@@ -1993,12 +2072,8 @@ void wxWindow::GetClientSize( int *width, int *height ) const
             GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
             GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
 
-#ifdef NEW_GTK_SCROLL_CODE
-            GtkWidget *viewport = GTK_BIN(scroll_window)->child;
-#else
+#if (GTK_MINOR_VERSION == 0)
             GtkWidget *viewport = scroll_window->viewport;
-#endif
-
             GtkStyleClass *viewport_class = viewport->style->klass;
 
             if ((m_windowStyle & wxRAISED_BORDER) ||
@@ -2007,18 +2082,23 @@ void wxWindow::GetClientSize( int *width, int *height ) const
                 dw += 2 * viewport_class->xthickness;
                 dh += 2 * viewport_class->ythickness;
             }
+#endif
+/*
+            GtkWidget *hscrollbar = scroll_window->hscrollbar;
+            GtkWidget *vscrollbar = scroll_window->vscrollbar;
+           
+           we use this instead:  range.slider_width = 11 + 2*2pts edge 
+*/
 
             if (scroll_window->vscrollbar_visible)
             {
-//              dw += vscrollbar->allocation.width;
-                dw += 15;                               // range.slider_width = 11 + 2*2pts edge
+                dw += 15;   /* dw += vscrollbar->allocation.width; */
                 dw += scroll_class->scrollbar_spacing;
             }
 
             if (scroll_window->hscrollbar_visible)
             {
-//              dh += hscrollbar->allocation.height;
-                dh += 15;
+                dh += 15;   /* dh += hscrollbar->allocation.height; */
                 dh += scroll_class->scrollbar_spacing;
             }
         }
index c163aa031f29eeef9f2c4706b36c9df7ac0e5c9c..c88d82b05ed38efe313dcabe8ad64bc36bf98d8b 100644 (file)
@@ -4,7 +4,7 @@ Version: 2.1.0
 Release: 1
 Copyright: wxWindows Licence
 Group: X11/Libraries
-Source: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxGTK210.tgz
+Source: ftp://wesley.informatik.uni-freiburg.de/pub/linux/wxxt/source/wxGTK21b.tgz
 URL: http://www.freiburg.linux.de/~wxxt/docs.html
 Packager: Robert Roebling <roebling@ruf.uni-freiburg.de>
 Requires: gtk+ >= 1.2.0