From 46dc76ba3573649a9ed7c7aff6dc677f533eee11 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 24 Jul 1998 19:05:25 +0000 Subject: [PATCH] wxFrame::CreateToolBar() stuff wxDC::SetBackground from Chris Breeze zillions of compile fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@364 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/file.h | 9 ---- include/wx/gtk/dc.h | 3 ++ include/wx/gtk/dcclient.h | 1 + include/wx/gtk/dnd.h | 2 +- include/wx/gtk/frame.h | 35 +++++++------- include/wx/gtk/mdi.h | 4 -- include/wx/gtk/tbargtk.h | 2 + include/wx/gtk1/dc.h | 3 ++ include/wx/gtk1/dcclient.h | 1 + include/wx/gtk1/dnd.h | 2 +- include/wx/gtk1/frame.h | 35 +++++++------- include/wx/gtk1/mdi.h | 4 -- include/wx/gtk1/tbargtk.h | 2 + include/wx/intl.h | 3 +- include/wx/list.h | 5 -- include/wx/matrix.h | 13 ++++-- include/wx/zstream.h | 6 +-- install/gtk/INSTALL | 78 +++++++++++++++++++------------ install/gtk/configure | 18 +++---- install/gtk/configure.in | 2 +- samples/mdi/mdi.cpp | 29 ++++++------ samples/mdi/mdi.h | 6 --- samples/memcheck/memcheck.cpp | 10 ++-- src/common/docview.cpp | 2 +- src/common/event.cpp | 5 +- src/common/filefn.cpp | 6 ++- src/common/framecmn.cpp | 2 +- src/common/list.cpp | 34 -------------- src/common/log.cpp | 14 +++--- src/common/memory.cpp | 2 +- src/common/odbc.cpp | 47 ++++++++++--------- src/common/zstream.cpp | 2 +- src/gtk/app.cpp | 27 +++++++++++ src/gtk/dcclient.cpp | 48 +++++++++++++++++++ src/gtk/frame.cpp | 88 +++++++++++++++++++++++++++++------ src/gtk/mdi.cpp | 17 ++----- src/gtk/tbargtk.cpp | 37 ++++++++++++++- src/gtk/textctrl.cpp | 2 +- src/gtk/window.cpp | 46 ++++++++++++------ src/gtk1/app.cpp | 27 +++++++++++ src/gtk1/dcclient.cpp | 48 +++++++++++++++++++ src/gtk1/frame.cpp | 88 +++++++++++++++++++++++++++++------ src/gtk1/mdi.cpp | 17 ++----- src/gtk1/tbargtk.cpp | 37 ++++++++++++++- src/gtk1/textctrl.cpp | 2 +- src/gtk1/window.cpp | 46 ++++++++++++------ src/iodbc/config.h | 2 + user/wxFile/wxFile.cpp | 78 +++++++------------------------ user/wxFile/wxFile.h | 1 - user/wxLayout/wxLayout.cpp | 2 +- user/wxLayout/wxllist.cpp | 2 +- user/wxLayout/wxlwindow.h | 4 +- user/wxTest/wxTest.cpp | 11 ++--- 53 files changed, 643 insertions(+), 374 deletions(-) diff --git a/include/wx/file.h b/include/wx/file.h index 72451f8608..40d4d8f21b 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -21,8 +21,6 @@ #include "wx/filefn.h" // ---------------------------------------------------------------------------- -<<<<<<< file.h -======= // constants // ---------------------------------------------------------------------------- @@ -47,7 +45,6 @@ const off_t ofsInvalid = (off_t)-1; #define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IROTH) // ---------------------------------------------------------------------------- ->>>>>>> 1.7 // class wxFile: raw file IO // // NB: for space efficiency this class has no virtual functions, including @@ -78,11 +75,6 @@ public: wxFile(int fd) { m_fd = fd; } // open/close -<<<<<<< file.h - bool Create(const char *szFileName, bool bOverwrite = FALSE); - bool Open(const char *szFileName, OpenMode mode = read); - inline bool Close(); // Close is a NOP if not opened -======= // create a new file (with the default value of bOverwrite, it will fail if // the file already exists, otherwise it will overwrite it and succeed) bool Create(const char *szFileName, bool bOverwrite = FALSE, @@ -90,7 +82,6 @@ public: bool Open(const char *szFileName, OpenMode mode = read, int access = wxS_DEFAULT); bool Close(); // Close is a NOP if not opened ->>>>>>> 1.7 // assign an existing file descriptor and get it back from wxFile object void Attach(int fd) { Close(); m_fd = fd; } diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index 9abb2793df..9678e6d693 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -119,6 +119,9 @@ class wxDC: public wxObject virtual void SetBrush( const wxBrush &brush ) = 0; virtual wxBrush *GetBrush(void) { return &m_brush; }; + virtual void SetBackground( const wxBrush &brush ) = 0; + virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; }; + virtual void SetLogicalFunction( int function ) = 0; virtual int GetLogicalFunction(void) { return m_logicalFunction; }; diff --git a/include/wx/gtk/dcclient.h b/include/wx/gtk/dcclient.h index b85fb317d1..57b784c0f4 100644 --- a/include/wx/gtk/dcclient.h +++ b/include/wx/gtk/dcclient.h @@ -80,6 +80,7 @@ class wxPaintDC: public wxDC virtual void SetFont( const wxFont &font ); virtual void SetPen( const wxPen &pen ); virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); virtual void SetLogicalFunction( int function ); virtual void SetTextForeground( const wxColour &col ); virtual void SetTextBackground( const wxColour &col ); diff --git a/include/wx/gtk/dnd.h b/include/wx/gtk/dnd.h index 4b27e36da1..1ce3e29040 100644 --- a/include/wx/gtk/dnd.h +++ b/include/wx/gtk/dnd.h @@ -35,7 +35,7 @@ class wxTextDragSource; // wxDropTarget //------------------------------------------------------------------------- -class wxDropTarget: wxObject +class wxDropTarget: public wxObject { public: diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index e98c4acd17..47f7037e0c 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -21,6 +21,7 @@ #include "wx/window.h" #include "wx/menu.h" #include "wx/statusbr.h" +#include "wx/toolbar.h" //----------------------------------------------------------------------------- // classes @@ -42,8 +43,9 @@ extern const char *wxFrameNameStr; class wxFrame: public wxWindow { + DECLARE_DYNAMIC_CLASS(wxFrame) public: - // construction + wxFrame(); wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, @@ -54,38 +56,35 @@ public: ~wxFrame(); bool Destroy(); - // operations - // virtual bool Show( bool show ); virtual void Enable( bool enable ); - // frame size virtual void GetClientSize( int *width, int *height ) const; - // set minimal size for the frame (@@@ other params not implemented) - void SetSizeHints(int minW, int minH, - int maxW = -1, int maxH = -1, - int incW = -1); + + // set minimal/maxmimal size for the frame + virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 ); - // status bar virtual bool CreateStatusBar( int number = 1 ); - wxStatusBar *GetStatusBar(); + virtual wxStatusBar *GetStatusBar(); virtual void SetStatusText( const wxString &text, int number = 0 ); virtual void SetStatusWidths( int n, int *width ); - // menu bar - void SetMenuBar( wxMenuBar *menuBar ); - wxMenuBar *GetMenuBar(); + virtual wxToolBar *CreateToolBar( int style = 0, + int orientation = wxHORIZONTAL, int rowsOrColumns = 1 ); + virtual wxToolBar *GetToolBar(); + + virtual void SetMenuBar( wxMenuBar *menuBar ); + virtual wxMenuBar *GetMenuBar(); - // frame title void SetTitle( const wxString &title ); wxString GetTitle() const { return m_title; } - // implementation - void OnActivate( wxActivateEvent &event ) { } // called from docview.cpp + void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp void OnSize( wxSizeEvent &event ); void OnCloseWindow( wxCloseEvent& event ); void OnIdle(wxIdleEvent& event); + virtual void AddChild( wxWindow *child ); virtual void GtkOnSize( int x, int y, int width, int height ); private: @@ -99,10 +98,12 @@ private: GtkWidget *m_mainWindow; wxMenuBar *m_frameMenuBar; wxStatusBar *m_frameStatusBar; + wxToolBar *m_frameToolBar; + int m_toolBarHeight; bool m_doingOnSize; + bool m_addPrivateChild; // for toolbar (and maybe menubar) wxString m_title; - DECLARE_DYNAMIC_CLASS(wxFrame) DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index 94fe7216b0..4a4aadf0bc 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -68,9 +68,6 @@ class wxMDIParentFrame: public wxFrame void GetClientSize(int *width, int *height) const; wxMDIChildFrame *GetActiveChild(void) const; - virtual void SetToolBar( wxToolBar *toolbar ); - virtual wxWindow *GetToolBar(void) const; - wxMDIClientWindow *GetClientWindow(void) const; virtual wxMDIClientWindow *OnCreateClient(void); @@ -95,7 +92,6 @@ class wxMDIParentFrame: public wxFrame wxMDIClientWindow *m_clientWindow; bool m_parentFrameActive; wxMenuBar *m_mdiMenuBar; - wxToolBar *m_toolBar; DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk/tbargtk.h b/include/wx/gtk/tbargtk.h index 8a952ec2da..19b59ff9d2 100644 --- a/include/wx/gtk/tbargtk.h +++ b/include/wx/gtk/tbargtk.h @@ -112,6 +112,8 @@ class wxToolBar: public wxControl const wxString& helpString1 = "", const wxString& helpString2 = ""); virtual void AddSeparator(void); virtual void ClearTools(void); + + virtual void Layout(void); virtual void EnableTool(int toolIndex, bool enable); virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on diff --git a/include/wx/gtk1/dc.h b/include/wx/gtk1/dc.h index 9abb2793df..9678e6d693 100644 --- a/include/wx/gtk1/dc.h +++ b/include/wx/gtk1/dc.h @@ -119,6 +119,9 @@ class wxDC: public wxObject virtual void SetBrush( const wxBrush &brush ) = 0; virtual wxBrush *GetBrush(void) { return &m_brush; }; + virtual void SetBackground( const wxBrush &brush ) = 0; + virtual wxBrush *GetBackground(void) { return &m_backgroundBrush; }; + virtual void SetLogicalFunction( int function ) = 0; virtual int GetLogicalFunction(void) { return m_logicalFunction; }; diff --git a/include/wx/gtk1/dcclient.h b/include/wx/gtk1/dcclient.h index b85fb317d1..57b784c0f4 100644 --- a/include/wx/gtk1/dcclient.h +++ b/include/wx/gtk1/dcclient.h @@ -80,6 +80,7 @@ class wxPaintDC: public wxDC virtual void SetFont( const wxFont &font ); virtual void SetPen( const wxPen &pen ); virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); virtual void SetLogicalFunction( int function ); virtual void SetTextForeground( const wxColour &col ); virtual void SetTextBackground( const wxColour &col ); diff --git a/include/wx/gtk1/dnd.h b/include/wx/gtk1/dnd.h index 4b27e36da1..1ce3e29040 100644 --- a/include/wx/gtk1/dnd.h +++ b/include/wx/gtk1/dnd.h @@ -35,7 +35,7 @@ class wxTextDragSource; // wxDropTarget //------------------------------------------------------------------------- -class wxDropTarget: wxObject +class wxDropTarget: public wxObject { public: diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index e98c4acd17..47f7037e0c 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -21,6 +21,7 @@ #include "wx/window.h" #include "wx/menu.h" #include "wx/statusbr.h" +#include "wx/toolbar.h" //----------------------------------------------------------------------------- // classes @@ -42,8 +43,9 @@ extern const char *wxFrameNameStr; class wxFrame: public wxWindow { + DECLARE_DYNAMIC_CLASS(wxFrame) public: - // construction + wxFrame(); wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, @@ -54,38 +56,35 @@ public: ~wxFrame(); bool Destroy(); - // operations - // virtual bool Show( bool show ); virtual void Enable( bool enable ); - // frame size virtual void GetClientSize( int *width, int *height ) const; - // set minimal size for the frame (@@@ other params not implemented) - void SetSizeHints(int minW, int minH, - int maxW = -1, int maxH = -1, - int incW = -1); + + // set minimal/maxmimal size for the frame + virtual void SetSizeHints( int minW, int minH, int maxW, int maxH, int incW = -1 ); - // status bar virtual bool CreateStatusBar( int number = 1 ); - wxStatusBar *GetStatusBar(); + virtual wxStatusBar *GetStatusBar(); virtual void SetStatusText( const wxString &text, int number = 0 ); virtual void SetStatusWidths( int n, int *width ); - // menu bar - void SetMenuBar( wxMenuBar *menuBar ); - wxMenuBar *GetMenuBar(); + virtual wxToolBar *CreateToolBar( int style = 0, + int orientation = wxHORIZONTAL, int rowsOrColumns = 1 ); + virtual wxToolBar *GetToolBar(); + + virtual void SetMenuBar( wxMenuBar *menuBar ); + virtual wxMenuBar *GetMenuBar(); - // frame title void SetTitle( const wxString &title ); wxString GetTitle() const { return m_title; } - // implementation - void OnActivate( wxActivateEvent &event ) { } // called from docview.cpp + void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp void OnSize( wxSizeEvent &event ); void OnCloseWindow( wxCloseEvent& event ); void OnIdle(wxIdleEvent& event); + virtual void AddChild( wxWindow *child ); virtual void GtkOnSize( int x, int y, int width, int height ); private: @@ -99,10 +98,12 @@ private: GtkWidget *m_mainWindow; wxMenuBar *m_frameMenuBar; wxStatusBar *m_frameStatusBar; + wxToolBar *m_frameToolBar; + int m_toolBarHeight; bool m_doingOnSize; + bool m_addPrivateChild; // for toolbar (and maybe menubar) wxString m_title; - DECLARE_DYNAMIC_CLASS(wxFrame) DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index 94fe7216b0..4a4aadf0bc 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -68,9 +68,6 @@ class wxMDIParentFrame: public wxFrame void GetClientSize(int *width, int *height) const; wxMDIChildFrame *GetActiveChild(void) const; - virtual void SetToolBar( wxToolBar *toolbar ); - virtual wxWindow *GetToolBar(void) const; - wxMDIClientWindow *GetClientWindow(void) const; virtual wxMDIClientWindow *OnCreateClient(void); @@ -95,7 +92,6 @@ class wxMDIParentFrame: public wxFrame wxMDIClientWindow *m_clientWindow; bool m_parentFrameActive; wxMenuBar *m_mdiMenuBar; - wxToolBar *m_toolBar; DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk1/tbargtk.h b/include/wx/gtk1/tbargtk.h index 8a952ec2da..19b59ff9d2 100644 --- a/include/wx/gtk1/tbargtk.h +++ b/include/wx/gtk1/tbargtk.h @@ -112,6 +112,8 @@ class wxToolBar: public wxControl const wxString& helpString1 = "", const wxString& helpString2 = ""); virtual void AddSeparator(void); virtual void ClearTools(void); + + virtual void Layout(void); virtual void EnableTool(int toolIndex, bool enable); virtual void ToggleTool(int toolIndex, bool toggle); // toggle is TRUE if toggled on diff --git a/include/wx/intl.h b/include/wx/intl.h index dce70d0c7b..3bbdd43355 100644 --- a/include/wx/intl.h +++ b/include/wx/intl.h @@ -107,7 +107,8 @@ private: // ---------------------------------------------------------------------------- // global functions // ---------------------------------------------------------------------------- -inline WXDLLEXPORT wxLocale* wxGetLocale() { return g_pLocale; } + +WXDLLEXPORT wxLocale* wxGetLocale(); // get the translation of the string in the current locale inline WXDLLEXPORT const char *wxGetTranslation(const char *sz) diff --git a/include/wx/list.h b/include/wx/list.h index 32444309a5..def8cc1713 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -76,11 +76,6 @@ class WXDLLEXPORT wxList: public wxObject wxList(int N, wxObject *Objects[]); wxList(wxObject *object, ...); -#ifdef USE_STORABLE_CLASSES - wxList( istream &stream, char *data ); - virtual void StoreObject( ostream &stream ); -#endif - ~wxList(void); inline int Number(void) const { return n; } diff --git a/include/wx/matrix.h b/include/wx/matrix.h index 1c5b592778..8969893444 100644 --- a/include/wx/matrix.h +++ b/include/wx/matrix.h @@ -97,19 +97,24 @@ public: */ }; + +/* +The code is wrong and doesn't compile. Chris Breeze als reported, that +some functions of wxTransformMatrix cannot work because it is not +known if he matrix has been inverted. Be careful when using it. + // Transform X value from logical to device inline double wxTransformMatrix::TransformX(double x) const { -// return (m_isIdentity ? x : (x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0])); - return 0; + return (m_isIdentity ? x : (x * m_matrix[0][0] + y * m_matrix[1][0] + m_matrix[2][0])); } // Transform Y value from logical to device inline double wxTransformMatrix::TransformY(double y) const { -// return (m_isIdentity ? y : (x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1])); - return 0; + return (m_isIdentity ? y : (x * m_matrix[0][1] + y * m_matrix[1][1] + m_matrix[2][1])); } +*/ // Is the matrix the identity matrix? // Perhaps there's some kind of optimization we can do to make this diff --git a/include/wx/zstream.h b/include/wx/zstream.h index 76734083d2..326058f3fb 100644 --- a/include/wx/zstream.h +++ b/include/wx/zstream.h @@ -16,7 +16,7 @@ #endif #include -#include "zlib.h" +#include "../zlib/zlib.h" class wxZlibInputStream: public wxFilterInputStream { public: @@ -27,7 +27,7 @@ class wxZlibInputStream: public wxFilterInputStream { protected: size_t DoRead(void *buffer, size_t size); - off_t DoSeekInput(off_t pos, wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; } + off_t DoSeekInput(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; } off_t DoTellInput() const { return wxInvalidOffset; } protected: @@ -47,7 +47,7 @@ class wxZlibOutputStream: public wxFilterOutputStream { protected: size_t DoWrite(const void *buffer, size_t size); - off_t DoSeekOutput(off_t pos, wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; } + off_t DoSeekOutput(off_t WXUNUSED(pos), wxSeekMode WXUNUSED(mode)) { return wxInvalidOffset; } off_t DoTellOutput() const { return wxInvalidOffset; } protected: diff --git a/install/gtk/INSTALL b/install/gtk/INSTALL index 3fd1aacada..511613954f 100644 --- a/install/gtk/INSTALL +++ b/install/gtk/INSTALL @@ -4,8 +4,48 @@ wxGTK uses GNU configure. If you have problems with your make use GNU make instead. +* Additional libraries +----------------------- + +wxGTK requires the GTK (The Gimp Toolkit) to be installed, +which probably makes sense. + +There will be a few more features of wxGTK, which will +require further libraries (on some platforms). These +features will be optional. I hope to teach configure +to check that out automatically. + +Thread support: + + Requires pthreads under Linux with glibc 2. pthreads are + always present on such systems, so just compile. + + Requires pcthreads under Linux with libc 5. If you + haven't installed pcthreads, there will be no thread + support in wxGTK, but the library will compile. + +Python scripting language support: + + Requires Python. Soon to come. + +* Other things to do +----------------------------- + +Copy the two files from ~/wxGTK/misc/imlib to your +home directory. You may also edit imrc by hand as +you like. The palette file is required when using +wxGTK in 256-colour mode. + +If you want to use wxGTK's ODBC support, you'll have +to create a .odbc.ini file. The readme file in +~/wxGTK/src/iodbc tells you what to do. + + * Create your configuration ----------------------------- + +This must be done in ~/wxGTK/install/gtk + Usage: ./configure options @@ -47,11 +87,13 @@ The following options handle the kind of library you want to build. broken. --with-mem_tracing Add built-in memory tracing. - Not yet. - --with-debug Add debug info to object + --with-debug_info Add debug info to object files. + --with-debug_flag Define __DEBUG__ and __WXDEBUG__ when + compiling. + * Feature Options ------------------- @@ -65,37 +107,11 @@ producing a shared library, wxGTK's configure system auto- matically enables all features, as long as they are already implemented. -* Additional libraries ------------------------ - -[Note: Currently wxGTK will compile out-of-the-box - with no extra libraries required. Support for - OpenGl, threads, Python and hopefully ODBC - support will soon be added.] - -wxGTK requires the GTK (The Gimp Toolkit) to be installed, -which probably makes sense. - -There will be a few more features of wxGTK, which will -require further libraries (on some platforms). These -features will be optional. I hope to teach configure -to check that out automatically. - -Thread support: - - Requires pthreads under Linux without glibc or glibc 2. - -OpenGl: - - Requires OpenGl or MesaGl. - -Python scripting language support: - - Requires Python. - * Compiling ------------- +This must be done in ~/wxGTK + First you have to create all makefiles in all subdirectories: make makefiles @@ -144,7 +160,7 @@ will do the work for you. -------------------------- I propose to put all contributed programs in the directory -"user", with a directory of its own. +"~/wcGTK/user", with a directory of its own. This directory then should include the following files: diff --git a/install/gtk/configure b/install/gtk/configure index 3795ffbcfb..49914c49f9 100755 --- a/install/gtk/configure +++ b/install/gtk/configure @@ -5710,11 +5710,7 @@ if test "$USE_MEM_TRACING" = 1 ; then #define USE_MEMORY_TRACING $USE_MEM_TRACING EOF - cat >> confdefs.h <&6 -echo "configure:6056: checking for $ac_word" >&5 +echo "configure:6052: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6083,7 +6079,7 @@ fi min_gtk_version=0.99.7 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:6087: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:6083: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" != "no" ; then GTK_CFLAGS=`$GTK_CONFIG --cflags` @@ -6096,7 +6092,7 @@ echo "configure:6087: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -6118,7 +6114,7 @@ main () } EOF -if { (eval echo configure:6122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -6174,7 +6170,7 @@ OPENGL_LINK= if test "$USE_OPENGL" = 1; then echo $ac_n "checking for OpenGL includes""... $ac_c" 1>&6 -echo "configure:6178: checking for OpenGL includes" >&5 +echo "configure:6174: checking for OpenGL includes" >&5 ac_find_includes= for ac_dir in $SEARCH_INCLUDE; @@ -6189,7 +6185,7 @@ for ac_dir in $SEARCH_INCLUDE; OPENGL_INCLUDE="-I$ac_find_includes" echo "$ac_t""found $ac_find_includes" 1>&6 echo $ac_n "checking for OpenGL library""... $ac_c" 1>&6 -echo "configure:6193: checking for OpenGL library" >&5 +echo "configure:6189: checking for OpenGL library" >&5 ac_find_libraries= for ac_dir in $SEARCH_LIB; diff --git a/install/gtk/configure.in b/install/gtk/configure.in index 507f0cdb6c..1d4f804a9a 100644 --- a/install/gtk/configure.in +++ b/install/gtk/configure.in @@ -963,7 +963,7 @@ fi if test "$USE_MEM_TRACING" = 1 ; then AC_DEFINE_UNQUOTED(USE_MEMORY_TRACING,$USE_MEM_TRACING) - AC_DEFINE_UNQUOTED(USE_GLOBAL_MEMORY_OPERATORS,$USE_MEM_TRACING) + dnl AC_DEFINE_UNQUOTED(USE_GLOBAL_MEMORY_OPERATORS,$USE_MEM_TRACING) fi PROFILE= diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index 114eb4c78d..7d9ac5bc79 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -21,17 +21,10 @@ #include "wx/mdi.h" #endif -#ifdef __WXMSW__ -#ifdef __WIN95__ -#include -#else -#include -#endif -#endif +#include #ifdef __WXGTK__ -//#include "list.xpm" -//#include "folder.xpm" +#include "folder.xpm" #endif #include "mdi.h" @@ -105,10 +98,8 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c wxTE_MULTILINE|wxSUNKEN_BORDER); textWindow->SetValue("A help window"); -#ifdef __WXMSW__ toolBar = new TestRibbon(this, 0, 0, 100, 30, wxNO_BORDER, wxVERTICAL, 1); SetToolBar(toolBar); -#endif } void MyFrame::OnQuit(wxCommandEvent& event) @@ -257,14 +248,12 @@ void MyFrame::OnSize(wxSizeEvent& event) int tw = 0; int th = 0; -#ifdef __WXMSW__ wxWindow* tbar = GetToolBar(); if (tbar) { tbar->GetSize(&tw, &th); tbar->SetSize(w, th); } -#endif textWindow->SetSize(0, th, 200, h-th); GetClientWindow()->SetSize(200, th, w - 200, h-th); @@ -316,8 +305,6 @@ bool MyChild::OnClose(void) return TRUE; } -#ifdef __WXMSW__ - BEGIN_EVENT_TABLE(TestRibbon, wxToolBar) EVT_PAINT(TestRibbon::OnPaint) END_EVENT_TABLE() @@ -328,6 +315,7 @@ TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h, { wxBitmap* bitmaps[8]; +#ifdef __WXMSW__ bitmaps[0] = new wxBitmap("icon1", wxBITMAP_TYPE_RESOURCE); bitmaps[1] = new wxBitmap("icon2", wxBITMAP_TYPE_RESOURCE); bitmaps[2] = new wxBitmap("icon3", wxBITMAP_TYPE_RESOURCE); @@ -336,6 +324,16 @@ TestRibbon::TestRibbon(wxFrame *frame, int x, int y, int w, int h, bitmaps[5] = new wxBitmap("icon6", wxBITMAP_TYPE_RESOURCE); bitmaps[6] = new wxBitmap("icon7", wxBITMAP_TYPE_RESOURCE); bitmaps[7] = new wxBitmap("icon8", wxBITMAP_TYPE_RESOURCE); +#else + bitmaps[0] = new wxBitmap( folder_xpm ); + bitmaps[1] = new wxBitmap( folder_xpm ); + bitmaps[2] = new wxBitmap( folder_xpm ); + bitmaps[3] = new wxBitmap( folder_xpm ); + bitmaps[4] = new wxBitmap( folder_xpm ); + bitmaps[5] = new wxBitmap( folder_xpm ); + bitmaps[6] = new wxBitmap( folder_xpm ); + bitmaps[7] = new wxBitmap( folder_xpm ); +#endif #ifdef __WXMSW__ int width = 24; @@ -403,4 +401,3 @@ void TestRibbon::OnPaint(wxPaintEvent& event) dc.DrawLine(0, h-1, w, h-1); } -#endif diff --git a/samples/mdi/mdi.h b/samples/mdi/mdi.h index 47d61ee24e..48a055a332 100644 --- a/samples/mdi/mdi.h +++ b/samples/mdi/mdi.h @@ -34,8 +34,6 @@ class MyCanvas: public wxScrolledWindow DECLARE_EVENT_TABLE() }; -#ifdef __WXMSW__ - class TestRibbon: public wxToolBar { public: @@ -48,17 +46,13 @@ class TestRibbon: public wxToolBar DECLARE_EVENT_TABLE() }; -#endif - // Define a new frame class MyFrame: public wxMDIParentFrame { public: wxTextCtrl *textWindow; -#ifdef __WXMSW__ TestRibbon* toolBar; -#endif MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, const long style); bool OnClose(void); diff --git a/samples/memcheck/memcheck.cpp b/samples/memcheck/memcheck.cpp index 3319c08232..4b1be5acf3 100644 --- a/samples/memcheck/memcheck.cpp +++ b/samples/memcheck/memcheck.cpp @@ -31,7 +31,7 @@ #error You must set WXDEBUG to 1 on the 'make' command line or make.env. #endif -#define new WXDEBUG_NEW +// #define new WXDEBUG_NEW // Define a new application type class MyApp: public wxApp @@ -81,7 +81,7 @@ bool MyApp::OnInit(void) frame->Show(TRUE); // wxDebugContext::SetCheckpoint(); - wxDebugContext::SetFile("debug.log"); +// wxDebugContext::SetFile("debug.log"); wxString *thing = new wxString; // WXDEBUG_NEW wxString; wxDate* date = new wxDate; @@ -92,9 +92,9 @@ bool MyApp::OnInit(void) const char *data = (const char*) thing ; - wxDebugContext::PrintClasses(); - wxDebugContext::Dump(); - wxDebugContext::PrintStatistics(); +// wxDebugContext::PrintClasses(); +// wxDebugContext::Dump(); +// wxDebugContext::PrintStatistics(); // Don't delete these two objects, to force wxApp to flag a memory leak. // delete thing; diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 80ad3550d6..30af039444 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -811,7 +811,7 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event)) preview = new wxWindowsPrintPreview(printout, view->OnCreatePrintout()); else #endif - preview = new wxPostScriptPrintPreview(printout, view->OnCreatePrintout()); + preview = new wxPostScriptPrintPreview(printout, view->OnCreatePrintout()); wxPreviewFrame *frame = new wxPreviewFrame(preview, (wxFrame *)wxTheApp->GetTopWindow(), "Print Preview", wxPoint(100, 100), wxSize(600, 650)); diff --git a/src/common/event.cpp b/src/common/event.cpp index 5917d2a595..f05273d387 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -356,7 +356,7 @@ bool wxEvtHandler::SearchEventTable(wxEventTable& table, wxEvent& event) while (table.entries[i].m_fn != NULL) { - wxEventType eventType = (wxEventType) table.entries[i].m_eventType; +// wxEventType eventType = (wxEventType) table.entries[i].m_eventType; if ((event.GetEventType() == table.entries[i].m_eventType) && (table.entries[i].m_id == -1 || // Match, if event spec says any id will do (id == -1) @@ -407,7 +407,8 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event ) while (node) { wxEventTableEntry *entry = (wxEventTableEntry*)node->Data(); - wxEventType eventType = (wxEventType) entry->m_eventType; + +// wxEventType eventType = (wxEventType) entry->m_eventType; if (entry->m_fn) { diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index c146f4ec4c..7934074852 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -736,7 +736,11 @@ wxDos2UnixFilename (char *s) } void +#ifdef __WXMSW__ wxUnix2DosFilename (char *s) +#else +wxUnix2DosFilename (char *WXUNUSED(s)) +#endif { // Yes, I really mean this to happen under DOS only! JACS #ifdef __WXMSW__ @@ -1346,7 +1350,7 @@ void WXDLLEXPORT wxSplitPath(const char *pszFileName, uint nPosDos = pSepDos ? pSepDos - pszFileName : 0; if ( nPosDos > nPosUnix ) nPosUnix = nPosDos; - uint nLen = Strlen(pszFileName); +// uint nLen = Strlen(pszFileName); if ( pstrPath ) *pstrPath = wxString(pszFileName, nPosUnix); diff --git a/src/common/framecmn.cpp b/src/common/framecmn.cpp index 19985714d3..4acd32c428 100644 --- a/src/common/framecmn.cpp +++ b/src/common/framecmn.cpp @@ -10,7 +10,7 @@ #include "wx/frame.h" -void wxFrame::OnIdle(wxIdleEvent& event) +void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) ) { DoMenuUpdates(); } diff --git a/src/common/list.cpp b/src/common/list.cpp index b4d2ab7410..c36e7f7953 100644 --- a/src/common/list.cpp +++ b/src/common/list.cpp @@ -210,40 +210,6 @@ wxList::~wxList (void) } } -#ifdef USE_STORABLE_CLASSES -wxList::wxList( istream &stream, char *WXUNUSED(data) ) -{ - char buf[200]; - unsigned int num; - stream.read( (char*)(&num), sizeof(num) ); - for (unsigned int i = 0; i < num; i++) - { - int len; - stream.read( (char*)(&len), sizeof(len) ); - stream.read( (char*)(&buf), len ); - buf[len] = 0; - Append( wxCreateStoredObject( buf, stream, NULL ) ); - }; -}; - -void wxList::StoreObject( ostream &stream ) -{ - unsigned int num = Number(); - stream.write( (char*)(&num), sizeof(num) ); - wxNode *node = First(); - while (node) - { - wxObject *obj = (wxObject*) node->Data(); - wxClassInfo *obj_info = obj->GetClassInfo(); - int len = strlen(obj_info->className); - stream.write( (char*)(&len), sizeof(len) ); - stream.write( obj_info->className, len ); - obj->StoreObject( stream ); - node = node->Next(); - }; -}; -#endif - wxNode *wxList::Append(wxObject *object) { wxNode *node = new wxNode(this, last_node, NULL, object); diff --git a/src/common/log.cpp b/src/common/log.cpp index 8a50359699..cbcaf76630 100644 --- a/src/common/log.cpp +++ b/src/common/log.cpp @@ -308,7 +308,7 @@ void wxLog::DoLog(wxLogLevel level, const char *szString) } } -void wxLog::DoLogString(const char *szString) +void wxLog::DoLogString(const char *WXUNUSED(szString)) { wxFAIL_MSG("DoLogString must be overrided if it's called."); } @@ -558,19 +558,19 @@ wxLogFrame::wxLogFrame(const char *szTitle) // @@ what about status bar? needed (for menu prompts)? } -void wxLogFrame::OnClose(wxCommandEvent& event) +void wxLogFrame::OnClose(wxCommandEvent& WXUNUSED(event)) { // just hide the window Show(FALSE); } -void wxLogFrame::OnCloseWindow(wxCloseEvent& event) +void wxLogFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event)) { // just hide the window Show(FALSE); } -void wxLogFrame::OnSave(wxCommandEvent& event) +void wxLogFrame::OnSave(wxCommandEvent& WXUNUSED(event)) { // get the file name // ----------------- @@ -583,9 +583,9 @@ void wxLogFrame::OnSave(wxCommandEvent& event) // open file // --------- wxFile file; - bool bOk; + bool bOk = FALSE; if ( wxFile::Exists(szFileName) ) { - bool bAppend; + bool bAppend = FALSE; wxString strMsg; strMsg.Printf(_("Append log to file '%s' " "(choosing [No] will overwrite it)?"), szFileName); @@ -637,7 +637,7 @@ void wxLogFrame::OnSave(wxCommandEvent& event) } } -void wxLogFrame::OnClear(wxCommandEvent& event) +void wxLogFrame::OnClear(wxCommandEvent& WXUNUSED(event)) { m_pTextCtrl->Clear(); } diff --git a/src/common/memory.cpp b/src/common/memory.cpp index ce4aec4926..4e84584d70 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -387,7 +387,7 @@ int wxMemStruct::ValidateNode () ErrorMsg ("Object already deleted"); else { // Can't use the error routines as we have no recognisable object. - wxTrace("Can't verify memory struct - all bets are off!\n"); + // wxTrace("Can't verify memory struct - all bets are off!\n"); } return 0; } diff --git a/src/common/odbc.cpp b/src/common/odbc.cpp index 67768ac38e..79d1f9b9df 100644 --- a/src/common/odbc.cpp +++ b/src/common/odbc.cpp @@ -129,7 +129,8 @@ char* wxDatabase::GetErrorClass(void) { return sqlstate; } -bool wxDatabase::Open(char *thedatasource, bool exclusive, bool readOnly, char *username, char *password) +bool wxDatabase::Open(char *thedatasource, bool WXUNUSED(exclusive), + bool WXUNUSED(readOnly), char *username, char *password) { err_occured = FALSE; @@ -198,7 +199,7 @@ char *wxDatabase::GetDatabaseName(void) char nameBuf[400]; int nameSize = 0; - retcode = SQLGetInfo(hDBC, SQL_DATABASE_NAME, nameBuf, sizeof(nameBuf), (short *)&nameSize); + retcode = SQLGetInfo(hDBC, SQL_DATABASE_NAME, (unsigned char*)nameBuf, sizeof(nameBuf), (short *)&nameSize); if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO) return NULL; @@ -230,15 +231,15 @@ bool wxDatabase::InWaitForDataSource(void) return FALSE; } -void wxDatabase::SetLoginTimeout(long seconds) +void wxDatabase::SetLoginTimeout(long WXUNUSED(seconds)) { } -void wxDatabase::SetQueryTimeout(long seconds) +void wxDatabase::SetQueryTimeout(long WXUNUSED(seconds)) { } -void wxDatabase::SetSynchronousMode(bool synchronous) +void wxDatabase::SetSynchronousMode(bool WXUNUSED(synchronous)) { } @@ -263,11 +264,11 @@ void wxDatabase::Cancel(void) } // Overridables -void wxDatabase::OnSetOptions(wxRecordSet *recordSet) +void wxDatabase::OnSetOptions(wxRecordSet *WXUNUSED(recordSet)) { } -void wxDatabase::OnWaitForDataSource(bool stillExecuting) +void wxDatabase::OnWaitForDataSource(bool WXUNUSED(stillExecuting)) { } @@ -335,7 +336,7 @@ void wxDatabase::ResetRecordSets(void) bool wxDatabase::GetInfo(long infoType, long *buf) { short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)infoType, (char *)buf, sizeof(buf), &sz); + retcode = SQLGetInfo(hDBC, (UWORD)infoType, (unsigned char*)buf, sizeof(buf), &sz); if (retcode != SQL_ERROR) return TRUE; @@ -349,7 +350,7 @@ bool wxDatabase::GetInfo(long infoType, char *buf, int bufSize) bufSize = sizeof(buf); short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)infoType, buf, bufSize, &sz); + retcode = SQLGetInfo(hDBC, (UWORD)infoType, (unsigned char*)buf, bufSize, &sz); if (retcode != SQL_ERROR) return TRUE; @@ -386,7 +387,7 @@ wxString wxDatabase::GetODBCVersionString(bool implementation) int bufSize = sizeof(buf); short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, buf, bufSize, &sz); + retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, (unsigned char*)buf, bufSize, &sz); if (hDBC != 0 && noDBC) { @@ -427,7 +428,7 @@ float wxDatabase::GetODBCVersionFloat(bool implementation) int bufSize = sizeof(buf); short sz = 0; - retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, buf, bufSize, &sz); + retcode = SQLGetInfo(hDBC, (UWORD)SQL_ODBC_VER, (unsigned char*)buf, bufSize, &sz); if (hDBC != 0 && noDBC) { @@ -485,7 +486,7 @@ wxRecordSet::~wxRecordSet(void) } // If SQL is non-NULL, table and columns can be NULL. -bool wxRecordSet::BeginQuery(int openType, char *sql, int options) +bool wxRecordSet::BeginQuery(int WXUNUSED(openType), char *WXUNUSED(sql), int WXUNUSED(options)) { // Needs to construct an appropriate SQL statement. By default // (i.e. if table and columns are provided) then @@ -565,7 +566,7 @@ void wxRecordSet::FillVars(int recnum) { do { ((wxQueryCol*)node->Data())->FillVar(recnum); - } while (node = node->Next()); + } while ((node = node->Next())); } bool wxRecordSet::GetResultSet(void) @@ -796,7 +797,7 @@ bool wxRecordSet::GetTables(void) bool wxRecordSet::GetColumns(char* table) { char* name=NULL; - char* wildcard = "%"; +// char* wildcard = "%"; name = table ? table : tablename; @@ -836,7 +837,7 @@ bool wxRecordSet::GetColumns(char* table) bool wxRecordSet::GetPrimaryKeys(char* table) { char* name=NULL; - char* wildcard = "%"; +// char* wildcard = "%"; name = table ? table : tablename; @@ -875,7 +876,7 @@ bool wxRecordSet::GetForeignKeys(char* PkTableName, char * FkTableName) { char* Pkname=NULL; char* Fkname=NULL; - char* wildcard = "%"; +// char* wildcard = "%"; // Try to disable situation: both PkTableName and FkTableName are NULL // set Pkname from tablename @@ -1371,7 +1372,7 @@ void wxRecordSet::SetFieldDirty(const char* name, bool dirty) ((wxQueryCol*)node->Data())->SetFieldDirty(cursor, dirty); } -void wxRecordSet::SetFieldNull(void *p, bool isNull) +void wxRecordSet::SetFieldNull(void *WXUNUSED(p), bool WXUNUSED(isNull)) { } @@ -1534,7 +1535,7 @@ long wxQueryCol::GetSize(int row) { wxNode* node = fields.Nth(row); if (!node) - return NULL; + return 0; return ((wxQueryField*)node->Data())->GetSize(); } @@ -1599,7 +1600,7 @@ bool wxQueryField::AllocData(void) { { if (data) // JACS delete[] (char*)data; - if (data = new char[size+1]) + if ((data = new char[size+1])) { char *str = (char *)data; int i; @@ -1613,7 +1614,7 @@ bool wxQueryField::AllocData(void) { { if (data) // JACS delete (long*)data; - if (data = new long) + if ((data = new long)) *(long*)data = 0L; break; } @@ -1621,7 +1622,7 @@ bool wxQueryField::AllocData(void) { { if (data) delete (short*)data; - if (data = new short) + if ((data = new short)) *(short*)data = 0; break; } @@ -1630,7 +1631,7 @@ bool wxQueryField::AllocData(void) { { if (data) delete (double*)data; - if (data = new double) + if ((data = new double)) *(double*)data = 0; break; } @@ -1638,7 +1639,7 @@ bool wxQueryField::AllocData(void) { { if (data) delete (float*)data; - if (data = new float) + if ((data = new float)) *(float*)data = (float)0; break; } diff --git a/src/common/zstream.cpp b/src/common/zstream.cpp index ea64071eb7..85b95b59e3 100644 --- a/src/common/zstream.cpp +++ b/src/common/zstream.cpp @@ -17,7 +17,7 @@ #include #include #include -#include "zlib.h" +#include "../zlib/zlib.h" #ifdef __BORLANDC__ #pragma hdrstop diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 9cfd6f2253..2317ad5320 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -18,6 +18,7 @@ #include "wx/postscrp.h" #include "wx/intl.h" #include "wx/log.h" +#include "wx/memory.h" #include "unistd.h" @@ -285,6 +286,18 @@ int wxEntry( int argc, char *argv[] ) wxClassInfo::InitializeClasses(); +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + +#if !defined(_WINDLL) + streambuf* sBuf = new wxDebugStreamBuf; +#else + streambuf* sBuf = NULL; +#endif + ostream* oStr = new ostream(sBuf) ; + wxDebugContext::SetStream(oStr, sBuf); + +#endif + if (!wxTheApp) { if (!wxApp::GetInitializerFunction()) @@ -347,6 +360,20 @@ int wxEntry( int argc, char *argv[] ) wxApp::CommonCleanUp(); +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + // At this point we want to check if there are any memory + // blocks that aren't part of the wxDebugContext itself, + // as a special case. Then when dumping we need to ignore + // wxDebugContext, too. + if (wxDebugContext::CountObjectsLeft() > 0) + { + wxTrace("There were memory leaks.\n"); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + } + wxDebugContext::SetStream(NULL, NULL); +#endif + return retValue; }; diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index c4b2b3ee14..1540320787 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -649,6 +649,46 @@ void wxPaintDC::SetBrush( const wxBrush &brush ) }; }; +// CMB 21/7/98: Added SetBackground. Sets background brush +// for Clear() and bg colour for shapes filled with cross-hatch brush +void wxPaintDC::SetBackground( const wxBrush &brush ) +{ + if (!Ok()) return; + + if (m_backgroundBrush == brush) return; + + m_backgroundBrush = brush; + + if (!m_backgroundBrush.Ok()) return; + + m_backgroundBrush.GetColour().CalcPixel( m_cmap ); + gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() ); + gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() ); + + GdkFill fillStyle = GDK_SOLID; + switch (m_backgroundBrush.GetStyle()) + { + case wxSOLID: + case wxTRANSPARENT: + break; + default: + fillStyle = GDK_STIPPLED; + }; + + gdk_gc_set_fill( m_bgGC, fillStyle ); + + if (m_backgroundBrush.GetStyle() == wxSTIPPLE) + { + gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() ); + }; + + if (IS_HATCH(m_backgroundBrush.GetStyle())) + { + int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH; + gdk_gc_set_stipple( m_bgGC, hatches[num] ); + }; +}; + void wxPaintDC::SetLogicalFunction( int function ) { if (m_logicalFunction == function) return; @@ -693,6 +733,14 @@ void wxPaintDC::SetTextBackground( const wxColour &col ) void wxPaintDC::SetBackgroundMode( int mode ) { m_backgroundMode = mode; + + // CMB 21/7/98: fill style of cross-hatch brushes is affected by + // transparent/solid background mode + if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT) + { + gdk_gc_set_fill( m_brushGC, + (m_backgroundMode == wxTRANSPARENT) ? GDK_STIPPLED : GDK_OPAQUE_STIPPLED); + } }; void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) ) diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index bd1ea693e2..2371b4c5ce 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -77,7 +77,9 @@ wxFrame::wxFrame() m_doingOnSize = FALSE; m_frameMenuBar = NULL; m_frameStatusBar = NULL; + m_frameToolBar = NULL; m_sizeSet = FALSE; + m_addPrivateChild = FALSE; wxTopLevelWindows.Insert( this ); }; @@ -85,7 +87,12 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { + m_doingOnSize = FALSE; + m_frameMenuBar = NULL; + m_frameStatusBar = NULL; + m_frameToolBar = NULL; m_sizeSet = FALSE; + m_addPrivateChild = FALSE; Create( parent, id, title, pos, size, style, name ); wxTopLevelWindows.Insert( this ); }; @@ -131,9 +138,6 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, gtk_container_add( GTK_CONTAINER(m_mainWindow), m_wxwindow ); - m_frameMenuBar = NULL; - m_frameStatusBar = NULL; - gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this ); @@ -195,6 +199,12 @@ void wxFrame::GetClientSize( int *width, int *height ) const { if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT; if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT; + if (m_frameToolBar) + { + int y = 0; + m_frameToolBar->GetSize( NULL, &y ); + (*height) -= y; + } }; }; @@ -236,6 +246,12 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height ) main_height -= wxMENU_HEIGHT; }; + int toolbar_height = 0; + if (m_frameToolBar) m_frameToolBar->GetSize( NULL, &toolbar_height ); + + main_y += toolbar_height; + main_height -= toolbar_height; + gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y ); gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height ); @@ -245,6 +261,12 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height ) gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 ); }; + if (m_frameToolBar) + { + gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT ); + gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height ); + }; + if (m_frameStatusBar) { m_frameStatusBar->SetSize( 0, main_height-wxSTATUS_HEIGHT, width, wxSTATUS_HEIGHT ); @@ -265,7 +287,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) // no child: go out ! if (!GetChildren()->First()) return; - + // do we have exactly one child? wxWindow *child = NULL; for(wxNode *node = GetChildren()->First(); node; node = node->Next()) @@ -273,8 +295,9 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) wxWindow *win = (wxWindow *)node->Data(); if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog)) -#if 0 // not in m_children anyway +#if 0 // not in m_children anyway && (win != m_frameMenuBar) && + (win != m_frameToolBar) && (win != m_frameStatusBar) #endif ) @@ -293,6 +316,25 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) } }; +void wxFrame::AddChild( wxWindow *child ) +{ + if (m_addPrivateChild) + { + gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y ); + + gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height ); + } + else + { + m_children.Append( child ); + + if (m_wxwindow) + gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); + + gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height ); + } +}; + static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) { menu->SetInvokingWindow( win ); @@ -329,6 +371,27 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) } }; +wxMenuBar *wxFrame::GetMenuBar(void) +{ + return m_frameMenuBar; +}; + +wxToolBar *wxFrame::CreateToolBar( int style, int WXUNUSED(orientation), int WXUNUSED(rowsOrColumns) ) +{ + m_addPrivateChild = TRUE; + + m_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style ); + + m_addPrivateChild = FALSE; + + return m_frameToolBar; +}; + +wxToolBar *wxFrame::GetToolBar(void) +{ + return m_frameToolBar; +}; + bool wxFrame::CreateStatusBar( int number ) { if (m_frameStatusBar) @@ -350,25 +413,20 @@ void wxFrame::SetStatusWidths( int n, int *width ) if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width ); }; -wxStatusBar *wxFrame::GetStatusBar() +wxStatusBar *wxFrame::GetStatusBar(void) { return m_frameStatusBar; }; -wxMenuBar *wxFrame::GetMenuBar() -{ - return m_frameMenuBar; -}; - void wxFrame::SetTitle( const wxString &title ) { m_title = title; gtk_window_set_title( GTK_WINDOW(m_widget), title ); }; -void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW) +void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) ) { - // VZ: I don't know a way to set the max size for the window in GTK and have - // no idea about what incW might be - gtk_widget_set_usize(m_widget, minW, minH); + if (m_wxwindow) + gdk_window_set_hints( m_wxwindow->window, -1, -1, + minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE ); } diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 69a709e439..fead398b88 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -69,7 +69,6 @@ wxMDIParentFrame::wxMDIParentFrame(void) m_clientWindow = NULL; m_currentChild = NULL; m_parentFrameActive = TRUE; - m_toolBar = NULL; }; wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, @@ -80,7 +79,6 @@ wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, m_clientWindow = NULL; m_currentChild = NULL; m_parentFrameActive = TRUE; - m_toolBar = NULL; Create( parent, id, title, pos, size, style, name ); }; @@ -132,16 +130,6 @@ void wxMDIParentFrame::GetClientSize(int *width, int *height ) const wxFrame::GetClientSize( width, height ); }; -void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar ) -{ - m_toolBar = toolbar; -}; - -wxWindow *wxMDIParentFrame::GetToolBar(void) const -{ - return m_toolBar; -}; - wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const { return m_currentChild; @@ -250,7 +238,8 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) while (node) { wxMenuItem *menuitem = (wxMenuItem*)node->Data(); - if (menuitem->GetSubMenu()) SetInvokingWindow( menuitem->GetSubMenu(), win ); + if (menuitem->IsSubMenu()) + SetInvokingWindow( menuitem->GetSubMenu(), win ); node = node->Next(); }; }; @@ -346,7 +335,7 @@ void wxMDIClientWindow::AddChild( wxWindow *child ) gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); - + gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget ); mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index ebf329df11..abdf6ec1a8 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -106,9 +106,17 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) { + wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex ); + event.SetEventObject( this ); + event.SetInt( toolIndex ); + event.SetExtraLong( (long) toggleDown); + +/* wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex); event.SetEventObject(this); + event.SetInt( toolIndex ); event.SetExtraLong((long) toggleDown); +*/ GetEventHandler()->ProcessEvent(event); @@ -117,8 +125,9 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) ) { - wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex); - event.SetEventObject(this); + wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex ); + event.SetEventObject( this ); + event.SetInt( toolIndex ); GetEventHandler()->ProcessEvent(event); }; @@ -127,6 +136,7 @@ void wxToolBar::OnMouseEnter( int toolIndex ) { wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex); event.SetEventObject(this); + event.SetInt( toolIndex ); GetEventHandler()->ProcessEvent(event); }; @@ -169,6 +179,29 @@ void wxToolBar::ClearTools(void) { }; +void wxToolBar::Layout(void) +{ + m_x = 0; + m_y = 0; + m_width = 100; + m_height = 0; + + wxNode *node = m_tools.First(); + while (node) + { + wxToolBarTool *tool = (wxToolBarTool*)node->Data(); + if (tool->m_bitmap1.Ok()) + { + int tool_height = tool->m_bitmap1.GetHeight(); + if (tool_height > m_height) m_height = tool_height; + }; + + node = node->Next(); + }; + + m_height += 10; +}; + void wxToolBar::EnableTool(int toolIndex, bool enable) { }; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 59c3d33980..12f7e7203c 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -308,7 +308,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) ) { }; -int wxTextCtrl::overflow(int c) +int wxTextCtrl::overflow( int WXUNUSED(c) ) { int len = pptr() - pbase(); char *txt = new char[len+1]; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 37023c65c9..9e1c673e78 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1417,7 +1417,6 @@ void wxWindow::SetFocus(void) bool wxWindow::OnClose(void) { - printf( "OnClose event.\n" ); return TRUE; }; @@ -1431,6 +1430,21 @@ void wxWindow::AddChild( wxWindow *child ) // for wxFrame, wxDialog, wxWindow and // wxMDIParentFrame. + // wxFrame and wxDialog as children aren't placed into the parents + + if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog))) + { + m_children.Append( child ); + + if ((child->m_x != -1) && (child->m_y != -1)) + gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y ); + + return; + } + + // In the case of an wxMDIChildFrame descendant, we use the + // client windows's AddChild() + if (IsKindOf(CLASSINFO(wxMDIParentFrame))) { if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) @@ -1440,30 +1454,32 @@ void wxWindow::AddChild( wxWindow *child ) { client->AddChild( child ); return; - }; - }; - }; + } + } + } - // wxNotebooks are very special, so they have their own AddChild + // wxNotebook is very special, so it has a private AddChild() if (IsKindOf(CLASSINFO(wxNotebook))) { wxNotebook *tab = (wxNotebook*)this; tab->AddChild( child ); return; - }; + } - m_children.Append( child ); - if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog))) + // wxFrame has a private AddChild + + if (IsKindOf(CLASSINFO(wxFrame))) { - if ((child->m_x != -1) && (child->m_y != -1)) - gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y ); + wxFrame *frame = (wxFrame*)this; + frame->AddChild( child ); + return; } - else - { - if (m_wxwindow) - gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); - }; + + // All the rest + + m_children.Append( child ); + if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height ); }; diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 9cfd6f2253..2317ad5320 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -18,6 +18,7 @@ #include "wx/postscrp.h" #include "wx/intl.h" #include "wx/log.h" +#include "wx/memory.h" #include "unistd.h" @@ -285,6 +286,18 @@ int wxEntry( int argc, char *argv[] ) wxClassInfo::InitializeClasses(); +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + +#if !defined(_WINDLL) + streambuf* sBuf = new wxDebugStreamBuf; +#else + streambuf* sBuf = NULL; +#endif + ostream* oStr = new ostream(sBuf) ; + wxDebugContext::SetStream(oStr, sBuf); + +#endif + if (!wxTheApp) { if (!wxApp::GetInitializerFunction()) @@ -347,6 +360,20 @@ int wxEntry( int argc, char *argv[] ) wxApp::CommonCleanUp(); +#if (WXDEBUG && USE_MEMORY_TRACING) || USE_DEBUG_CONTEXT + // At this point we want to check if there are any memory + // blocks that aren't part of the wxDebugContext itself, + // as a special case. Then when dumping we need to ignore + // wxDebugContext, too. + if (wxDebugContext::CountObjectsLeft() > 0) + { + wxTrace("There were memory leaks.\n"); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + } + wxDebugContext::SetStream(NULL, NULL); +#endif + return retValue; }; diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index c4b2b3ee14..1540320787 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -649,6 +649,46 @@ void wxPaintDC::SetBrush( const wxBrush &brush ) }; }; +// CMB 21/7/98: Added SetBackground. Sets background brush +// for Clear() and bg colour for shapes filled with cross-hatch brush +void wxPaintDC::SetBackground( const wxBrush &brush ) +{ + if (!Ok()) return; + + if (m_backgroundBrush == brush) return; + + m_backgroundBrush = brush; + + if (!m_backgroundBrush.Ok()) return; + + m_backgroundBrush.GetColour().CalcPixel( m_cmap ); + gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() ); + gdk_gc_set_foreground( m_bgGC, m_backgroundBrush.GetColour().GetColor() ); + + GdkFill fillStyle = GDK_SOLID; + switch (m_backgroundBrush.GetStyle()) + { + case wxSOLID: + case wxTRANSPARENT: + break; + default: + fillStyle = GDK_STIPPLED; + }; + + gdk_gc_set_fill( m_bgGC, fillStyle ); + + if (m_backgroundBrush.GetStyle() == wxSTIPPLE) + { + gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() ); + }; + + if (IS_HATCH(m_backgroundBrush.GetStyle())) + { + int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH; + gdk_gc_set_stipple( m_bgGC, hatches[num] ); + }; +}; + void wxPaintDC::SetLogicalFunction( int function ) { if (m_logicalFunction == function) return; @@ -693,6 +733,14 @@ void wxPaintDC::SetTextBackground( const wxColour &col ) void wxPaintDC::SetBackgroundMode( int mode ) { m_backgroundMode = mode; + + // CMB 21/7/98: fill style of cross-hatch brushes is affected by + // transparent/solid background mode + if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT) + { + gdk_gc_set_fill( m_brushGC, + (m_backgroundMode == wxTRANSPARENT) ? GDK_STIPPLED : GDK_OPAQUE_STIPPLED); + } }; void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) ) diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index bd1ea693e2..2371b4c5ce 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -77,7 +77,9 @@ wxFrame::wxFrame() m_doingOnSize = FALSE; m_frameMenuBar = NULL; m_frameStatusBar = NULL; + m_frameToolBar = NULL; m_sizeSet = FALSE; + m_addPrivateChild = FALSE; wxTopLevelWindows.Insert( this ); }; @@ -85,7 +87,12 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { + m_doingOnSize = FALSE; + m_frameMenuBar = NULL; + m_frameStatusBar = NULL; + m_frameToolBar = NULL; m_sizeSet = FALSE; + m_addPrivateChild = FALSE; Create( parent, id, title, pos, size, style, name ); wxTopLevelWindows.Insert( this ); }; @@ -131,9 +138,6 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, gtk_container_add( GTK_CONTAINER(m_mainWindow), m_wxwindow ); - m_frameMenuBar = NULL; - m_frameStatusBar = NULL; - gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this ); @@ -195,6 +199,12 @@ void wxFrame::GetClientSize( int *width, int *height ) const { if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT; if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT; + if (m_frameToolBar) + { + int y = 0; + m_frameToolBar->GetSize( NULL, &y ); + (*height) -= y; + } }; }; @@ -236,6 +246,12 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height ) main_height -= wxMENU_HEIGHT; }; + int toolbar_height = 0; + if (m_frameToolBar) m_frameToolBar->GetSize( NULL, &toolbar_height ); + + main_y += toolbar_height; + main_height -= toolbar_height; + gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y ); gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height ); @@ -245,6 +261,12 @@ void wxFrame::GtkOnSize( int x, int y, int width, int height ) gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 ); }; + if (m_frameToolBar) + { + gtk_widget_set_uposition( m_frameToolBar->m_widget, 1, wxMENU_HEIGHT ); + gtk_widget_set_usize( m_frameToolBar->m_widget, width-2, toolbar_height ); + }; + if (m_frameStatusBar) { m_frameStatusBar->SetSize( 0, main_height-wxSTATUS_HEIGHT, width, wxSTATUS_HEIGHT ); @@ -265,7 +287,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) // no child: go out ! if (!GetChildren()->First()) return; - + // do we have exactly one child? wxWindow *child = NULL; for(wxNode *node = GetChildren()->First(); node; node = node->Next()) @@ -273,8 +295,9 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) wxWindow *win = (wxWindow *)node->Data(); if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog)) -#if 0 // not in m_children anyway +#if 0 // not in m_children anyway && (win != m_frameMenuBar) && + (win != m_frameToolBar) && (win != m_frameStatusBar) #endif ) @@ -293,6 +316,25 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) } }; +void wxFrame::AddChild( wxWindow *child ) +{ + if (m_addPrivateChild) + { + gtk_myfixed_put( GTK_MYFIXED(m_mainWindow), child->m_widget, child->m_x, child->m_y ); + + gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height ); + } + else + { + m_children.Append( child ); + + if (m_wxwindow) + gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); + + gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height ); + } +}; + static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) { menu->SetInvokingWindow( win ); @@ -329,6 +371,27 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar ) } }; +wxMenuBar *wxFrame::GetMenuBar(void) +{ + return m_frameMenuBar; +}; + +wxToolBar *wxFrame::CreateToolBar( int style, int WXUNUSED(orientation), int WXUNUSED(rowsOrColumns) ) +{ + m_addPrivateChild = TRUE; + + m_frameToolBar = new wxToolBar( this, -1, wxDefaultPosition, wxDefaultSize, style ); + + m_addPrivateChild = FALSE; + + return m_frameToolBar; +}; + +wxToolBar *wxFrame::GetToolBar(void) +{ + return m_frameToolBar; +}; + bool wxFrame::CreateStatusBar( int number ) { if (m_frameStatusBar) @@ -350,25 +413,20 @@ void wxFrame::SetStatusWidths( int n, int *width ) if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width ); }; -wxStatusBar *wxFrame::GetStatusBar() +wxStatusBar *wxFrame::GetStatusBar(void) { return m_frameStatusBar; }; -wxMenuBar *wxFrame::GetMenuBar() -{ - return m_frameMenuBar; -}; - void wxFrame::SetTitle( const wxString &title ) { m_title = title; gtk_window_set_title( GTK_WINDOW(m_widget), title ); }; -void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int incW) +void wxFrame::SetSizeHints(int minW, int minH, int maxW, int maxH, int WXUNUSED(incW) ) { - // VZ: I don't know a way to set the max size for the window in GTK and have - // no idea about what incW might be - gtk_widget_set_usize(m_widget, minW, minH); + if (m_wxwindow) + gdk_window_set_hints( m_wxwindow->window, -1, -1, + minW, minH, maxW, maxH, GDK_HINT_MIN_SIZE | GDK_HINT_MIN_SIZE ); } diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 69a709e439..fead398b88 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -69,7 +69,6 @@ wxMDIParentFrame::wxMDIParentFrame(void) m_clientWindow = NULL; m_currentChild = NULL; m_parentFrameActive = TRUE; - m_toolBar = NULL; }; wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, @@ -80,7 +79,6 @@ wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent, m_clientWindow = NULL; m_currentChild = NULL; m_parentFrameActive = TRUE; - m_toolBar = NULL; Create( parent, id, title, pos, size, style, name ); }; @@ -132,16 +130,6 @@ void wxMDIParentFrame::GetClientSize(int *width, int *height ) const wxFrame::GetClientSize( width, height ); }; -void wxMDIParentFrame::SetToolBar( wxToolBar *toolbar ) -{ - m_toolBar = toolbar; -}; - -wxWindow *wxMDIParentFrame::GetToolBar(void) const -{ - return m_toolBar; -}; - wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const { return m_currentChild; @@ -250,7 +238,8 @@ static void SetInvokingWindow( wxMenu *menu, wxWindow *win ) while (node) { wxMenuItem *menuitem = (wxMenuItem*)node->Data(); - if (menuitem->GetSubMenu()) SetInvokingWindow( menuitem->GetSubMenu(), win ); + if (menuitem->IsSubMenu()) + SetInvokingWindow( menuitem->GetSubMenu(), win ); node = node->Next(); }; }; @@ -346,7 +335,7 @@ void wxMDIClientWindow::AddChild( wxWindow *child ) gtk_signal_connect( GTK_OBJECT(child->m_widget), "size_allocate", GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)child ); - + gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget ); mdi_child->m_page = (GtkNotebookPage*) (g_list_last(GTK_NOTEBOOK(m_widget)->children)->data); diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index ebf329df11..abdf6ec1a8 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -106,9 +106,17 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) { + wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex ); + event.SetEventObject( this ); + event.SetInt( toolIndex ); + event.SetExtraLong( (long) toggleDown); + +/* wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex); event.SetEventObject(this); + event.SetInt( toolIndex ); event.SetExtraLong((long) toggleDown); +*/ GetEventHandler()->ProcessEvent(event); @@ -117,8 +125,9 @@ bool wxToolBar::OnLeftClick( int toolIndex, bool toggleDown ) void wxToolBar::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) ) { - wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex); - event.SetEventObject(this); + wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, toolIndex ); + event.SetEventObject( this ); + event.SetInt( toolIndex ); GetEventHandler()->ProcessEvent(event); }; @@ -127,6 +136,7 @@ void wxToolBar::OnMouseEnter( int toolIndex ) { wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex); event.SetEventObject(this); + event.SetInt( toolIndex ); GetEventHandler()->ProcessEvent(event); }; @@ -169,6 +179,29 @@ void wxToolBar::ClearTools(void) { }; +void wxToolBar::Layout(void) +{ + m_x = 0; + m_y = 0; + m_width = 100; + m_height = 0; + + wxNode *node = m_tools.First(); + while (node) + { + wxToolBarTool *tool = (wxToolBarTool*)node->Data(); + if (tool->m_bitmap1.Ok()) + { + int tool_height = tool->m_bitmap1.GetHeight(); + if (tool_height > m_height) m_height = tool_height; + }; + + node = node->Next(); + }; + + m_height += 10; +}; + void wxToolBar::EnableTool(int toolIndex, bool enable) { }; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 59c3d33980..12f7e7203c 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -308,7 +308,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) ) { }; -int wxTextCtrl::overflow(int c) +int wxTextCtrl::overflow( int WXUNUSED(c) ) { int len = pptr() - pbase(); char *txt = new char[len+1]; diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 37023c65c9..9e1c673e78 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1417,7 +1417,6 @@ void wxWindow::SetFocus(void) bool wxWindow::OnClose(void) { - printf( "OnClose event.\n" ); return TRUE; }; @@ -1431,6 +1430,21 @@ void wxWindow::AddChild( wxWindow *child ) // for wxFrame, wxDialog, wxWindow and // wxMDIParentFrame. + // wxFrame and wxDialog as children aren't placed into the parents + + if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog))) + { + m_children.Append( child ); + + if ((child->m_x != -1) && (child->m_y != -1)) + gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y ); + + return; + } + + // In the case of an wxMDIChildFrame descendant, we use the + // client windows's AddChild() + if (IsKindOf(CLASSINFO(wxMDIParentFrame))) { if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) @@ -1440,30 +1454,32 @@ void wxWindow::AddChild( wxWindow *child ) { client->AddChild( child ); return; - }; - }; - }; + } + } + } - // wxNotebooks are very special, so they have their own AddChild + // wxNotebook is very special, so it has a private AddChild() if (IsKindOf(CLASSINFO(wxNotebook))) { wxNotebook *tab = (wxNotebook*)this; tab->AddChild( child ); return; - }; + } - m_children.Append( child ); - if (child->IsKindOf(CLASSINFO(wxFrame)) || child->IsKindOf(CLASSINFO(wxDialog))) + // wxFrame has a private AddChild + + if (IsKindOf(CLASSINFO(wxFrame))) { - if ((child->m_x != -1) && (child->m_y != -1)) - gtk_widget_set_uposition( child->m_widget, child->m_x, child->m_y ); + wxFrame *frame = (wxFrame*)this; + frame->AddChild( child ); + return; } - else - { - if (m_wxwindow) - gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); - }; + + // All the rest + + m_children.Append( child ); + if (m_wxwindow) gtk_myfixed_put( GTK_MYFIXED(m_wxwindow), child->m_widget, child->m_x, child->m_y ); gtk_widget_set_usize( child->m_widget, child->m_width, child->m_height ); }; diff --git a/src/iodbc/config.h b/src/iodbc/config.h index da47f8c399..7883fb87be 100644 --- a/src/iodbc/config.h +++ b/src/iodbc/config.h @@ -1,7 +1,9 @@ #ifndef _LINUX_CONFIG_H #define _LINUX_CONFIG_H +#ifdef __LINUX__ #include +#endif /* * Defines for what uname() should return diff --git a/user/wxFile/wxFile.cpp b/user/wxFile/wxFile.cpp index 63703f2ae5..c37f33a305 100644 --- a/user/wxFile/wxFile.cpp +++ b/user/wxFile/wxFile.cpp @@ -79,24 +79,16 @@ const ID_MD = 502; IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame ) BEGIN_EVENT_TABLE(MyFrame,wxFrame) - EVT_SIZE (MyFrame::OnSize) EVT_MENU (ID_ABOUT, MyFrame::OnAbout) - EVT_TOOL (ID_ABOUT, MyFrame::OnAbout) EVT_MENU (ID_QUIT, MyFrame::OnCommand) - EVT_TOOL (ID_QUIT, MyFrame::OnCommand) EVT_MENU (ID_HOME, MyFrame::OnCommand) - EVT_TOOL (ID_HOME, MyFrame::OnCommand) EVT_MENU (ID_PARENT, MyFrame::OnCommand) - EVT_TOOL (ID_PARENT, MyFrame::OnCommand) EVT_MENU (ID_LIST, MyFrame::OnView) EVT_MENU (ID_REPORT, MyFrame::OnView) EVT_MENU (ID_ICON, MyFrame::OnView) - EVT_TOOL (ID_LIST, MyFrame::OnView) - EVT_TOOL (ID_REPORT, MyFrame::OnView) - EVT_TOOL (ID_ICON, MyFrame::OnView) - EVT_TOOL (ID_TREE, MyFrame::OnView) - EVT_TOOL (ID_SINGLE, MyFrame::OnView) - EVT_TOOL (ID_COMMANDER, MyFrame::OnView) + EVT_MENU (ID_TREE, MyFrame::OnView) + EVT_MENU (ID_SINGLE, MyFrame::OnView) + EVT_MENU (ID_COMMANDER, MyFrame::OnView) EVT_LIST_KEY_DOWN (ID_FILECTRL, MyFrame::OnListKeyDown) EVT_LIST_DELETE_ITEM (ID_FILECTRL, MyFrame::OnListDeleteItem) EVT_LIST_END_LABEL_EDIT (ID_FILECTRL, MyFrame::OnListEndLabelEdit) @@ -129,56 +121,32 @@ MyFrame::MyFrame(void) : SetStatusText( "Welcome", 0 ); SetStatusText( "wxFile v0.2 by Robert Roebling.", 1 ); - m_tb = new wxToolBar( this, ID_TOOLBAR, wxPoint(2,60), wxSize(300-4,26) ); + wxToolBar *m_tb = CreateToolBar( ID_TOOLBAR ); m_tb->SetMargins( 2, 2 ); - wxBitmap *bm; m_tb->AddSeparator(); - - bm = new wxBitmap( exit_xpm ); - m_tb->AddTool( ID_QUIT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Exit wxFile" ); + m_tb->AddTool( ID_QUIT, wxBitmap( exit_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Exit wxFile" ); m_tb->AddSeparator(); - - bm = new wxBitmap( prev_xpm ); - m_tb->AddTool( ID_PARENT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Go to parent directory" ); - bm = new wxBitmap( home_xpm ); - m_tb->AddTool( ID_HOME, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Go to home directory" ); + m_tb->AddTool( ID_PARENT, wxBitmap( prev_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Go to parent directory" ); + m_tb->AddTool( ID_HOME, wxBitmap( home_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Go to home directory" ); m_tb->AddSeparator(); - - bm = new wxBitmap( delete_xpm ); - m_tb->AddTool( ID_DELETE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Delete file" ); + m_tb->AddTool( ID_DELETE, wxBitmap( delete_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Delete file" ); m_tb->AddSeparator(); - - bm = new wxBitmap( fileopen_xpm ); - m_tb->AddTool( ID_MD, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Create directory" ); + m_tb->AddTool( ID_MD, wxBitmap( fileopen_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Create directory" ); m_tb->AddSeparator(); - - bm = new wxBitmap( listview_xpm ); - m_tb->AddTool( ID_LIST, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "List view" ); - bm = new wxBitmap( reportview_xpm ); - m_tb->AddTool( ID_REPORT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Report view" ); - bm = new wxBitmap( iconview_xpm ); - m_tb->AddTool( ID_ICON, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Icon view" ); + m_tb->AddTool( ID_LIST, wxBitmap( listview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "List view" ); + m_tb->AddTool( ID_REPORT, wxBitmap( reportview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Report view" ); + m_tb->AddTool( ID_ICON, wxBitmap( iconview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Icon view" ); m_tb->AddSeparator(); - - bm = new wxBitmap( treeview_xpm ); - m_tb->AddTool( ID_TREE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Tree view" ); - bm = new wxBitmap( commanderview_xpm ); - m_tb->AddTool( ID_COMMANDER, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Commander view" ); - bm = new wxBitmap( singleview_xpm ); - m_tb->AddTool( ID_SINGLE, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Single view" ); + m_tb->AddTool( ID_TREE, wxBitmap( treeview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Tree view" ); + m_tb->AddTool( ID_COMMANDER, wxBitmap( commanderview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Commander view" ); + m_tb->AddTool( ID_SINGLE, wxBitmap( singleview_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Single view" ); m_tb->AddSeparator(); - - bm = new wxBitmap( search_xpm ); - m_tb->AddTool( ID_MOUNT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Mount devices" ); + m_tb->AddTool( ID_MOUNT, wxBitmap( search_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Mount devices" ); m_tb->AddSeparator(); - - bm = new wxBitmap( save_xpm ); - m_tb->AddTool( ID_SEARCH, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "Find file(s)" ); + m_tb->AddTool( ID_SEARCH, wxBitmap( save_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "Find file(s)" ); m_tb->AddSeparator(); - - bm = new wxBitmap( help_xpm ); - m_tb->AddTool( ID_ABOUT, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" ); + m_tb->AddTool( ID_ABOUT, wxBitmap( help_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "About wxFile" ); m_tb->Layout(); @@ -205,16 +173,6 @@ MyFrame::MyFrame(void) : m_splitter->SetMinimumPaneSize( 10 ); }; -void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) -{ - int x = 0; - int y = 0; - GetClientSize( &x, &y ); - - m_tb->SetSize( 1, 0, x-2, 30 ); - m_splitter->SetSize( 0, 31, x, y-31 ); -}; - void MyFrame::OnView( wxCommandEvent &event ) { int x = 0; diff --git a/user/wxFile/wxFile.h b/user/wxFile/wxFile.h index 93b5ef3291..ee5d3ac884 100644 --- a/user/wxFile/wxFile.h +++ b/user/wxFile/wxFile.h @@ -52,7 +52,6 @@ class MyFrame: public wxFrame public: MyFrame(void); - void OnSize( wxSizeEvent &event ); void OnCommand( wxCommandEvent &event ); void OnAbout( wxCommandEvent &event ); void OnView( wxCommandEvent &event ); diff --git a/user/wxLayout/wxLayout.cpp b/user/wxLayout/wxLayout.cpp index 41e3392c61..925cba8edb 100644 --- a/user/wxLayout/wxLayout.cpp +++ b/user/wxLayout/wxLayout.cpp @@ -39,7 +39,7 @@ IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame ) BEGIN_EVENT_TABLE(MyFrame,wxFrame) EVT_MENU (-1, MyFrame::OnCommand) EVT_COMMAND (-1,-1, MyFrame::OnCommand) - EVT_CHAR (wxLayoutWindow::OnChar) + EVT_CHAR ( wxLayoutWindow::OnChar ) END_EVENT_TABLE() MyFrame::MyFrame(void) : diff --git a/user/wxLayout/wxllist.cpp b/user/wxLayout/wxllist.cpp index 92e91f8e94..eae1b75cc4 100644 --- a/user/wxLayout/wxllist.cpp +++ b/user/wxLayout/wxllist.cpp @@ -23,7 +23,7 @@ #endif #include "wxllist.h" -#include "iostream" +#include "iostream.h" #include #include diff --git a/user/wxLayout/wxlwindow.h b/user/wxLayout/wxlwindow.h index fea528ac79..86a487fc64 100644 --- a/user/wxLayout/wxlwindow.h +++ b/user/wxLayout/wxlwindow.h @@ -25,8 +25,8 @@ public: //virtual void OnDraw(wxDC &dc); void OnPaint(wxPaintEvent &WXUNUSED(event)); - virtual void OnMouse(wxMouseEvent& event); - virtual void OnChar(wxKeyEvent& event); + /*virtual*/ void OnMouse(wxMouseEvent& event); + /*virtual*/ void OnChar(wxKeyEvent& event); void UpdateScrollbars(void); void Print(void); void Erase(void) diff --git a/user/wxTest/wxTest.cpp b/user/wxTest/wxTest.cpp index f035649154..837fae3510 100644 --- a/user/wxTest/wxTest.cpp +++ b/user/wxTest/wxTest.cpp @@ -470,16 +470,11 @@ MyFrame::MyFrame(void) : m_canvas = new MyCanvas( this, -1, wxPoint(2,62), wxSize(300-4,120-4) ); m_canvas->SetScrollbars( 10, 10, 50, 50 ); - m_tb = new wxToolBar( this, -1, wxPoint(2,60), wxSize(300-4,26) ); + m_tb = CreateToolBar(); m_tb->SetMargins( 2, 2 ); - - wxBitmap *bm = new wxBitmap( list_xpm ); - m_tb->AddTool( 0, *bm, wxNullBitmap, FALSE, -1, -1, NULL, "This is a button" ); - bm = new wxBitmap( folder_xpm ); - m_tb->AddTool( 0, *bm, wxNullBitmap, TRUE, -1, -1, NULL, "This is a toggle" ); - + m_tb->AddTool( 0, wxBitmap( list_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "This is a button" ); + m_tb->AddTool( 0, wxBitmap( folder_xpm ), wxNullBitmap, TRUE, -1, -1, NULL, "This is a toggle" ); m_tb->Layout(); - m_tb->Show( TRUE ); // m_timer.Start( 1000, TRUE ); }; -- 2.45.2