Here it comes:

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
This commit is contained in:
Robert Roebling
1999-04-09 18:01:17 +00:00
parent c84fb40aab
commit 034be8882c
40 changed files with 1338 additions and 664 deletions

View File

@@ -54,6 +54,11 @@ cd generic
cp *.h ~/wxgtk_dist/wxGTK/include/wx/generic cp *.h ~/wxgtk_dist/wxGTK/include/wx/generic
cd .. 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 mkdir ~/wxgtk_dist/wxGTK/include/wx/gtk
cd gtk cd gtk
cp *.h ~/wxgtk_dist/wxGTK/include/wx/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 cp *.cpp ~/wxgtk_dist/wxGTK/src/gtk
cd .. cd ..
cd unix
mkdir ~/wxgtk_dist/wxGTK/src/unix
cp *.cpp ~/wxgtk_dist/wxGTK/src/unix
cd ..
cd generic cd generic
mkdir ~/wxgtk_dist/wxGTK/src/generic mkdir ~/wxgtk_dist/wxGTK/src/generic
cp *.cpp ~/wxgtk_dist/wxGTK/src/generic cp *.cpp ~/wxgtk_dist/wxGTK/src/generic

View File

@@ -6,12 +6,16 @@ like to read install instructions just do (in the base dir):
./configure ./configure
make make
su <type root password>
make install make install
ldconfig
exit
* The most simple errors * 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 although you are certainly sure you have. Well, you have
installed it, but you also have another version of the installed it, but you also have another version of the
GTK installed, which you may need to removed including 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. 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 It has to be a stable version, preferebly version 1.2.1. It might also
a version previous to 1.0.6 you'll might get crashes here and there. 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 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.
You can get the newest version of the GTK+ from the GTK homepage You can get the newest version of the GTK+ from the GTK homepage
at at
http://www.gtk.org 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. about downloading at my homepage.
* Additional libraries * Additional libraries
@@ -92,7 +94,10 @@ You can enable thread support by running
./configure "--with-threads" ./configure "--with-threads"
make clean make clean
make make
su <type root password>
make install make install
ldconfig
exit
NB: I included thread support in wxWindows/Gtk, as this NB: I included thread support in wxWindows/Gtk, as this
problem will disappear in the near future when all major problem will disappear in the near future when all major

View 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 you have downloaded version 2.1 of the GTK+ 1.2 port of
the wxWindows GUI library. 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: More information is available from my homepage at:
@@ -20,7 +23,10 @@ all systems
./configure ./configure
make make
su <type root password>
ldconfig
make install make install
exit
Type the following to make the samples 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... this has no effect, but I tried...
The library produced by the install process will be called 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 once a binary incompatible version of wxWindows/Gtk comes out
we'll augment library version number to avoid linking problems. we'll augment library version number to avoid linking problems.

View File

@@ -1,10 +1,13 @@
-------------------- High priority --------------------- -------------------- High priority ---------------------
DnD
-> Must be rewritten for GTK+ 1.2
-------------------- Medium priority --------------------- -------------------- Medium priority ---------------------
Show accelerator in menus and control labels and actually implement them Show accelerator control labels and actually implement them
-> Changed in GTK 1.2 (so let's do it for 1.2). Postponed. -> Changed in GTK 1.2 (so let's do it for 1.2). Difficult.
-------------------- Low priority --------------------- -------------------- Low priority ---------------------
@@ -13,9 +16,6 @@ Right aligned checkboxes: focus highlighting is wrong, tooltips can't be set
OwnerDraw for wxListCtrl and others OwnerDraw for wxListCtrl and others
-> Postponed. -> Postponed.
DnD
-> Must be rewritten for GTK+ 1.2
Implement wxPalette Implement wxPalette
-> I never understood that. Postponed. -> I never understood that. Postponed.

View File

@@ -1132,6 +1132,8 @@ typedef struct _GtkToolbar GtkToolbar;
typedef struct _GtkTooltips GtkTooltips; typedef struct _GtkTooltips GtkTooltips;
typedef struct _GtkNotebook GtkNotebook; typedef struct _GtkNotebook GtkNotebook;
typedef struct _GtkNotebookPage GtkNotebookPage; typedef struct _GtkNotebookPage GtkNotebookPage;
typedef struct _GtkAccelGroup GtkAccelGroup;
typedef struct _GtkItemFactory GtkItemFactory;
#endif #endif

View File

@@ -79,7 +79,9 @@ public:
bool m_ownsPrimarySelection; bool m_ownsPrimarySelection;
wxDataBroker *m_dataBroker; 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; bool m_formatSupported;
GdkAtom m_targetRequested; GdkAtom m_targetRequested;

View File

@@ -105,9 +105,9 @@ class wxMenu : public wxEvtHandler
DECLARE_DYNAMIC_CLASS(wxMenu) DECLARE_DYNAMIC_CLASS(wxMenu)
public: public:
// construction
wxMenu( const wxString& title = wxEmptyString, wxMenu( const wxString& title = wxEmptyString,
const wxFunction func = (wxFunction) NULL ); const wxFunction func = (wxFunction) NULL );
~wxMenu();
// operations // operations
// title // title
@@ -174,6 +174,9 @@ public:
GtkWidget *m_menu; // GtkMenu GtkWidget *m_menu; // GtkMenu
GtkWidget *m_owner; GtkWidget *m_owner;
GtkAccelGroup *m_accel;
GtkItemFactory *m_factory;
private: private:
wxString m_title; wxString m_title;
wxList m_items; wxList m_items;

View File

@@ -11,10 +11,10 @@
#ifndef __GTK_MYFIXED_H__ #ifndef __GTK_MYFIXED_H__
#define __GTK_MYFIXED_H__ #define __GTK_MYFIXED_H__
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtkcontainer.h> #include <gtk/gtkcontainer.h>
#include <gtk/gtkadjustment.h>
#include <gtk/gtkfeatures.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -33,13 +33,21 @@ typedef struct _GtkMyFixedChild GtkMyFixedChild;
struct _GtkMyFixed struct _GtkMyFixed
{ {
GtkContainer container; GtkContainer container;
GList *children; GList *children;
#if (GTK_MINOR_VERSION > 0)
GtkShadowType shadow_type;
#endif
}; };
struct _GtkMyFixedClass struct _GtkMyFixedClass
{ {
GtkContainerClass parent_class; GtkContainerClass parent_class;
#if (GTK_MINOR_VERSION > 0)
void (*set_scroll_adjustments) (GtkMyFixed *myfixed,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
#endif
}; };
struct _GtkMyFixedChild struct _GtkMyFixedChild
@@ -51,6 +59,10 @@ struct _GtkMyFixedChild
guint gtk_myfixed_get_type (void); guint gtk_myfixed_get_type (void);
GtkWidget* gtk_myfixed_new (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, void gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint16 x,
@@ -59,7 +71,6 @@ void gtk_myfixed_move (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint16 x,
gint16 y); gint16 y);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -98,16 +98,6 @@ private:
wxString m_data; wxString m_data;
}; };
//-----------------------------------------------------------------------------
// (debug)
//-----------------------------------------------------------------------------
#ifdef __WXDEBUG__
void debug_focus_in( GtkWidget* widget, const char* name, const char* window );
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxWindow // wxWindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -485,7 +475,7 @@ public:
GtkAdjustment *m_hAdjust,*m_vAdjust; GtkAdjustment *m_hAdjust,*m_vAdjust;
float m_oldHorizontalPos; float m_oldHorizontalPos;
float m_oldVerticalPos; float m_oldVerticalPos;
bool m_needParent; bool m_needParent; /* ! wxFrame, wxDialog, wxNotebookPage ? */
bool m_hasScrolling; bool m_hasScrolling;
bool m_isScrolling; bool m_isScrolling;
bool m_hasVMT; bool m_hasVMT;
@@ -493,8 +483,9 @@ public:
bool m_resizing; bool m_resizing;
GdkGC *m_scrollGC; GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle; GtkStyle *m_widgetStyle;
bool m_isStaticBox; bool m_isStaticBox; /* faster than IS_KIND_OF */
bool m_acceptsFocus; bool m_isFrame; /* faster than IS_KIND_OF */
bool m_acceptsFocus; /* ! wxStaticBox etc. */
wxInsertChildFunction m_insertCallback; wxInsertChildFunction m_insertCallback;

View File

@@ -79,7 +79,9 @@ public:
bool m_ownsPrimarySelection; bool m_ownsPrimarySelection;
wxDataBroker *m_dataBroker; 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; bool m_formatSupported;
GdkAtom m_targetRequested; GdkAtom m_targetRequested;

View File

@@ -105,9 +105,9 @@ class wxMenu : public wxEvtHandler
DECLARE_DYNAMIC_CLASS(wxMenu) DECLARE_DYNAMIC_CLASS(wxMenu)
public: public:
// construction
wxMenu( const wxString& title = wxEmptyString, wxMenu( const wxString& title = wxEmptyString,
const wxFunction func = (wxFunction) NULL ); const wxFunction func = (wxFunction) NULL );
~wxMenu();
// operations // operations
// title // title
@@ -174,6 +174,9 @@ public:
GtkWidget *m_menu; // GtkMenu GtkWidget *m_menu; // GtkMenu
GtkWidget *m_owner; GtkWidget *m_owner;
GtkAccelGroup *m_accel;
GtkItemFactory *m_factory;
private: private:
wxString m_title; wxString m_title;
wxList m_items; wxList m_items;

View File

@@ -11,10 +11,10 @@
#ifndef __GTK_MYFIXED_H__ #ifndef __GTK_MYFIXED_H__
#define __GTK_MYFIXED_H__ #define __GTK_MYFIXED_H__
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtkcontainer.h> #include <gtk/gtkcontainer.h>
#include <gtk/gtkadjustment.h>
#include <gtk/gtkfeatures.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -33,13 +33,21 @@ typedef struct _GtkMyFixedChild GtkMyFixedChild;
struct _GtkMyFixed struct _GtkMyFixed
{ {
GtkContainer container; GtkContainer container;
GList *children; GList *children;
#if (GTK_MINOR_VERSION > 0)
GtkShadowType shadow_type;
#endif
}; };
struct _GtkMyFixedClass struct _GtkMyFixedClass
{ {
GtkContainerClass parent_class; GtkContainerClass parent_class;
#if (GTK_MINOR_VERSION > 0)
void (*set_scroll_adjustments) (GtkMyFixed *myfixed,
GtkAdjustment *hadjustment,
GtkAdjustment *vadjustment);
#endif
}; };
struct _GtkMyFixedChild struct _GtkMyFixedChild
@@ -51,6 +59,10 @@ struct _GtkMyFixedChild
guint gtk_myfixed_get_type (void); guint gtk_myfixed_get_type (void);
GtkWidget* gtk_myfixed_new (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, void gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint16 x,
@@ -59,7 +71,6 @@ void gtk_myfixed_move (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
gint16 x, gint16 x,
gint16 y); gint16 y);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@@ -98,16 +98,6 @@ private:
wxString m_data; wxString m_data;
}; };
//-----------------------------------------------------------------------------
// (debug)
//-----------------------------------------------------------------------------
#ifdef __WXDEBUG__
void debug_focus_in( GtkWidget* widget, const char* name, const char* window );
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxWindow // wxWindow
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -485,7 +475,7 @@ public:
GtkAdjustment *m_hAdjust,*m_vAdjust; GtkAdjustment *m_hAdjust,*m_vAdjust;
float m_oldHorizontalPos; float m_oldHorizontalPos;
float m_oldVerticalPos; float m_oldVerticalPos;
bool m_needParent; bool m_needParent; /* ! wxFrame, wxDialog, wxNotebookPage ? */
bool m_hasScrolling; bool m_hasScrolling;
bool m_isScrolling; bool m_isScrolling;
bool m_hasVMT; bool m_hasVMT;
@@ -493,8 +483,9 @@ public:
bool m_resizing; bool m_resizing;
GdkGC *m_scrollGC; GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle; GtkStyle *m_widgetStyle;
bool m_isStaticBox; bool m_isStaticBox; /* faster than IS_KIND_OF */
bool m_acceptsFocus; bool m_isFrame; /* faster than IS_KIND_OF */
bool m_acceptsFocus; /* ! wxStaticBox etc. */
wxInsertChildFunction m_insertCallback; wxInsertChildFunction m_insertCallback;

View File

@@ -449,7 +449,7 @@ m_text(NULL), m_notebook(NULL)
wxPanel *panel = (wxPanel*) NULL; wxPanel *panel = (wxPanel*) NULL;
panel = new wxPanel(m_notebook); 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); m_listbox->SetCursor(*wxCROSS_CURSOR);
#if wxUSE_TOOLTIPS #if wxUSE_TOOLTIPS
m_listbox->SetToolTip( "This is a list box" ); 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_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_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) ); (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 #if wxUSE_TOOLTIPS
button->SetToolTip( "Press here to set italic font" ); button->SetToolTip( "Press here to set italic font" );
#endif // wxUSE_TOOLTIPS #endif // wxUSE_TOOLTIPS

View File

@@ -104,7 +104,7 @@ install::
$(includedir)/wx \ $(includedir)/wx \
$(includedir)/wx/gtk \ $(includedir)/wx/gtk \
$(includedir)/wx/motif \ $(includedir)/wx/motif \
$(includedir)/wx/common \ $(includedir)/wx/unix \
$(includedir)/wx/generic \ $(includedir)/wx/generic \
$(includedir)/wx/protocol \ $(includedir)/wx/protocol \
$(libdir)/wx/include/wx/gtk \ $(libdir)/wx/include/wx/gtk \
@@ -152,6 +152,12 @@ install::
rm -f $(includedir)/wx/protocol/$$f ; \ rm -f $(includedir)/wx/protocol/$$f ; \
$(INSTALL_DATA) $$f $(includedir)/wx/protocol/$$f ; \ $(INSTALL_DATA) $$f $(includedir)/wx/protocol/$$f ; \
done 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" @echo " Moving setup.h to library path"
@if test "@TOOLKIT@" = "GTK" ; then \ @if test "@TOOLKIT@" = "GTK" ; then \
cd $(WXBASEDIR)/src ; \ cd $(WXBASEDIR)/src ; \
@@ -172,12 +178,11 @@ install::
@cd $(WXBASEDIR)/src ; \ @cd $(WXBASEDIR)/src ; \
rm -f $(libdir)/$(STATIC_LIBRARY) ; \ rm -f $(libdir)/$(STATIC_LIBRARY) ; \
$(INSTALL_DATA) $(WXBASEDIR)/lib/$(OS)/$(STATIC_LIBRARY) $(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 \ @if test -f $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) ; then \
echo " Copying shared library" ; \ echo " Copying shared library" ; \
rm -f $(libdir)/lib$(LIB_TARGET).so* ; \ rm -f $(libdir)/lib$(LIB_TARGET).so* ; \
$(INSTALL_PROGRAM) $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) ; \ $(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.$(LIB_MAJOR) ; \
$(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so ; \ $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so ; \
echo " " ; \ echo " " ; \

View File

@@ -58,6 +58,9 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
long style, const wxValidator& validator, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
#if (GTK_MINOR_VERSION > 0)
m_acceptsFocus = TRUE;
#endif
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );

View File

@@ -15,6 +15,8 @@
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
#include "wx/utils.h"
#include "glib.h" #include "glib.h"
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
@@ -60,30 +62,49 @@ struct _GtkSelectionData
static void static void
targets_selection_received( GtkWidget *WXUNUSED(widget), targets_selection_received( GtkWidget *WXUNUSED(widget),
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
#if (GTK_MINOR_VERSION > 0)
guint32 WXUNUSED(time),
#endif
wxClipboard *clipboard ) wxClipboard *clipboard )
{ {
if (!wxTheClipboard) return; if (!wxTheClipboard)
{
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 form /* make sure we got the data in the correct form */
if (selection_data->type != GDK_SELECTION_TYPE_ATOM) return; if (selection_data->type != GDK_SELECTION_TYPE_ATOM)
{
clipboard->m_waiting = FALSE;
return;
}
// the atoms we received, holding a list of targets (= formats) // the atoms we received, holding a list of targets (= formats)
GdkAtom *atoms = (GdkAtom *)selection_data->data; GdkAtom *atoms = (GdkAtom *)selection_data->data;
for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++) for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++)
{ {
/*
char *name = gdk_atom_name (atoms[i]); char *name = gdk_atom_name (atoms[i]);
if (name) printf( "Format available: %s.\n", name ); if (name) printf( "Format available: %s.\n", name );
*/
if (atoms[i] == clipboard->m_targetRequested) if (atoms[i] == clipboard->m_targetRequested)
{ {
clipboard->m_waiting = FALSE;
clipboard->m_formatSupported = TRUE; clipboard->m_formatSupported = TRUE;
return; return;
} }
} }
clipboard->m_waiting = FALSE;
return; return;
} }
@@ -94,28 +115,50 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
static void static void
selection_received( GtkWidget *WXUNUSED(widget), selection_received( GtkWidget *WXUNUSED(widget),
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
#if (GTK_MINOR_VERSION > 0)
guint32 WXUNUSED(time),
#endif
wxClipboard *clipboard ) wxClipboard *clipboard )
{ {
if (!wxTheClipboard) return; if (!wxTheClipboard)
{
clipboard->m_waiting = FALSE;
return;
}
wxDataObject *data_object = clipboard->m_receivedData; 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 /* make sure we got the data in the correct format */
if (data_object->GetFormat().GetAtom() != selection_data->target)
{
clipboard->m_waiting = FALSE;
return;
}
if (data_object->GetFormat().GetAtom() != selection_data->target) 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()) switch (data_object->GetFormat().GetType())
{ {
case wxDF_TEXT: 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; wxTextDataObject *text_object = (wxTextDataObject *) data_object;
@@ -128,16 +171,22 @@ selection_received( GtkWidget *WXUNUSED(widget),
case wxDF_BITMAP: case wxDF_BITMAP:
{ {
if (selection_data->type != GDK_SELECTION_TYPE_BITMAP) return; if (selection_data->type != GDK_SELECTION_TYPE_BITMAP)
{
clipboard->m_waiting = FALSE;
return; return;
}
break; break;
} }
case wxDF_PRIVATE: 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; wxPrivateDataObject *private_object = (wxPrivateDataObject *) data_object;
@@ -148,11 +197,13 @@ selection_received( GtkWidget *WXUNUSED(widget),
default: default:
{ {
clipboard->m_waiting = FALSE;
return; return;
} }
} }
wxTheClipboard->m_formatSupported = TRUE; wxTheClipboard->m_formatSupported = TRUE;
clipboard->m_waiting = FALSE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -285,9 +336,26 @@ wxClipboard::wxClipboard()
m_receivedData = (wxDataObject*) NULL; 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 ); m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
gtk_widget_realize( m_clipboardWidget ); 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), gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
"selection_clear_event", "selection_clear_event",
GTK_SIGNAL_FUNC( selection_clear_clip ), GTK_SIGNAL_FUNC( selection_clear_clip ),
@@ -305,6 +373,7 @@ wxClipboard::~wxClipboard()
Clear(); Clear();
if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget ); if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
if (m_targetsWidget) gtk_widget_destroy( m_targetsWidget );
} }
void wxClipboard::Clear() void wxClipboard::Clear()
@@ -454,26 +523,24 @@ bool wxClipboard::IsSupported( wxDataFormat format )
wxCHECK_MSG( m_targetRequested, FALSE, "invalid clipboard 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; m_formatSupported = FALSE;
/* perform query. this will set m_formatSupported to /* perform query. this will set m_formatSupported to
* TRUE if m_targetRequested is supported */ 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 */
gtk_selection_convert( m_clipboardWidget, m_waiting = TRUE;
gtk_selection_convert( m_targetsWidget,
g_clipboardAtom, g_clipboardAtom,
g_targetsAtom, g_targetsAtom,
GDK_CURRENT_TIME ); GDK_CURRENT_TIME );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), while (m_waiting) gtk_main_iteration();
GTK_SIGNAL_FUNC( targets_selection_received ),
(gpointer) this );
if (!m_formatSupported) return FALSE; if (!m_formatSupported) return FALSE;
@@ -502,21 +569,23 @@ bool wxClipboard::GetData( wxDataObject *data )
m_formatSupported = FALSE; m_formatSupported = FALSE;
gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), /* ask for clipboard contents. this will set
"selection_received", m_formatSupported to TRUE if m_targetRequested
GTK_SIGNAL_FUNC( selection_received ), is supported.
(gpointer) this ); 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, gtk_selection_convert( m_clipboardWidget,
g_clipboardAtom, g_clipboardAtom,
m_targetRequested, m_targetRequested,
GDK_CURRENT_TIME ); GDK_CURRENT_TIME );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), while (m_waiting) gtk_main_iteration();
GTK_SIGNAL_FUNC( selection_received ),
(gpointer) this );
/* this is a true error as we checked for the presence of such data before */ /* this is a true error as we checked for the presence of such data before */

View File

@@ -13,6 +13,8 @@
#include "wx/control.h" #include "wx/control.h"
#include "gtk/gtkfeatures.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxControl // wxControl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -32,7 +32,7 @@ IMPLEMENT_CLASS(wxDataFormat, wxObject)
wxDataFormat::wxDataFormat() 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_type = wxDF_INVALID;
m_hasAtom = FALSE; m_hasAtom = FALSE;
m_atom = (GdkAtom) 0; m_atom = (GdkAtom) 0;
@@ -40,19 +40,19 @@ wxDataFormat::wxDataFormat()
wxDataFormat::wxDataFormat( wxDataType type ) 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 ); SetType( type );
} }
wxDataFormat::wxDataFormat( const wxString &id ) 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 ); SetId( id );
} }
wxDataFormat::wxDataFormat( wxDataFormat &format ) 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_type = format.GetType();
m_id = format.GetId(); m_id = format.GetId();
m_hasAtom = TRUE; m_hasAtom = TRUE;
@@ -61,7 +61,7 @@ wxDataFormat::wxDataFormat( wxDataFormat &format )
wxDataFormat::wxDataFormat( const GdkAtom atom ) 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_hasAtom = TRUE;
m_atom = atom; m_atom = atom;
@@ -91,7 +91,7 @@ void wxDataFormat::SetType( wxDataType type )
if (m_type == wxDF_TEXT) if (m_type == wxDF_TEXT)
{ {
m_id = "text/plain"; m_id = "STRING";
} }
else else
if (m_type == wxDF_BITMAP) if (m_type == wxDF_BITMAP)

View File

@@ -145,6 +145,27 @@ bool wxDialog::Create( wxWindow *parent,
gtk_widget_realize( m_widget ); 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_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );

View File

@@ -171,6 +171,27 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
gtk_widget_realize( m_widget ); 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_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );

View File

@@ -192,8 +192,16 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
SetValidator( validator ); SetValidator( validator );
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL ); m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
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_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
}
m_list = GTK_LIST( gtk_list_new() ); 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) ); gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
#endif #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) ); gtk_widget_show( GTK_WIDGET(m_list) );
wxSize newSize = size; wxSize newSize = size;
@@ -252,10 +241,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
list_item = gtk_list_item_new_with_label( str ); 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_container_add( GTK_CONTAINER(m_list), list_item );
gtk_signal_connect( GTK_OBJECT(list_item), "select", gtk_signal_connect( GTK_OBJECT(list_item), "select",

View File

@@ -72,19 +72,22 @@ wxMenuBar::wxMenuBar()
void wxMenuBar::Append( wxMenu *menu, const wxString &title ) void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{ {
m_menus.Append( menu ); m_menus.Append( menu );
wxString title2 = title;
int pos; wxString s = "";
do for ( const char *pc = title; *pc != '\0'; pc++ )
{ {
pos = title2.First( '&' ); if (*pc == '&')
if (pos != wxNOT_FOUND) {
title2.Remove( pos, 1 ); pc++; /* skip it */
} while (pos != wxNOT_FOUND); #if (GTK_MINOR_VERSION > 0)
// s << '_'; not yet
#endif
}
s << *pc;
}
menu->SetTitle(title2); menu->SetTitle(s);
menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(s) );
menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(title2) );
gtk_widget_show( menu->m_owner ); gtk_widget_show( menu->m_owner );
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu ); 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 = ""; m_text = "";
for ( const char *pc = str; *pc != '\0'; pc++ ) 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; m_text << *pc;
} }
@@ -457,7 +466,14 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
m_title = title; m_title = title;
m_items.DeleteContents( TRUE ); m_items.DeleteContents( TRUE );
m_invokingWindow = (wxWindow *) NULL; 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! m_menu = gtk_menu_new(); // Do not show!
#endif
m_callback = func; m_callback = func;
m_eventHandler = this; m_eventHandler = this;
@@ -473,6 +489,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
m_owner = (GtkWidget*) NULL; m_owner = (GtkWidget*) NULL;
} }
wxMenu::~wxMenu()
{
/* how do we delete an item-factory ? */
}
void wxMenu::SetTitle( const wxString& title ) void wxMenu::SetTitle( const wxString& title )
{ {
// TODO Waiting for something better // TODO Waiting for something better
@@ -492,6 +513,7 @@ void wxMenu::AppendSeparator()
GtkWidget *menuItem = gtk_menu_item_new(); GtkWidget *menuItem = gtk_menu_item_new();
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
mitem->SetMenuItem(menuItem); mitem->SetMenuItem(menuItem);
m_items.Append( mitem ); m_items.Append( mitem );
} }
@@ -504,25 +526,58 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
mitem->SetHelp(helpStr); mitem->SetHelp(helpStr);
mitem->SetCheckable(checkable); mitem->SetCheckable(checkable);
const char *text = mitem->GetText(); 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) GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
: gtk_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_connect( GTK_OBJECT(menuItem), "activate",
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
(gpointer*)this ); (gpointer)this );
gtk_signal_connect( GTK_OBJECT(menuItem), "select",
GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
(gpointer*)this );
gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
(gpointer*)this );
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
#endif
gtk_signal_connect( GTK_OBJECT(menuItem), "select",
GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
(gpointer)this );
gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
(gpointer)this );
mitem->SetMenuItem(menuItem);
m_items.Append( mitem ); m_items.Append( mitem );
} }
@@ -590,14 +645,18 @@ void wxMenu::Append( wxMenuItem *item )
int wxMenu::FindItem( const wxString itemString ) const int wxMenu::FindItem( const wxString itemString ) const
{ {
wxString s( itemString ); wxString s = "";
for ( const char *pc = itemString; *pc != '\0'; pc++ )
int pos;
do
{ {
pos = s.First( '&' ); if (*pc == '&')
if (pos != -1) s.Remove( pos, 1 ); {
} while (pos != -1); pc++; /* skip it */
#if (GTK_MINOR_VERSION > 0)
s << '_';
#endif
}
s << *pc;
}
wxNode *node = m_items.First(); wxNode *node = m_items.First();
while (node) while (node)

View File

@@ -233,10 +233,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
m_widget = gtk_notebook_new(); 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 ); gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_idHandler = gtk_signal_connect ( m_idHandler = gtk_signal_connect (

View File

@@ -37,9 +37,9 @@ extern bool g_blockEventsOnDrag;
static void static void
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) 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 ); wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
event.SetString( win->GetValue() ); 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 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(); win->CalculateScrollbar();
} }
@@ -124,19 +126,19 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
SetValidator( validator ); SetValidator( validator );
m_vScrollbarVisible = TRUE; m_vScrollbarVisible = FALSE;
bool multi_line = (style & wxTE_MULTILINE) != 0; bool multi_line = (style & wxTE_MULTILINE) != 0;
if ( multi_line ) if ( multi_line )
{ {
// a multi-line edit control: create a vertical scrollbar by default and /* a multi-line edit control: create a vertical scrollbar by default and
// horizontal if requested horizontal if requested */
bool bHasHScrollbar = (style & wxHSCROLL) != 0; bool bHasHScrollbar = (style & wxHSCROLL) != 0;
// create our control... /* create our control ... */
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); 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); m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); 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), (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
0, 0); 0, 0);
// put the horizontal scrollbar in the lower left hand corner /* put the horizontal scrollbar in the lower left hand corner */
if (bHasHScrollbar) if (bHasHScrollbar)
{ {
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj); 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); gtk_widget_show(hscrollbar);
} }
// finally, put the vertical scrollbar in the upper right corner /* we create the vertical scrollbar on demand */
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj ); m_vScrollbar = (GtkWidget*) NULL;
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 );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_text_size_callback), (gpointer)this );
} }
else else
{ {
// a single-line text control: no need for scrollbars /* a single-line text control: no need for scrollbars */
m_widget = m_widget =
m_text = gtk_entry_new(); m_text = gtk_entry_new();
} }
@@ -195,7 +188,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_widget_show(m_text); 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_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
@@ -229,11 +222,17 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_text_set_editable( GTK_TEXT(m_text), 1 ); gtk_text_set_editable( GTK_TEXT(m_text), 1 );
} }
Show( TRUE );
SetBackgroundColour( parent->GetBackgroundColour() ); SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() ); SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
if (multi_line)
{
gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
(GtkSignalFunc) gtk_scrollbar_changed_callback, (gpointer) this );
}
return TRUE; return TRUE;
} }
@@ -256,6 +255,18 @@ void wxTextCtrl::CalculateScrollbar()
{ {
if (!m_vScrollbarVisible) if (!m_vScrollbarVisible)
{ {
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 ); gtk_widget_show( m_vScrollbar );
m_vScrollbarVisible = TRUE; m_vScrollbarVisible = TRUE;

View File

@@ -8,15 +8,7 @@
/////////////////////////////////////////////////////////////////////////// */ /////////////////////////////////////////////////////////////////////////// */
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include <gtk/gtkfeatures.h> #include "gtk/gtksignal.h"
/*-------------------------------------------------------------------------
// conditional compilation
//------------------------------------------------------------------------- */
#if (GTK_MINOR_VERSION > 0)
#define NEW_GTK_CONSTRUCT_CODE
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -25,7 +17,7 @@ extern "C" {
static void gtk_myfixed_class_init (GtkMyFixedClass *klass); static void gtk_myfixed_class_init (GtkMyFixedClass *klass);
static void gtk_myfixed_init (GtkMyFixed *myfixed); static void gtk_myfixed_init (GtkMyFixed *myfixed);
static void gtk_myfixed_map (GtkWidget *widget); static void gtk_myfixed_map (GtkWidget *widget);
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION == 0)
static void gtk_myfixed_unmap (GtkWidget *widget); static void gtk_myfixed_unmap (GtkWidget *widget);
#endif #endif
static void gtk_myfixed_realize (GtkWidget *widget); static void gtk_myfixed_realize (GtkWidget *widget);
@@ -49,14 +41,20 @@ static void gtk_myfixed_foreach (GtkContainer *container,
#endif #endif
GtkCallback callback, GtkCallback callback,
gpointer callback_data); gpointer callback_data);
#ifdef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
static GtkType gtk_myfixed_child_type (GtkContainer *container); static GtkType gtk_myfixed_child_type (GtkContainer *container);
#endif #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 guint
gtk_myfixed_get_type () gtk_myfixed_get_type ()
{ {
@@ -71,13 +69,13 @@ gtk_myfixed_get_type ()
sizeof (GtkMyFixedClass), sizeof (GtkMyFixedClass),
(GtkClassInitFunc) gtk_myfixed_class_init, (GtkClassInitFunc) gtk_myfixed_class_init,
(GtkObjectInitFunc) gtk_myfixed_init, (GtkObjectInitFunc) gtk_myfixed_init,
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
#else
/* reserved_1 */ NULL, /* reserved_1 */ NULL,
/* reserved_2 */ NULL, /* reserved_2 */ NULL,
(GtkClassInitFunc) NULL, (GtkClassInitFunc) NULL,
#else
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
#endif #endif
}; };
@@ -98,14 +96,14 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass; container_class = (GtkContainerClass*) klass;
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
parent_class = gtk_type_class (gtk_container_get_type ());
#else
parent_class = gtk_type_class (GTK_TYPE_CONTAINER); parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
#else
parent_class = gtk_type_class (gtk_container_get_type ());
#endif #endif
widget_class->map = gtk_myfixed_map; widget_class->map = gtk_myfixed_map;
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION == 0)
widget_class->unmap = gtk_myfixed_unmap; widget_class->unmap = gtk_myfixed_unmap;
#endif #endif
widget_class->realize = gtk_myfixed_realize; widget_class->realize = gtk_myfixed_realize;
@@ -122,12 +120,24 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
container_class->foreach = gtk_myfixed_foreach; container_class->foreach = gtk_myfixed_foreach;
#endif #endif
#ifdef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
container_class->child_type = gtk_myfixed_child_type; container_class->child_type = gtk_myfixed_child_type;
#endif #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 static GtkType
gtk_myfixed_child_type (GtkContainer *container) gtk_myfixed_child_type (GtkContainer *container)
{ {
@@ -140,10 +150,14 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
{ {
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW); 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); GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
#endif #endif
#if (GTK_MINOR_VERSION > 0)
myfixed->shadow_type = GTK_SHADOW_NONE;
#endif
myfixed->children = NULL; myfixed->children = NULL;
} }
@@ -157,6 +171,34 @@ gtk_myfixed_new ()
return GTK_WIDGET (myfixed); 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 void
gtk_myfixed_put (GtkMyFixed *myfixed, gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
@@ -249,7 +291,7 @@ gtk_myfixed_map (GtkWidget *widget)
} }
} }
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION == 0)
static void static void
gtk_myfixed_unmap (GtkWidget *widget) gtk_myfixed_unmap (GtkWidget *widget)
{ {
@@ -275,10 +317,26 @@ gtk_myfixed_realize (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD; 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.x = widget->allocation.x;
attributes.y = widget->allocation.y; attributes.y = widget->allocation.y;
attributes.width = 32000; attributes.width = 32000;
attributes.height = 32000; attributes.height = 32000;
#endif
attributes.wclass = GDK_INPUT_OUTPUT; attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget); attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget); attributes.colormap = gtk_widget_get_colormap (widget);
@@ -344,10 +402,10 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkMyFixed *myfixed; GtkMyFixed *myfixed;
gint border;
GtkMyFixedChild *child; GtkMyFixedChild *child;
GtkAllocation child_allocation; GtkAllocation child_allocation;
GList *children; GList *children;
guint16 border_width;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED(widget)); g_return_if_fail (GTK_IS_MYFIXED(widget));
@@ -355,11 +413,22 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
myfixed = GTK_MYFIXED (widget); myfixed = GTK_MYFIXED (widget);
if (myfixed->shadow_type == GTK_SHADOW_NONE)
border = 0;
else
border = 2;
widget->allocation = *allocation; widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window, allocation->x, allocation->y, 32000, 32000 ); {
gdk_window_move_resize( widget->window,
border_width = GTK_CONTAINER (myfixed)->border_width; allocation->x+border, allocation->y+border,
#if (GTK_MINOR_VERSION > 0)
allocation->width-border*2, allocation->height-border*2 );
#else
32000, 32000 );
#endif
}
children = myfixed->children; children = myfixed->children;
while (children) while (children)
@@ -369,8 +438,8 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (child->widget)) if (GTK_WIDGET_VISIBLE (child->widget))
{ {
child_allocation.x = child->x + border_width; child_allocation.x = child->x;
child_allocation.y = child->y + border_width; child_allocation.y = child->y;
child_allocation.width = child->widget->requisition.width; child_allocation.width = child->widget->requisition.width;
child_allocation.height = child->widget->requisition.height; child_allocation.height = child->widget->requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation); gtk_widget_size_allocate (child->widget, &child_allocation);

View File

@@ -122,47 +122,10 @@
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// conditional compilation // constants
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#if (GTK_MINOR_VERSION > 0) #define FRAME_BORDER_WIDTH 2
#define NEW_GTK_SCROLL_CODE
#endif
//-----------------------------------------------------------------------------
// (debug)
//-----------------------------------------------------------------------------
#ifdef __WXDEBUG__
static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
GdkEvent *WXUNUSED(event),
const char *name )
{
printf( "FOCUS NOW AT: " );
printf( name );
printf( "\n" );
return FALSE;
}
void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
{
return;
wxString tmp = name;
tmp += " FROM ";
tmp += window;
char *s = new char[tmp.Length()+1];
strcpy( s, WXSTRINGCAST tmp );
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
}
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// data // data
@@ -174,12 +137,105 @@ extern bool g_blockEventsOnScroll;
static bool g_capturing = FALSE; static bool g_capturing = FALSE;
static wxWindow *g_focusWindow = (wxWindow*) NULL; static wxWindow *g_focusWindow = (wxWindow*) NULL;
// hack: we need something to pass to gtk_menu_popup, so we store the time of /* hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here the last click here */
static guint32 gs_timeLastClick = 0; static guint32 gs_timeLastClick = 0;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "expose_event" (of m_wxwindow, not of m_widget) // local code (see below)
//-----------------------------------------------------------------------------
static void draw_frame( GtkWidget *widget, wxWindow *win )
{
if (!win->HasVMT()) return;
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 );
/*
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 += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing;
}
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;
}
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
{
if (gdk_event->count > 0) return;
draw_frame( widget, win );
}
//-----------------------------------------------------------------------------
// "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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win ) 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 ) 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) if (ret)
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" ); 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.m_y = 0;
event.SetEventObject( win ); event.SetEventObject( win );
bool ret = win->GetEventHandler()->ProcessEvent( event ); if (win->GetEventHandler()->ProcessEvent( event ))
if (ret)
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_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 ) 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_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE; if (g_blockEventsOnScroll) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (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 " ); printf( "OnButtonPress from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) 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; gs_timeLastClick = gdk_event->time;
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_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 ) static gint gtk_window_button_release_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 FALSE;
if (g_blockEventsOnScroll) return FALSE;
if (g_blockEventsOnDrag) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
if (g_blockEventsOnScroll) return TRUE;
if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnButtonRelease from " ); printf( "OnButtonRelease from " );
@@ -766,9 +823,12 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_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 ) 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) if (gdk_event->is_hint)
{ {
int x = 0; int x = 0;
@@ -788,13 +854,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
gdk_event->state = state; 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 " ); printf( "OnMotion from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -875,9 +934,12 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "motion_notify_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 ) 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; 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 " ); printf( "OnSetFocus from " );
@@ -919,9 +981,12 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_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 ) 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 (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS); GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
} }
if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnKillFocus from " ); printf( "OnKillFocus from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -950,9 +1015,12 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_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 ) 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)) if ((widget->window) && (win->m_cursor))
gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); 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 " ); printf( "OnEnter from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) 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; event.m_y -= pt.y;
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_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 ) 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)) if ((widget->window) && (win->m_cursor))
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); 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 " ); printf( "OnLeave from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) 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; event.m_y -= pt.y;
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_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 ); m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); 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); 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 ); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
scroll_class->scrollbar_spacing = 0; scroll_class->scrollbar_spacing = 0;
@@ -1427,21 +1490,25 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
m_wxwindow = gtk_myfixed_new(); m_wxwindow = gtk_myfixed_new();
#ifdef __WXDEBUG__
debug_focus_in( m_wxwindow, "wxWindow::m_wxwindow", name );
#endif
#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 );
#else
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
#endif
#ifdef __WXDEBUG__ #if (GTK_MINOR_VERSION > 0)
debug_focus_in( GTK_WIDGET(viewport), "wxWindow::viewport", name ); GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
#endif
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
GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
if (m_windowStyle & wxRAISED_BORDER) 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 ); gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
} }
#endif
if (m_windowStyle & wxTAB_TRAVERSAL) if (m_windowStyle & wxTAB_TRAVERSAL)
{ {
@@ -1469,9 +1537,11 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
m_acceptsFocus = TRUE; m_acceptsFocus = TRUE;
} }
#if (GTK_MINOR_VERSION == 0)
// shut the viewport up // 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_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) ); 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 // I _really_ don't want scrollbars in the beginning
m_vAdjust->lower = 0.0; 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", gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); (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) // scrolling or when the window size (and therefore scrollbar configuration)
// has changed // has changed
@@ -1695,11 +1765,19 @@ void wxWindow::PostCreation()
if (m_wxwindow) if (m_wxwindow)
{ {
/* these get reported to wxWindows -> wxPaintEvent */
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); 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() ); ConnectWidget( GetConnectWidget() );
@@ -1928,33 +2006,34 @@ void wxWindow::DoSetClientSize( int width, int height )
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass ); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
#ifdef NEW_GTK_SCROLL_CODE #if (GTK_MINOR_VERSION == 0)
GtkWidget *viewport = GTK_BIN(scroll_window)->child;
#else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif
GtkStyleClass *viewport_class = viewport->style->klass; GtkStyleClass *viewport_class = viewport->style->klass;
GtkWidget *hscrollbar = scroll_window->hscrollbar;
GtkWidget *vscrollbar = scroll_window->vscrollbar;
if ((m_windowStyle & wxRAISED_BORDER) || if ((m_windowStyle & wxRAISED_BORDER) ||
(m_windowStyle & wxSUNKEN_BORDER)) (m_windowStyle & wxSUNKEN_BORDER))
{ {
dw += 2 * viewport_class->xthickness; dw += 2 * viewport_class->xthickness;
dh += 2 * viewport_class->ythickness; 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) if (scroll_window->vscrollbar_visible)
{ {
dw += vscrollbar->allocation.width; dw += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing; dw += scroll_class->scrollbar_spacing;
} }
if (scroll_window->hscrollbar_visible) if (scroll_window->hscrollbar_visible)
{ {
dh += hscrollbar->allocation.height; dh += 15; /* dh += hscrollbar->allocation.height; */
dw += scroll_class->scrollbar_spacing; dw += scroll_class->scrollbar_spacing;
} }
} }
@@ -1993,12 +2072,8 @@ void wxWindow::GetClientSize( int *width, int *height ) const
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass ); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
#ifdef NEW_GTK_SCROLL_CODE #if (GTK_MINOR_VERSION == 0)
GtkWidget *viewport = GTK_BIN(scroll_window)->child;
#else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif
GtkStyleClass *viewport_class = viewport->style->klass; GtkStyleClass *viewport_class = viewport->style->klass;
if ((m_windowStyle & wxRAISED_BORDER) || if ((m_windowStyle & wxRAISED_BORDER) ||
@@ -2007,18 +2082,23 @@ void wxWindow::GetClientSize( int *width, int *height ) const
dw += 2 * viewport_class->xthickness; dw += 2 * viewport_class->xthickness;
dh += 2 * viewport_class->ythickness; 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) if (scroll_window->vscrollbar_visible)
{ {
// dw += vscrollbar->allocation.width; dw += 15; /* dw += vscrollbar->allocation.width; */
dw += 15; // range.slider_width = 11 + 2*2pts edge
dw += scroll_class->scrollbar_spacing; dw += scroll_class->scrollbar_spacing;
} }
if (scroll_window->hscrollbar_visible) if (scroll_window->hscrollbar_visible)
{ {
// dh += hscrollbar->allocation.height; dh += 15; /* dh += hscrollbar->allocation.height; */
dh += 15;
dh += scroll_class->scrollbar_spacing; dh += scroll_class->scrollbar_spacing;
} }
} }

View File

@@ -58,6 +58,9 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
long style, const wxValidator& validator, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
#if (GTK_MINOR_VERSION > 0)
m_acceptsFocus = TRUE;
#endif
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );

View File

@@ -15,6 +15,8 @@
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
#include "wx/utils.h"
#include "glib.h" #include "glib.h"
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gtk/gtk.h" #include "gtk/gtk.h"
@@ -60,30 +62,49 @@ struct _GtkSelectionData
static void static void
targets_selection_received( GtkWidget *WXUNUSED(widget), targets_selection_received( GtkWidget *WXUNUSED(widget),
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
#if (GTK_MINOR_VERSION > 0)
guint32 WXUNUSED(time),
#endif
wxClipboard *clipboard ) wxClipboard *clipboard )
{ {
if (!wxTheClipboard) return; if (!wxTheClipboard)
{
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 form /* make sure we got the data in the correct form */
if (selection_data->type != GDK_SELECTION_TYPE_ATOM) return; if (selection_data->type != GDK_SELECTION_TYPE_ATOM)
{
clipboard->m_waiting = FALSE;
return;
}
// the atoms we received, holding a list of targets (= formats) // the atoms we received, holding a list of targets (= formats)
GdkAtom *atoms = (GdkAtom *)selection_data->data; GdkAtom *atoms = (GdkAtom *)selection_data->data;
for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++) for (unsigned int i=0; i<selection_data->length/sizeof(GdkAtom); i++)
{ {
/*
char *name = gdk_atom_name (atoms[i]); char *name = gdk_atom_name (atoms[i]);
if (name) printf( "Format available: %s.\n", name ); if (name) printf( "Format available: %s.\n", name );
*/
if (atoms[i] == clipboard->m_targetRequested) if (atoms[i] == clipboard->m_targetRequested)
{ {
clipboard->m_waiting = FALSE;
clipboard->m_formatSupported = TRUE; clipboard->m_formatSupported = TRUE;
return; return;
} }
} }
clipboard->m_waiting = FALSE;
return; return;
} }
@@ -94,28 +115,50 @@ targets_selection_received( GtkWidget *WXUNUSED(widget),
static void static void
selection_received( GtkWidget *WXUNUSED(widget), selection_received( GtkWidget *WXUNUSED(widget),
GtkSelectionData *selection_data, GtkSelectionData *selection_data,
#if (GTK_MINOR_VERSION > 0)
guint32 WXUNUSED(time),
#endif
wxClipboard *clipboard ) wxClipboard *clipboard )
{ {
if (!wxTheClipboard) return; if (!wxTheClipboard)
{
clipboard->m_waiting = FALSE;
return;
}
wxDataObject *data_object = clipboard->m_receivedData; 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 /* make sure we got the data in the correct format */
if (data_object->GetFormat().GetAtom() != selection_data->target)
{
clipboard->m_waiting = FALSE;
return;
}
if (data_object->GetFormat().GetAtom() != selection_data->target) 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()) switch (data_object->GetFormat().GetType())
{ {
case wxDF_TEXT: 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; wxTextDataObject *text_object = (wxTextDataObject *) data_object;
@@ -128,16 +171,22 @@ selection_received( GtkWidget *WXUNUSED(widget),
case wxDF_BITMAP: case wxDF_BITMAP:
{ {
if (selection_data->type != GDK_SELECTION_TYPE_BITMAP) return; if (selection_data->type != GDK_SELECTION_TYPE_BITMAP)
{
clipboard->m_waiting = FALSE;
return; return;
}
break; break;
} }
case wxDF_PRIVATE: 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; wxPrivateDataObject *private_object = (wxPrivateDataObject *) data_object;
@@ -148,11 +197,13 @@ selection_received( GtkWidget *WXUNUSED(widget),
default: default:
{ {
clipboard->m_waiting = FALSE;
return; return;
} }
} }
wxTheClipboard->m_formatSupported = TRUE; wxTheClipboard->m_formatSupported = TRUE;
clipboard->m_waiting = FALSE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -285,9 +336,26 @@ wxClipboard::wxClipboard()
m_receivedData = (wxDataObject*) NULL; 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 ); m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
gtk_widget_realize( m_clipboardWidget ); 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), gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
"selection_clear_event", "selection_clear_event",
GTK_SIGNAL_FUNC( selection_clear_clip ), GTK_SIGNAL_FUNC( selection_clear_clip ),
@@ -305,6 +373,7 @@ wxClipboard::~wxClipboard()
Clear(); Clear();
if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget ); if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
if (m_targetsWidget) gtk_widget_destroy( m_targetsWidget );
} }
void wxClipboard::Clear() void wxClipboard::Clear()
@@ -454,26 +523,24 @@ bool wxClipboard::IsSupported( wxDataFormat format )
wxCHECK_MSG( m_targetRequested, FALSE, "invalid clipboard 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; m_formatSupported = FALSE;
/* perform query. this will set m_formatSupported to /* perform query. this will set m_formatSupported to
* TRUE if m_targetRequested is supported */ 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 */
gtk_selection_convert( m_clipboardWidget, m_waiting = TRUE;
gtk_selection_convert( m_targetsWidget,
g_clipboardAtom, g_clipboardAtom,
g_targetsAtom, g_targetsAtom,
GDK_CURRENT_TIME ); GDK_CURRENT_TIME );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), while (m_waiting) gtk_main_iteration();
GTK_SIGNAL_FUNC( targets_selection_received ),
(gpointer) this );
if (!m_formatSupported) return FALSE; if (!m_formatSupported) return FALSE;
@@ -502,21 +569,23 @@ bool wxClipboard::GetData( wxDataObject *data )
m_formatSupported = FALSE; m_formatSupported = FALSE;
gtk_signal_connect( GTK_OBJECT(m_clipboardWidget), /* ask for clipboard contents. this will set
"selection_received", m_formatSupported to TRUE if m_targetRequested
GTK_SIGNAL_FUNC( selection_received ), is supported.
(gpointer) this ); 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, gtk_selection_convert( m_clipboardWidget,
g_clipboardAtom, g_clipboardAtom,
m_targetRequested, m_targetRequested,
GDK_CURRENT_TIME ); GDK_CURRENT_TIME );
gtk_signal_disconnect_by_func( GTK_OBJECT(m_clipboardWidget), while (m_waiting) gtk_main_iteration();
GTK_SIGNAL_FUNC( selection_received ),
(gpointer) this );
/* this is a true error as we checked for the presence of such data before */ /* this is a true error as we checked for the presence of such data before */

View File

@@ -13,6 +13,8 @@
#include "wx/control.h" #include "wx/control.h"
#include "gtk/gtkfeatures.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxControl // wxControl
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -32,7 +32,7 @@ IMPLEMENT_CLASS(wxDataFormat, wxObject)
wxDataFormat::wxDataFormat() 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_type = wxDF_INVALID;
m_hasAtom = FALSE; m_hasAtom = FALSE;
m_atom = (GdkAtom) 0; m_atom = (GdkAtom) 0;
@@ -40,19 +40,19 @@ wxDataFormat::wxDataFormat()
wxDataFormat::wxDataFormat( wxDataType type ) 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 ); SetType( type );
} }
wxDataFormat::wxDataFormat( const wxString &id ) 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 ); SetId( id );
} }
wxDataFormat::wxDataFormat( wxDataFormat &format ) 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_type = format.GetType();
m_id = format.GetId(); m_id = format.GetId();
m_hasAtom = TRUE; m_hasAtom = TRUE;
@@ -61,7 +61,7 @@ wxDataFormat::wxDataFormat( wxDataFormat &format )
wxDataFormat::wxDataFormat( const GdkAtom atom ) 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_hasAtom = TRUE;
m_atom = atom; m_atom = atom;
@@ -91,7 +91,7 @@ void wxDataFormat::SetType( wxDataType type )
if (m_type == wxDF_TEXT) if (m_type == wxDF_TEXT)
{ {
m_id = "text/plain"; m_id = "STRING";
} }
else else
if (m_type == wxDF_BITMAP) if (m_type == wxDF_BITMAP)

View File

@@ -145,6 +145,27 @@ bool wxDialog::Create( wxWindow *parent,
gtk_widget_realize( m_widget ); 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_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );

View File

@@ -171,6 +171,27 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
gtk_widget_realize( m_widget ); 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_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );

View File

@@ -192,8 +192,16 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
SetValidator( validator ); SetValidator( validator );
m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL ); m_widget = gtk_scrolled_window_new( (GtkAdjustment*) NULL, (GtkAdjustment*) NULL );
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_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
}
m_list = GTK_LIST( gtk_list_new() ); 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) ); gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
#endif #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) ); gtk_widget_show( GTK_WIDGET(m_list) );
wxSize newSize = size; wxSize newSize = size;
@@ -252,10 +241,6 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
list_item = gtk_list_item_new_with_label( str ); 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_container_add( GTK_CONTAINER(m_list), list_item );
gtk_signal_connect( GTK_OBJECT(list_item), "select", gtk_signal_connect( GTK_OBJECT(list_item), "select",

View File

@@ -72,19 +72,22 @@ wxMenuBar::wxMenuBar()
void wxMenuBar::Append( wxMenu *menu, const wxString &title ) void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{ {
m_menus.Append( menu ); m_menus.Append( menu );
wxString title2 = title;
int pos; wxString s = "";
do for ( const char *pc = title; *pc != '\0'; pc++ )
{ {
pos = title2.First( '&' ); if (*pc == '&')
if (pos != wxNOT_FOUND) {
title2.Remove( pos, 1 ); pc++; /* skip it */
} while (pos != wxNOT_FOUND); #if (GTK_MINOR_VERSION > 0)
// s << '_'; not yet
#endif
}
s << *pc;
}
menu->SetTitle(title2); menu->SetTitle(s);
menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(s) );
menu->m_owner = gtk_menu_item_new_with_label( WXSTRINGCAST(title2) );
gtk_widget_show( menu->m_owner ); gtk_widget_show( menu->m_owner );
gtk_menu_item_set_submenu( GTK_MENU_ITEM(menu->m_owner), menu->m_menu ); 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 = ""; m_text = "";
for ( const char *pc = str; *pc != '\0'; pc++ ) 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; m_text << *pc;
} }
@@ -457,7 +466,14 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
m_title = title; m_title = title;
m_items.DeleteContents( TRUE ); m_items.DeleteContents( TRUE );
m_invokingWindow = (wxWindow *) NULL; 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! m_menu = gtk_menu_new(); // Do not show!
#endif
m_callback = func; m_callback = func;
m_eventHandler = this; m_eventHandler = this;
@@ -473,6 +489,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
m_owner = (GtkWidget*) NULL; m_owner = (GtkWidget*) NULL;
} }
wxMenu::~wxMenu()
{
/* how do we delete an item-factory ? */
}
void wxMenu::SetTitle( const wxString& title ) void wxMenu::SetTitle( const wxString& title )
{ {
// TODO Waiting for something better // TODO Waiting for something better
@@ -492,6 +513,7 @@ void wxMenu::AppendSeparator()
GtkWidget *menuItem = gtk_menu_item_new(); GtkWidget *menuItem = gtk_menu_item_new();
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
mitem->SetMenuItem(menuItem); mitem->SetMenuItem(menuItem);
m_items.Append( mitem ); m_items.Append( mitem );
} }
@@ -504,25 +526,58 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
mitem->SetHelp(helpStr); mitem->SetHelp(helpStr);
mitem->SetCheckable(checkable); mitem->SetCheckable(checkable);
const char *text = mitem->GetText(); 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) GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
: gtk_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_connect( GTK_OBJECT(menuItem), "activate",
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
(gpointer*)this ); (gpointer)this );
gtk_signal_connect( GTK_OBJECT(menuItem), "select",
GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
(gpointer*)this );
gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
(gpointer*)this );
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
#endif
gtk_signal_connect( GTK_OBJECT(menuItem), "select",
GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
(gpointer)this );
gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
(gpointer)this );
mitem->SetMenuItem(menuItem);
m_items.Append( mitem ); m_items.Append( mitem );
} }
@@ -590,14 +645,18 @@ void wxMenu::Append( wxMenuItem *item )
int wxMenu::FindItem( const wxString itemString ) const int wxMenu::FindItem( const wxString itemString ) const
{ {
wxString s( itemString ); wxString s = "";
for ( const char *pc = itemString; *pc != '\0'; pc++ )
int pos;
do
{ {
pos = s.First( '&' ); if (*pc == '&')
if (pos != -1) s.Remove( pos, 1 ); {
} while (pos != -1); pc++; /* skip it */
#if (GTK_MINOR_VERSION > 0)
s << '_';
#endif
}
s << *pc;
}
wxNode *node = m_items.First(); wxNode *node = m_items.First();
while (node) while (node)

View File

@@ -233,10 +233,6 @@ bool wxNotebook::Create(wxWindow *parent, wxWindowID id,
m_widget = gtk_notebook_new(); 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 ); gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 );
m_idHandler = gtk_signal_connect ( m_idHandler = gtk_signal_connect (

View File

@@ -37,9 +37,9 @@ extern bool g_blockEventsOnDrag;
static void static void
gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) 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 ); wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
event.SetString( win->GetValue() ); 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 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(); win->CalculateScrollbar();
} }
@@ -124,19 +126,19 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
SetValidator( validator ); SetValidator( validator );
m_vScrollbarVisible = TRUE; m_vScrollbarVisible = FALSE;
bool multi_line = (style & wxTE_MULTILINE) != 0; bool multi_line = (style & wxTE_MULTILINE) != 0;
if ( multi_line ) if ( multi_line )
{ {
// a multi-line edit control: create a vertical scrollbar by default and /* a multi-line edit control: create a vertical scrollbar by default and
// horizontal if requested horizontal if requested */
bool bHasHScrollbar = (style & wxHSCROLL) != 0; bool bHasHScrollbar = (style & wxHSCROLL) != 0;
// create our control... /* create our control ... */
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); 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); m_widget = gtk_table_new(bHasHScrollbar ? 2 : 1, 2, FALSE);
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); 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), (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
0, 0); 0, 0);
// put the horizontal scrollbar in the lower left hand corner /* put the horizontal scrollbar in the lower left hand corner */
if (bHasHScrollbar) if (bHasHScrollbar)
{ {
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj); 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); gtk_widget_show(hscrollbar);
} }
// finally, put the vertical scrollbar in the upper right corner /* we create the vertical scrollbar on demand */
m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj ); m_vScrollbar = (GtkWidget*) NULL;
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 );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_text_size_callback), (gpointer)this );
} }
else else
{ {
// a single-line text control: no need for scrollbars /* a single-line text control: no need for scrollbars */
m_widget = m_widget =
m_text = gtk_entry_new(); m_text = gtk_entry_new();
} }
@@ -195,7 +188,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_widget_show(m_text); 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_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
@@ -229,11 +222,17 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
gtk_text_set_editable( GTK_TEXT(m_text), 1 ); gtk_text_set_editable( GTK_TEXT(m_text), 1 );
} }
Show( TRUE );
SetBackgroundColour( parent->GetBackgroundColour() ); SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() ); SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
if (multi_line)
{
gtk_signal_connect(GTK_OBJECT(GTK_TEXT(m_text)->vadj), "changed",
(GtkSignalFunc) gtk_scrollbar_changed_callback, (gpointer) this );
}
return TRUE; return TRUE;
} }
@@ -256,6 +255,18 @@ void wxTextCtrl::CalculateScrollbar()
{ {
if (!m_vScrollbarVisible) if (!m_vScrollbarVisible)
{ {
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 ); gtk_widget_show( m_vScrollbar );
m_vScrollbarVisible = TRUE; m_vScrollbarVisible = TRUE;

View File

@@ -8,15 +8,7 @@
/////////////////////////////////////////////////////////////////////////// */ /////////////////////////////////////////////////////////////////////////// */
#include "wx/gtk/win_gtk.h" #include "wx/gtk/win_gtk.h"
#include <gtk/gtkfeatures.h> #include "gtk/gtksignal.h"
/*-------------------------------------------------------------------------
// conditional compilation
//------------------------------------------------------------------------- */
#if (GTK_MINOR_VERSION > 0)
#define NEW_GTK_CONSTRUCT_CODE
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -25,7 +17,7 @@ extern "C" {
static void gtk_myfixed_class_init (GtkMyFixedClass *klass); static void gtk_myfixed_class_init (GtkMyFixedClass *klass);
static void gtk_myfixed_init (GtkMyFixed *myfixed); static void gtk_myfixed_init (GtkMyFixed *myfixed);
static void gtk_myfixed_map (GtkWidget *widget); static void gtk_myfixed_map (GtkWidget *widget);
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION == 0)
static void gtk_myfixed_unmap (GtkWidget *widget); static void gtk_myfixed_unmap (GtkWidget *widget);
#endif #endif
static void gtk_myfixed_realize (GtkWidget *widget); static void gtk_myfixed_realize (GtkWidget *widget);
@@ -49,14 +41,20 @@ static void gtk_myfixed_foreach (GtkContainer *container,
#endif #endif
GtkCallback callback, GtkCallback callback,
gpointer callback_data); gpointer callback_data);
#ifdef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
static GtkType gtk_myfixed_child_type (GtkContainer *container); static GtkType gtk_myfixed_child_type (GtkContainer *container);
#endif #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 guint
gtk_myfixed_get_type () gtk_myfixed_get_type ()
{ {
@@ -71,13 +69,13 @@ gtk_myfixed_get_type ()
sizeof (GtkMyFixedClass), sizeof (GtkMyFixedClass),
(GtkClassInitFunc) gtk_myfixed_class_init, (GtkClassInitFunc) gtk_myfixed_class_init,
(GtkObjectInitFunc) gtk_myfixed_init, (GtkObjectInitFunc) gtk_myfixed_init,
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
#else
/* reserved_1 */ NULL, /* reserved_1 */ NULL,
/* reserved_2 */ NULL, /* reserved_2 */ NULL,
(GtkClassInitFunc) NULL, (GtkClassInitFunc) NULL,
#else
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
#endif #endif
}; };
@@ -98,14 +96,14 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
widget_class = (GtkWidgetClass*) klass; widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass; container_class = (GtkContainerClass*) klass;
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
parent_class = gtk_type_class (gtk_container_get_type ());
#else
parent_class = gtk_type_class (GTK_TYPE_CONTAINER); parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
#else
parent_class = gtk_type_class (gtk_container_get_type ());
#endif #endif
widget_class->map = gtk_myfixed_map; widget_class->map = gtk_myfixed_map;
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION == 0)
widget_class->unmap = gtk_myfixed_unmap; widget_class->unmap = gtk_myfixed_unmap;
#endif #endif
widget_class->realize = gtk_myfixed_realize; widget_class->realize = gtk_myfixed_realize;
@@ -122,12 +120,24 @@ gtk_myfixed_class_init (GtkMyFixedClass *klass)
container_class->foreach = gtk_myfixed_foreach; container_class->foreach = gtk_myfixed_foreach;
#endif #endif
#ifdef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION > 0)
container_class->child_type = gtk_myfixed_child_type; container_class->child_type = gtk_myfixed_child_type;
#endif #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 static GtkType
gtk_myfixed_child_type (GtkContainer *container) gtk_myfixed_child_type (GtkContainer *container)
{ {
@@ -140,10 +150,14 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
{ {
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW); 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); GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
#endif #endif
#if (GTK_MINOR_VERSION > 0)
myfixed->shadow_type = GTK_SHADOW_NONE;
#endif
myfixed->children = NULL; myfixed->children = NULL;
} }
@@ -157,6 +171,34 @@ gtk_myfixed_new ()
return GTK_WIDGET (myfixed); 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 void
gtk_myfixed_put (GtkMyFixed *myfixed, gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget, GtkWidget *widget,
@@ -249,7 +291,7 @@ gtk_myfixed_map (GtkWidget *widget)
} }
} }
#ifndef NEW_GTK_CONSTRUCT_CODE #if (GTK_MINOR_VERSION == 0)
static void static void
gtk_myfixed_unmap (GtkWidget *widget) gtk_myfixed_unmap (GtkWidget *widget)
{ {
@@ -275,10 +317,26 @@ gtk_myfixed_realize (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD; 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.x = widget->allocation.x;
attributes.y = widget->allocation.y; attributes.y = widget->allocation.y;
attributes.width = 32000; attributes.width = 32000;
attributes.height = 32000; attributes.height = 32000;
#endif
attributes.wclass = GDK_INPUT_OUTPUT; attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget); attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget); attributes.colormap = gtk_widget_get_colormap (widget);
@@ -344,10 +402,10 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
GtkMyFixed *myfixed; GtkMyFixed *myfixed;
gint border;
GtkMyFixedChild *child; GtkMyFixedChild *child;
GtkAllocation child_allocation; GtkAllocation child_allocation;
GList *children; GList *children;
guint16 border_width;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED(widget)); g_return_if_fail (GTK_IS_MYFIXED(widget));
@@ -355,11 +413,22 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
myfixed = GTK_MYFIXED (widget); myfixed = GTK_MYFIXED (widget);
if (myfixed->shadow_type == GTK_SHADOW_NONE)
border = 0;
else
border = 2;
widget->allocation = *allocation; widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window, allocation->x, allocation->y, 32000, 32000 ); {
gdk_window_move_resize( widget->window,
border_width = GTK_CONTAINER (myfixed)->border_width; allocation->x+border, allocation->y+border,
#if (GTK_MINOR_VERSION > 0)
allocation->width-border*2, allocation->height-border*2 );
#else
32000, 32000 );
#endif
}
children = myfixed->children; children = myfixed->children;
while (children) while (children)
@@ -369,8 +438,8 @@ gtk_myfixed_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_VISIBLE (child->widget)) if (GTK_WIDGET_VISIBLE (child->widget))
{ {
child_allocation.x = child->x + border_width; child_allocation.x = child->x;
child_allocation.y = child->y + border_width; child_allocation.y = child->y;
child_allocation.width = child->widget->requisition.width; child_allocation.width = child->widget->requisition.width;
child_allocation.height = child->widget->requisition.height; child_allocation.height = child->widget->requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation); gtk_widget_size_allocate (child->widget, &child_allocation);

View File

@@ -122,47 +122,10 @@
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// conditional compilation // constants
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#if (GTK_MINOR_VERSION > 0) #define FRAME_BORDER_WIDTH 2
#define NEW_GTK_SCROLL_CODE
#endif
//-----------------------------------------------------------------------------
// (debug)
//-----------------------------------------------------------------------------
#ifdef __WXDEBUG__
static gint gtk_debug_focus_in_callback( GtkWidget *WXUNUSED(widget),
GdkEvent *WXUNUSED(event),
const char *name )
{
printf( "FOCUS NOW AT: " );
printf( name );
printf( "\n" );
return FALSE;
}
void debug_focus_in( GtkWidget* widget, const char* name, const char *window )
{
return;
wxString tmp = name;
tmp += " FROM ";
tmp += window;
char *s = new char[tmp.Length()+1];
strcpy( s, WXSTRINGCAST tmp );
gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
GTK_SIGNAL_FUNC(gtk_debug_focus_in_callback), (gpointer)s );
}
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// data // data
@@ -174,12 +137,105 @@ extern bool g_blockEventsOnScroll;
static bool g_capturing = FALSE; static bool g_capturing = FALSE;
static wxWindow *g_focusWindow = (wxWindow*) NULL; static wxWindow *g_focusWindow = (wxWindow*) NULL;
// hack: we need something to pass to gtk_menu_popup, so we store the time of /* hack: we need something to pass to gtk_menu_popup, so we store the time of
// the last click here the last click here */
static guint32 gs_timeLastClick = 0; static guint32 gs_timeLastClick = 0;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "expose_event" (of m_wxwindow, not of m_widget) // local code (see below)
//-----------------------------------------------------------------------------
static void draw_frame( GtkWidget *widget, wxWindow *win )
{
if (!win->HasVMT()) return;
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 );
/*
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 += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing;
}
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;
}
}
//-----------------------------------------------------------------------------
// "expose_event" of m_widget
//-----------------------------------------------------------------------------
static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
{
if (gdk_event->count > 0) return;
draw_frame( widget, win );
}
//-----------------------------------------------------------------------------
// "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
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win ) 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 ) 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) if (ret)
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" ); 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.m_y = 0;
event.SetEventObject( win ); event.SetEventObject( win );
bool ret = win->GetEventHandler()->ProcessEvent( event ); if (win->GetEventHandler()->ProcessEvent( event ))
if (ret)
{ {
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_release_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 ) 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_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE; if (g_blockEventsOnScroll) return TRUE;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
if (win->m_wxwindow) if (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow) && !GTK_WIDGET_HAS_FOCUS (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 " ); printf( "OnButtonPress from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) 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; gs_timeLastClick = gdk_event->time;
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_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 ) static gint gtk_window_button_release_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 FALSE;
if (g_blockEventsOnScroll) return FALSE;
if (g_blockEventsOnDrag) return TRUE; if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
if (g_blockEventsOnScroll) return TRUE;
if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnButtonRelease from " ); printf( "OnButtonRelease from " );
@@ -766,9 +823,12 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_release_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 ) 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) if (gdk_event->is_hint)
{ {
int x = 0; int x = 0;
@@ -788,13 +854,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
gdk_event->state = state; 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 " ); printf( "OnMotion from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -875,9 +934,12 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "motion_notify_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 ) 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; 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 " ); printf( "OnSetFocus from " );
@@ -919,9 +981,12 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_in_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 ) 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 (win->m_wxwindow)
{ {
if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow)) if (GTK_WIDGET_CAN_FOCUS(win->m_wxwindow))
GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS); GTK_WIDGET_UNSET_FLAGS (win->m_wxwindow, GTK_HAS_FOCUS);
} }
if (!win->HasVMT()) return TRUE;
/* /*
printf( "OnKillFocus from " ); printf( "OnKillFocus from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
@@ -950,9 +1015,12 @@ static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEvent *WXUNUSED
event.SetEventObject( win ); event.SetEventObject( win );
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "focus_out_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 ) 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)) if ((widget->window) && (win->m_cursor))
gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); 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 " ); printf( "OnEnter from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) 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; event.m_y -= pt.y;
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "enter_notify_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 ) 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)) if ((widget->window) && (win->m_cursor))
gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); 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 " ); printf( "OnLeave from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) 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; event.m_y -= pt.y;
if (win->GetEventHandler()->ProcessEvent( event )) if (win->GetEventHandler()->ProcessEvent( event ))
{
gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "leave_notify_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 ); m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); 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); 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 ); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
scroll_class->scrollbar_spacing = 0; scroll_class->scrollbar_spacing = 0;
@@ -1427,21 +1490,25 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
m_wxwindow = gtk_myfixed_new(); m_wxwindow = gtk_myfixed_new();
#ifdef __WXDEBUG__
debug_focus_in( m_wxwindow, "wxWindow::m_wxwindow", name );
#endif
#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 );
#else
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
#endif
#ifdef __WXDEBUG__ #if (GTK_MINOR_VERSION > 0)
debug_focus_in( GTK_WIDGET(viewport), "wxWindow::viewport", name ); GtkMyFixed *myfixed = GTK_MYFIXED(m_wxwindow);
#endif
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
GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
if (m_windowStyle & wxRAISED_BORDER) 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 ); gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
} }
#endif
if (m_windowStyle & wxTAB_TRAVERSAL) if (m_windowStyle & wxTAB_TRAVERSAL)
{ {
@@ -1469,9 +1537,11 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
m_acceptsFocus = TRUE; m_acceptsFocus = TRUE;
} }
#if (GTK_MINOR_VERSION == 0)
// shut the viewport up // 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_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) ); 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 // I _really_ don't want scrollbars in the beginning
m_vAdjust->lower = 0.0; 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", gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); (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) // scrolling or when the window size (and therefore scrollbar configuration)
// has changed // has changed
@@ -1695,11 +1765,19 @@ void wxWindow::PostCreation()
if (m_wxwindow) if (m_wxwindow)
{ {
/* these get reported to wxWindows -> wxPaintEvent */
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event", gtk_signal_connect( GTK_OBJECT(m_wxwindow), "expose_event",
GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_window_expose_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw", gtk_signal_connect( GTK_OBJECT(m_wxwindow), "draw",
GTK_SIGNAL_FUNC(gtk_window_draw_callback), (gpointer)this ); 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() ); ConnectWidget( GetConnectWidget() );
@@ -1928,33 +2006,34 @@ void wxWindow::DoSetClientSize( int width, int height )
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass ); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
#ifdef NEW_GTK_SCROLL_CODE #if (GTK_MINOR_VERSION == 0)
GtkWidget *viewport = GTK_BIN(scroll_window)->child;
#else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif
GtkStyleClass *viewport_class = viewport->style->klass; GtkStyleClass *viewport_class = viewport->style->klass;
GtkWidget *hscrollbar = scroll_window->hscrollbar;
GtkWidget *vscrollbar = scroll_window->vscrollbar;
if ((m_windowStyle & wxRAISED_BORDER) || if ((m_windowStyle & wxRAISED_BORDER) ||
(m_windowStyle & wxSUNKEN_BORDER)) (m_windowStyle & wxSUNKEN_BORDER))
{ {
dw += 2 * viewport_class->xthickness; dw += 2 * viewport_class->xthickness;
dh += 2 * viewport_class->ythickness; 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) if (scroll_window->vscrollbar_visible)
{ {
dw += vscrollbar->allocation.width; dw += 15; /* dw += vscrollbar->allocation.width; */
dw += scroll_class->scrollbar_spacing; dw += scroll_class->scrollbar_spacing;
} }
if (scroll_window->hscrollbar_visible) if (scroll_window->hscrollbar_visible)
{ {
dh += hscrollbar->allocation.height; dh += 15; /* dh += hscrollbar->allocation.height; */
dw += scroll_class->scrollbar_spacing; dw += scroll_class->scrollbar_spacing;
} }
} }
@@ -1993,12 +2072,8 @@ void wxWindow::GetClientSize( int *width, int *height ) const
GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(m_widget);
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass ); GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
#ifdef NEW_GTK_SCROLL_CODE #if (GTK_MINOR_VERSION == 0)
GtkWidget *viewport = GTK_BIN(scroll_window)->child;
#else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif
GtkStyleClass *viewport_class = viewport->style->klass; GtkStyleClass *viewport_class = viewport->style->klass;
if ((m_windowStyle & wxRAISED_BORDER) || if ((m_windowStyle & wxRAISED_BORDER) ||
@@ -2007,18 +2082,23 @@ void wxWindow::GetClientSize( int *width, int *height ) const
dw += 2 * viewport_class->xthickness; dw += 2 * viewport_class->xthickness;
dh += 2 * viewport_class->ythickness; 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) if (scroll_window->vscrollbar_visible)
{ {
// dw += vscrollbar->allocation.width; dw += 15; /* dw += vscrollbar->allocation.width; */
dw += 15; // range.slider_width = 11 + 2*2pts edge
dw += scroll_class->scrollbar_spacing; dw += scroll_class->scrollbar_spacing;
} }
if (scroll_window->hscrollbar_visible) if (scroll_window->hscrollbar_visible)
{ {
// dh += hscrollbar->allocation.height; dh += 15; /* dh += hscrollbar->allocation.height; */
dh += 15;
dh += scroll_class->scrollbar_spacing; dh += scroll_class->scrollbar_spacing;
} }
} }

View File

@@ -4,7 +4,7 @@ Version: 2.1.0
Release: 1 Release: 1
Copyright: wxWindows Licence Copyright: wxWindows Licence
Group: X11/Libraries 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 URL: http://www.freiburg.linux.de/~wxxt/docs.html
Packager: Robert Roebling <roebling@ruf.uni-freiburg.de> Packager: Robert Roebling <roebling@ruf.uni-freiburg.de>
Requires: gtk+ >= 1.2.0 Requires: gtk+ >= 1.2.0