From: Robert Roebling Date: Sat, 2 Jan 1999 19:13:25 +0000 (+0000) Subject: Header changes (gtk.h etc no longer included in defs.h X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/83624f79609f0d5e240c1f7d77d044bfff9702fc Header changes (gtk.h etc no longer included in defs.h but in *.cpp to speed up compilation (?) ) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/defs.h b/include/wx/defs.h index d906f09812..095cb07c4e 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -16,15 +16,6 @@ #pragma interface "defs.h" #endif -#ifdef __WXGTK__ - -#include "glib.h" -#include "gdk/gdk.h" -#include "gtk/gtk.h" -#include "wx/gtk/win_gtk.h" - -#endif - #include #include "wx/setup.h" @@ -664,7 +655,8 @@ enum { // Logical ops -typedef enum { +typedef enum +{ wxCLEAR, // 0 wxXOR, // src XOR dst wxINVERT, // NOT dst @@ -736,8 +728,8 @@ typedef enum { #define wxSIZE_NO_ADJUSTMENTS 0x0008 -// Data format for drag & drop and clipboard operations -// numbers as per winuser.h +/* Data format for drag & drop and clipboard operations + * numbers as per winuser.h */ enum wxDataFormat { @@ -750,9 +742,10 @@ enum wxDataFormat wxDF_PRIVATE = 20 }; -// Virtual keycodes +/* Virtual keycodes */ -enum wxKeyCode { +enum wxKeyCode +{ WXK_BACK = 8, WXK_TAB = 9, WXK_RETURN = 13, @@ -771,8 +764,8 @@ enum wxKeyCode { WXK_MENU, WXK_PAUSE, WXK_CAPITAL, - WXK_PRIOR, // Page up - WXK_NEXT, // Page down + WXK_PRIOR, /* Page up */ + WXK_NEXT, /* Page down */ WXK_END, WXK_HOME, WXK_LEFT, @@ -831,37 +824,36 @@ enum wxKeyCode { WXK_PAGEDOWN }; -// Colours - see wx_gdi.cc for database - -// OS mnemonics -- Identify the running OS (useful for Windows) -// [Not all platforms are currently available or supported] -enum { +/* OS mnemonics -- Identify the running OS (useful for Windows) + * [Not all platforms are currently available or supported] */ +enum +{ wxUNKNOWN_PLATFORM, - wxCURSES, // Text-only CURSES - wxXVIEW_X, // Sun's XView OpenLOOK toolkit - wxMOTIF_X, // OSF Motif 1.x.x - wxCOSE_X, // OSF Common Desktop Environment - wxNEXTSTEP, // NeXTStep - wxMACINTOSH, // Apple System 7 - wxGTK, // GTK - wxQT, // Qt - wxGEOS, // GEOS - wxOS2_PM, // OS/2 Workplace - wxWINDOWS, // Windows or WfW - wxPENWINDOWS, // Windows for Pen Computing - wxWINDOWS_NT, // Windows NT - wxWIN32S, // Windows 32S API - wxWIN95, // Windows 95 - wxWIN386 // Watcom 32-bit supervisor modus + wxCURSES, /* Text-only CURSES */ + wxXVIEW_X, /* Sun's XView OpenLOOK toolkit */ + wxMOTIF_X, /* OSF Motif 1.x.x */ + wxCOSE_X, /* OSF Common Desktop Environment */ + wxNEXTSTEP, /* NeXTStep */ + wxMACINTOSH, /* Apple System 7 */ + wxGTK, /* GTK */ + wxQT, /* Qt */ + wxGEOS, /* GEOS */ + wxOS2_PM, /* OS/2 Workplace */ + wxWINDOWS, /* Windows or WfW */ + wxPENWINDOWS, /* Windows for Pen Computing */ + wxWINDOWS_NT, /* Windows NT */ + wxWIN32S, /* Windows 32S API */ + wxWIN95, /* Windows 95 */ + wxWIN386 /* Watcom 32-bit supervisor modus */ }; -// Printing +/* Printing */ #ifndef wxPORTRAIT #define wxPORTRAIT 1 #define wxLANDSCAPE 2 #endif -// Standard menu identifiers +/* Standard menu identifiers */ #define wxID_OPEN 5000 #define wxID_CLOSE 5001 #define wxID_NEW 5002 @@ -908,13 +900,12 @@ enum { #define wxID_HIGHEST 5999 -// Shortcut for easier dialog-unit-to-pixel conversion +/* Shortcut for easier dialog-unit-to-pixel conversion */ #define wxDLG_UNIT(parent, pt) parent->ConvertDialogToPixels(pt) #ifdef __WXMSW__ -// Stand-ins for Windows types, to avoid -// #including all of windows.h - +/* Stand-ins for Windows types, to avoid + * #including all of windows.h */ typedef unsigned long WXHWND; typedef unsigned long WXHANDLE; typedef unsigned long WXHICON; @@ -956,7 +947,7 @@ typedef int (*WXFARPROC)(); #endif #ifdef __WXMOTIF__ -// Stand-ins for X/Xt/Motif types +/* Stand-ins for X/Xt/Motif types */ typedef void* WXWindow; typedef void* WXWidget; typedef void* WXAppContext; @@ -974,5 +965,36 @@ typedef void* WXCursor; typedef void* WXFontList; #endif +#ifdef __WXGTK__ +/* Stand-ins for GLIB types */ +typedef int gint; +typedef unsigned guint; +typedef unsigned long gulong; +typedef void* gpointer; + +/* Stand-ins for GDK types */ +typedef gulong GdkAtom; +typedef struct _GdkColor GdkColor; +typedef struct _GdkColormap GdkColormap; +typedef struct _GdkFont GdkFont; +typedef struct _GdkGC GdkGC; +typedef struct _GdkWindow GdkWindow; +typedef struct _GdkWindow GdkBitmap; +typedef struct _GdkWindow GdkPixmap; +typedef struct _GdkCursor GdkCursor; +typedef struct _GdkRegion GdkRegion; + +/* Stand-ins for GTK types */ +typedef struct _GtkWidget GtkWidget; +typedef struct _GtkStyle GtkStyle; +typedef struct _GtkAdjustment GtkAdjustment; +typedef struct _GtkList GtkList; +typedef struct _GtkToolbar GtkToolbar; +typedef struct _GtkNotebook GtkNotebook; +typedef struct _GtkNotebookPage GtkNotebookPage; + +#endif + + #endif // _WX_DEFS_H_ diff --git a/include/wx/gtk/filedlg.h b/include/wx/gtk/filedlg.h index 5035ba8bb7..5337b50c94 100644 --- a/include/wx/gtk/filedlg.h +++ b/include/wx/gtk/filedlg.h @@ -37,7 +37,7 @@ class wxFileDialog: public wxDialog wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, const wxString& defaultDir = "", const wxString& defaultFile = "", - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, long style = 0, const wxPoint& pos = wxDefaultPosition); inline void SetMessage(const wxString& message) { m_message = message; } diff --git a/include/wx/gtk/tbargtk.h b/include/wx/gtk/tbargtk.h index 2b7ec30b31..776433c303 100644 --- a/include/wx/gtk/tbargtk.h +++ b/include/wx/gtk/tbargtk.h @@ -143,8 +143,8 @@ class wxToolBar: public wxControl int m_separation; wxList m_tools; - GdkColor m_fg; - GdkColor m_bg; + GdkColor *m_fg; + GdkColor *m_bg; int m_xMargin; int m_yMargin; bool m_hasToolAlready; diff --git a/include/wx/gtk1/filedlg.h b/include/wx/gtk1/filedlg.h index 5035ba8bb7..5337b50c94 100644 --- a/include/wx/gtk1/filedlg.h +++ b/include/wx/gtk1/filedlg.h @@ -37,7 +37,7 @@ class wxFileDialog: public wxDialog wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr, const wxString& defaultDir = "", const wxString& defaultFile = "", - const wxString& wildCard = wxFileSelectorDefaultWildcardStr, + const wxString& wildCard = wxFileSelectorDefaultWildcardStr, long style = 0, const wxPoint& pos = wxDefaultPosition); inline void SetMessage(const wxString& message) { m_message = message; } diff --git a/include/wx/gtk1/tbargtk.h b/include/wx/gtk1/tbargtk.h index 2b7ec30b31..776433c303 100644 --- a/include/wx/gtk1/tbargtk.h +++ b/include/wx/gtk1/tbargtk.h @@ -143,8 +143,8 @@ class wxToolBar: public wxControl int m_separation; wxList m_tools; - GdkColor m_fg; - GdkColor m_bg; + GdkColor *m_fg; + GdkColor *m_bg; int m_xMargin; int m_yMargin; bool m_hasToolAlready; diff --git a/setup/maketmpl.in b/setup/maketmpl.in index e6f902ccef..ba9166a894 100644 --- a/setup/maketmpl.in +++ b/setup/maketmpl.in @@ -96,12 +96,11 @@ EXTRA_LINK = @EXTRA_LINK@ # INCLUDES WX_INCLUDES = \ $(TOOLKIT_DEF) \ --I. \ --I.. \ -I$(WXBASEDIR)/include \ +-I. \ +$(GUI_TK_INCLUDE) \ -I$(WXBASEDIR)/src/zlib \ -I$(WXBASEDIR)/src/iodbc \ -$(GUI_TK_INCLUDE) \ $(OPENGL_INCLUDE) \ $(X_CFLAGS) diff --git a/src/common/image.cpp b/src/common/image.cpp index 148059fb99..c7a7b0dc74 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -25,11 +25,6 @@ #include "../png/png.h" #include "wx/filefn.h" -#ifdef __WXGTK__ -#include "gdk/gdkprivate.h" -#include "gdk/gdkx.h" -#endif - //----------------------------------------------------------------------------- // wxImage //----------------------------------------------------------------------------- @@ -1247,6 +1242,10 @@ wxImage::wxImage( const wxBitmap &bitmap ) #ifdef __WXGTK__ +#include "gtk/gtk.h" +#include "gdk/gdk.h" +#include "gdk/gdkx.h" + wxBitmap wxImage::ConvertToBitmap() const { wxBitmap bitmap; diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 53902a97a3..6b3be61991 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -26,6 +26,11 @@ #include "unistd.h" +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // global data //----------------------------------------------------------------------------- diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 3e9ade68da..0b6b995c25 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -14,9 +14,11 @@ #include "wx/bitmap.h" #include "wx/icon.h" #include "wx/filefn.h" +#include "wx/image.h" + +#include "gdk/gdk.h" #include "gdk/gdkprivate.h" #include "gdk/gdkx.h" -#include "wx/image.h" //----------------------------------------------------------------------------- // wxMask diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index cd10cf260c..49f84d1698 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -13,6 +13,9 @@ #include "wx/bmpbuttn.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- diff --git a/src/gtk/brush.cpp b/src/gtk/brush.cpp index 146a4d0d88..be6d5e2e91 100644 --- a/src/gtk/brush.cpp +++ b/src/gtk/brush.cpp @@ -13,6 +13,8 @@ #include "wx/brush.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxBrush //----------------------------------------------------------------------------- diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 8980bb0301..8c91ec2adc 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -13,6 +13,9 @@ #include "wx/button.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 9d594ca495..85425761d0 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -14,6 +14,9 @@ #include "wx/checkbox.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 4d7e6fe775..1a092196ec 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -13,6 +13,9 @@ #include "wx/checklst.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxCheckListBox //----------------------------------------------------------------------------- diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 8bbf2ab5b2..27ba2fa798 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -14,6 +14,9 @@ #include "wx/choice.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk/clipbrd.cpp b/src/gtk/clipbrd.cpp index f220a49abd..d142820342 100644 --- a/src/gtk/clipbrd.cpp +++ b/src/gtk/clipbrd.cpp @@ -13,6 +13,10 @@ #include "wx/clipbrd.h" +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk/colour.cpp b/src/gtk/colour.cpp index 74e414ef03..c9a9255301 100644 --- a/src/gtk/colour.cpp +++ b/src/gtk/colour.cpp @@ -14,6 +14,7 @@ #include "wx/gdicmn.h" +#include "gdk/gdk.h" #include "gdk/gdkprivate.h" //----------------------------------------------------------------------------- diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index ae8b352156..1405a02f1d 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -14,6 +14,9 @@ #include "wx/combobox.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk/cursor.cpp b/src/gtk/cursor.cpp index 73babdfb05..2034a9076a 100644 --- a/src/gtk/cursor.cpp +++ b/src/gtk/cursor.cpp @@ -14,6 +14,8 @@ #include "wx/cursor.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxCursor //----------------------------------------------------------------------------- diff --git a/src/gtk/data.cpp b/src/gtk/data.cpp index 42e8ea7018..e72ca64abd 100644 --- a/src/gtk/data.cpp +++ b/src/gtk/data.cpp @@ -21,8 +21,7 @@ #define _MAXPATHLEN 500 -// Used for X resources - +/* Used for X resources */ #include #include #include @@ -30,50 +29,49 @@ wxResourceCache *wxTheResourceCache = (wxResourceCache *) NULL; XrmDatabase wxResourceDatabase; -// Useful buffer, initialized in wxCommonInit +/* Useful buffer, initialized in wxCommonInit */ char *wxBuffer = (char *) NULL; -// Windows List +/* Windows List */ wxList wxTopLevelWindows; -// List of windows pending deletion +/* List of windows pending deletion */ wxList wxPendingDelete; -// Current cursor, in order to hang on to -// cursor handle when setting the cursor globally +/* Current cursor, in order to hang on to + * cursor handle when setting the cursor globally */ wxCursor *g_globalCursor = (wxCursor *) NULL; -// Don't allow event propagation during drag +/* Don't allow event propagation during drag */ bool g_blockEventsOnDrag = FALSE; -// Don't allow mouse event propagation during scroll +/* Don't allow mouse event propagation during scroll */ bool g_blockEventsOnScroll = FALSE; -// Message Strings for Internationalization +/* Message Strings for Internationalization */ char **wx_msg_str = (char**)NULL; -// Custom OS version, as optionally placed in wx.ini/.wxrc -// Currently this can be Win95, Windows, Win32s, WinNT. -// For some systems, you can't tell until run-time what services you -// have. See wxGetOsVersion, which uses this string if present. +/* Custom OS version, as optionally placed in wx.ini/.wxrc + * Currently this can be Win95, Windows, Win32s, WinNT. + * For some systems, you can't tell until run-time what services you + * have. See wxGetOsVersion, which uses this string if present. */ char *wxOsVersion = (char *) NULL; -// For printing several pages +/* For printing several pages */ int wxPageNumber; wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase *) NULL; -// GDI Object Lists +/* GDI Object Lists */ wxBrushList *wxTheBrushList = (wxBrushList *) NULL; wxPenList *wxThePenList = (wxPenList *) NULL; wxFontList *wxTheFontList = (wxFontList *) NULL; wxColourDatabase *wxTheColourDatabase = (wxColourDatabase *) NULL; -wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL; +wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL; - -// X only font names +/* X only font names */ wxFontNameDirectory *wxTheFontNameDirectory; -// Stock objects +/* Stock objects */ wxFont *wxNORMAL_FONT; wxFont *wxSMALL_FONT; wxFont *wxITALIC_FONT; @@ -103,7 +101,7 @@ wxBrush *wxLIGHT_GREY_BRUSH; wxColour *wxBLACK; wxColour *wxWHITE; -wxColour *wxGREY; // Robert Roebling +wxColour *wxGREY; wxColour *wxRED; wxColour *wxBLUE; wxColour *wxGREEN; @@ -114,7 +112,7 @@ wxCursor *wxSTANDARD_CURSOR = (wxCursor *) NULL; wxCursor *wxHOURGLASS_CURSOR = (wxCursor *) NULL; wxCursor *wxCROSS_CURSOR = (wxCursor *) NULL; -// 'Null' objects +/* 'Null' objects */ wxAcceleratorTable wxNullAcceleratorTable; wxBitmap wxNullBitmap; wxIcon wxNullIcon; @@ -126,7 +124,7 @@ wxColour wxNullColour; wxPalette wxNullPalette; wxRegion wxNullRegion; -// Default window names +/* Default window names */ const char *wxButtonNameStr = "button"; const char *wxCanvasNameStr = "canvas"; const char *wxCheckBoxNameStr = "check"; @@ -162,610 +160,10 @@ const char *wxFileSelectorDefaultWildcardStr = "*.*"; const char *wxInternalErrorStr = "wxWindows Internal Error"; const char *wxFatalErrorStr = "wxWindows Fatal Error"; -// See wx/utils.h +/* See wx/utils.h */ const char *wxFloatToStringStr = "%.2f"; const char *wxDoubleToStringStr = "%.2f"; -#ifdef wx_msw -const char *wxUserResourceStr = "TEXT"; -#endif - - -#if wxUSE_SHARED_LIBRARY -/* - * For wxWindows to be made into a dynamic library (e.g. Sun), - * all IMPLEMENT_... macros must be in one place. - * But normally, the definitions are in the appropriate places. - */ - -// Hand-coded IMPLEMENT... macro for wxObject (define static data) -wxClassInfo wxObject::classwxObject((char *) "wxObject", (char *) NULL, (char *) NULL, (int ) sizeof(wxObject), (wxObjectConstructorFn) NULL); -wxClassInfo *wxClassInfo::first = (wxClassInfo *) NULL; -wxHashTable wxClassInfo::classTable(wxKEY_STRING); - -#include "wx/button.h" -#include "wx/bmpbuttn.h" -IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) - -#include "wx/checkbox.h" -IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) - -#include "wx/choice.h" -IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) - -#if wxUSE_CLIPBOARD -#include "wx/clipbrd.h" -IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject) -#endif - -#if wxUSE_COMBOBOX -#include "wx/combobox.h" -IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) -#endif - -#include "wx/dc.h" -#include "wx/dcmemory.h" -#include "wx/dcclient.h" -#include "wx/dcscreen.h" -IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) - -#if defined(wx_msw) -#include "wx/dcprint.h" -IMPLEMENT_CLASS(wxPrinterDC, wxDC) -#endif - -#include "wx/dialog.h" -IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxWindow) - -#include "wx/frame.h" -IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) - -#include "wx/mdi.h" -IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) - -#include "wx/cmndata.h" -IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject) - -#include "wx/colordlg.h" -#include "wx/fontdlg.h" - -#if !defined(wx_msw) || wxUSE_GENERIC_DIALOGS_IN_MSW -#include "wx/generic/colordlg.h" -#include "wx/generic/fontdlg.h" -IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog) -IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog) -#endif - -// X defines wxColourDialog to be wxGenericColourDialog -#ifndef wx_x -IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) -#endif - -#include "wx/gdicmn.h" -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/font.h" -#include "wx/palette.h" -#include "wx/icon.h" -#include "wx/cursor.h" - -IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) -IMPLEMENT_CLASS(wxColourDatabase, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList) - -/* -#if (!USE_TYPEDEFS) -IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxIntPoint, wxObject) -#endif -*/ - -#if defined(wx_x) || (defined(wx_msw) && wxUSE_PORTABLE_FONTS_IN_MSW) -IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject) -#endif - -#include "wx/hash.h" -IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject) - -#include "wx/help.h" -IMPLEMENT_DYNAMIC_CLASS(wxHelpInstance, wxClient) -IMPLEMENT_CLASS(wxHelpConnection, wxConnection) - -#include "wx/list.h" -IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList) - -#if wxUSE_PRINTING_ARCHITECTURE -#include "wx/print.h" -IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) -IMPLEMENT_DYNAMIC_CLASS(wxPrinterBase, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase) -IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase) -IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject) -IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow) -IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow) -IMPLEMENT_CLASS(wxPreviewFrame, wxFrame) -IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) -IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase) -IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase) -IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog) -IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog) -#endif - -#if wxUSE_POSTSCRIPT -#include "wx/postscrp.h" -IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPageSetupData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList) -#endif - -#if wxUSE_WX_RESOURCES -#include "wx/resource.h" -IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable) -#endif - -#include "wx/event.h" -IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) -IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent) - -#include "wx/utils.h" -IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList) - -// IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject) - -#include "wx/process.h" -IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler) - -#if wxUSE_TIMEDATE -#include "wx/date.h" -IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject) -#endif - -#if wxUSE_DOC_VIEW_ARCHITECTURE -#include "wx/docview.h" -//IMPLEMENT_ABSTRACT_CLASS(wxDocItem, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler) -IMPLEMENT_CLASS(wxDocChildFrame, wxFrame) -IMPLEMENT_CLASS(wxDocParentFrame, wxFrame) -#if wxUSE_PRINTING_ARCHITECTURE -IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout) -#endif -IMPLEMENT_CLASS(wxCommand, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject) -#endif - -#if wxUSE_CONSTRAINTS -#include "wx/layout.h" -IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxSizer, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxRowColSizer, wxSizer) -#endif - -#if wxUSE_TOOLBAR -#include "wx/tbarbase.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl) - -#include "wx/tbarsmpl.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBarSimple, wxToolBarBase) - -#ifdef wx_msw -#include "wx/tbarmsw.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase) - -#include "wx/tbar95.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase) -#endif - -#endif - -#include "wx/sckaddr.h" - -IMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxSockAddress) -#ifdef ENABLE_IPV6 -IMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxSockAddress) -#endif -#ifndef __UNIX__ -IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) -#endif - -#include "wx/socket.h" - -IMPLEMENT_CLASS(wxSocketBase, wxEvtHandler) -IMPLEMENT_CLASS(wxSocketClient, wxSocketBase) -IMPLEMENT_CLASS(wxSocketServer, wxSocketBase) -IMPLEMENT_CLASS(wxSocketHandler, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent) - -#include "wx/url.h" - -IMPLEMENT_CLASS(wxProtoInfo, wxObject) -IMPLEMENT_CLASS(wxURL, wxObject) - -#include "wx/protocol/http.h" - -IMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol) -IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE) - -#include "wx/protocol/ftp.h" - -IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol) -IMPLEMENT_PROTOCOL(wxFTP, "ftp", "21", TRUE) - -#include "wx/protocol/sckfile.h" - -IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) -IMPLEMENT_PROTOCOL(wxFileProto, "file", NULL, FALSE) - -#include "wx/sckipc.h" - -IMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase) -IMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase) -IMPLEMENT_DYNAMIC_CLASS(wxTCPConnection, wxConnectionBase) - -#include "wx/statusbr.h" - -IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) - -BEGIN_EVENT_TABLE(wxStatusBar, wxWindow) - EVT_PAINT(wxStatusBar::OnPaint) - EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged) -END_EVENT_TABLE() - -#if wxUSE_TIMEDATE -#include "wx/time.h" -IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject) -#endif - -#if !USE_GNU_WXSTRING -#include "wx/string.h" -IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject) -#endif - -#ifdef wx_motif -IMPLEMENT_DYNAMIC_CLASS(wxXColormap, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxXFont, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject) -#endif -IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) -IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap) -IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) - -// This will presumably be implemented on other platforms too -#ifdef wx_msw -IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxBitmapHandler) -#endif - -#include "wx/statbox.h" -IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) - -#if wxUSE_IPC -#include "wx/dde.h" -IMPLEMENT_ABSTRACT_CLASS(wxDDEObject, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxDDEObject) -IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxDDEObject) -IMPLEMENT_CLASS(wxDDEConnection, wxObject) -#endif - -IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) - -#include "wx/listbox.h" -IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) - -IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) - -#include "wx/menu.h" -IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow) -IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow) - -#include "wx/stattext.h" -#include "wx/statbmp.h" -IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) - -#if wxUSE_METAFILE -#include "wx/metafile.h" -IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC) -#endif - -#include "wx/radiobox.h" -#include "wx/radiobut.h" -IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) - -IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) -// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton) - -#include "wx/scrolbar.h" -IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl) - -#if WXWIN_COMPATIBILITY -BEGIN_EVENT_TABLE(wxScrollBar, wxControl) - EVT_SCROLL(wxScrollBar::OnScroll) -END_EVENT_TABLE() -#endif - -#include "wx/slider.h" -IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl) - -#if WXWIN_COMPATIBILITY -BEGIN_EVENT_TABLE(wxSlider, wxControl) - EVT_SCROLL(wxSlider::OnScroll) -END_EVENT_TABLE() -#endif - -#include "wx/timer.h" -IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) - -#include "wx/textctrl.h" -IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl) - -#include "wx/window.h" -IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) - -#include "wx/scrolwin.h" -IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow) - -#include "wx/panel.h" -IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow) - -#include "wx/msgbxdlg.h" -#include "wx/textdlg.h" -#include "wx/filedlg.h" -#include "wx/dirdlg.h" -#include "wx/choicdlg.h" - -#if !defined(wx_msw) || wxUSE_GENERIC_DIALOGS_IN_MSW -#include "wx/generic/msgdlgg.h" -IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog) -#endif - -IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) -IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) -IMPLEMENT_CLASS(wxFileDialog, wxDialog) -IMPLEMENT_CLASS(wxDirDialog, wxDialog) - -#ifdef wx_msw -IMPLEMENT_CLASS(wxMessageDialog) -#endif - -#if wxUSE_GAUGE -#ifdef wx_motif -#include "../../contrib/xmgauge/gauge.h" -#endif -#include "wx_gauge.h" -IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) -#endif - -#include "wx/grid.h" -IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel) - -///// Event tables (also must be in one, statically-linked file for shared libraries) - -// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here -const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } - -const wxEventTable wxEvtHandler::sm_eventTable = - { NULL, &wxEvtHandler::sm_eventTableEntries[0] }; - -const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, -#ifdef __SGI_CC__ - 0L -#else - NULL -#endif - } -}; - -BEGIN_EVENT_TABLE(wxFrame, wxWindow) - EVT_SIZE(wxFrame::OnSize) - EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) - EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) - EVT_IDLE(wxFrame::OnIdle) - EVT_CLOSE(wxFrame::OnCloseWindow) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxDialog, wxPanel) - EVT_BUTTON(wxID_OK, wxDialog::OnOK) - EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) - EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) - EVT_CHAR_HOOK(wxDialog::OnCharHook) - EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) - EVT_CLOSE(wxDialog::OnCloseWindow) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) - EVT_CHAR(wxWindow::OnChar) - EVT_SIZE(wxWindow::Size) - EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) - EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) - EVT_INIT_DIALOG(wxWindow::OnInitDialog) - EVT_IDLE(wxWindow::OnIdle) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow) - EVT_SCROLL(wxScrolledWindow::OnScroll) - EVT_SIZE(wxScrolledWindow::OnSize) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxPanel, wxWindow) - EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) - EVT_CHAR(wxTextCtrl::OnChar) - EVT_DROP_FILES(wxTextCtrl::OnDropFiles) - EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) -END_EVENT_TABLE() - -#ifdef wx_msw -BEGIN_EVENT_TABLE(wxMDIParentWindow, wxFrame) - EVT_SIZE(wxMDIParentWindow::OnSize) - EVT_ACTIVATE(wxMDIParentWindow::OnActivate) - EVT_SYS_COLOUR_CHANGED(wxMDIParentWindow::OnSysColourChanged) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) - EVT_SCROLL(wxMDIClientWindow::OnScroll) -END_EVENT_TABLE() -#endif - -BEGIN_EVENT_TABLE(wxToolBarBase, wxControl) - EVT_SCROLL(wxToolBarBase::OnScroll) - EVT_SIZE(wxToolBarBase::OnSize) - EVT_IDLE(wxToolBarBase::OnIdle) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase) - EVT_SIZE(wxToolBarSimple::OnSize) - EVT_PAINT(wxToolBarSimple::OnPaint) - EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus) - EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent) -END_EVENT_TABLE() - -#ifdef wx_msw -BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) - EVT_SIZE(wxToolBarMSW::OnSize) - EVT_PAINT(wxToolBarMSW::OnPaint) - EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) - EVT_SIZE(wxToolBar95::OnSize) - EVT_PAINT(wxToolBar95::OnPaint) - EVT_KILL_FOCUS(wxToolBar95::OnKillFocus) - EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) - EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) -END_EVENT_TABLE() -#endif - -BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel) - EVT_SIZE(wxGenericGrid::OnSize) - EVT_PAINT(wxGenericGrid::OnPaint) - EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) - EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) - EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) - EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxControl, wxWindow) - EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground) -END_EVENT_TABLE() - -#if !defined(wx_msw) || wxUSE_GENERIC_DIALOGS_IN_MSW -BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) - EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) - EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) - EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) - EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) - EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) - EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider) - EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) - EVT_PAINT(wxGenericColourDialog::OnPaint) - EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) - EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) - EVT_PAINT(wxGenericFontDialog::OnPaint) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK) - EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup) - EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange) -END_EVENT_TABLE() - -#endif - -BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) -END_EVENT_TABLE() - -#include "wx/prntbase.h" - -BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) - EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow) - EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose) - EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) - EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious) - EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext) - EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) -END_EVENT_TABLE() - -#endif - - +/* Dafaults for wxWindow etc. */ const wxSize wxDefaultSize(-1, -1); const wxPoint wxDefaultPosition(-1, -1); diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 44fe792814..821bef8774 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -14,6 +14,9 @@ #include "wx/dc.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // constants //----------------------------------------------------------------------------- diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 0b2a1391cd..f1af921f28 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -16,6 +16,9 @@ #include "wx/image.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // local data //----------------------------------------------------------------------------- diff --git a/src/gtk/dcmemory.cpp b/src/gtk/dcmemory.cpp index e996334c00..139438b215 100644 --- a/src/gtk/dcmemory.cpp +++ b/src/gtk/dcmemory.cpp @@ -13,6 +13,9 @@ #include "wx/dcmemory.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxMemoryDC //----------------------------------------------------------------------------- diff --git a/src/gtk/dcps.cpp b/src/gtk/dcps.cpp index 275e0d1b35..8ee9ce5a25 100644 --- a/src/gtk/dcps.cpp +++ b/src/gtk/dcps.cpp @@ -24,6 +24,9 @@ #include "wx/image.h" #include "wx/log.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // start and end of document/page //----------------------------------------------------------------------------- diff --git a/src/gtk/dcscreen.cpp b/src/gtk/dcscreen.cpp index bdb29ad1bd..b7a89b9b83 100644 --- a/src/gtk/dcscreen.cpp +++ b/src/gtk/dcscreen.cpp @@ -14,6 +14,9 @@ #include "wx/dcscreen.h" #include "wx/window.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // global data initialization //----------------------------------------------------------------------------- diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index f34fbdbf69..ceba496548 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -14,6 +14,9 @@ #include "wx/dialog.h" #include "wx/frame.h" #include "wx/app.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index d38405ec0c..12d4124a6a 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -18,6 +18,8 @@ #include "wx/intl.h" #include "wx/utils.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "gdk/gdkprivate.h" #include diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index df42cb90a1..0af0f8a0e0 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -16,151 +16,156 @@ #include "wx/intl.h" #include "wx/generic/msgdlgg.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxFileDialog //----------------------------------------------------------------------------- void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), gpointer data ) { - wxFileDialog *dialog = (wxFileDialog*)data; - wxCommandEvent event(wxEVT_NULL); - int style; + wxFileDialog *dialog = (wxFileDialog*)data; + wxCommandEvent event(wxEVT_NULL); + int style; - style=dialog->GetStyle(); + style = dialog->GetStyle(); - if((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) - if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) { + if((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) + { + if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) + { if(wxMessageBox(_("File exists. Overwrite?"), _("Confirm"), wxYES_NO) != wxYES) return; } + } - dialog->OnOK( event ); + dialog->OnOK( event ); } void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data ) { - wxFileDialog *dialog = (wxFileDialog*)data; - wxCommandEvent event(wxEVT_NULL); - dialog->OnCancel( event ); + wxFileDialog *dialog = (wxFileDialog*)data; + wxCommandEvent event(wxEVT_NULL); + dialog->OnCancel( event ); } IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog) -wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, - const wxString& defaultDir, const wxString& defaultFileName, - const wxString& wildCard, - long style, const wxPoint& pos ) +wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, + const wxString& defaultDir, const wxString& defaultFileName, + const wxString& wildCard, + long style, const wxPoint& pos ) { - m_needParent = FALSE; - - PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); - m_message = message; - m_path = ""; - m_fileName = defaultFileName; - m_dir = defaultDir; - m_wildCard = wildCard; - m_dialogStyle = style; - m_filterIndex = 1; - - m_widget = gtk_file_selection_new( m_message ); + m_needParent = FALSE; + + PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); + m_message = message; + m_path = ""; + m_fileName = defaultFileName; + m_dir = defaultDir; + m_wildCard = wildCard; + m_dialogStyle = style; + m_filterIndex = 1; + + m_widget = gtk_file_selection_new( m_message ); - int x = (gdk_screen_width () - 400) / 2; - int y = (gdk_screen_height () - 400) / 2; - gtk_widget_set_uposition( m_widget, x, y ); + int x = (gdk_screen_width () - 400) / 2; + int y = (gdk_screen_height () - 400) / 2; + gtk_widget_set_uposition( m_widget, x, y ); - GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); + GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); - m_path.Append(m_dir); - if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); - m_path.Append(m_fileName); + m_path.Append(m_dir); + if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); + m_path.Append(m_fileName); - if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path); + if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path); - gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", - GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", + GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", - GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", + GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); } int wxFileDialog::ShowModal(void) { - int ret = wxDialog::ShowModal(); - - if (ret == wxID_OK) - { - m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); - m_path = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); - } - return ret; + int ret = wxDialog::ShowModal(); + + if (ret == wxID_OK) + { + m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); + m_path = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); + } + return ret; } -char *wxFileSelector(const char *title, - const char *defaultDir, const char *defaultFileName, - const char *defaultExtension, const char *filter, int flags, - wxWindow *parent, int x, int y) +char *wxFileSelector( const char *title, + const char *defaultDir, const char *defaultFileName, + const char *defaultExtension, const char *filter, int flags, + wxWindow *parent, int x, int y ) { - wxString filter2(""); - if ( defaultExtension && !filter ) - filter2 = wxString("*.") + wxString(defaultExtension) ; - else if ( filter ) - filter2 = filter; - - wxString defaultDirString; - if (defaultDir) - defaultDirString = defaultDir; - else - defaultDirString = ""; - - wxString defaultFilenameString; - if (defaultFileName) - defaultFilenameString = defaultFileName; - else - defaultFilenameString = ""; - - wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, - filter2, flags, wxPoint(x, y)); - - if ( fileDialog.ShowModal() == wxID_OK ) - { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; - } - else - return (char *) NULL; + wxString filter2(""); + if ( defaultExtension && !filter ) + filter2 = wxString("*.") + wxString(defaultExtension) ; + else if ( filter ) + filter2 = filter; + + wxString defaultDirString; + if (defaultDir) + defaultDirString = defaultDir; + else + defaultDirString = ""; + + wxString defaultFilenameString; + if (defaultFileName) + defaultFilenameString = defaultFileName; + else + defaultFilenameString = ""; + + wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) ); + + if ( fileDialog.ShowModal() == wxID_OK ) + { + strcpy(wxBuffer, (const char *)fileDialog.GetPath()); + return wxBuffer; + } + else + { + return (char *) NULL; + } } -char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name, - wxWindow *parent ) +char* wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + char *ext = (char *)extension; - char prompt[50]; - wxString str = _("Load %s file"); - sprintf(prompt, str, what); + char prompt[50]; + wxString str = _("Load %s file"); + sprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == '.') ext++; + char wild[60]; + sprintf(wild, "*.%s", ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); } char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + char *ext = (char *)extension; - char prompt[50]; - wxString str = _("Save %s file"); - sprintf(prompt, str, what); + char prompt[50]; + wxString str = _("Save %s file"); + sprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == '.') ext++; + char wild[60]; + sprintf(wild, "*.%s", ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); } diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index 49a32fd768..a327b75fd0 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -16,6 +16,8 @@ #include "wx/log.h" #include +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // local data //----------------------------------------------------------------------------- diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index ae11c5097e..ec90e4e7e2 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -19,6 +19,10 @@ #include "wx/toolbar.h" #include "wx/statusbr.h" #include "wx/dcclient.h" + +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index eb0f339bb0..051b70390b 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -12,6 +12,8 @@ #endif #include "wx/gauge.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" //----------------------------------------------------------------------------- // wxGauge diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 630925e135..e9a16c6fb1 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -18,6 +18,9 @@ #include "wx/intl.h" #include "wx/checklst.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //------------------------------------------------------------------------- // conditional compilation //------------------------------------------------------------------------- diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 3612109580..cd4c7355f4 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -14,9 +14,13 @@ #include "wx/mdi.h" #include "wx/dialog.h" #include "wx/menu.h" -#include "wx/gtk/win_gtk.h" #include +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // constants //----------------------------------------------------------------------------- @@ -35,16 +39,16 @@ extern wxList wxPendingDelete; static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) { - if ((win->m_x == alloc->x) && - (win->m_y == alloc->y) && - (win->m_width == alloc->width) && - (win->m_height == alloc->height) && - (win->m_sizeSet)) - { - return; - } + if ((win->m_x == alloc->x) && + (win->m_y == alloc->y) && + (win->m_width == alloc->width) && + (win->m_height == alloc->height) && + (win->m_sizeSet)) + { + return; + } - win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); + win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); } //----------------------------------------------------------------------------- @@ -56,19 +60,19 @@ static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget), gint WXUNUSED(nPage), wxMDIClientWindow *client_win ) { - wxNode *node = client_win->m_children.First(); - while (node) - { - wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); - if (child_frame->m_page == page) + wxNode *node = client_win->m_children.First(); + while (node) { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)client_win->m_parent; - mdi_frame->m_currentChild = child_frame; - mdi_frame->SetMDIMenuBar( child_frame->m_menuBar ); - return; + wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); + if (child_frame->m_page == page) + { + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)client_win->m_parent; + mdi_frame->m_currentChild = child_frame; + mdi_frame->SetMDIMenuBar( child_frame->m_menuBar ); + return; + } + node = node->Next(); } - node = node->Next(); - } } //----------------------------------------------------------------------------- @@ -82,9 +86,9 @@ END_EVENT_TABLE() wxMDIParentFrame::wxMDIParentFrame(void) { - m_clientWindow = (wxMDIClientWindow *) NULL; - m_currentChild = (wxMDIChildFrame *) NULL; - m_parentFrameActive = TRUE; + m_clientWindow = (wxMDIClientWindow *) NULL; + m_currentChild = (wxMDIChildFrame *) NULL; + m_parentFrameActive = TRUE; } wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, @@ -92,10 +96,10 @@ wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { - m_clientWindow = (wxMDIClientWindow *) NULL; - m_currentChild = (wxMDIChildFrame *) NULL; - m_parentFrameActive = TRUE; - Create( parent, id, title, pos, size, style, name ); + m_clientWindow = (wxMDIClientWindow *) NULL; + m_currentChild = (wxMDIChildFrame *) NULL; + m_parentFrameActive = TRUE; + Create( parent, id, title, pos, size, style, name ); } wxMDIParentFrame::~wxMDIParentFrame(void) @@ -107,75 +111,75 @@ bool wxMDIParentFrame::Create( wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { - wxFrame::Create( parent, id, title, pos, size, style, name ); + wxFrame::Create( parent, id, title, pos, size, style, name ); - OnCreateClient(); + OnCreateClient(); - return TRUE; + return TRUE; } void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height ) { - wxFrame::GtkOnSize( x, y, width, height ); + wxFrame::GtkOnSize( x, y, width, height ); - if (m_mdiMenuBar) - { - m_mdiMenuBar->m_x = 0; - m_mdiMenuBar->m_y = 0; - m_mdiMenuBar->m_width = m_width; - m_mdiMenuBar->m_height = wxMENU_HEIGHT; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); - gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); - } + if (m_mdiMenuBar) + { + m_mdiMenuBar->m_x = 0; + m_mdiMenuBar->m_y = 0; + m_mdiMenuBar->m_width = m_width; + m_mdiMenuBar->m_height = wxMENU_HEIGHT; + gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); + gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); + } } void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar ) { - if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE ); - m_mdiMenuBar = menu_bar; - if (m_mdiMenuBar) - { - m_mdiMenuBar->m_x = 0; - m_mdiMenuBar->m_y = 0; - m_mdiMenuBar->m_width = m_width; - m_mdiMenuBar->m_height = wxMENU_HEIGHT; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); - gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); - m_mdiMenuBar->Show( TRUE ); - } + if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE ); + m_mdiMenuBar = menu_bar; + if (m_mdiMenuBar) + { + m_mdiMenuBar->m_x = 0; + m_mdiMenuBar->m_y = 0; + m_mdiMenuBar->m_width = m_width; + m_mdiMenuBar->m_height = wxMENU_HEIGHT; + gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); + gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); + m_mdiMenuBar->Show( TRUE ); + } } void wxMDIParentFrame::GetClientSize(int *width, int *height ) const { - wxFrame::GetClientSize( width, height ); + wxFrame::GetClientSize( width, height ); } wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const { - return m_currentChild; + return m_currentChild; } wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { - return m_clientWindow; + return m_clientWindow; } wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void) { - m_clientWindow = new wxMDIClientWindow( this ); - return m_clientWindow; + m_clientWindow = new wxMDIClientWindow( this ); + return m_clientWindow; } void wxMDIParentFrame::ActivateNext(void) { - if (m_clientWindow) - gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); + if (m_clientWindow) + gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); } void wxMDIParentFrame::ActivatePrevious(void) { - if (m_clientWindow) - gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); + if (m_clientWindow) + gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); } void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) @@ -193,13 +197,13 @@ void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(eve IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) - EVT_ACTIVATE(wxMDIChildFrame::OnActivate) + EVT_ACTIVATE(wxMDIChildFrame::OnActivate) END_EVENT_TABLE() wxMDIChildFrame::wxMDIChildFrame(void) { - m_menuBar = (wxMenuBar *) NULL; - m_page = (GtkNotebookPage *) NULL; + m_menuBar = (wxMenuBar *) NULL; + m_page = (GtkNotebookPage *) NULL; } wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, @@ -207,23 +211,23 @@ wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { - m_menuBar = (wxMenuBar *) NULL; - m_page = (GtkNotebookPage *) NULL; - Create( parent, id, title, wxDefaultPosition, size, style, name ); + m_menuBar = (wxMenuBar *) NULL; + m_page = (GtkNotebookPage *) NULL; + Create( parent, id, title, wxDefaultPosition, size, style, name ); } wxMDIChildFrame::~wxMDIChildFrame(void) { - if (m_menuBar) - { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; - if (mdi_frame->m_currentChild == this) + if (m_menuBar) { - mdi_frame->SetMDIMenuBar( (wxMenuBar *) NULL ); - mdi_frame->m_currentChild = (wxMDIChildFrame *) NULL; + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; + if (mdi_frame->m_currentChild == this) + { + mdi_frame->SetMDIMenuBar( (wxMenuBar *) NULL ); + mdi_frame->m_currentChild = (wxMDIChildFrame *) NULL; + } + delete m_menuBar; } - delete m_menuBar; - } } bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, @@ -231,64 +235,64 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { - m_title = title; + m_title = title; - return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); + return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); } void wxMDIChildFrame::GetClientSize( int *width, int *height ) const { - wxWindow::GetClientSize( width, height ); + wxWindow::GetClientSize( width, height ); } void wxMDIChildFrame::AddChild( wxWindow *child ) { - wxWindow::AddChild( child ); + wxWindow::AddChild( child ); } static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) { - menu->SetInvokingWindow( win ); - wxNode *node = menu->m_items.First(); - while (node) - { - wxMenuItem *menuitem = (wxMenuItem*)node->Data(); - if (menuitem->IsSubMenu()) - SetInvokingWindow( menuitem->GetSubMenu(), win ); - node = node->Next(); - } + menu->SetInvokingWindow( win ); + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *menuitem = (wxMenuItem*)node->Data(); + if (menuitem->IsSubMenu()) + SetInvokingWindow( menuitem->GetSubMenu(), win ); + node = node->Next(); + } } void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) { - m_menuBar = menu_bar; + m_menuBar = menu_bar; - if (m_menuBar) - { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; - - if (m_menuBar->m_parent != this) + if (m_menuBar) { - wxNode *node = m_menuBar->m_menus.First(); - while (node) - { - wxMenu *menu = (wxMenu*)node->Data(); - SetInvokingWindow( menu, this ); - node = node->Next(); - } - - m_menuBar->m_parent = mdi_frame; + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; + + if (m_menuBar->m_parent != this) + { + wxNode *node = m_menuBar->m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + SetInvokingWindow( menu, this ); + node = node->Next(); + } + + m_menuBar->m_parent = mdi_frame; + } + mdi_frame->SetMDIMenuBar( m_menuBar ); + + gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow), + m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y ); } - mdi_frame->SetMDIMenuBar( m_menuBar ); - - gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow), - m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y ); - } } wxMenuBar *wxMDIChildFrame::GetMenuBar() { - return m_menuBar; + return m_menuBar; } void wxMDIChildFrame::Activate(void) @@ -305,24 +309,24 @@ void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) ) static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* child ) { - wxString s = child->m_title; - if (s.IsNull()) s = _("MDI child"); + wxString s = child->m_title; + if (s.IsNull()) s = _("MDI child"); - GtkWidget *label_widget = gtk_label_new( s ); - gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); + GtkWidget *label_widget = gtk_label_new( s ); + gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); - gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", - GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); + gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", + GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); - GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget); + GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget); - gtk_notebook_append_page( notebook, child->m_widget, label_widget ); + gtk_notebook_append_page( notebook, child->m_widget, label_widget ); - child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); + child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); - gtk_notebook_set_page( notebook, parent->m_children.Number()-1 ); + gtk_notebook_set_page( notebook, parent->m_children.Number()-1 ); - gtk_page_change_callback( (GtkNotebook *) NULL, child->m_page, 0, parent ); + gtk_page_change_callback( (GtkNotebook *) NULL, child->m_page, 0, parent ); } //----------------------------------------------------------------------------- @@ -337,7 +341,7 @@ wxMDIClientWindow::wxMDIClientWindow(void) wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style ) { - CreateClient( parent, style ); + CreateClient( parent, style ); } wxMDIClientWindow::~wxMDIClientWindow(void) @@ -346,28 +350,28 @@ wxMDIClientWindow::~wxMDIClientWindow(void) bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) { - m_needParent = TRUE; + m_needParent = TRUE; - m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; + m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; - PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" ); + PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" ); - m_widget = gtk_notebook_new(); + m_widget = gtk_notebook_new(); - gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", - GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this ); + gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", + GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this ); - gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 ); + gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 ); - m_parent->AddChild( this ); + m_parent->AddChild( this ); - (m_parent->m_insertCallback)( m_parent, this ); + (m_parent->m_insertCallback)( m_parent, this ); - PostCreation(); + PostCreation(); - Show( TRUE ); + Show( TRUE ); - return TRUE; + return TRUE; } diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 11d281273e..ff038197a8 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -16,6 +16,9 @@ #include "wx/log.h" #include "wx/intl.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxMenuBar //----------------------------------------------------------------------------- @@ -24,124 +27,131 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow) wxMenuBar::wxMenuBar() { - m_needParent = FALSE; // hmmm + m_needParent = FALSE; // hmmm - PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); + PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); - m_menus.DeleteContents( TRUE ); + m_menus.DeleteContents( TRUE ); - m_menubar = gtk_menu_bar_new(); + m_menubar = gtk_menu_bar_new(); - m_widget = GTK_WIDGET(m_menubar); + m_widget = GTK_WIDGET(m_menubar); - PostCreation(); + PostCreation(); - Show( TRUE ); + Show( TRUE ); } void wxMenuBar::Append( wxMenu *menu, const wxString &title ) { - m_menus.Append( menu ); - menu->m_title = title; // ?????? + m_menus.Append( menu ); + menu->m_title = title; - int pos; - do { - pos = menu->m_title.First( '&' ); - if (pos != -1) menu->m_title.Remove( pos, 1 ); - } while (pos != -1); + int pos; + do + { + pos = menu->m_title.First( '&' ); + if (pos != -1) menu->m_title.Remove( pos, 1 ); + } while (pos != -1); - GtkWidget *root_menu; - root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) ); - gtk_widget_show( root_menu ); - gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu ); + GtkWidget *root_menu; + root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) ); + gtk_widget_show( root_menu ); + gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu ); - gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu ); + gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu ); } static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) { - if (menu->m_title == menuString) - { - int res = menu->FindItem( itemString ); - if (res != -1) return res; - } - wxNode *node = menu->m_items.First(); - while (node) - { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if (item->IsSubMenu()) - return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); - node = node->Next(); - } - return -1; + if (menu->m_title == menuString) + { + int res = menu->FindItem( itemString ); + if (res != -1) return res; + } + + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->IsSubMenu()) + return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); + node = node->Next(); + } + + return -1; } int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const { - wxNode *node = m_menus.First(); - while (node) - { - wxMenu *menu = (wxMenu*)node->Data(); - int res = FindMenuItemRecursive( menu, menuString, itemString); - if (res != -1) return res; - node = node->Next(); - } - return -1; + wxNode *node = m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + int res = FindMenuItemRecursive( menu, menuString, itemString); + if (res != -1) return res; + node = node->Next(); + } + return -1; } -// Find a wxMenuItem using its id. Recurses down into sub-menus +/* Find a wxMenuItem using its id. Recurses down into sub-menus */ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) { - wxMenuItem* result = menu->FindItem(id); + wxMenuItem* result = menu->FindItem(id); - wxNode *node = menu->m_items.First(); - while ( node && result == NULL ) { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if ( item->IsSubMenu() ) - result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); - node = node->Next(); - } + wxNode *node = menu->m_items.First(); + while ( node && result == NULL ) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->IsSubMenu()) + { + result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); + } + node = node->Next(); + } - return result; + return result; } wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const { - wxMenuItem* result = 0; - wxNode *node = m_menus.First(); - while (node && result == 0) - { - wxMenu *menu = (wxMenu*)node->Data(); - result = FindMenuItemByIdRecursive( menu, id ); - node = node->Next(); - } - return result; + wxMenuItem* result = 0; + wxNode *node = m_menus.First(); + while (node && result == 0) + { + wxMenu *menu = (wxMenu*)node->Data(); + result = FindMenuItemByIdRecursive( menu, id ); + node = node->Next(); + } + + return result; } void wxMenuBar::Check( int id, bool check ) { - wxMenuItem* item = FindMenuItemById( id ); - if (item) item->Check(check); + wxMenuItem* item = FindMenuItemById( id ); + if (item) item->Check(check); } bool wxMenuBar::Checked( int id ) const { - wxMenuItem* item = FindMenuItemById( id ); - if (item) return item->IsChecked(); - return FALSE; + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->IsChecked(); + return FALSE; } void wxMenuBar::Enable( int id, bool enable ) { - wxMenuItem* item = FindMenuItemById( id ); - if (item) item->Enable(enable); + wxMenuItem* item = FindMenuItemById( id ); + if (item) item->Enable(enable); } bool wxMenuBar::Enabled( int id ) const { - wxMenuItem* item = FindMenuItemById( id ); - if (item) return item->IsEnabled(); - return FALSE; + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->IsEnabled(); + return FALSE; } //----------------------------------------------------------------------------- @@ -150,27 +160,27 @@ bool wxMenuBar::Enabled( int id ) const static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { - int id = menu->FindMenuIdByMenuItem(widget); + int id = menu->FindMenuIdByMenuItem(widget); - // should find it for normal (not popup) menu - wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) ); + /* should find it for normal (not popup) menu */ + wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) ); - if (!menu->IsEnabled(id)) return; + if (!menu->IsEnabled(id)) return; - wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); - event.SetEventObject( menu ); - event.SetInt(id ); + wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); + event.SetEventObject( menu ); + event.SetInt(id ); - if (menu->m_callback) - { - (void) (*(menu->m_callback)) (*menu, event); - return; - } + if (menu->m_callback) + { + (void) (*(menu->m_callback)) (*menu, event); + return; + } - if (menu->GetEventHandler()->ProcessEvent(event)) return; + if (menu->GetEventHandler()->ProcessEvent(event)) return; - wxWindow *win = menu->GetInvokingWindow(); - if (win) win->GetEventHandler()->ProcessEvent( event ); + wxWindow *win = menu->GetInvokingWindow(); + if (win) win->GetEventHandler()->ProcessEvent( event ); } //----------------------------------------------------------------------------- @@ -179,28 +189,29 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) { - int id = menu->FindMenuIdByMenuItem(widget); + int id = menu->FindMenuIdByMenuItem(widget); + + wxASSERT( id != -1 ); // should find it! - wxASSERT( id != -1 ); // should find it! + if (!menu->IsEnabled(id)) return; - if (!menu->IsEnabled(id)) return; + wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id ); + event.SetEventObject( menu ); + event.SetInt(id ); - wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id ); - event.SetEventObject( menu ); - event.SetInt(id ); +/* wxMSW doesn't call callback here either -/* wxMSW doesn't call callback here either - if (menu->m_callback) - { - (void) (*(menu->m_callback)) (*menu, event); - return; - } + if (menu->m_callback) + { + (void) (*(menu->m_callback)) (*menu, event); + return; + } */ - if (menu->GetEventHandler()->ProcessEvent(event)) return; + if (menu->GetEventHandler()->ProcessEvent(event)) return; - wxWindow *win = menu->GetInvokingWindow(); - if (win) win->GetEventHandler()->ProcessEvent( event ); + wxWindow *win = menu->GetInvokingWindow(); + if (win) win->GetEventHandler()->ProcessEvent( event ); } //----------------------------------------------------------------------------- @@ -211,276 +222,305 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject) wxMenuItem::wxMenuItem() { - m_id = ID_SEPARATOR; - m_isCheckMenu = FALSE; - m_isChecked = FALSE; - m_isEnabled = TRUE; - m_subMenu = (wxMenu *) NULL; - m_menuItem = (GtkWidget *) NULL; + m_id = ID_SEPARATOR; + m_isCheckMenu = FALSE; + m_isChecked = FALSE; + m_isEnabled = TRUE; + m_subMenu = (wxMenu *) NULL; + m_menuItem = (GtkWidget *) NULL; } -// it's valid for this function to be called even if m_menuItem == NULL -void wxMenuItem::SetName(const wxString& str) +/* it's valid for this function to be called even if m_menuItem == NULL */ +void wxMenuItem::SetName( const wxString& str ) { - m_text = ""; - for ( const char *pc = str; *pc != '\0'; pc++ ) - { - if ( *pc == '&' ) - pc++; // skip it + m_text = ""; + for ( const char *pc = str; *pc != '\0'; pc++ ) + { + if (*pc == '&') pc++; /* skip it */ + m_text << *pc; + } - m_text << *pc; - } - - if ( m_menuItem ) - { - GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); - - gtk_label_set( label, m_text.c_str()); - } + if (m_menuItem) + { + GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); + gtk_label_set( label, m_text.c_str()); + } } void wxMenuItem::Check( bool check ) { - wxCHECK_RET( m_menuItem, "invalid menu item" ); + wxCHECK_RET( m_menuItem, "invalid menu item" ); - wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" ) + wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" ) - m_isChecked = check; - gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); + m_isChecked = check; + gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); } void wxMenuItem::Enable( bool enable ) { - wxCHECK_RET( m_menuItem, "invalid menu item" ); + wxCHECK_RET( m_menuItem, "invalid menu item" ); - gtk_widget_set_sensitive( m_menuItem, enable ); - m_isEnabled = enable; + gtk_widget_set_sensitive( m_menuItem, enable ); + m_isEnabled = enable; } bool wxMenuItem::IsChecked() const { - wxCHECK_MSG( m_menuItem, FALSE, "invalid menu item" ); + wxCHECK_MSG( m_menuItem, FALSE, "invalid menu item" ); - wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item! + wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item! - bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0; + bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0; - wxASSERT( bIsChecked == m_isChecked ); // consistency check + wxASSERT( bIsChecked == m_isChecked ); // consistency check - return bIsChecked; + return bIsChecked; } //----------------------------------------------------------------------------- -// wxMenuItem +// wxMenu //----------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) wxMenu::wxMenu( const wxString& title, const wxFunction func ) { - m_title = title; - m_items.DeleteContents( TRUE ); - m_invokingWindow = (wxWindow *) NULL; - m_menu = gtk_menu_new(); // Do not show! + m_title = title; + m_items.DeleteContents( TRUE ); + m_invokingWindow = (wxWindow *) NULL; + m_menu = gtk_menu_new(); // Do not show! - m_callback = func; - m_eventHandler = this; - m_clientData = (void*) NULL; + m_callback = func; + m_eventHandler = this; + m_clientData = (void*) NULL; - if (m_title.IsNull()) m_title = ""; - if (m_title != "") - { - Append(-2, m_title); - AppendSeparator(); - } + if (m_title.IsNull()) m_title = ""; + if (m_title != "") + { + Append(-2, m_title); + AppendSeparator(); + } } void wxMenu::SetTitle( const wxString& title ) { - // Waiting for something better. - m_title = title; + /* Waiting for something better. */ + m_title = title; } const wxString wxMenu::GetTitle() const { - return m_title; + return m_title; } void wxMenu::AppendSeparator() { - wxMenuItem *mitem = new wxMenuItem(); - mitem->SetId(ID_SEPARATOR); + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(ID_SEPARATOR); - GtkWidget *menuItem = gtk_menu_item_new(); - gtk_menu_append( GTK_MENU(m_menu), menuItem ); - gtk_widget_show( menuItem ); - mitem->SetMenuItem(menuItem); - m_items.Append( mitem ); + GtkWidget *menuItem = gtk_menu_item_new(); + gtk_menu_append( GTK_MENU(m_menu), menuItem ); + gtk_widget_show( menuItem ); + mitem->SetMenuItem(menuItem); + m_items.Append( mitem ); } void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable ) { - wxMenuItem *mitem = new wxMenuItem(); - mitem->SetId(id); - mitem->SetText(item); - mitem->SetHelp(helpStr); - mitem->SetCheckable(checkable); - const char *text = mitem->GetText(); - GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text) - : gtk_menu_item_new_with_label(text); + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(id); + mitem->SetText(item); + mitem->SetHelp(helpStr); + mitem->SetCheckable(checkable); + const char *text = mitem->GetText(); + GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text) + : gtk_menu_item_new_with_label(text); - mitem->SetMenuItem(menuItem); + mitem->SetMenuItem(menuItem); - gtk_signal_connect( GTK_OBJECT(menuItem), "activate", - GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), - (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(menuItem), "activate", + GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), + (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(menuItem), "select", - GTK_SIGNAL_FUNC(gtk_menu_hilight_callback), - (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(menuItem), "select", + GTK_SIGNAL_FUNC(gtk_menu_hilight_callback), + (gpointer*)this ); - gtk_menu_append( GTK_MENU(m_menu), menuItem ); - gtk_widget_show( menuItem ); - m_items.Append( mitem ); + gtk_menu_append( GTK_MENU(m_menu), menuItem ); + gtk_widget_show( menuItem ); + m_items.Append( mitem ); } void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr ) { - wxMenuItem *mitem = new wxMenuItem(); - mitem->SetId(id); - mitem->SetText(text); + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(id); + mitem->SetText(text); - GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText()); - mitem->SetHelp(helpStr); - mitem->SetMenuItem(menuItem); - mitem->SetSubMenu(subMenu); + GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText()); + mitem->SetHelp(helpStr); + mitem->SetMenuItem(menuItem); + mitem->SetSubMenu(subMenu); - gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), subMenu->m_menu ); - gtk_menu_append( GTK_MENU(m_menu), menuItem ); - gtk_widget_show( menuItem ); - m_items.Append( mitem ); + gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), subMenu->m_menu ); + gtk_menu_append( GTK_MENU(m_menu), menuItem ); + gtk_widget_show( menuItem ); + m_items.Append( mitem ); } int wxMenu::FindItem( const wxString itemString ) const { - wxString s( itemString ); + wxString s( itemString ); - int pos; - do { - pos = s.First( '&' ); - if (pos != -1) s.Remove( pos, 1 ); - } while (pos != -1); + int pos; + do + { + pos = s.First( '&' ); + if (pos != -1) s.Remove( pos, 1 ); + } while (pos != -1); - wxNode *node = m_items.First(); - while (node) - { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if (item->GetText() == s) - return item->GetId(); - node = node->Next(); - } + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetText() == s) + { + return item->GetId(); + } + node = node->Next(); + } - return -1; + return -1; } void wxMenu::Enable( int id, bool enable ) { - wxMenuItem *item = FindItem(id); - if ( item ) - item->Enable(enable); + wxMenuItem *item = FindItem(id); + if (item) + { + item->Enable(enable); + } } bool wxMenu::IsEnabled( int id ) const { - wxMenuItem *item = FindItem(id); - if ( item ) - return item->IsEnabled(); - else - return FALSE; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->IsEnabled(); + } + else + { + return FALSE; + } } void wxMenu::Check( int id, bool enable ) { - wxMenuItem *item = FindItem(id); - if ( item ) - item->Check(enable); + wxMenuItem *item = FindItem(id); + if (item) + { + item->Check(enable); + } } bool wxMenu::IsChecked( int id ) const { - wxMenuItem *item = FindItem(id); - if ( item ) - return item->IsChecked(); - else - return FALSE; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->IsChecked(); + } + else + { + return FALSE; + } } void wxMenu::SetLabel( int id, const wxString &label ) { - wxMenuItem *item = FindItem(id); - if (item) - item->SetText(label); + wxMenuItem *item = FindItem(id); + if (item) + { + item->SetText(label); + } } wxString wxMenu::GetLabel( int id ) const { - wxMenuItem *item = FindItem(id); - if (item) return item->GetText(); - return ""; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->GetText(); + } + else + { + return ""; + } } void wxMenu::SetHelpString( int id, const wxString& helpString ) { - wxMenuItem *item = FindItem(id); - if (item) item->SetHelp( helpString ); + wxMenuItem *item = FindItem(id); + if (item) item->SetHelp( helpString ); } wxString wxMenu::GetHelpString( int id ) const { - wxMenuItem *item = FindItem(id); - if (item) return item->GetHelp(); - return ""; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->GetHelp(); + } + else + { + return ""; + } } int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const { - wxNode *node = m_items.First(); - while (node) - { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if (item->GetMenuItem() == menuItem) - return item->GetId(); - node = node->Next(); - } + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetMenuItem() == menuItem) + return item->GetId(); + node = node->Next(); + } - return -1; + return -1; } wxMenuItem *wxMenu::FindItem(int id) const { - wxNode *node = m_items.First(); - while (node) { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if ( item->GetId() == id ) - return item; - node = node->Next(); - } + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetId() == id) + { + return item; + } + node = node->Next(); + } - // Not finding anything here can be correct - // when search the entire menu system for - // an entry -> no error message. + /* Not finding anything here can be correct + * when search the entire menu system for + * an entry -> no error message. */ - return (wxMenuItem *) NULL; + return (wxMenuItem *) NULL; } void wxMenu::SetInvokingWindow( wxWindow *win ) { - m_invokingWindow = win; + m_invokingWindow = win; } wxWindow *wxMenu::GetInvokingWindow() { - return m_invokingWindow; + return m_invokingWindow; } diff --git a/src/gtk/minifram.cpp b/src/gtk/minifram.cpp index d2e750c04a..a5a86f9be6 100644 --- a/src/gtk/minifram.cpp +++ b/src/gtk/minifram.cpp @@ -14,6 +14,10 @@ #include "wx/minifram.h" #include "wx/dcscreen.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" + + //----------------------------------------------------------------------------- // "clicked" //----------------------------------------------------------------------------- diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index ca46259e27..db83d59ac4 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -17,6 +17,10 @@ #include "wx/imaglist.h" #include "wx/intl.h" #include "wx/log.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" #include "gdk/gdkkeysyms.h" //----------------------------------------------------------------------------- diff --git a/src/gtk/palette.cpp b/src/gtk/palette.cpp index c94a33616d..4cdaef3726 100644 --- a/src/gtk/palette.cpp +++ b/src/gtk/palette.cpp @@ -15,6 +15,8 @@ #include "wx/palette.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxPalette //----------------------------------------------------------------------------- diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index 8402796a46..3152074605 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -14,6 +14,8 @@ #include "wx/pen.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxPen //----------------------------------------------------------------------------- diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 58c3867d01..9708cf57e0 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -15,6 +15,9 @@ #include "wx/radiobox.h" #include "wx/dialog.h" #include "wx/frame.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index efab7e9d5c..abf7ac99f2 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -13,6 +13,8 @@ #endif #include "wx/radiobut.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" //----------------------------------------------------------------------------- // data diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index a01289855b..a607e5da6c 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -14,6 +14,9 @@ #include "wx/region.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxRegion //----------------------------------------------------------------------------- diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index c0d729487d..a6973405bc 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -16,6 +16,9 @@ #include "wx/utils.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 334280504f..234bce0a2d 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -15,6 +15,9 @@ #include "wx/settings.h" #include "wx/debug.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + /* #define wxSYS_COLOUR_SCROLLBAR 0 #define wxSYS_COLOUR_BACKGROUND 1 diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index d45eda3add..cddd5f54f0 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -15,6 +15,9 @@ #include "wx/utils.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk/spinbutt.cpp b/src/gtk/spinbutt.cpp index 5fb2935fc4..dfe03b27a1 100644 --- a/src/gtk/spinbutt.cpp +++ b/src/gtk/spinbutt.cpp @@ -16,6 +16,9 @@ #include "wx/utils.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -28,31 +31,31 @@ extern bool g_blockEventsOnDrag; static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win ) { - if (!win->HasVMT()) return; - if (g_blockEventsOnDrag) return; + if (!win->HasVMT()) return; + if (g_blockEventsOnDrag) return; - float diff = win->m_adjust->value - win->m_oldPos; - if (fabs(diff) < 0.2) return; + float diff = win->m_adjust->value - win->m_oldPos; + if (fabs(diff) < 0.2) return; - wxEventType command = wxEVT_NULL; + wxEventType command = wxEVT_NULL; - float line_step = win->m_adjust->step_increment; - float page_step = win->m_adjust->page_increment; + float line_step = win->m_adjust->step_increment; + float page_step = win->m_adjust->page_increment; - if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN; - else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP; - else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN; - else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP; - else command = wxEVT_SCROLL_THUMBTRACK; + if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN; + else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP; + else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN; + else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP; + else command = wxEVT_SCROLL_THUMBTRACK; - int value = (int)(win->m_adjust->value+0.5); + int value = (int)(win->m_adjust->value+0.5); - wxSpinEvent event( command, win->GetId()); - event.SetPosition( value ); - event.SetOrientation( wxVERTICAL ); - event.SetEventObject( win ); + wxSpinEvent event( command, win->GetId()); + event.SetPosition( value ); + event.SetOrientation( wxVERTICAL ); + event.SetEventObject( win ); - win->ProcessEvent( event ); + win->ProcessEvent( event ); } //----------------------------------------------------------------------------- @@ -72,38 +75,40 @@ wxSpinButton::wxSpinButton() bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { - m_needParent = TRUE; + m_needParent = TRUE; - wxSize new_size = size; - new_size.x = 16; - if (new_size.y == -1) new_size.y = 30; + wxSize new_size = size; + new_size.x = 16; + if (new_size.y == -1) new_size.y = 30; - PreCreation( parent, id, pos, new_size, style, name ); + PreCreation( parent, id, pos, new_size, style, name ); // SetValidator( validator ); - m_oldPos = 0.0; + m_oldPos = 0.0; - m_adjust = (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 5.0, 0.0); + m_adjust = (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 5.0, 0.0); - m_widget = gtk_spin_button_new( m_adjust, 0, 0 ); + m_widget = gtk_spin_button_new( m_adjust, 0, 0 ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (m_windowStyle & wxSP_WRAP) ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (m_windowStyle & wxSP_WRAP) ); - gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed", - (GtkSignalFunc) gtk_spinbutt_callback, (gpointer) this ); + gtk_signal_connect( GTK_OBJECT (m_adjust), + "value_changed", + (GtkSignalFunc) gtk_spinbutt_callback, + (gpointer) this ); - m_parent->AddChild( this ); + m_parent->AddChild( this ); - (m_parent->m_insertCallback)( m_parent, this ); + (m_parent->m_insertCallback)( m_parent, this ); - PostCreation(); + PostCreation(); - SetBackgroundColour( parent->GetBackgroundColour() ); + SetBackgroundColour( parent->GetBackgroundColour() ); - Show( TRUE ); + Show( TRUE ); - return TRUE; + return TRUE; } wxSpinButton::~wxSpinButton() @@ -112,71 +117,74 @@ wxSpinButton::~wxSpinButton() int wxSpinButton::GetMin() const { - wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); + wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); - return (int)(m_adjust->lower+0.5); + return (int)(m_adjust->lower+0.5); } int wxSpinButton::GetMax() const { - wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); + wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); - return (int)(m_adjust->upper+0.5); + return (int)(m_adjust->upper+0.5); } int wxSpinButton::GetValue() const { - wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); + wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); - return (int)(m_adjust->value+0.5); + return (int)(m_adjust->value+0.5); } void wxSpinButton::SetValue( int value ) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); - float fpos = (float)value; - m_oldPos = fpos; - if (fabs(fpos-m_adjust->value) < 0.2) return; - m_adjust->value = fpos; + float fpos = (float)value; + m_oldPos = fpos; + if (fabs(fpos-m_adjust->value) < 0.2) return; + + m_adjust->value = fpos; - gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); + gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); } void wxSpinButton::SetRange(int minVal, int maxVal) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); - float fmin = (float)minVal; - float fmax = (float)maxVal; + float fmin = (float)minVal; + float fmax = (float)maxVal; - if ((fabs(fmin-m_adjust->lower) < 0.2) && - (fabs(fmax-m_adjust->upper) < 0.2)) - return; + if ((fabs(fmin-m_adjust->lower) < 0.2) && + (fabs(fmax-m_adjust->upper) < 0.2)) + { + return; + } - m_adjust->lower = fmin; - m_adjust->upper = fmax; + m_adjust->lower = fmin; + m_adjust->upper = fmax; - gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); + gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); } void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); - m_width = 16; - gtk_widget_set_usize( m_widget, m_width, m_height ); + m_width = 16; + gtk_widget_set_usize( m_widget, m_width, m_height ); } bool wxSpinButton::IsOwnGtkWindow( GdkWindow *window ) { - return GTK_SPIN_BUTTON(m_widget)->panel == window; + return GTK_SPIN_BUTTON(m_widget)->panel == window; } void wxSpinButton::ApplyWidgetStyle() { - SetWidgetStyle(); - gtk_widget_set_style( m_widget, m_widgetStyle ); + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); } //----------------------------------------------------------------------------- diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index 69b6b571d6..7d752190cd 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -13,6 +13,9 @@ #include "wx/statbmp.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxStaticBitmap //----------------------------------------------------------------------------- diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index a41325fb08..e5239cc924 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -13,6 +13,9 @@ #include "wx/statbox.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxStaticBox //----------------------------------------------------------------------------- diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index e7b40878d4..b1f31084a5 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -14,6 +14,9 @@ #include "wx/stattext.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxStaticText //----------------------------------------------------------------------------- diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 671fa18e00..0c7e7f1320 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -13,6 +13,10 @@ #include "wx/toolbar.h" +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -99,6 +103,8 @@ wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id, wxToolBar::~wxToolBar() { + delete m_fg; + delete m_bg; } bool wxToolBar::Create( wxWindow *parent, wxWindowID id, @@ -121,18 +127,20 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_widget = GTK_WIDGET(m_toolbar); gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); + + m_fg = new GdkColor; + m_fg->red = 0; + m_fg->green = 0; + m_fg->blue = 0; + gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), m_fg ); - m_fg.red = 0; - m_fg.green = 0; - m_fg.blue = 0; - gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), &m_fg ); - - m_bg.red = 65535; - m_bg.green = 65535; - m_bg.blue = 50000; - gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), &m_bg ); + m_bg = new GdkColor; + m_bg->red = 65535; + m_bg->green = 65535; + m_bg->blue = 50000; + gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), m_bg ); - gtk_tooltips_set_colors( GTK_TOOLBAR(m_toolbar)->tooltips, &m_bg, &m_fg ); + gtk_tooltips_set_colors( GTK_TOOLBAR(m_toolbar)->tooltips, m_bg, m_fg ); m_xMargin = 0; m_yMargin = 0; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 7a3cf2f76f..ea17cd1920 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -20,6 +20,8 @@ #include #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "gdk/gdkkeysyms.h" //----------------------------------------------------------------------------- diff --git a/src/gtk/threadpsx.cpp b/src/gtk/threadpsx.cpp index 224a3a15b8..2b314bec01 100644 --- a/src/gtk/threadpsx.cpp +++ b/src/gtk/threadpsx.cpp @@ -24,6 +24,9 @@ #include "wx/utils.h" #include "wx/log.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + enum thread_state { STATE_IDLE = 0, diff --git a/src/gtk/threadsgi.cpp b/src/gtk/threadsgi.cpp index 8dcac37000..3b66071667 100644 --- a/src/gtk/threadsgi.cpp +++ b/src/gtk/threadsgi.cpp @@ -23,7 +23,11 @@ #include "wx/utils.h" #include "wx/log.h" -enum thread_state { +#include "gdk/gdk.h" +#include "gtk/gtk.h" + +enum thread_state +{ STATE_IDLE = 0, STATE_RUNNING, STATE_CANCELED, diff --git a/src/gtk/timer.cpp b/src/gtk/timer.cpp index 61de7eeb11..36aada6e6f 100644 --- a/src/gtk/timer.cpp +++ b/src/gtk/timer.cpp @@ -14,6 +14,8 @@ #include "wx/timer.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxTimer //----------------------------------------------------------------------------- @@ -22,46 +24,49 @@ IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject) gint timeout_callback( gpointer data ) { - wxTimer *timer = (wxTimer*)data; - timer->Notify(); + wxTimer *timer = (wxTimer*)data; + timer->Notify(); - if ( timer->OneShot() ) - timer->Stop(); + if (timer->OneShot()) + { + timer->Stop(); + } - return TRUE; + return TRUE; } wxTimer::wxTimer() { - m_tag = -1; - m_time = 1000; - m_oneShot = FALSE; + m_tag = -1; + m_time = 1000; + m_oneShot = FALSE; } wxTimer::~wxTimer() { - Stop(); + Stop(); } bool wxTimer::Start( int millisecs, bool oneShot ) { - if ( millisecs != -1 ) - m_time = millisecs; + if (millisecs != -1) + { + m_time = millisecs; + } - m_oneShot = oneShot; + m_oneShot = oneShot; - m_tag = gtk_timeout_add( millisecs, timeout_callback, this ); + m_tag = gtk_timeout_add( millisecs, timeout_callback, this ); - return TRUE; + return TRUE; } void wxTimer::Stop() { - if ( m_tag != -1 ) - { - gtk_timeout_remove( m_tag ); - - m_tag = -1; - } + if (m_tag != -1) + { + gtk_timeout_remove( m_tag ); + m_tag = -1; + } } diff --git a/src/gtk/utilsgtk.cpp b/src/gtk/utilsgtk.cpp index 6f27685f98..252eda116c 100644 --- a/src/gtk/utilsgtk.cpp +++ b/src/gtk/utilsgtk.cpp @@ -34,7 +34,10 @@ #include #include -#include "gdk/gdkx.h" // GDK_DISPLAY +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "gdk/gdkx.h" #ifdef __SVR4__ #include diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 2d1683c26d..96a880d688 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -28,11 +28,15 @@ #include "wx/intl.h" #include "wx/settings.h" #include "wx/log.h" -#include "gdk/gdkprivate.h" -#include "gdk/gdkkeysyms.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "gdk/gdkprivate.h" +#include "gdk/gdkkeysyms.h" +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // documentation on internals //----------------------------------------------------------------------------- diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 53902a97a3..6b3be61991 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -26,6 +26,11 @@ #include "unistd.h" +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // global data //----------------------------------------------------------------------------- diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 3e9ade68da..0b6b995c25 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -14,9 +14,11 @@ #include "wx/bitmap.h" #include "wx/icon.h" #include "wx/filefn.h" +#include "wx/image.h" + +#include "gdk/gdk.h" #include "gdk/gdkprivate.h" #include "gdk/gdkx.h" -#include "wx/image.h" //----------------------------------------------------------------------------- // wxMask diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index cd10cf260c..49f84d1698 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -13,6 +13,9 @@ #include "wx/bmpbuttn.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- diff --git a/src/gtk1/brush.cpp b/src/gtk1/brush.cpp index 146a4d0d88..be6d5e2e91 100644 --- a/src/gtk1/brush.cpp +++ b/src/gtk1/brush.cpp @@ -13,6 +13,8 @@ #include "wx/brush.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxBrush //----------------------------------------------------------------------------- diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 8980bb0301..8c91ec2adc 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -13,6 +13,9 @@ #include "wx/button.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // classes //----------------------------------------------------------------------------- diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 9d594ca495..85425761d0 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -14,6 +14,9 @@ #include "wx/checkbox.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk1/checklst.cpp b/src/gtk1/checklst.cpp index 4d7e6fe775..1a092196ec 100644 --- a/src/gtk1/checklst.cpp +++ b/src/gtk1/checklst.cpp @@ -13,6 +13,9 @@ #include "wx/checklst.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxCheckListBox //----------------------------------------------------------------------------- diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 8bbf2ab5b2..27ba2fa798 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -14,6 +14,9 @@ #include "wx/choice.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk1/clipbrd.cpp b/src/gtk1/clipbrd.cpp index f220a49abd..d142820342 100644 --- a/src/gtk1/clipbrd.cpp +++ b/src/gtk1/clipbrd.cpp @@ -13,6 +13,10 @@ #include "wx/clipbrd.h" +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk1/colour.cpp b/src/gtk1/colour.cpp index 74e414ef03..c9a9255301 100644 --- a/src/gtk1/colour.cpp +++ b/src/gtk1/colour.cpp @@ -14,6 +14,7 @@ #include "wx/gdicmn.h" +#include "gdk/gdk.h" #include "gdk/gdkprivate.h" //----------------------------------------------------------------------------- diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index ae8b352156..1405a02f1d 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -14,6 +14,9 @@ #include "wx/combobox.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk1/cursor.cpp b/src/gtk1/cursor.cpp index 73babdfb05..2034a9076a 100644 --- a/src/gtk1/cursor.cpp +++ b/src/gtk1/cursor.cpp @@ -14,6 +14,8 @@ #include "wx/cursor.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxCursor //----------------------------------------------------------------------------- diff --git a/src/gtk1/data.cpp b/src/gtk1/data.cpp index 42e8ea7018..e72ca64abd 100644 --- a/src/gtk1/data.cpp +++ b/src/gtk1/data.cpp @@ -21,8 +21,7 @@ #define _MAXPATHLEN 500 -// Used for X resources - +/* Used for X resources */ #include #include #include @@ -30,50 +29,49 @@ wxResourceCache *wxTheResourceCache = (wxResourceCache *) NULL; XrmDatabase wxResourceDatabase; -// Useful buffer, initialized in wxCommonInit +/* Useful buffer, initialized in wxCommonInit */ char *wxBuffer = (char *) NULL; -// Windows List +/* Windows List */ wxList wxTopLevelWindows; -// List of windows pending deletion +/* List of windows pending deletion */ wxList wxPendingDelete; -// Current cursor, in order to hang on to -// cursor handle when setting the cursor globally +/* Current cursor, in order to hang on to + * cursor handle when setting the cursor globally */ wxCursor *g_globalCursor = (wxCursor *) NULL; -// Don't allow event propagation during drag +/* Don't allow event propagation during drag */ bool g_blockEventsOnDrag = FALSE; -// Don't allow mouse event propagation during scroll +/* Don't allow mouse event propagation during scroll */ bool g_blockEventsOnScroll = FALSE; -// Message Strings for Internationalization +/* Message Strings for Internationalization */ char **wx_msg_str = (char**)NULL; -// Custom OS version, as optionally placed in wx.ini/.wxrc -// Currently this can be Win95, Windows, Win32s, WinNT. -// For some systems, you can't tell until run-time what services you -// have. See wxGetOsVersion, which uses this string if present. +/* Custom OS version, as optionally placed in wx.ini/.wxrc + * Currently this can be Win95, Windows, Win32s, WinNT. + * For some systems, you can't tell until run-time what services you + * have. See wxGetOsVersion, which uses this string if present. */ char *wxOsVersion = (char *) NULL; -// For printing several pages +/* For printing several pages */ int wxPageNumber; wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase *) NULL; -// GDI Object Lists +/* GDI Object Lists */ wxBrushList *wxTheBrushList = (wxBrushList *) NULL; wxPenList *wxThePenList = (wxPenList *) NULL; wxFontList *wxTheFontList = (wxFontList *) NULL; wxColourDatabase *wxTheColourDatabase = (wxColourDatabase *) NULL; -wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL; +wxBitmapList *wxTheBitmapList = (wxBitmapList *) NULL; - -// X only font names +/* X only font names */ wxFontNameDirectory *wxTheFontNameDirectory; -// Stock objects +/* Stock objects */ wxFont *wxNORMAL_FONT; wxFont *wxSMALL_FONT; wxFont *wxITALIC_FONT; @@ -103,7 +101,7 @@ wxBrush *wxLIGHT_GREY_BRUSH; wxColour *wxBLACK; wxColour *wxWHITE; -wxColour *wxGREY; // Robert Roebling +wxColour *wxGREY; wxColour *wxRED; wxColour *wxBLUE; wxColour *wxGREEN; @@ -114,7 +112,7 @@ wxCursor *wxSTANDARD_CURSOR = (wxCursor *) NULL; wxCursor *wxHOURGLASS_CURSOR = (wxCursor *) NULL; wxCursor *wxCROSS_CURSOR = (wxCursor *) NULL; -// 'Null' objects +/* 'Null' objects */ wxAcceleratorTable wxNullAcceleratorTable; wxBitmap wxNullBitmap; wxIcon wxNullIcon; @@ -126,7 +124,7 @@ wxColour wxNullColour; wxPalette wxNullPalette; wxRegion wxNullRegion; -// Default window names +/* Default window names */ const char *wxButtonNameStr = "button"; const char *wxCanvasNameStr = "canvas"; const char *wxCheckBoxNameStr = "check"; @@ -162,610 +160,10 @@ const char *wxFileSelectorDefaultWildcardStr = "*.*"; const char *wxInternalErrorStr = "wxWindows Internal Error"; const char *wxFatalErrorStr = "wxWindows Fatal Error"; -// See wx/utils.h +/* See wx/utils.h */ const char *wxFloatToStringStr = "%.2f"; const char *wxDoubleToStringStr = "%.2f"; -#ifdef wx_msw -const char *wxUserResourceStr = "TEXT"; -#endif - - -#if wxUSE_SHARED_LIBRARY -/* - * For wxWindows to be made into a dynamic library (e.g. Sun), - * all IMPLEMENT_... macros must be in one place. - * But normally, the definitions are in the appropriate places. - */ - -// Hand-coded IMPLEMENT... macro for wxObject (define static data) -wxClassInfo wxObject::classwxObject((char *) "wxObject", (char *) NULL, (char *) NULL, (int ) sizeof(wxObject), (wxObjectConstructorFn) NULL); -wxClassInfo *wxClassInfo::first = (wxClassInfo *) NULL; -wxHashTable wxClassInfo::classTable(wxKEY_STRING); - -#include "wx/button.h" -#include "wx/bmpbuttn.h" -IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton) - -#include "wx/checkbox.h" -IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox) - -#include "wx/choice.h" -IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) - -#if wxUSE_CLIPBOARD -#include "wx/clipbrd.h" -IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject) -#endif - -#if wxUSE_COMBOBOX -#include "wx/combobox.h" -IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl) -#endif - -#include "wx/dc.h" -#include "wx/dcmemory.h" -#include "wx/dcclient.h" -#include "wx/dcscreen.h" -IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) - -#if defined(wx_msw) -#include "wx/dcprint.h" -IMPLEMENT_CLASS(wxPrinterDC, wxDC) -#endif - -#include "wx/dialog.h" -IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxWindow) - -#include "wx/frame.h" -IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) - -#include "wx/mdi.h" -IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) -IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) - -#include "wx/cmndata.h" -IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject) - -#include "wx/colordlg.h" -#include "wx/fontdlg.h" - -#if !defined(wx_msw) || wxUSE_GENERIC_DIALOGS_IN_MSW -#include "wx/generic/colordlg.h" -#include "wx/generic/fontdlg.h" -IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog) -IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog) -#endif - -// X defines wxColourDialog to be wxGenericColourDialog -#ifndef wx_x -IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) -IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) -#endif - -#include "wx/gdicmn.h" -#include "wx/pen.h" -#include "wx/brush.h" -#include "wx/font.h" -#include "wx/palette.h" -#include "wx/icon.h" -#include "wx/cursor.h" - -IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject) -IMPLEMENT_CLASS(wxColourDatabase, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList) -IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList) - -/* -#if (!USE_TYPEDEFS) -IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxIntPoint, wxObject) -#endif -*/ - -#if defined(wx_x) || (defined(wx_msw) && wxUSE_PORTABLE_FONTS_IN_MSW) -IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject) -#endif - -#include "wx/hash.h" -IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject) - -#include "wx/help.h" -IMPLEMENT_DYNAMIC_CLASS(wxHelpInstance, wxClient) -IMPLEMENT_CLASS(wxHelpConnection, wxConnection) - -#include "wx/list.h" -IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList) - -#if wxUSE_PRINTING_ARCHITECTURE -#include "wx/print.h" -IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog) -IMPLEMENT_DYNAMIC_CLASS(wxPrinterBase, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase) -IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase) -IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject) -IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow) -IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow) -IMPLEMENT_CLASS(wxPreviewFrame, wxFrame) -IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject) -IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase) -IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase) -IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog) -IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog) -#endif - -#if wxUSE_POSTSCRIPT -#include "wx/postscrp.h" -IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC) -IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPageSetupData, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList) -#endif - -#if wxUSE_WX_RESOURCES -#include "wx/resource.h" -IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable) -#endif - -#include "wx/event.h" -IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent) -IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent) -IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent) - -#include "wx/utils.h" -IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList) - -// IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject) - -#include "wx/process.h" -IMPLEMENT_DYNAMIC_CLASS(wxProcess, wxEvtHandler) - -#if wxUSE_TIMEDATE -#include "wx/date.h" -IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject) -#endif - -#if wxUSE_DOC_VIEW_ARCHITECTURE -#include "wx/docview.h" -//IMPLEMENT_ABSTRACT_CLASS(wxDocItem, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler) -IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler) -IMPLEMENT_CLASS(wxDocChildFrame, wxFrame) -IMPLEMENT_CLASS(wxDocParentFrame, wxFrame) -#if wxUSE_PRINTING_ARCHITECTURE -IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout) -#endif -IMPLEMENT_CLASS(wxCommand, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject) -#endif - -#if wxUSE_CONSTRAINTS -#include "wx/layout.h" -IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxSizer, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxRowColSizer, wxSizer) -#endif - -#if wxUSE_TOOLBAR -#include "wx/tbarbase.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl) - -#include "wx/tbarsmpl.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBarSimple, wxToolBarBase) - -#ifdef wx_msw -#include "wx/tbarmsw.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase) - -#include "wx/tbar95.h" -IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase) -#endif - -#endif - -#include "wx/sckaddr.h" - -IMPLEMENT_DYNAMIC_CLASS(wxIPV4address, wxSockAddress) -#ifdef ENABLE_IPV6 -IMPLEMENT_DYNAMIC_CLASS(wxIPV6address, wxSockAddress) -#endif -#ifndef __UNIX__ -IMPLEMENT_DYNAMIC_CLASS(wxUNIXaddress, wxSockAddress) -#endif - -#include "wx/socket.h" - -IMPLEMENT_CLASS(wxSocketBase, wxEvtHandler) -IMPLEMENT_CLASS(wxSocketClient, wxSocketBase) -IMPLEMENT_CLASS(wxSocketServer, wxSocketBase) -IMPLEMENT_CLASS(wxSocketHandler, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxSocketEvent, wxEvent) - -#include "wx/url.h" - -IMPLEMENT_CLASS(wxProtoInfo, wxObject) -IMPLEMENT_CLASS(wxURL, wxObject) - -#include "wx/protocol/http.h" - -IMPLEMENT_DYNAMIC_CLASS(wxHTTP, wxProtocol) -IMPLEMENT_PROTOCOL(wxHTTP, "http", "80", TRUE) - -#include "wx/protocol/ftp.h" - -IMPLEMENT_DYNAMIC_CLASS(wxFTP, wxProtocol) -IMPLEMENT_PROTOCOL(wxFTP, "ftp", "21", TRUE) - -#include "wx/protocol/sckfile.h" - -IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) -IMPLEMENT_PROTOCOL(wxFileProto, "file", NULL, FALSE) - -#include "wx/sckipc.h" - -IMPLEMENT_DYNAMIC_CLASS(wxTCPServer, wxServerBase) -IMPLEMENT_DYNAMIC_CLASS(wxTCPClient, wxClientBase) -IMPLEMENT_DYNAMIC_CLASS(wxTCPConnection, wxConnectionBase) - -#include "wx/statusbr.h" - -IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow) - -BEGIN_EVENT_TABLE(wxStatusBar, wxWindow) - EVT_PAINT(wxStatusBar::OnPaint) - EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged) -END_EVENT_TABLE() - -#if wxUSE_TIMEDATE -#include "wx/time.h" -IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject) -#endif - -#if !USE_GNU_WXSTRING -#include "wx/string.h" -IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject) -#endif - -#ifdef wx_motif -IMPLEMENT_DYNAMIC_CLASS(wxXColormap, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxXFont, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject) -#endif -IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap) -IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap) -IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) -IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) - -// This will presumably be implemented on other platforms too -#ifdef wx_msw -IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxBitmapHandler) -IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxBitmapHandler) -#endif - -#include "wx/statbox.h" -IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) - -#if wxUSE_IPC -#include "wx/dde.h" -IMPLEMENT_ABSTRACT_CLASS(wxDDEObject, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxDDEObject) -IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxDDEObject) -IMPLEMENT_CLASS(wxDDEConnection, wxObject) -#endif - -IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow) - -#include "wx/listbox.h" -IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) - -IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler) - -#include "wx/menu.h" -IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow) -IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject) -IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow) - -#include "wx/stattext.h" -#include "wx/statbmp.h" -IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl) -IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl) - -#if wxUSE_METAFILE -#include "wx/metafile.h" -IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject) -IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC) -#endif - -#include "wx/radiobox.h" -#include "wx/radiobut.h" -IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl) - -IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl) -// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton) - -#include "wx/scrolbar.h" -IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl) - -#if WXWIN_COMPATIBILITY -BEGIN_EVENT_TABLE(wxScrollBar, wxControl) - EVT_SCROLL(wxScrollBar::OnScroll) -END_EVENT_TABLE() -#endif - -#include "wx/slider.h" -IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl) - -#if WXWIN_COMPATIBILITY -BEGIN_EVENT_TABLE(wxSlider, wxControl) - EVT_SCROLL(wxSlider::OnScroll) -END_EVENT_TABLE() -#endif - -#include "wx/timer.h" -IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) - -#include "wx/textctrl.h" -IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl) - -#include "wx/window.h" -IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) - -#include "wx/scrolwin.h" -IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow) - -#include "wx/panel.h" -IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow) - -#include "wx/msgbxdlg.h" -#include "wx/textdlg.h" -#include "wx/filedlg.h" -#include "wx/dirdlg.h" -#include "wx/choicdlg.h" - -#if !defined(wx_msw) || wxUSE_GENERIC_DIALOGS_IN_MSW -#include "wx/generic/msgdlgg.h" -IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog) -#endif - -IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog) -IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog) -IMPLEMENT_CLASS(wxFileDialog, wxDialog) -IMPLEMENT_CLASS(wxDirDialog, wxDialog) - -#ifdef wx_msw -IMPLEMENT_CLASS(wxMessageDialog) -#endif - -#if wxUSE_GAUGE -#ifdef wx_motif -#include "../../contrib/xmgauge/gauge.h" -#endif -#include "wx_gauge.h" -IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl) -#endif - -#include "wx/grid.h" -IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel) - -///// Event tables (also must be in one, statically-linked file for shared libraries) - -// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here -const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; } - -const wxEventTable wxEvtHandler::sm_eventTable = - { NULL, &wxEvtHandler::sm_eventTableEntries[0] }; - -const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, -#ifdef __SGI_CC__ - 0L -#else - NULL -#endif - } -}; - -BEGIN_EVENT_TABLE(wxFrame, wxWindow) - EVT_SIZE(wxFrame::OnSize) - EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight) - EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) - EVT_IDLE(wxFrame::OnIdle) - EVT_CLOSE(wxFrame::OnCloseWindow) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxDialog, wxPanel) - EVT_BUTTON(wxID_OK, wxDialog::OnOK) - EVT_BUTTON(wxID_APPLY, wxDialog::OnApply) - EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel) - EVT_CHAR_HOOK(wxDialog::OnCharHook) - EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged) - EVT_CLOSE(wxDialog::OnCloseWindow) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) - EVT_CHAR(wxWindow::OnChar) - EVT_SIZE(wxWindow::Size) - EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) - EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) - EVT_INIT_DIALOG(wxWindow::OnInitDialog) - EVT_IDLE(wxWindow::OnIdle) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow) - EVT_SCROLL(wxScrolledWindow::OnScroll) - EVT_SIZE(wxScrolledWindow::OnSize) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxPanel, wxWindow) - EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) - EVT_CHAR(wxTextCtrl::OnChar) - EVT_DROP_FILES(wxTextCtrl::OnDropFiles) - EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) -END_EVENT_TABLE() - -#ifdef wx_msw -BEGIN_EVENT_TABLE(wxMDIParentWindow, wxFrame) - EVT_SIZE(wxMDIParentWindow::OnSize) - EVT_ACTIVATE(wxMDIParentWindow::OnActivate) - EVT_SYS_COLOUR_CHANGED(wxMDIParentWindow::OnSysColourChanged) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) - EVT_SCROLL(wxMDIClientWindow::OnScroll) -END_EVENT_TABLE() -#endif - -BEGIN_EVENT_TABLE(wxToolBarBase, wxControl) - EVT_SCROLL(wxToolBarBase::OnScroll) - EVT_SIZE(wxToolBarBase::OnSize) - EVT_IDLE(wxToolBarBase::OnIdle) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase) - EVT_SIZE(wxToolBarSimple::OnSize) - EVT_PAINT(wxToolBarSimple::OnPaint) - EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus) - EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent) -END_EVENT_TABLE() - -#ifdef wx_msw -BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase) - EVT_SIZE(wxToolBarMSW::OnSize) - EVT_PAINT(wxToolBarMSW::OnPaint) - EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase) - EVT_SIZE(wxToolBar95::OnSize) - EVT_PAINT(wxToolBar95::OnPaint) - EVT_KILL_FOCUS(wxToolBar95::OnKillFocus) - EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent) - EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged) -END_EVENT_TABLE() -#endif - -BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel) - EVT_SIZE(wxGenericGrid::OnSize) - EVT_PAINT(wxGenericGrid::OnPaint) - EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent) - EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText) - EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll) - EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxControl, wxWindow) - EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground) -END_EVENT_TABLE() - -#if !defined(wx_msw) || wxUSE_GENERIC_DIALOGS_IN_MSW -BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog) - EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes) - EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo) - EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog) - EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom) - EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider) - EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider) - EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider) - EVT_PAINT(wxGenericColourDialog::OnPaint) - EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog) - EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont) - EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont) - EVT_PAINT(wxGenericFontDialog::OnPaint) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK) - EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup) - EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange) -END_EVENT_TABLE() - -#endif - -BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog) - EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK) -END_EVENT_TABLE() - -#include "wx/prntbase.h" - -BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog) - EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel) -END_EVENT_TABLE() - -BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow) - EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose) - EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) - EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious) - EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext) - EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom) -END_EVENT_TABLE() - -#endif - - +/* Dafaults for wxWindow etc. */ const wxSize wxDefaultSize(-1, -1); const wxPoint wxDefaultPosition(-1, -1); diff --git a/src/gtk1/dc.cpp b/src/gtk1/dc.cpp index 44fe792814..821bef8774 100644 --- a/src/gtk1/dc.cpp +++ b/src/gtk1/dc.cpp @@ -14,6 +14,9 @@ #include "wx/dc.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // constants //----------------------------------------------------------------------------- diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 0b2a1391cd..f1af921f28 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -16,6 +16,9 @@ #include "wx/image.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // local data //----------------------------------------------------------------------------- diff --git a/src/gtk1/dcmemory.cpp b/src/gtk1/dcmemory.cpp index e996334c00..139438b215 100644 --- a/src/gtk1/dcmemory.cpp +++ b/src/gtk1/dcmemory.cpp @@ -13,6 +13,9 @@ #include "wx/dcmemory.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxMemoryDC //----------------------------------------------------------------------------- diff --git a/src/gtk1/dcps.cpp b/src/gtk1/dcps.cpp index 275e0d1b35..8ee9ce5a25 100644 --- a/src/gtk1/dcps.cpp +++ b/src/gtk1/dcps.cpp @@ -24,6 +24,9 @@ #include "wx/image.h" #include "wx/log.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // start and end of document/page //----------------------------------------------------------------------------- diff --git a/src/gtk1/dcscreen.cpp b/src/gtk1/dcscreen.cpp index bdb29ad1bd..b7a89b9b83 100644 --- a/src/gtk1/dcscreen.cpp +++ b/src/gtk1/dcscreen.cpp @@ -14,6 +14,9 @@ #include "wx/dcscreen.h" #include "wx/window.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // global data initialization //----------------------------------------------------------------------------- diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index f34fbdbf69..ceba496548 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -14,6 +14,9 @@ #include "wx/dialog.h" #include "wx/frame.h" #include "wx/app.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index d38405ec0c..12d4124a6a 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -18,6 +18,8 @@ #include "wx/intl.h" #include "wx/utils.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "gdk/gdkprivate.h" #include diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index df42cb90a1..0af0f8a0e0 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -16,151 +16,156 @@ #include "wx/intl.h" #include "wx/generic/msgdlgg.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxFileDialog //----------------------------------------------------------------------------- void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), gpointer data ) { - wxFileDialog *dialog = (wxFileDialog*)data; - wxCommandEvent event(wxEVT_NULL); - int style; + wxFileDialog *dialog = (wxFileDialog*)data; + wxCommandEvent event(wxEVT_NULL); + int style; - style=dialog->GetStyle(); + style = dialog->GetStyle(); - if((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) - if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) { + if((style&wxSAVE)&&(style&wxOVERWRITE_PROMPT)) + { + if(wxFileExists(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog->m_widget) ))) + { if(wxMessageBox(_("File exists. Overwrite?"), _("Confirm"), wxYES_NO) != wxYES) return; } + } - dialog->OnOK( event ); + dialog->OnOK( event ); } void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data ) { - wxFileDialog *dialog = (wxFileDialog*)data; - wxCommandEvent event(wxEVT_NULL); - dialog->OnCancel( event ); + wxFileDialog *dialog = (wxFileDialog*)data; + wxCommandEvent event(wxEVT_NULL); + dialog->OnCancel( event ); } IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog) -wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, - const wxString& defaultDir, const wxString& defaultFileName, - const wxString& wildCard, - long style, const wxPoint& pos ) +wxFileDialog::wxFileDialog( wxWindow *parent, const wxString& message, + const wxString& defaultDir, const wxString& defaultFileName, + const wxString& wildCard, + long style, const wxPoint& pos ) { - m_needParent = FALSE; - - PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); - m_message = message; - m_path = ""; - m_fileName = defaultFileName; - m_dir = defaultDir; - m_wildCard = wildCard; - m_dialogStyle = style; - m_filterIndex = 1; - - m_widget = gtk_file_selection_new( m_message ); + m_needParent = FALSE; + + PreCreation( parent, -1, pos, wxDefaultSize, style | wxDIALOG_MODAL, "filedialog" ); + m_message = message; + m_path = ""; + m_fileName = defaultFileName; + m_dir = defaultDir; + m_wildCard = wildCard; + m_dialogStyle = style; + m_filterIndex = 1; + + m_widget = gtk_file_selection_new( m_message ); - int x = (gdk_screen_width () - 400) / 2; - int y = (gdk_screen_height () - 400) / 2; - gtk_widget_set_uposition( m_widget, x, y ); + int x = (gdk_screen_width () - 400) / 2; + int y = (gdk_screen_height () - 400) / 2; + gtk_widget_set_uposition( m_widget, x, y ); - GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); + GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget); - m_path.Append(m_dir); - if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); - m_path.Append(m_fileName); + m_path.Append(m_dir); + if(! m_path.IsEmpty() && m_path.Last()!='/') m_path.Append('/'); + m_path.Append(m_fileName); - if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path); + if(m_path.Length()>1) gtk_file_selection_set_filename(sel,m_path); - gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", - GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked", + GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", - GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked", + GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this ); } int wxFileDialog::ShowModal(void) { - int ret = wxDialog::ShowModal(); - - if (ret == wxID_OK) - { - m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); - m_path = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); - } - return ret; + int ret = wxDialog::ShowModal(); + + if (ret == wxID_OK) + { + m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); + m_path = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) ); + } + return ret; } -char *wxFileSelector(const char *title, - const char *defaultDir, const char *defaultFileName, - const char *defaultExtension, const char *filter, int flags, - wxWindow *parent, int x, int y) +char *wxFileSelector( const char *title, + const char *defaultDir, const char *defaultFileName, + const char *defaultExtension, const char *filter, int flags, + wxWindow *parent, int x, int y ) { - wxString filter2(""); - if ( defaultExtension && !filter ) - filter2 = wxString("*.") + wxString(defaultExtension) ; - else if ( filter ) - filter2 = filter; - - wxString defaultDirString; - if (defaultDir) - defaultDirString = defaultDir; - else - defaultDirString = ""; - - wxString defaultFilenameString; - if (defaultFileName) - defaultFilenameString = defaultFileName; - else - defaultFilenameString = ""; - - wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, - filter2, flags, wxPoint(x, y)); - - if ( fileDialog.ShowModal() == wxID_OK ) - { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); - return wxBuffer; - } - else - return (char *) NULL; + wxString filter2(""); + if ( defaultExtension && !filter ) + filter2 = wxString("*.") + wxString(defaultExtension) ; + else if ( filter ) + filter2 = filter; + + wxString defaultDirString; + if (defaultDir) + defaultDirString = defaultDir; + else + defaultDirString = ""; + + wxString defaultFilenameString; + if (defaultFileName) + defaultFilenameString = defaultFileName; + else + defaultFilenameString = ""; + + wxFileDialog fileDialog( parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y) ); + + if ( fileDialog.ShowModal() == wxID_OK ) + { + strcpy(wxBuffer, (const char *)fileDialog.GetPath()); + return wxBuffer; + } + else + { + return (char *) NULL; + } } -char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name, - wxWindow *parent ) +char* wxLoadFileSelector( const char *what, const char *extension, const char *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + char *ext = (char *)extension; - char prompt[50]; - wxString str = _("Load %s file"); - sprintf(prompt, str, what); + char prompt[50]; + wxString str = _("Load %s file"); + sprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == '.') ext++; + char wild[60]; + sprintf(wild, "*.%s", ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); } char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent ) { - char *ext = (char *)extension; + char *ext = (char *)extension; - char prompt[50]; - wxString str = _("Save %s file"); - sprintf(prompt, str, what); + char prompt[50]; + wxString str = _("Save %s file"); + sprintf(prompt, str, what); - if (*ext == '.') ext++; - char wild[60]; - sprintf(wild, "*.%s", ext); + if (*ext == '.') ext++; + char wild[60]; + sprintf(wild, "*.%s", ext); - return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); + return wxFileSelector (prompt, (const char *) NULL, default_name, ext, wild, 0, parent); } diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index 49a32fd768..a327b75fd0 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -16,6 +16,8 @@ #include "wx/log.h" #include +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // local data //----------------------------------------------------------------------------- diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index ae11c5097e..ec90e4e7e2 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -19,6 +19,10 @@ #include "wx/toolbar.h" #include "wx/statusbr.h" #include "wx/dcclient.h" + +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp index eb0f339bb0..051b70390b 100644 --- a/src/gtk1/gauge.cpp +++ b/src/gtk1/gauge.cpp @@ -12,6 +12,8 @@ #endif #include "wx/gauge.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" //----------------------------------------------------------------------------- // wxGauge diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 630925e135..e9a16c6fb1 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -18,6 +18,9 @@ #include "wx/intl.h" #include "wx/checklst.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //------------------------------------------------------------------------- // conditional compilation //------------------------------------------------------------------------- diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 3612109580..cd4c7355f4 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -14,9 +14,13 @@ #include "wx/mdi.h" #include "wx/dialog.h" #include "wx/menu.h" -#include "wx/gtk/win_gtk.h" #include +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // constants //----------------------------------------------------------------------------- @@ -35,16 +39,16 @@ extern wxList wxPendingDelete; static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxWindow *win ) { - if ((win->m_x == alloc->x) && - (win->m_y == alloc->y) && - (win->m_width == alloc->width) && - (win->m_height == alloc->height) && - (win->m_sizeSet)) - { - return; - } + if ((win->m_x == alloc->x) && + (win->m_y == alloc->y) && + (win->m_width == alloc->width) && + (win->m_height == alloc->height) && + (win->m_sizeSet)) + { + return; + } - win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); + win->SetSize( alloc->x, alloc->y, alloc->width, alloc->height ); } //----------------------------------------------------------------------------- @@ -56,19 +60,19 @@ static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget), gint WXUNUSED(nPage), wxMDIClientWindow *client_win ) { - wxNode *node = client_win->m_children.First(); - while (node) - { - wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); - if (child_frame->m_page == page) + wxNode *node = client_win->m_children.First(); + while (node) { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)client_win->m_parent; - mdi_frame->m_currentChild = child_frame; - mdi_frame->SetMDIMenuBar( child_frame->m_menuBar ); - return; + wxMDIChildFrame *child_frame = (wxMDIChildFrame *)node->Data(); + if (child_frame->m_page == page) + { + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)client_win->m_parent; + mdi_frame->m_currentChild = child_frame; + mdi_frame->SetMDIMenuBar( child_frame->m_menuBar ); + return; + } + node = node->Next(); } - node = node->Next(); - } } //----------------------------------------------------------------------------- @@ -82,9 +86,9 @@ END_EVENT_TABLE() wxMDIParentFrame::wxMDIParentFrame(void) { - m_clientWindow = (wxMDIClientWindow *) NULL; - m_currentChild = (wxMDIChildFrame *) NULL; - m_parentFrameActive = TRUE; + m_clientWindow = (wxMDIClientWindow *) NULL; + m_currentChild = (wxMDIChildFrame *) NULL; + m_parentFrameActive = TRUE; } wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, @@ -92,10 +96,10 @@ wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { - m_clientWindow = (wxMDIClientWindow *) NULL; - m_currentChild = (wxMDIChildFrame *) NULL; - m_parentFrameActive = TRUE; - Create( parent, id, title, pos, size, style, name ); + m_clientWindow = (wxMDIClientWindow *) NULL; + m_currentChild = (wxMDIChildFrame *) NULL; + m_parentFrameActive = TRUE; + Create( parent, id, title, pos, size, style, name ); } wxMDIParentFrame::~wxMDIParentFrame(void) @@ -107,75 +111,75 @@ bool wxMDIParentFrame::Create( wxWindow *parent, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) { - wxFrame::Create( parent, id, title, pos, size, style, name ); + wxFrame::Create( parent, id, title, pos, size, style, name ); - OnCreateClient(); + OnCreateClient(); - return TRUE; + return TRUE; } void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height ) { - wxFrame::GtkOnSize( x, y, width, height ); + wxFrame::GtkOnSize( x, y, width, height ); - if (m_mdiMenuBar) - { - m_mdiMenuBar->m_x = 0; - m_mdiMenuBar->m_y = 0; - m_mdiMenuBar->m_width = m_width; - m_mdiMenuBar->m_height = wxMENU_HEIGHT; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); - gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); - } + if (m_mdiMenuBar) + { + m_mdiMenuBar->m_x = 0; + m_mdiMenuBar->m_y = 0; + m_mdiMenuBar->m_width = m_width; + m_mdiMenuBar->m_height = wxMENU_HEIGHT; + gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); + gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); + } } void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar ) { - if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE ); - m_mdiMenuBar = menu_bar; - if (m_mdiMenuBar) - { - m_mdiMenuBar->m_x = 0; - m_mdiMenuBar->m_y = 0; - m_mdiMenuBar->m_width = m_width; - m_mdiMenuBar->m_height = wxMENU_HEIGHT; - gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); - gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); - m_mdiMenuBar->Show( TRUE ); - } + if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE ); + m_mdiMenuBar = menu_bar; + if (m_mdiMenuBar) + { + m_mdiMenuBar->m_x = 0; + m_mdiMenuBar->m_y = 0; + m_mdiMenuBar->m_width = m_width; + m_mdiMenuBar->m_height = wxMENU_HEIGHT; + gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_mdiMenuBar->m_widget, 0, 0 ); + gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT ); + m_mdiMenuBar->Show( TRUE ); + } } void wxMDIParentFrame::GetClientSize(int *width, int *height ) const { - wxFrame::GetClientSize( width, height ); + wxFrame::GetClientSize( width, height ); } wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const { - return m_currentChild; + return m_currentChild; } wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { - return m_clientWindow; + return m_clientWindow; } wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void) { - m_clientWindow = new wxMDIClientWindow( this ); - return m_clientWindow; + m_clientWindow = new wxMDIClientWindow( this ); + return m_clientWindow; } void wxMDIParentFrame::ActivateNext(void) { - if (m_clientWindow) - gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); + if (m_clientWindow) + gtk_notebook_next_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); } void wxMDIParentFrame::ActivatePrevious(void) { - if (m_clientWindow) - gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); + if (m_clientWindow) + gtk_notebook_prev_page( GTK_NOTEBOOK(m_clientWindow->m_widget) ); } void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) ) @@ -193,13 +197,13 @@ void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(eve IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxFrame) BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) - EVT_ACTIVATE(wxMDIChildFrame::OnActivate) + EVT_ACTIVATE(wxMDIChildFrame::OnActivate) END_EVENT_TABLE() wxMDIChildFrame::wxMDIChildFrame(void) { - m_menuBar = (wxMenuBar *) NULL; - m_page = (GtkNotebookPage *) NULL; + m_menuBar = (wxMenuBar *) NULL; + m_page = (GtkNotebookPage *) NULL; } wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, @@ -207,23 +211,23 @@ wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent, const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { - m_menuBar = (wxMenuBar *) NULL; - m_page = (GtkNotebookPage *) NULL; - Create( parent, id, title, wxDefaultPosition, size, style, name ); + m_menuBar = (wxMenuBar *) NULL; + m_page = (GtkNotebookPage *) NULL; + Create( parent, id, title, wxDefaultPosition, size, style, name ); } wxMDIChildFrame::~wxMDIChildFrame(void) { - if (m_menuBar) - { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; - if (mdi_frame->m_currentChild == this) + if (m_menuBar) { - mdi_frame->SetMDIMenuBar( (wxMenuBar *) NULL ); - mdi_frame->m_currentChild = (wxMDIChildFrame *) NULL; + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; + if (mdi_frame->m_currentChild == this) + { + mdi_frame->SetMDIMenuBar( (wxMenuBar *) NULL ); + mdi_frame->m_currentChild = (wxMDIChildFrame *) NULL; + } + delete m_menuBar; } - delete m_menuBar; - } } bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, @@ -231,64 +235,64 @@ bool wxMDIChildFrame::Create( wxMDIParentFrame *parent, const wxPoint& WXUNUSED(pos), const wxSize& size, long style, const wxString& name ) { - m_title = title; + m_title = title; - return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); + return wxWindow::Create( parent->GetClientWindow(), id, wxDefaultPosition, size, style, name ); } void wxMDIChildFrame::GetClientSize( int *width, int *height ) const { - wxWindow::GetClientSize( width, height ); + wxWindow::GetClientSize( width, height ); } void wxMDIChildFrame::AddChild( wxWindow *child ) { - wxWindow::AddChild( child ); + wxWindow::AddChild( child ); } static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) { - menu->SetInvokingWindow( win ); - wxNode *node = menu->m_items.First(); - while (node) - { - wxMenuItem *menuitem = (wxMenuItem*)node->Data(); - if (menuitem->IsSubMenu()) - SetInvokingWindow( menuitem->GetSubMenu(), win ); - node = node->Next(); - } + menu->SetInvokingWindow( win ); + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *menuitem = (wxMenuItem*)node->Data(); + if (menuitem->IsSubMenu()) + SetInvokingWindow( menuitem->GetSubMenu(), win ); + node = node->Next(); + } } void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar ) { - m_menuBar = menu_bar; + m_menuBar = menu_bar; - if (m_menuBar) - { - wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; - - if (m_menuBar->m_parent != this) + if (m_menuBar) { - wxNode *node = m_menuBar->m_menus.First(); - while (node) - { - wxMenu *menu = (wxMenu*)node->Data(); - SetInvokingWindow( menu, this ); - node = node->Next(); - } - - m_menuBar->m_parent = mdi_frame; + wxMDIParentFrame *mdi_frame = (wxMDIParentFrame*)m_parent->m_parent; + + if (m_menuBar->m_parent != this) + { + wxNode *node = m_menuBar->m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + SetInvokingWindow( menu, this ); + node = node->Next(); + } + + m_menuBar->m_parent = mdi_frame; + } + mdi_frame->SetMDIMenuBar( m_menuBar ); + + gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow), + m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y ); } - mdi_frame->SetMDIMenuBar( m_menuBar ); - - gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow), - m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y ); - } } wxMenuBar *wxMDIChildFrame::GetMenuBar() { - return m_menuBar; + return m_menuBar; } void wxMDIChildFrame::Activate(void) @@ -305,24 +309,24 @@ void wxMDIChildFrame::OnActivate( wxActivateEvent &WXUNUSED(event) ) static void wxInsertChildInMDI( wxMDIClientWindow* parent, wxMDIChildFrame* child ) { - wxString s = child->m_title; - if (s.IsNull()) s = _("MDI child"); + wxString s = child->m_title; + if (s.IsNull()) s = _("MDI child"); - GtkWidget *label_widget = gtk_label_new( s ); - gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); + GtkWidget *label_widget = gtk_label_new( s ); + gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 ); - gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", - GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); + gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", + GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); - GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget); + GtkNotebook *notebook = GTK_NOTEBOOK(parent->m_widget); - gtk_notebook_append_page( notebook, child->m_widget, label_widget ); + gtk_notebook_append_page( notebook, child->m_widget, label_widget ); - child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); + child->m_page = (GtkNotebookPage*) (g_list_last(notebook->children)->data); - gtk_notebook_set_page( notebook, parent->m_children.Number()-1 ); + gtk_notebook_set_page( notebook, parent->m_children.Number()-1 ); - gtk_page_change_callback( (GtkNotebook *) NULL, child->m_page, 0, parent ); + gtk_page_change_callback( (GtkNotebook *) NULL, child->m_page, 0, parent ); } //----------------------------------------------------------------------------- @@ -337,7 +341,7 @@ wxMDIClientWindow::wxMDIClientWindow(void) wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, long style ) { - CreateClient( parent, style ); + CreateClient( parent, style ); } wxMDIClientWindow::~wxMDIClientWindow(void) @@ -346,28 +350,28 @@ wxMDIClientWindow::~wxMDIClientWindow(void) bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, long style ) { - m_needParent = TRUE; + m_needParent = TRUE; - m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; + m_insertCallback = (wxInsertChildFunction)wxInsertChildInMDI; - PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" ); + PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" ); - m_widget = gtk_notebook_new(); + m_widget = gtk_notebook_new(); - gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", - GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this ); + gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page", + GTK_SIGNAL_FUNC(gtk_page_change_callback), (gpointer)this ); - gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 ); + gtk_notebook_set_scrollable( GTK_NOTEBOOK(m_widget), 1 ); - m_parent->AddChild( this ); + m_parent->AddChild( this ); - (m_parent->m_insertCallback)( m_parent, this ); + (m_parent->m_insertCallback)( m_parent, this ); - PostCreation(); + PostCreation(); - Show( TRUE ); + Show( TRUE ); - return TRUE; + return TRUE; } diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 11d281273e..ff038197a8 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -16,6 +16,9 @@ #include "wx/log.h" #include "wx/intl.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxMenuBar //----------------------------------------------------------------------------- @@ -24,124 +27,131 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow) wxMenuBar::wxMenuBar() { - m_needParent = FALSE; // hmmm + m_needParent = FALSE; // hmmm - PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); + PreCreation( (wxWindow *) NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" ); - m_menus.DeleteContents( TRUE ); + m_menus.DeleteContents( TRUE ); - m_menubar = gtk_menu_bar_new(); + m_menubar = gtk_menu_bar_new(); - m_widget = GTK_WIDGET(m_menubar); + m_widget = GTK_WIDGET(m_menubar); - PostCreation(); + PostCreation(); - Show( TRUE ); + Show( TRUE ); } void wxMenuBar::Append( wxMenu *menu, const wxString &title ) { - m_menus.Append( menu ); - menu->m_title = title; // ?????? + m_menus.Append( menu ); + menu->m_title = title; - int pos; - do { - pos = menu->m_title.First( '&' ); - if (pos != -1) menu->m_title.Remove( pos, 1 ); - } while (pos != -1); + int pos; + do + { + pos = menu->m_title.First( '&' ); + if (pos != -1) menu->m_title.Remove( pos, 1 ); + } while (pos != -1); - GtkWidget *root_menu; - root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) ); - gtk_widget_show( root_menu ); - gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu ); + GtkWidget *root_menu; + root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) ); + gtk_widget_show( root_menu ); + gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu ); - gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu ); + gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu ); } static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) { - if (menu->m_title == menuString) - { - int res = menu->FindItem( itemString ); - if (res != -1) return res; - } - wxNode *node = menu->m_items.First(); - while (node) - { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if (item->IsSubMenu()) - return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); - node = node->Next(); - } - return -1; + if (menu->m_title == menuString) + { + int res = menu->FindItem( itemString ); + if (res != -1) return res; + } + + wxNode *node = menu->m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->IsSubMenu()) + return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); + node = node->Next(); + } + + return -1; } int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const { - wxNode *node = m_menus.First(); - while (node) - { - wxMenu *menu = (wxMenu*)node->Data(); - int res = FindMenuItemRecursive( menu, menuString, itemString); - if (res != -1) return res; - node = node->Next(); - } - return -1; + wxNode *node = m_menus.First(); + while (node) + { + wxMenu *menu = (wxMenu*)node->Data(); + int res = FindMenuItemRecursive( menu, menuString, itemString); + if (res != -1) return res; + node = node->Next(); + } + return -1; } -// Find a wxMenuItem using its id. Recurses down into sub-menus +/* Find a wxMenuItem using its id. Recurses down into sub-menus */ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) { - wxMenuItem* result = menu->FindItem(id); + wxMenuItem* result = menu->FindItem(id); - wxNode *node = menu->m_items.First(); - while ( node && result == NULL ) { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if ( item->IsSubMenu() ) - result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); - node = node->Next(); - } + wxNode *node = menu->m_items.First(); + while ( node && result == NULL ) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->IsSubMenu()) + { + result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); + } + node = node->Next(); + } - return result; + return result; } wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const { - wxMenuItem* result = 0; - wxNode *node = m_menus.First(); - while (node && result == 0) - { - wxMenu *menu = (wxMenu*)node->Data(); - result = FindMenuItemByIdRecursive( menu, id ); - node = node->Next(); - } - return result; + wxMenuItem* result = 0; + wxNode *node = m_menus.First(); + while (node && result == 0) + { + wxMenu *menu = (wxMenu*)node->Data(); + result = FindMenuItemByIdRecursive( menu, id ); + node = node->Next(); + } + + return result; } void wxMenuBar::Check( int id, bool check ) { - wxMenuItem* item = FindMenuItemById( id ); - if (item) item->Check(check); + wxMenuItem* item = FindMenuItemById( id ); + if (item) item->Check(check); } bool wxMenuBar::Checked( int id ) const { - wxMenuItem* item = FindMenuItemById( id ); - if (item) return item->IsChecked(); - return FALSE; + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->IsChecked(); + return FALSE; } void wxMenuBar::Enable( int id, bool enable ) { - wxMenuItem* item = FindMenuItemById( id ); - if (item) item->Enable(enable); + wxMenuItem* item = FindMenuItemById( id ); + if (item) item->Enable(enable); } bool wxMenuBar::Enabled( int id ) const { - wxMenuItem* item = FindMenuItemById( id ); - if (item) return item->IsEnabled(); - return FALSE; + wxMenuItem* item = FindMenuItemById( id ); + if (item) return item->IsEnabled(); + return FALSE; } //----------------------------------------------------------------------------- @@ -150,27 +160,27 @@ bool wxMenuBar::Enabled( int id ) const static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) { - int id = menu->FindMenuIdByMenuItem(widget); + int id = menu->FindMenuIdByMenuItem(widget); - // should find it for normal (not popup) menu - wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) ); + /* should find it for normal (not popup) menu */ + wxASSERT( (id != -1) || (menu->GetInvokingWindow() != NULL) ); - if (!menu->IsEnabled(id)) return; + if (!menu->IsEnabled(id)) return; - wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); - event.SetEventObject( menu ); - event.SetInt(id ); + wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); + event.SetEventObject( menu ); + event.SetInt(id ); - if (menu->m_callback) - { - (void) (*(menu->m_callback)) (*menu, event); - return; - } + if (menu->m_callback) + { + (void) (*(menu->m_callback)) (*menu, event); + return; + } - if (menu->GetEventHandler()->ProcessEvent(event)) return; + if (menu->GetEventHandler()->ProcessEvent(event)) return; - wxWindow *win = menu->GetInvokingWindow(); - if (win) win->GetEventHandler()->ProcessEvent( event ); + wxWindow *win = menu->GetInvokingWindow(); + if (win) win->GetEventHandler()->ProcessEvent( event ); } //----------------------------------------------------------------------------- @@ -179,28 +189,29 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu ) static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu ) { - int id = menu->FindMenuIdByMenuItem(widget); + int id = menu->FindMenuIdByMenuItem(widget); + + wxASSERT( id != -1 ); // should find it! - wxASSERT( id != -1 ); // should find it! + if (!menu->IsEnabled(id)) return; - if (!menu->IsEnabled(id)) return; + wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id ); + event.SetEventObject( menu ); + event.SetInt(id ); - wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id ); - event.SetEventObject( menu ); - event.SetInt(id ); +/* wxMSW doesn't call callback here either -/* wxMSW doesn't call callback here either - if (menu->m_callback) - { - (void) (*(menu->m_callback)) (*menu, event); - return; - } + if (menu->m_callback) + { + (void) (*(menu->m_callback)) (*menu, event); + return; + } */ - if (menu->GetEventHandler()->ProcessEvent(event)) return; + if (menu->GetEventHandler()->ProcessEvent(event)) return; - wxWindow *win = menu->GetInvokingWindow(); - if (win) win->GetEventHandler()->ProcessEvent( event ); + wxWindow *win = menu->GetInvokingWindow(); + if (win) win->GetEventHandler()->ProcessEvent( event ); } //----------------------------------------------------------------------------- @@ -211,276 +222,305 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject) wxMenuItem::wxMenuItem() { - m_id = ID_SEPARATOR; - m_isCheckMenu = FALSE; - m_isChecked = FALSE; - m_isEnabled = TRUE; - m_subMenu = (wxMenu *) NULL; - m_menuItem = (GtkWidget *) NULL; + m_id = ID_SEPARATOR; + m_isCheckMenu = FALSE; + m_isChecked = FALSE; + m_isEnabled = TRUE; + m_subMenu = (wxMenu *) NULL; + m_menuItem = (GtkWidget *) NULL; } -// it's valid for this function to be called even if m_menuItem == NULL -void wxMenuItem::SetName(const wxString& str) +/* it's valid for this function to be called even if m_menuItem == NULL */ +void wxMenuItem::SetName( const wxString& str ) { - m_text = ""; - for ( const char *pc = str; *pc != '\0'; pc++ ) - { - if ( *pc == '&' ) - pc++; // skip it + m_text = ""; + for ( const char *pc = str; *pc != '\0'; pc++ ) + { + if (*pc == '&') pc++; /* skip it */ + m_text << *pc; + } - m_text << *pc; - } - - if ( m_menuItem ) - { - GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); - - gtk_label_set( label, m_text.c_str()); - } + if (m_menuItem) + { + GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); + gtk_label_set( label, m_text.c_str()); + } } void wxMenuItem::Check( bool check ) { - wxCHECK_RET( m_menuItem, "invalid menu item" ); + wxCHECK_RET( m_menuItem, "invalid menu item" ); - wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" ) + wxCHECK_RET( IsCheckable(), "Can't check uncheckable item!" ) - m_isChecked = check; - gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); + m_isChecked = check; + gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); } void wxMenuItem::Enable( bool enable ) { - wxCHECK_RET( m_menuItem, "invalid menu item" ); + wxCHECK_RET( m_menuItem, "invalid menu item" ); - gtk_widget_set_sensitive( m_menuItem, enable ); - m_isEnabled = enable; + gtk_widget_set_sensitive( m_menuItem, enable ); + m_isEnabled = enable; } bool wxMenuItem::IsChecked() const { - wxCHECK_MSG( m_menuItem, FALSE, "invalid menu item" ); + wxCHECK_MSG( m_menuItem, FALSE, "invalid menu item" ); - wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item! + wxCHECK( IsCheckable(), FALSE ); // can't get state of uncheckable item! - bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0; + bool bIsChecked = ((GtkCheckMenuItem*)m_menuItem)->active != 0; - wxASSERT( bIsChecked == m_isChecked ); // consistency check + wxASSERT( bIsChecked == m_isChecked ); // consistency check - return bIsChecked; + return bIsChecked; } //----------------------------------------------------------------------------- -// wxMenuItem +// wxMenu //----------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) wxMenu::wxMenu( const wxString& title, const wxFunction func ) { - m_title = title; - m_items.DeleteContents( TRUE ); - m_invokingWindow = (wxWindow *) NULL; - m_menu = gtk_menu_new(); // Do not show! + m_title = title; + m_items.DeleteContents( TRUE ); + m_invokingWindow = (wxWindow *) NULL; + m_menu = gtk_menu_new(); // Do not show! - m_callback = func; - m_eventHandler = this; - m_clientData = (void*) NULL; + m_callback = func; + m_eventHandler = this; + m_clientData = (void*) NULL; - if (m_title.IsNull()) m_title = ""; - if (m_title != "") - { - Append(-2, m_title); - AppendSeparator(); - } + if (m_title.IsNull()) m_title = ""; + if (m_title != "") + { + Append(-2, m_title); + AppendSeparator(); + } } void wxMenu::SetTitle( const wxString& title ) { - // Waiting for something better. - m_title = title; + /* Waiting for something better. */ + m_title = title; } const wxString wxMenu::GetTitle() const { - return m_title; + return m_title; } void wxMenu::AppendSeparator() { - wxMenuItem *mitem = new wxMenuItem(); - mitem->SetId(ID_SEPARATOR); + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(ID_SEPARATOR); - GtkWidget *menuItem = gtk_menu_item_new(); - gtk_menu_append( GTK_MENU(m_menu), menuItem ); - gtk_widget_show( menuItem ); - mitem->SetMenuItem(menuItem); - m_items.Append( mitem ); + GtkWidget *menuItem = gtk_menu_item_new(); + gtk_menu_append( GTK_MENU(m_menu), menuItem ); + gtk_widget_show( menuItem ); + mitem->SetMenuItem(menuItem); + m_items.Append( mitem ); } void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable ) { - wxMenuItem *mitem = new wxMenuItem(); - mitem->SetId(id); - mitem->SetText(item); - mitem->SetHelp(helpStr); - mitem->SetCheckable(checkable); - const char *text = mitem->GetText(); - GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text) - : gtk_menu_item_new_with_label(text); + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(id); + mitem->SetText(item); + mitem->SetHelp(helpStr); + mitem->SetCheckable(checkable); + const char *text = mitem->GetText(); + GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text) + : gtk_menu_item_new_with_label(text); - mitem->SetMenuItem(menuItem); + mitem->SetMenuItem(menuItem); - gtk_signal_connect( GTK_OBJECT(menuItem), "activate", - GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), - (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(menuItem), "activate", + GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), + (gpointer*)this ); - gtk_signal_connect( GTK_OBJECT(menuItem), "select", - GTK_SIGNAL_FUNC(gtk_menu_hilight_callback), - (gpointer*)this ); + gtk_signal_connect( GTK_OBJECT(menuItem), "select", + GTK_SIGNAL_FUNC(gtk_menu_hilight_callback), + (gpointer*)this ); - gtk_menu_append( GTK_MENU(m_menu), menuItem ); - gtk_widget_show( menuItem ); - m_items.Append( mitem ); + gtk_menu_append( GTK_MENU(m_menu), menuItem ); + gtk_widget_show( menuItem ); + m_items.Append( mitem ); } void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr ) { - wxMenuItem *mitem = new wxMenuItem(); - mitem->SetId(id); - mitem->SetText(text); + wxMenuItem *mitem = new wxMenuItem(); + mitem->SetId(id); + mitem->SetText(text); - GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText()); - mitem->SetHelp(helpStr); - mitem->SetMenuItem(menuItem); - mitem->SetSubMenu(subMenu); + GtkWidget *menuItem = gtk_menu_item_new_with_label(mitem->GetText()); + mitem->SetHelp(helpStr); + mitem->SetMenuItem(menuItem); + mitem->SetSubMenu(subMenu); - gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), subMenu->m_menu ); - gtk_menu_append( GTK_MENU(m_menu), menuItem ); - gtk_widget_show( menuItem ); - m_items.Append( mitem ); + gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), subMenu->m_menu ); + gtk_menu_append( GTK_MENU(m_menu), menuItem ); + gtk_widget_show( menuItem ); + m_items.Append( mitem ); } int wxMenu::FindItem( const wxString itemString ) const { - wxString s( itemString ); + wxString s( itemString ); - int pos; - do { - pos = s.First( '&' ); - if (pos != -1) s.Remove( pos, 1 ); - } while (pos != -1); + int pos; + do + { + pos = s.First( '&' ); + if (pos != -1) s.Remove( pos, 1 ); + } while (pos != -1); - wxNode *node = m_items.First(); - while (node) - { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if (item->GetText() == s) - return item->GetId(); - node = node->Next(); - } + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetText() == s) + { + return item->GetId(); + } + node = node->Next(); + } - return -1; + return -1; } void wxMenu::Enable( int id, bool enable ) { - wxMenuItem *item = FindItem(id); - if ( item ) - item->Enable(enable); + wxMenuItem *item = FindItem(id); + if (item) + { + item->Enable(enable); + } } bool wxMenu::IsEnabled( int id ) const { - wxMenuItem *item = FindItem(id); - if ( item ) - return item->IsEnabled(); - else - return FALSE; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->IsEnabled(); + } + else + { + return FALSE; + } } void wxMenu::Check( int id, bool enable ) { - wxMenuItem *item = FindItem(id); - if ( item ) - item->Check(enable); + wxMenuItem *item = FindItem(id); + if (item) + { + item->Check(enable); + } } bool wxMenu::IsChecked( int id ) const { - wxMenuItem *item = FindItem(id); - if ( item ) - return item->IsChecked(); - else - return FALSE; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->IsChecked(); + } + else + { + return FALSE; + } } void wxMenu::SetLabel( int id, const wxString &label ) { - wxMenuItem *item = FindItem(id); - if (item) - item->SetText(label); + wxMenuItem *item = FindItem(id); + if (item) + { + item->SetText(label); + } } wxString wxMenu::GetLabel( int id ) const { - wxMenuItem *item = FindItem(id); - if (item) return item->GetText(); - return ""; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->GetText(); + } + else + { + return ""; + } } void wxMenu::SetHelpString( int id, const wxString& helpString ) { - wxMenuItem *item = FindItem(id); - if (item) item->SetHelp( helpString ); + wxMenuItem *item = FindItem(id); + if (item) item->SetHelp( helpString ); } wxString wxMenu::GetHelpString( int id ) const { - wxMenuItem *item = FindItem(id); - if (item) return item->GetHelp(); - return ""; + wxMenuItem *item = FindItem(id); + if (item) + { + return item->GetHelp(); + } + else + { + return ""; + } } int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const { - wxNode *node = m_items.First(); - while (node) - { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if (item->GetMenuItem() == menuItem) - return item->GetId(); - node = node->Next(); - } + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetMenuItem() == menuItem) + return item->GetId(); + node = node->Next(); + } - return -1; + return -1; } wxMenuItem *wxMenu::FindItem(int id) const { - wxNode *node = m_items.First(); - while (node) { - wxMenuItem *item = (wxMenuItem*)node->Data(); - if ( item->GetId() == id ) - return item; - node = node->Next(); - } + wxNode *node = m_items.First(); + while (node) + { + wxMenuItem *item = (wxMenuItem*)node->Data(); + if (item->GetId() == id) + { + return item; + } + node = node->Next(); + } - // Not finding anything here can be correct - // when search the entire menu system for - // an entry -> no error message. + /* Not finding anything here can be correct + * when search the entire menu system for + * an entry -> no error message. */ - return (wxMenuItem *) NULL; + return (wxMenuItem *) NULL; } void wxMenu::SetInvokingWindow( wxWindow *win ) { - m_invokingWindow = win; + m_invokingWindow = win; } wxWindow *wxMenu::GetInvokingWindow() { - return m_invokingWindow; + return m_invokingWindow; } diff --git a/src/gtk1/minifram.cpp b/src/gtk1/minifram.cpp index d2e750c04a..a5a86f9be6 100644 --- a/src/gtk1/minifram.cpp +++ b/src/gtk1/minifram.cpp @@ -14,6 +14,10 @@ #include "wx/minifram.h" #include "wx/dcscreen.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" + + //----------------------------------------------------------------------------- // "clicked" //----------------------------------------------------------------------------- diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index ca46259e27..db83d59ac4 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -17,6 +17,10 @@ #include "wx/imaglist.h" #include "wx/intl.h" #include "wx/log.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "wx/gtk/win_gtk.h" #include "gdk/gdkkeysyms.h" //----------------------------------------------------------------------------- diff --git a/src/gtk1/palette.cpp b/src/gtk1/palette.cpp index c94a33616d..4cdaef3726 100644 --- a/src/gtk1/palette.cpp +++ b/src/gtk1/palette.cpp @@ -15,6 +15,8 @@ #include "wx/palette.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxPalette //----------------------------------------------------------------------------- diff --git a/src/gtk1/pen.cpp b/src/gtk1/pen.cpp index 8402796a46..3152074605 100644 --- a/src/gtk1/pen.cpp +++ b/src/gtk1/pen.cpp @@ -14,6 +14,8 @@ #include "wx/pen.h" +#include "gdk/gdk.h" + //----------------------------------------------------------------------------- // wxPen //----------------------------------------------------------------------------- diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 58c3867d01..9708cf57e0 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -15,6 +15,9 @@ #include "wx/radiobox.h" #include "wx/dialog.h" #include "wx/frame.h" + +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" //----------------------------------------------------------------------------- diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index efab7e9d5c..abf7ac99f2 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -13,6 +13,8 @@ #endif #include "wx/radiobut.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" //----------------------------------------------------------------------------- // data diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index a01289855b..a607e5da6c 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -14,6 +14,9 @@ #include "wx/region.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxRegion //----------------------------------------------------------------------------- diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index c0d729487d..a6973405bc 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -16,6 +16,9 @@ #include "wx/utils.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 334280504f..234bce0a2d 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -15,6 +15,9 @@ #include "wx/settings.h" #include "wx/debug.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + /* #define wxSYS_COLOUR_SCROLLBAR 0 #define wxSYS_COLOUR_BACKGROUND 1 diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index d45eda3add..cddd5f54f0 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -15,6 +15,9 @@ #include "wx/utils.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- diff --git a/src/gtk1/spinbutt.cpp b/src/gtk1/spinbutt.cpp index 5fb2935fc4..dfe03b27a1 100644 --- a/src/gtk1/spinbutt.cpp +++ b/src/gtk1/spinbutt.cpp @@ -16,6 +16,9 @@ #include "wx/utils.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -28,31 +31,31 @@ extern bool g_blockEventsOnDrag; static void gtk_spinbutt_callback( GtkWidget *WXUNUSED(widget), wxSpinButton *win ) { - if (!win->HasVMT()) return; - if (g_blockEventsOnDrag) return; + if (!win->HasVMT()) return; + if (g_blockEventsOnDrag) return; - float diff = win->m_adjust->value - win->m_oldPos; - if (fabs(diff) < 0.2) return; + float diff = win->m_adjust->value - win->m_oldPos; + if (fabs(diff) < 0.2) return; - wxEventType command = wxEVT_NULL; + wxEventType command = wxEVT_NULL; - float line_step = win->m_adjust->step_increment; - float page_step = win->m_adjust->page_increment; + float line_step = win->m_adjust->step_increment; + float page_step = win->m_adjust->page_increment; - if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN; - else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP; - else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN; - else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP; - else command = wxEVT_SCROLL_THUMBTRACK; + if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN; + else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP; + else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN; + else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP; + else command = wxEVT_SCROLL_THUMBTRACK; - int value = (int)(win->m_adjust->value+0.5); + int value = (int)(win->m_adjust->value+0.5); - wxSpinEvent event( command, win->GetId()); - event.SetPosition( value ); - event.SetOrientation( wxVERTICAL ); - event.SetEventObject( win ); + wxSpinEvent event( command, win->GetId()); + event.SetPosition( value ); + event.SetOrientation( wxVERTICAL ); + event.SetEventObject( win ); - win->ProcessEvent( event ); + win->ProcessEvent( event ); } //----------------------------------------------------------------------------- @@ -72,38 +75,40 @@ wxSpinButton::wxSpinButton() bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { - m_needParent = TRUE; + m_needParent = TRUE; - wxSize new_size = size; - new_size.x = 16; - if (new_size.y == -1) new_size.y = 30; + wxSize new_size = size; + new_size.x = 16; + if (new_size.y == -1) new_size.y = 30; - PreCreation( parent, id, pos, new_size, style, name ); + PreCreation( parent, id, pos, new_size, style, name ); // SetValidator( validator ); - m_oldPos = 0.0; + m_oldPos = 0.0; - m_adjust = (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 5.0, 0.0); + m_adjust = (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 100.0, 1.0, 5.0, 0.0); - m_widget = gtk_spin_button_new( m_adjust, 0, 0 ); + m_widget = gtk_spin_button_new( m_adjust, 0, 0 ); - gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (m_windowStyle & wxSP_WRAP) ); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (m_windowStyle & wxSP_WRAP) ); - gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed", - (GtkSignalFunc) gtk_spinbutt_callback, (gpointer) this ); + gtk_signal_connect( GTK_OBJECT (m_adjust), + "value_changed", + (GtkSignalFunc) gtk_spinbutt_callback, + (gpointer) this ); - m_parent->AddChild( this ); + m_parent->AddChild( this ); - (m_parent->m_insertCallback)( m_parent, this ); + (m_parent->m_insertCallback)( m_parent, this ); - PostCreation(); + PostCreation(); - SetBackgroundColour( parent->GetBackgroundColour() ); + SetBackgroundColour( parent->GetBackgroundColour() ); - Show( TRUE ); + Show( TRUE ); - return TRUE; + return TRUE; } wxSpinButton::~wxSpinButton() @@ -112,71 +117,74 @@ wxSpinButton::~wxSpinButton() int wxSpinButton::GetMin() const { - wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); + wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); - return (int)(m_adjust->lower+0.5); + return (int)(m_adjust->lower+0.5); } int wxSpinButton::GetMax() const { - wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); + wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); - return (int)(m_adjust->upper+0.5); + return (int)(m_adjust->upper+0.5); } int wxSpinButton::GetValue() const { - wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); + wxCHECK_MSG( (m_widget != NULL), 0, "invalid spin button" ); - return (int)(m_adjust->value+0.5); + return (int)(m_adjust->value+0.5); } void wxSpinButton::SetValue( int value ) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); - float fpos = (float)value; - m_oldPos = fpos; - if (fabs(fpos-m_adjust->value) < 0.2) return; - m_adjust->value = fpos; + float fpos = (float)value; + m_oldPos = fpos; + if (fabs(fpos-m_adjust->value) < 0.2) return; + + m_adjust->value = fpos; - gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); + gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); } void wxSpinButton::SetRange(int minVal, int maxVal) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); - float fmin = (float)minVal; - float fmax = (float)maxVal; + float fmin = (float)minVal; + float fmax = (float)maxVal; - if ((fabs(fmin-m_adjust->lower) < 0.2) && - (fabs(fmax-m_adjust->upper) < 0.2)) - return; + if ((fabs(fmin-m_adjust->lower) < 0.2) && + (fabs(fmax-m_adjust->upper) < 0.2)) + { + return; + } - m_adjust->lower = fmin; - m_adjust->upper = fmax; + m_adjust->lower = fmin; + m_adjust->upper = fmax; - gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); + gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); } void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) ) { - wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); + wxCHECK_RET( (m_widget != NULL), "invalid spin button" ); - m_width = 16; - gtk_widget_set_usize( m_widget, m_width, m_height ); + m_width = 16; + gtk_widget_set_usize( m_widget, m_width, m_height ); } bool wxSpinButton::IsOwnGtkWindow( GdkWindow *window ) { - return GTK_SPIN_BUTTON(m_widget)->panel == window; + return GTK_SPIN_BUTTON(m_widget)->panel == window; } void wxSpinButton::ApplyWidgetStyle() { - SetWidgetStyle(); - gtk_widget_set_style( m_widget, m_widgetStyle ); + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); } //----------------------------------------------------------------------------- diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp index 69b6b571d6..7d752190cd 100644 --- a/src/gtk1/statbmp.cpp +++ b/src/gtk1/statbmp.cpp @@ -13,6 +13,9 @@ #include "wx/statbmp.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxStaticBitmap //----------------------------------------------------------------------------- diff --git a/src/gtk1/statbox.cpp b/src/gtk1/statbox.cpp index a41325fb08..e5239cc924 100644 --- a/src/gtk1/statbox.cpp +++ b/src/gtk1/statbox.cpp @@ -13,6 +13,9 @@ #include "wx/statbox.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxStaticBox //----------------------------------------------------------------------------- diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index e7b40878d4..b1f31084a5 100644 --- a/src/gtk1/stattext.cpp +++ b/src/gtk1/stattext.cpp @@ -14,6 +14,9 @@ #include "wx/stattext.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxStaticText //----------------------------------------------------------------------------- diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 671fa18e00..0c7e7f1320 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -13,6 +13,10 @@ #include "wx/toolbar.h" +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -99,6 +103,8 @@ wxToolBar::wxToolBar( wxWindow *parent, wxWindowID id, wxToolBar::~wxToolBar() { + delete m_fg; + delete m_bg; } bool wxToolBar::Create( wxWindow *parent, wxWindowID id, @@ -121,18 +127,20 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_widget = GTK_WIDGET(m_toolbar); gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); + + m_fg = new GdkColor; + m_fg->red = 0; + m_fg->green = 0; + m_fg->blue = 0; + gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), m_fg ); - m_fg.red = 0; - m_fg.green = 0; - m_fg.blue = 0; - gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), &m_fg ); - - m_bg.red = 65535; - m_bg.green = 65535; - m_bg.blue = 50000; - gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), &m_bg ); + m_bg = new GdkColor; + m_bg->red = 65535; + m_bg->green = 65535; + m_bg->blue = 50000; + gdk_color_alloc( gtk_widget_get_colormap( GTK_WIDGET(m_toolbar) ), m_bg ); - gtk_tooltips_set_colors( GTK_TOOLBAR(m_toolbar)->tooltips, &m_bg, &m_fg ); + gtk_tooltips_set_colors( GTK_TOOLBAR(m_toolbar)->tooltips, m_bg, m_fg ); m_xMargin = 0; m_yMargin = 0; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 7a3cf2f76f..ea17cd1920 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -20,6 +20,8 @@ #include #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" #include "gdk/gdkkeysyms.h" //----------------------------------------------------------------------------- diff --git a/src/gtk1/threadpsx.cpp b/src/gtk1/threadpsx.cpp index 224a3a15b8..2b314bec01 100644 --- a/src/gtk1/threadpsx.cpp +++ b/src/gtk1/threadpsx.cpp @@ -24,6 +24,9 @@ #include "wx/utils.h" #include "wx/log.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" + enum thread_state { STATE_IDLE = 0, diff --git a/src/gtk1/threadsgi.cpp b/src/gtk1/threadsgi.cpp index 8dcac37000..3b66071667 100644 --- a/src/gtk1/threadsgi.cpp +++ b/src/gtk1/threadsgi.cpp @@ -23,7 +23,11 @@ #include "wx/utils.h" #include "wx/log.h" -enum thread_state { +#include "gdk/gdk.h" +#include "gtk/gtk.h" + +enum thread_state +{ STATE_IDLE = 0, STATE_RUNNING, STATE_CANCELED, diff --git a/src/gtk1/timer.cpp b/src/gtk1/timer.cpp index 61de7eeb11..36aada6e6f 100644 --- a/src/gtk1/timer.cpp +++ b/src/gtk1/timer.cpp @@ -14,6 +14,8 @@ #include "wx/timer.h" +#include "gtk/gtk.h" + //----------------------------------------------------------------------------- // wxTimer //----------------------------------------------------------------------------- @@ -22,46 +24,49 @@ IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject) gint timeout_callback( gpointer data ) { - wxTimer *timer = (wxTimer*)data; - timer->Notify(); + wxTimer *timer = (wxTimer*)data; + timer->Notify(); - if ( timer->OneShot() ) - timer->Stop(); + if (timer->OneShot()) + { + timer->Stop(); + } - return TRUE; + return TRUE; } wxTimer::wxTimer() { - m_tag = -1; - m_time = 1000; - m_oneShot = FALSE; + m_tag = -1; + m_time = 1000; + m_oneShot = FALSE; } wxTimer::~wxTimer() { - Stop(); + Stop(); } bool wxTimer::Start( int millisecs, bool oneShot ) { - if ( millisecs != -1 ) - m_time = millisecs; + if (millisecs != -1) + { + m_time = millisecs; + } - m_oneShot = oneShot; + m_oneShot = oneShot; - m_tag = gtk_timeout_add( millisecs, timeout_callback, this ); + m_tag = gtk_timeout_add( millisecs, timeout_callback, this ); - return TRUE; + return TRUE; } void wxTimer::Stop() { - if ( m_tag != -1 ) - { - gtk_timeout_remove( m_tag ); - - m_tag = -1; - } + if (m_tag != -1) + { + gtk_timeout_remove( m_tag ); + m_tag = -1; + } } diff --git a/src/gtk1/utilsgtk.cpp b/src/gtk1/utilsgtk.cpp index 6f27685f98..252eda116c 100644 --- a/src/gtk1/utilsgtk.cpp +++ b/src/gtk1/utilsgtk.cpp @@ -34,7 +34,10 @@ #include #include -#include "gdk/gdkx.h" // GDK_DISPLAY +#include "glib.h" +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "gdk/gdkx.h" #ifdef __SVR4__ #include diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 2d1683c26d..96a880d688 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -28,11 +28,15 @@ #include "wx/intl.h" #include "wx/settings.h" #include "wx/log.h" -#include "gdk/gdkprivate.h" -#include "gdk/gdkkeysyms.h" #include +#include "gdk/gdk.h" +#include "gtk/gtk.h" +#include "gdk/gdkprivate.h" +#include "gdk/gdkkeysyms.h" +#include "wx/gtk/win_gtk.h" + //----------------------------------------------------------------------------- // documentation on internals //----------------------------------------------------------------------------- diff --git a/wx-config.in b/wx-config.in index a3ad5a6e1f..e7d8382549 100755 --- a/wx-config.in +++ b/wx-config.in @@ -43,11 +43,11 @@ while test $# -gt 0; do includes=-I@includedir@ fi includes="$includes -I@libdir@/wx/include" - echo $includes -D@TOOLKIT_DEF@ @GUI_TK_INCLUDE@ @WXDEBUG_DEFINE@ + echo $includes -D@TOOLKIT_DEF@ @WXDEBUG_DEFINE@ ;; --libs) - echo -L@libdir@ -lwx_gtk2 @DL_LIBRARY@ @GUI_TK_LIBRARY@ @THREADS_LINK@ @EXTRA_LINK@ + echo -L@libdir@ @THREADS_LINK@ -lwx_gtk2 @DL_LIBRARY@ @GUI_TK_LIBRARY@ @EXTRA_LINK@ ;; *) echo "${usage}" 1>&2