From 58614078c466cffaf0e5d0369741706f130fb793 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 29 Oct 1998 18:03:18 +0000 Subject: [PATCH] Big color update with the newest information from the GTK+ hot-line, eh mail-list. The news is that they don't know what they do. Conversion from 12pt, wxSWISS, wxNORMAL, wxNORMAL to GTK+ system font Probably some other things git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 4 +-- configure.in | 4 +-- docs/gtk/install.txt | 58 ++++++++++++++++++------------ docs/gtk/todo.txt | 6 ---- include/wx/generic/panelg.h | 2 +- include/wx/gtk/bmpbuttn.h | 4 +++ include/wx/gtk/button.h | 8 +++-- include/wx/gtk/checkbox.h | 7 ++-- include/wx/gtk/choice.h | 6 ++-- include/wx/gtk/combobox.h | 12 +++---- include/wx/gtk/dialog.h | 4 +-- include/wx/gtk/dnd.h | 2 +- include/wx/gtk/filedlg.h | 5 ++- include/wx/gtk/font.h | 3 +- include/wx/gtk/frame.h | 10 +++--- include/wx/gtk/gauge.h | 13 +++---- include/wx/gtk/gdiobj.h | 5 ++- include/wx/gtk/icon.h | 5 ++- include/wx/gtk/listbox.h | 10 ++---- include/wx/gtk/mdi.h | 7 ++-- include/wx/gtk/menu.h | 5 ++- include/wx/gtk/notebook.h | 13 ++++--- include/wx/gtk/pen.h | 5 ++- include/wx/gtk/radiobox.h | 8 ++--- include/wx/gtk/radiobut.h | 6 ++-- include/wx/gtk/region.h | 5 ++- include/wx/gtk/scrolbar.h | 9 ++--- include/wx/gtk/settings.h | 5 ++- include/wx/gtk/slider.h | 7 ++-- include/wx/gtk/statbmp.h | 7 ++-- include/wx/gtk/statbox.h | 9 +++-- include/wx/gtk/stattext.h | 9 +++-- include/wx/gtk/tbargtk.h | 2 -- include/wx/gtk/textctrl.h | 4 ++- include/wx/gtk/timer.h | 5 ++- include/wx/gtk/win_gtk.h | 5 ++- include/wx/gtk/window.h | 9 ++--- include/wx/gtk1/bmpbuttn.h | 4 +++ include/wx/gtk1/button.h | 8 +++-- include/wx/gtk1/checkbox.h | 7 ++-- include/wx/gtk1/choice.h | 6 ++-- include/wx/gtk1/combobox.h | 12 +++---- include/wx/gtk1/dialog.h | 4 +-- include/wx/gtk1/dnd.h | 2 +- include/wx/gtk1/filedlg.h | 5 ++- include/wx/gtk1/font.h | 3 +- include/wx/gtk1/frame.h | 10 +++--- include/wx/gtk1/gauge.h | 13 +++---- include/wx/gtk1/gdiobj.h | 5 ++- include/wx/gtk1/icon.h | 5 ++- include/wx/gtk1/listbox.h | 10 ++---- include/wx/gtk1/mdi.h | 7 ++-- include/wx/gtk1/menu.h | 5 ++- include/wx/gtk1/notebook.h | 13 ++++--- include/wx/gtk1/pen.h | 5 ++- include/wx/gtk1/radiobox.h | 8 ++--- include/wx/gtk1/radiobut.h | 6 ++-- include/wx/gtk1/region.h | 5 ++- include/wx/gtk1/scrolbar.h | 9 ++--- include/wx/gtk1/settings.h | 5 ++- include/wx/gtk1/slider.h | 7 ++-- include/wx/gtk1/statbmp.h | 7 ++-- include/wx/gtk1/statbox.h | 9 +++-- include/wx/gtk1/stattext.h | 9 +++-- include/wx/gtk1/tbargtk.h | 2 -- include/wx/gtk1/textctrl.h | 4 ++- include/wx/gtk1/timer.h | 5 ++- include/wx/gtk1/win_gtk.h | 5 ++- include/wx/gtk1/window.h | 9 ++--- samples/controls/controls.cpp | 53 +++++++++++++++++---------- src/generic/panelg.cpp | 1 + src/gtk.inc | 3 +- src/gtk/bmpbuttn.cpp | 4 +++ src/gtk/button.cpp | 29 ++------------- src/gtk/checkbox.cpp | 19 +++------- src/gtk/choice.cpp | 55 +++++++++------------------- src/gtk/combobox.cpp | 45 +++++------------------ src/gtk/dialog.cpp | 2 -- src/gtk/font.cpp | 16 +++++++-- src/gtk/frame.cpp | 1 - src/gtk/gauge.cpp | 6 ++++ src/gtk/listbox.cpp | 31 +++------------- src/gtk/notebook.cpp | 18 ++-------- src/gtk/radiobox.cpp | 32 ++++------------- src/gtk/radiobut.cpp | 21 ++++------- src/gtk/scrolbar.cpp | 7 ++++ src/gtk/settings.cpp | 2 +- src/gtk/slider.cpp | 26 +++++--------- src/gtk/statbmp.cpp | 9 +++-- src/gtk/statbox.cpp | 10 ++++++ src/gtk/stattext.cpp | 10 ++++++ src/gtk/textctrl.cpp | 18 ++++++++-- src/gtk/window.cpp | 67 +++++++++++++++++++++-------------- src/gtk1/bmpbuttn.cpp | 4 +++ src/gtk1/button.cpp | 29 ++------------- src/gtk1/checkbox.cpp | 19 +++------- src/gtk1/choice.cpp | 55 +++++++++------------------- src/gtk1/combobox.cpp | 45 +++++------------------ src/gtk1/dialog.cpp | 2 -- src/gtk1/font.cpp | 16 +++++++-- src/gtk1/frame.cpp | 1 - src/gtk1/gauge.cpp | 6 ++++ src/gtk1/listbox.cpp | 31 +++------------- src/gtk1/notebook.cpp | 18 ++-------- src/gtk1/radiobox.cpp | 32 ++++------------- src/gtk1/radiobut.cpp | 21 ++++------- src/gtk1/scrolbar.cpp | 7 ++++ src/gtk1/settings.cpp | 2 +- src/gtk1/slider.cpp | 26 +++++--------- src/gtk1/statbmp.cpp | 9 +++-- src/gtk1/statbox.cpp | 10 ++++++ src/gtk1/stattext.cpp | 10 ++++++ src/gtk1/textctrl.cpp | 18 ++++++++-- src/gtk1/window.cpp | 67 +++++++++++++++++++++-------------- 114 files changed, 633 insertions(+), 782 deletions(-) diff --git a/configure b/configure index 93da230c0f..80bf2c2402 100755 --- a/configure +++ b/configure @@ -5977,7 +5977,7 @@ else echo "$ac_t""no" 1>&6 fi - min_gtk_version=0.99.7 + min_gtk_version=1.0.6 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 echo "configure:5983: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" @@ -6041,7 +6041,7 @@ fi echo "$ac_t""no" 1>&6 GTK_CFLAGS="" GTK_LIBS="" - { echo "configure: error: Are gtk-config and the GTK in path and up-to-date?" 1>&2; exit 1; } + { echo "configure: error: Is gtk-config in path and GTK+ is version 1.0.6?" 1>&2; exit 1; } fi diff --git a/configure.in b/configure.in index ce06d5a83a..21ba45a90e 100644 --- a/configure.in +++ b/configure.in @@ -1000,10 +1000,10 @@ GUI_TK_LINK= MAKEINCLUDE= if test "$wxUSE_GTK" = 1; then - AM_PATH_GTK(0.99.7, [ + AM_PATH_GTK(1.0.6, [ GUI_TK_INCLUDE="$GTK_CFLAGS" GUI_TK_LIBRARY="$GTK_LIBS" - ], AC_MSG_ERROR(Are gtk-config and the GTK in path and up-to-date?)) + ], AC_MSG_ERROR(Is gtk-config in path and GTK+ is version 1.0.6?)) TOOLKIT=GTK TOOLKIT_DEF=__WXGTK__ MAKEINCLUDE=../gtk.inc diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index c9886b3a9e..1038da9bdd 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -35,38 +35,50 @@ for newest information. ----------------------- wxWindows/GTK requires the GTK+ library to be installed on your system. -It has to be a stable version, preferebly version 1.0.6. +It has to be a stable version, preferebly version 1.0.6. When using +a version previous to 1.0.6 you'll get crashes here and there. This +is certain to happen with colors in native widgets. You can get the newest version of the GTK+ from the GTK homepage at http://www.gtk.org +We also mirror GTK+ 1.0.6 at our ftp site. You'll find information +about downloading at my homepage. + * Additional libraries ----------------------- -There will be a few more features of wxWindows, 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, unless - you have RedHat 5.0, which has a broken combination of - glibc 2 and X. In this case, you have to run configure - with "--without-threads". - - Requires PCthreads under Linux with libc 5. If you - haven't installed pcthreads, there will be no thread - support in wxWindows, but the library will compile. - - Requires Posix threads on commercial Unix system, - which are always present. Just compile. - - On SGI Irix we first look for sprocs, then pthreads and - use the last one found. +wxWindows/Gtk requires a thread library and X libraries +known to work with threads. This is the case on all +commercial Unix-Variants and all Linux-Versions that +are based on glibc 2 except RedHat 5.0 which is broken +in many aspects. As of writing this, these Linux +distributions have correct glibc 2 support: + + - RedHat 5.1 + - Debian 2.0 + - Stampede + +The next major version of SuSE will also support glibc 2, +but version 5.X does not. Also Caldera and Slackware +don't yet support glibc 2. + +On IRIX you can also use SGI threads if Posix-Threads +are not present. The SGI threads will be detected by +configure automatically. + +You can always disable thread support by running + +./configure "--without-threads" +make clean +make +NB: I included thread support in wxWindows/Gtk, as this +problem will disappear in the near future when all major +Linux Variants have moved to glibc 2. Also, the Linux +Base Standard will include glibc 2. + * Create your configuration ----------------------------- diff --git a/docs/gtk/todo.txt b/docs/gtk/todo.txt index 415cbcb0d4..998a2c254e 100644 --- a/docs/gtk/todo.txt +++ b/docs/gtk/todo.txt @@ -16,12 +16,6 @@ wxHelpController Fix printing of bitmaps -> No idea. -Add support SetForegroundColour in GTK widgets - -> On the way. - -wxBitmapCheckBox - -> Interface same as checkbox? - wxImage -> 24-bit support diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index b20133534f..701a0ca000 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -64,7 +64,7 @@ public: void OnSysColourChanged(wxSysColourChangedEvent& event); // Process a keyboard navigation message (Tab traversal) void OnNavigationKey(wxNavigationKeyEvent& event); - + protected: bool SetFocusToNextChild(wxNode *nodeCurrent = (wxNode *) NULL, bool bForward = TRUE); diff --git a/include/wx/gtk/bmpbuttn.h b/include/wx/gtk/bmpbuttn.h index 380642dc6a..bcb31a9e90 100644 --- a/include/wx/gtk/bmpbuttn.h +++ b/include/wx/gtk/bmpbuttn.h @@ -63,6 +63,10 @@ class wxBitmapButton: public wxControl virtual void SetBitmapLabel( const wxBitmap& bitmap ); wxBitmap& GetBitmapLabel(void) const { return (wxBitmap&) m_bitmap; } + // implementation + + void ApplyWidgetStyle(); + public: wxBitmap m_bitmap; diff --git a/include/wx/gtk/button.h b/include/wx/gtk/button.h index 0b1d34d52e..45f0c1b4ae 100644 --- a/include/wx/gtk/button.h +++ b/include/wx/gtk/button.h @@ -59,9 +59,11 @@ class wxButton: public wxControl void SetDefault(void); void SetLabel( const wxString &label ); void Enable( bool enable ); - void SetFont( const wxFont &font ); - void SetBackgroundColour( const wxColour &colour ); - void SetForegroundColour( const wxColour &colour ); + + // implementation + + void ApplyWidgetStyle(); + }; #endif // __GTKBUTTONH__ diff --git a/include/wx/gtk/checkbox.h b/include/wx/gtk/checkbox.h index a2f858b791..c410c2d728 100644 --- a/include/wx/gtk/checkbox.h +++ b/include/wx/gtk/checkbox.h @@ -60,9 +60,12 @@ class wxCheckBox: public wxControl bool GetValue() const; void SetLabel( const wxString& label ); - void SetFont( const wxFont &font ); void Enable( bool enable ); - void SetBackgroundColour( const wxColour &colour ); + + // implementation + + void ApplyWidgetStyle(); + }; #endif // __GTKCHECKBOXH__ diff --git a/include/wx/gtk/choice.h b/include/wx/gtk/choice.h index 70f5f4bd7e..92fb5f40a7 100644 --- a/include/wx/gtk/choice.h +++ b/include/wx/gtk/choice.h @@ -73,9 +73,9 @@ class wxChoice: public wxControl void SetSelection( int n ); void SetStringSelection( const wxString &string ); - void SetFont( const wxFont &font ); - void SetBackgroundColour( const wxColour &colour ); - + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKCHOICEH__ diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index 5b8046a4a5..faf0f3a8a8 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -93,20 +93,16 @@ class wxComboBox: public wxControl void SetSelection(long from, long to); void SetEditable(bool editable); - void SetFont( const wxFont &font ); void OnSize( wxSizeEvent &event ); - void SetBackgroundColour( const wxColour &colour ); // implementation - - bool m_alreadySent; - private: - + bool m_alreadySent; wxList m_clientData; - GtkWidget* GetConnectWidget(void); - bool IsOwnGtkWindow( GdkWindow *window ); + GtkWidget* GetConnectWidget(void); + bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk/dialog.h b/include/wx/gtk/dialog.h index 624b4f06ed..f838cbf3be 100644 --- a/include/wx/gtk/dialog.h +++ b/include/wx/gtk/dialog.h @@ -3,8 +3,8 @@ // Purpose: // Author: Robert Roebling // Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/dnd.h b/include/wx/gtk/dnd.h index 7f72906e47..34f15b2b40 100644 --- a/include/wx/gtk/dnd.h +++ b/include/wx/gtk/dnd.h @@ -2,7 +2,7 @@ // Name: dnd.h // Purpose: declaration of the wxDropTarget class // Author: Robert Roebling -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/filedlg.h b/include/wx/gtk/filedlg.h index dd4452794b..5035ba8bb7 100644 --- a/include/wx/gtk/filedlg.h +++ b/include/wx/gtk/filedlg.h @@ -2,9 +2,8 @@ // Name: filedlg.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/font.h b/include/wx/gtk/font.h index 70e82bedb8..bd34c91791 100644 --- a/include/wx/gtk/font.h +++ b/include/wx/gtk/font.h @@ -2,8 +2,7 @@ // Name: font.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index c9274982ac..af0fe7328a 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -2,9 +2,8 @@ // Name: frame.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -99,7 +98,10 @@ public: void OnCloseWindow( wxCloseEvent& event ); void OnIdle(wxIdleEvent& event); - virtual void AddChild( wxWindow *child ); + void AddChild( wxWindow *child ); + + // implementation + virtual void GtkOnSize( int x, int y, int width, int height ); private: diff --git a/include/wx/gtk/gauge.h b/include/wx/gtk/gauge.h index 51e9563b56..d6c546f706 100644 --- a/include/wx/gtk/gauge.h +++ b/include/wx/gtk/gauge.h @@ -2,9 +2,8 @@ // Name: gauge.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -72,9 +71,11 @@ class wxGauge: public wxControl // Are we a Win95/GTK progress bar, or a normal gauge? inline bool GetProgressBar(void) const { return m_useProgressBar; } - - protected: - + + // implementation + + void ApplyWidgetStyle(); + int m_rangeMax; int m_gaugePos; bool m_useProgressBar; diff --git a/include/wx/gtk/gdiobj.h b/include/wx/gtk/gdiobj.h index 2b6a5d1921..72069458e7 100644 --- a/include/wx/gtk/gdiobj.h +++ b/include/wx/gtk/gdiobj.h @@ -2,9 +2,8 @@ // Name: gdiobj.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/icon.h b/include/wx/gtk/icon.h index 7596879cd9..ee31769568 100644 --- a/include/wx/gtk/icon.h +++ b/include/wx/gtk/icon.h @@ -2,9 +2,8 @@ // Name: icon.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/listbox.h b/include/wx/gtk/listbox.h index 028422912d..ea621e0697 100644 --- a/include/wx/gtk/listbox.h +++ b/include/wx/gtk/listbox.h @@ -2,9 +2,8 @@ // Name: listbox.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -83,18 +82,15 @@ class wxListBox: public wxControl void SetString( int n, const wxString &string ); void SetStringSelection( const wxString &string, bool select = TRUE ); - void SetFont( const wxFont &font ); void SetDropTarget( wxDropTarget *dropTarget ); - virtual void SetBackgroundColour(const wxColour &colour); // implementation int GetIndex( GtkWidget *item ) const; GtkWidget *GetConnectWidget(void); bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); - private: - GtkList *m_list; wxList m_clientData; diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index 081cd5a407..2651f98366 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -2,9 +2,8 @@ // Name: mdi.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,7 +79,7 @@ class wxMDIParentFrame: public wxFrame void OnActivate( wxActivateEvent& event ); void OnSysColourChanged( wxSysColourChangedEvent& event ); - //private: + // implementation wxMDIChildFrame *m_currentChild; diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 9258a25e85..7060ea2dd0 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -2,9 +2,8 @@ // Name: menu.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/notebook.h b/include/wx/gtk/notebook.h index 92d011ac2b..ac362bcffe 100644 --- a/include/wx/gtk/notebook.h +++ b/include/wx/gtk/notebook.h @@ -138,13 +138,12 @@ public: wxWindow *GetPage(int nPage) const; // implementation - // -------------- - // base class virtuals - virtual void AddChild(wxWindow *child); - virtual void SetConstraintSizes(bool recurse); - virtual bool DoPhase(int phase); - virtual void SetFont( const wxFont &font ); - virtual void SetBackgroundColour( const wxColour &colour ); + + void AddChild(wxWindow *child); + void SetConstraintSizes(bool recurse); + bool DoPhase(int phase); + void ApplyWidgetStyle(); + private: // common part of all ctors diff --git a/include/wx/gtk/pen.h b/include/wx/gtk/pen.h index 0649fe2473..10ccf5e962 100644 --- a/include/wx/gtk/pen.h +++ b/include/wx/gtk/pen.h @@ -2,9 +2,8 @@ // Name: pen.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index e30d8f00a1..e3984613ee 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -2,9 +2,8 @@ // Name: radiobox.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,13 +79,12 @@ class wxRadioBox: public wxControl int GetNumberOfRowsOrCols(void) const; void SetNumberOfRowsOrCols( int n ); - void SetFont( const wxFont &font ); - void SetBackgroundColour( const wxColour &colour ); void OnSize( wxSizeEvent &event ); // implementation bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); bool m_alreadySent; wxList m_boxes; diff --git a/include/wx/gtk/radiobut.h b/include/wx/gtk/radiobut.h index 72907e0f72..1bf88485a8 100644 --- a/include/wx/gtk/radiobut.h +++ b/include/wx/gtk/radiobut.h @@ -60,9 +60,11 @@ class wxRadioButton: public wxControl virtual void SetLabel(const wxString& label); virtual void SetValue(bool val); virtual bool GetValue(void) const; - void SetFont( const wxFont &font ); void Enable( bool enable ); - void SetBackgroundColour( const wxColour &colour ); + + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKRADIOBUTTONH__ diff --git a/include/wx/gtk/region.h b/include/wx/gtk/region.h index 35e146938c..9ba3f50125 100644 --- a/include/wx/gtk/region.h +++ b/include/wx/gtk/region.h @@ -2,9 +2,8 @@ // Name: region.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/scrolbar.h b/include/wx/gtk/scrolbar.h index f4a50694d0..5bb14787bf 100644 --- a/include/wx/gtk/scrolbar.h +++ b/include/wx/gtk/scrolbar.h @@ -2,9 +2,8 @@ // Name: scrolbar.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -67,7 +66,8 @@ class wxScrollBar: public wxControl virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, bool refresh = TRUE ); - // Backward compatibility + // Backward compatibility + int GetValue(void) const; void SetValue( int viewStart ); void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const; @@ -80,6 +80,7 @@ class wxScrollBar: public wxControl // implementation bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); GtkAdjustment *m_adjust; float m_oldPos; diff --git a/include/wx/gtk/settings.h b/include/wx/gtk/settings.h index b446e86b1f..2774b17709 100644 --- a/include/wx/gtk/settings.h +++ b/include/wx/gtk/settings.h @@ -2,9 +2,8 @@ // Name: settings.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/slider.h b/include/wx/gtk/slider.h index f683919642..cb7e567c0f 100644 --- a/include/wx/gtk/slider.h +++ b/include/wx/gtk/slider.h @@ -2,8 +2,7 @@ // Name: slider.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -63,9 +62,6 @@ class wxSlider: public wxControl const wxString& name = wxSliderNameStr ); virtual int GetValue(void) const; virtual void SetValue( int ); - void GetSize( int *x, int *y ) const; - void SetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); - void GetPosition( int *x, int *y ) const; void SetRange( int minValue, int maxValue ); int GetMin(void) const; int GetMax(void) const; @@ -87,6 +83,7 @@ class wxSlider: public wxControl // implementation bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); GtkAdjustment *m_adjust; float m_oldPos; diff --git a/include/wx/gtk/statbmp.h b/include/wx/gtk/statbmp.h index b534110b1d..1bddd276b2 100644 --- a/include/wx/gtk/statbmp.h +++ b/include/wx/gtk/statbmp.h @@ -2,9 +2,8 @@ // Name: statbmp.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -51,7 +50,7 @@ class wxStaticBitmap: public wxControl long style = 0, const wxString& name = wxStaticBitmapNameStr); virtual void SetBitmap( const wxBitmap& bitmap ); wxBitmap& GetBitmap(void) const { return (wxBitmap&)m_bitmap; } - + private: wxBitmap m_bitmap; diff --git a/include/wx/gtk/statbox.h b/include/wx/gtk/statbox.h index d6c8314bc0..7d827c0d4b 100644 --- a/include/wx/gtk/statbox.h +++ b/include/wx/gtk/statbox.h @@ -2,9 +2,8 @@ // Name: stabox.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -51,6 +50,10 @@ class wxStaticBox: public wxControl const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0, const wxString &name = wxStaticBoxNameStr ); void SetLabel( const wxString &label ); + + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKSTATICBOXH__ diff --git a/include/wx/gtk/stattext.h b/include/wx/gtk/stattext.h index e60303c890..1febeb3139 100644 --- a/include/wx/gtk/stattext.h +++ b/include/wx/gtk/stattext.h @@ -2,9 +2,8 @@ // Name: stattext.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -52,6 +51,10 @@ class wxStaticText: public wxControl long style = 0, const wxString &name = wxStaticTextNameStr ); wxString GetLabel(void) const; void SetLabel( const wxString &label ); + + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKSTATICTEXTH__ diff --git a/include/wx/gtk/tbargtk.h b/include/wx/gtk/tbargtk.h index 93f6e7bafc..ac40522343 100644 --- a/include/wx/gtk/tbargtk.h +++ b/include/wx/gtk/tbargtk.h @@ -2,8 +2,6 @@ // Name: tbargtk.h // Purpose: GTK toolbar // Author: Robert Roebling -// Modified by: -// Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling // Licence: wxWindows licence diff --git a/include/wx/gtk/textctrl.h b/include/wx/gtk/textctrl.h index 525b11808f..eb7fe290ff 100644 --- a/include/wx/gtk/textctrl.h +++ b/include/wx/gtk/textctrl.h @@ -101,12 +101,14 @@ class wxTextCtrl: public wxControl, public streambuf wxTextCtrl& operator<<(const char c); void SetFont( const wxFont &font ); - virtual void SetBackgroundColour(const wxColour &colour); + void SetForegroundColour(const wxColour &colour); + void SetBackgroundColour(const wxColour &colour); // implementation GtkWidget* GetConnectWidget(void); bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); private: diff --git a/include/wx/gtk/timer.h b/include/wx/gtk/timer.h index 9a1abc11c2..80e302758b 100644 --- a/include/wx/gtk/timer.h +++ b/include/wx/gtk/timer.h @@ -2,9 +2,8 @@ // Name: timer.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk/win_gtk.h b/include/wx/gtk/win_gtk.h index d42e89bebe..16acb8d305 100644 --- a/include/wx/gtk/win_gtk.h +++ b/include/wx/gtk/win_gtk.h @@ -2,9 +2,8 @@ // Name: win_gtk.h // Purpose: wxWindows's GTK base widget // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////// */ diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 20c067a48c..9766527a36 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -2,9 +2,8 @@ // Name: window.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -243,7 +242,9 @@ public: bool HasVMT(); virtual void ImplementSetSize(); virtual void ImplementSetPosition(); - GtkStyle *GetWidgetStyle(); + GtkStyle *GetWidgetStyle(); + void SetWidgetStyle(); + virtual void ApplyWidgetStyle(); wxWindow *m_parent; wxList m_children; diff --git a/include/wx/gtk1/bmpbuttn.h b/include/wx/gtk1/bmpbuttn.h index 380642dc6a..bcb31a9e90 100644 --- a/include/wx/gtk1/bmpbuttn.h +++ b/include/wx/gtk1/bmpbuttn.h @@ -63,6 +63,10 @@ class wxBitmapButton: public wxControl virtual void SetBitmapLabel( const wxBitmap& bitmap ); wxBitmap& GetBitmapLabel(void) const { return (wxBitmap&) m_bitmap; } + // implementation + + void ApplyWidgetStyle(); + public: wxBitmap m_bitmap; diff --git a/include/wx/gtk1/button.h b/include/wx/gtk1/button.h index 0b1d34d52e..45f0c1b4ae 100644 --- a/include/wx/gtk1/button.h +++ b/include/wx/gtk1/button.h @@ -59,9 +59,11 @@ class wxButton: public wxControl void SetDefault(void); void SetLabel( const wxString &label ); void Enable( bool enable ); - void SetFont( const wxFont &font ); - void SetBackgroundColour( const wxColour &colour ); - void SetForegroundColour( const wxColour &colour ); + + // implementation + + void ApplyWidgetStyle(); + }; #endif // __GTKBUTTONH__ diff --git a/include/wx/gtk1/checkbox.h b/include/wx/gtk1/checkbox.h index a2f858b791..c410c2d728 100644 --- a/include/wx/gtk1/checkbox.h +++ b/include/wx/gtk1/checkbox.h @@ -60,9 +60,12 @@ class wxCheckBox: public wxControl bool GetValue() const; void SetLabel( const wxString& label ); - void SetFont( const wxFont &font ); void Enable( bool enable ); - void SetBackgroundColour( const wxColour &colour ); + + // implementation + + void ApplyWidgetStyle(); + }; #endif // __GTKCHECKBOXH__ diff --git a/include/wx/gtk1/choice.h b/include/wx/gtk1/choice.h index 70f5f4bd7e..92fb5f40a7 100644 --- a/include/wx/gtk1/choice.h +++ b/include/wx/gtk1/choice.h @@ -73,9 +73,9 @@ class wxChoice: public wxControl void SetSelection( int n ); void SetStringSelection( const wxString &string ); - void SetFont( const wxFont &font ); - void SetBackgroundColour( const wxColour &colour ); - + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKCHOICEH__ diff --git a/include/wx/gtk1/combobox.h b/include/wx/gtk1/combobox.h index 5b8046a4a5..faf0f3a8a8 100644 --- a/include/wx/gtk1/combobox.h +++ b/include/wx/gtk1/combobox.h @@ -93,20 +93,16 @@ class wxComboBox: public wxControl void SetSelection(long from, long to); void SetEditable(bool editable); - void SetFont( const wxFont &font ); void OnSize( wxSizeEvent &event ); - void SetBackgroundColour( const wxColour &colour ); // implementation - - bool m_alreadySent; - private: - + bool m_alreadySent; wxList m_clientData; - GtkWidget* GetConnectWidget(void); - bool IsOwnGtkWindow( GdkWindow *window ); + GtkWidget* GetConnectWidget(void); + bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); DECLARE_EVENT_TABLE() }; diff --git a/include/wx/gtk1/dialog.h b/include/wx/gtk1/dialog.h index 624b4f06ed..f838cbf3be 100644 --- a/include/wx/gtk1/dialog.h +++ b/include/wx/gtk1/dialog.h @@ -3,8 +3,8 @@ // Purpose: // Author: Robert Roebling // Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/dnd.h b/include/wx/gtk1/dnd.h index 7f72906e47..34f15b2b40 100644 --- a/include/wx/gtk1/dnd.h +++ b/include/wx/gtk1/dnd.h @@ -2,7 +2,7 @@ // Name: dnd.h // Purpose: declaration of the wxDropTarget class // Author: Robert Roebling -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling // Licence: wxWindows license /////////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/filedlg.h b/include/wx/gtk1/filedlg.h index dd4452794b..5035ba8bb7 100644 --- a/include/wx/gtk1/filedlg.h +++ b/include/wx/gtk1/filedlg.h @@ -2,9 +2,8 @@ // Name: filedlg.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/font.h b/include/wx/gtk1/font.h index 70e82bedb8..bd34c91791 100644 --- a/include/wx/gtk1/font.h +++ b/include/wx/gtk1/font.h @@ -2,8 +2,7 @@ // Name: font.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/frame.h b/include/wx/gtk1/frame.h index c9274982ac..af0fe7328a 100644 --- a/include/wx/gtk1/frame.h +++ b/include/wx/gtk1/frame.h @@ -2,9 +2,8 @@ // Name: frame.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -99,7 +98,10 @@ public: void OnCloseWindow( wxCloseEvent& event ); void OnIdle(wxIdleEvent& event); - virtual void AddChild( wxWindow *child ); + void AddChild( wxWindow *child ); + + // implementation + virtual void GtkOnSize( int x, int y, int width, int height ); private: diff --git a/include/wx/gtk1/gauge.h b/include/wx/gtk1/gauge.h index 51e9563b56..d6c546f706 100644 --- a/include/wx/gtk1/gauge.h +++ b/include/wx/gtk1/gauge.h @@ -2,9 +2,8 @@ // Name: gauge.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -72,9 +71,11 @@ class wxGauge: public wxControl // Are we a Win95/GTK progress bar, or a normal gauge? inline bool GetProgressBar(void) const { return m_useProgressBar; } - - protected: - + + // implementation + + void ApplyWidgetStyle(); + int m_rangeMax; int m_gaugePos; bool m_useProgressBar; diff --git a/include/wx/gtk1/gdiobj.h b/include/wx/gtk1/gdiobj.h index 2b6a5d1921..72069458e7 100644 --- a/include/wx/gtk1/gdiobj.h +++ b/include/wx/gtk1/gdiobj.h @@ -2,9 +2,8 @@ // Name: gdiobj.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/icon.h b/include/wx/gtk1/icon.h index 7596879cd9..ee31769568 100644 --- a/include/wx/gtk1/icon.h +++ b/include/wx/gtk1/icon.h @@ -2,9 +2,8 @@ // Name: icon.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/listbox.h b/include/wx/gtk1/listbox.h index 028422912d..ea621e0697 100644 --- a/include/wx/gtk1/listbox.h +++ b/include/wx/gtk1/listbox.h @@ -2,9 +2,8 @@ // Name: listbox.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -83,18 +82,15 @@ class wxListBox: public wxControl void SetString( int n, const wxString &string ); void SetStringSelection( const wxString &string, bool select = TRUE ); - void SetFont( const wxFont &font ); void SetDropTarget( wxDropTarget *dropTarget ); - virtual void SetBackgroundColour(const wxColour &colour); // implementation int GetIndex( GtkWidget *item ) const; GtkWidget *GetConnectWidget(void); bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); - private: - GtkList *m_list; wxList m_clientData; diff --git a/include/wx/gtk1/mdi.h b/include/wx/gtk1/mdi.h index 081cd5a407..2651f98366 100644 --- a/include/wx/gtk1/mdi.h +++ b/include/wx/gtk1/mdi.h @@ -2,9 +2,8 @@ // Name: mdi.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,7 +79,7 @@ class wxMDIParentFrame: public wxFrame void OnActivate( wxActivateEvent& event ); void OnSysColourChanged( wxSysColourChangedEvent& event ); - //private: + // implementation wxMDIChildFrame *m_currentChild; diff --git a/include/wx/gtk1/menu.h b/include/wx/gtk1/menu.h index 9258a25e85..7060ea2dd0 100644 --- a/include/wx/gtk1/menu.h +++ b/include/wx/gtk1/menu.h @@ -2,9 +2,8 @@ // Name: menu.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/notebook.h b/include/wx/gtk1/notebook.h index 92d011ac2b..ac362bcffe 100644 --- a/include/wx/gtk1/notebook.h +++ b/include/wx/gtk1/notebook.h @@ -138,13 +138,12 @@ public: wxWindow *GetPage(int nPage) const; // implementation - // -------------- - // base class virtuals - virtual void AddChild(wxWindow *child); - virtual void SetConstraintSizes(bool recurse); - virtual bool DoPhase(int phase); - virtual void SetFont( const wxFont &font ); - virtual void SetBackgroundColour( const wxColour &colour ); + + void AddChild(wxWindow *child); + void SetConstraintSizes(bool recurse); + bool DoPhase(int phase); + void ApplyWidgetStyle(); + private: // common part of all ctors diff --git a/include/wx/gtk1/pen.h b/include/wx/gtk1/pen.h index 0649fe2473..10ccf5e962 100644 --- a/include/wx/gtk1/pen.h +++ b/include/wx/gtk1/pen.h @@ -2,9 +2,8 @@ // Name: pen.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/radiobox.h b/include/wx/gtk1/radiobox.h index e30d8f00a1..e3984613ee 100644 --- a/include/wx/gtk1/radiobox.h +++ b/include/wx/gtk1/radiobox.h @@ -2,9 +2,8 @@ // Name: radiobox.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -80,13 +79,12 @@ class wxRadioBox: public wxControl int GetNumberOfRowsOrCols(void) const; void SetNumberOfRowsOrCols( int n ); - void SetFont( const wxFont &font ); - void SetBackgroundColour( const wxColour &colour ); void OnSize( wxSizeEvent &event ); // implementation bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); bool m_alreadySent; wxList m_boxes; diff --git a/include/wx/gtk1/radiobut.h b/include/wx/gtk1/radiobut.h index 72907e0f72..1bf88485a8 100644 --- a/include/wx/gtk1/radiobut.h +++ b/include/wx/gtk1/radiobut.h @@ -60,9 +60,11 @@ class wxRadioButton: public wxControl virtual void SetLabel(const wxString& label); virtual void SetValue(bool val); virtual bool GetValue(void) const; - void SetFont( const wxFont &font ); void Enable( bool enable ); - void SetBackgroundColour( const wxColour &colour ); + + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKRADIOBUTTONH__ diff --git a/include/wx/gtk1/region.h b/include/wx/gtk1/region.h index 35e146938c..9ba3f50125 100644 --- a/include/wx/gtk1/region.h +++ b/include/wx/gtk1/region.h @@ -2,9 +2,8 @@ // Name: region.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/scrolbar.h b/include/wx/gtk1/scrolbar.h index f4a50694d0..5bb14787bf 100644 --- a/include/wx/gtk1/scrolbar.h +++ b/include/wx/gtk1/scrolbar.h @@ -2,9 +2,8 @@ // Name: scrolbar.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -67,7 +66,8 @@ class wxScrollBar: public wxControl virtual void SetScrollbar( int position, int thumbSize, int range, int pageSize, bool refresh = TRUE ); - // Backward compatibility + // Backward compatibility + int GetValue(void) const; void SetValue( int viewStart ); void GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength) const; @@ -80,6 +80,7 @@ class wxScrollBar: public wxControl // implementation bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); GtkAdjustment *m_adjust; float m_oldPos; diff --git a/include/wx/gtk1/settings.h b/include/wx/gtk1/settings.h index b446e86b1f..2774b17709 100644 --- a/include/wx/gtk1/settings.h +++ b/include/wx/gtk1/settings.h @@ -2,9 +2,8 @@ // Name: settings.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/slider.h b/include/wx/gtk1/slider.h index f683919642..cb7e567c0f 100644 --- a/include/wx/gtk1/slider.h +++ b/include/wx/gtk1/slider.h @@ -2,8 +2,7 @@ // Name: slider.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -63,9 +62,6 @@ class wxSlider: public wxControl const wxString& name = wxSliderNameStr ); virtual int GetValue(void) const; virtual void SetValue( int ); - void GetSize( int *x, int *y ) const; - void SetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); - void GetPosition( int *x, int *y ) const; void SetRange( int minValue, int maxValue ); int GetMin(void) const; int GetMax(void) const; @@ -87,6 +83,7 @@ class wxSlider: public wxControl // implementation bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); GtkAdjustment *m_adjust; float m_oldPos; diff --git a/include/wx/gtk1/statbmp.h b/include/wx/gtk1/statbmp.h index b534110b1d..1bddd276b2 100644 --- a/include/wx/gtk1/statbmp.h +++ b/include/wx/gtk1/statbmp.h @@ -2,9 +2,8 @@ // Name: statbmp.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -51,7 +50,7 @@ class wxStaticBitmap: public wxControl long style = 0, const wxString& name = wxStaticBitmapNameStr); virtual void SetBitmap( const wxBitmap& bitmap ); wxBitmap& GetBitmap(void) const { return (wxBitmap&)m_bitmap; } - + private: wxBitmap m_bitmap; diff --git a/include/wx/gtk1/statbox.h b/include/wx/gtk1/statbox.h index d6c8314bc0..7d827c0d4b 100644 --- a/include/wx/gtk1/statbox.h +++ b/include/wx/gtk1/statbox.h @@ -2,9 +2,8 @@ // Name: stabox.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -51,6 +50,10 @@ class wxStaticBox: public wxControl const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0, const wxString &name = wxStaticBoxNameStr ); void SetLabel( const wxString &label ); + + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKSTATICBOXH__ diff --git a/include/wx/gtk1/stattext.h b/include/wx/gtk1/stattext.h index e60303c890..1febeb3139 100644 --- a/include/wx/gtk1/stattext.h +++ b/include/wx/gtk1/stattext.h @@ -2,9 +2,8 @@ // Name: stattext.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -52,6 +51,10 @@ class wxStaticText: public wxControl long style = 0, const wxString &name = wxStaticTextNameStr ); wxString GetLabel(void) const; void SetLabel( const wxString &label ); + + // implementation + + void ApplyWidgetStyle(); }; #endif // __GTKSTATICTEXTH__ diff --git a/include/wx/gtk1/tbargtk.h b/include/wx/gtk1/tbargtk.h index 93f6e7bafc..ac40522343 100644 --- a/include/wx/gtk1/tbargtk.h +++ b/include/wx/gtk1/tbargtk.h @@ -2,8 +2,6 @@ // Name: tbargtk.h // Purpose: GTK toolbar // Author: Robert Roebling -// Modified by: -// Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling // Licence: wxWindows licence diff --git a/include/wx/gtk1/textctrl.h b/include/wx/gtk1/textctrl.h index 525b11808f..eb7fe290ff 100644 --- a/include/wx/gtk1/textctrl.h +++ b/include/wx/gtk1/textctrl.h @@ -101,12 +101,14 @@ class wxTextCtrl: public wxControl, public streambuf wxTextCtrl& operator<<(const char c); void SetFont( const wxFont &font ); - virtual void SetBackgroundColour(const wxColour &colour); + void SetForegroundColour(const wxColour &colour); + void SetBackgroundColour(const wxColour &colour); // implementation GtkWidget* GetConnectWidget(void); bool IsOwnGtkWindow( GdkWindow *window ); + void ApplyWidgetStyle(); private: diff --git a/include/wx/gtk1/timer.h b/include/wx/gtk1/timer.h index 9a1abc11c2..80e302758b 100644 --- a/include/wx/gtk1/timer.h +++ b/include/wx/gtk1/timer.h @@ -2,9 +2,8 @@ // Name: timer.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/include/wx/gtk1/win_gtk.h b/include/wx/gtk1/win_gtk.h index d42e89bebe..16acb8d305 100644 --- a/include/wx/gtk1/win_gtk.h +++ b/include/wx/gtk1/win_gtk.h @@ -2,9 +2,8 @@ // Name: win_gtk.h // Purpose: wxWindows's GTK base widget // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////// */ diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 20c067a48c..9766527a36 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -2,9 +2,8 @@ // Name: window.h // Purpose: // Author: Robert Roebling -// Created: 01/02/97 -// Id: -// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem +// Id: $Id$ +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -243,7 +242,9 @@ public: bool HasVMT(); virtual void ImplementSetSize(); virtual void ImplementSetPosition(); - GtkStyle *GetWidgetStyle(); + GtkStyle *GetWidgetStyle(); + void SetWidgetStyle(); + virtual void ApplyWidgetStyle(); wxWindow *m_parent; wxList m_children; diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index ab5a9e5770..8ce29591c8 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -33,7 +33,7 @@ #include "icons/list.xpm" #include "icons/radio.xpm" #include "icons/text.xpm" -#include "icons/stattext.xpm" +#include "icons/gauge.xpm" #endif //---------------------------------------------------------------------- @@ -69,6 +69,8 @@ class MyPanel: public wxPanel wxChoice *m_choice; wxComboBox *m_combo; wxRadioBox *m_radio; + wxGauge *m_gauge; + wxSlider *m_slider; wxButton *m_fontButton; wxTextCtrl *m_text; @@ -176,6 +178,10 @@ const ID_RADIOBOX_ENABLE = 164; const ID_SET_FONT = 170; +const ID_GAUGE = 180; +const ID_SLIDER = 181; + + BEGIN_EVENT_TABLE(MyPanel, wxPanel) EVT_SIZE ( MyPanel::OnSize) EVT_NOTEBOOK_PAGE_CHANGED(ID_NOTEBOOK, MyPanel::OnPageChanged) @@ -214,7 +220,7 @@ END_EVENT_TABLE() MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ) { - SetBackgroundColour("cadet blue"); +// SetBackgroundColour("cadet blue"); m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE ); m_text->SetBackgroundColour("wheat"); @@ -233,14 +239,14 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : // image ids and names enum { - Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Static, Image_Max + Image_List, Image_Choice, Image_Combo, Image_Text, Image_Radio, Image_Gauge, Image_Max }; // fill the image list #ifdef __WXMSW__ const char *aIconNames[] = { - "list.xpm", "choice.xpm", "combo.xpm", "text.xpm", "radio.xpm", "stattext.xpm" + "list.xpm", "choice.xpm", "combo.xpm", "text.xpm", "radio.xpm", "gauge.txt" }; wxASSERT( WXSIZEOF(aIconNames) == Image_Max ); // keep in sync @@ -260,7 +266,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : imagelist-> Add( wxBitmap( combo_xpm )); imagelist-> Add( wxBitmap( text_xpm )); imagelist-> Add( wxBitmap( radio_xpm )); - imagelist-> Add( wxBitmap( stattext_xpm )); + imagelist-> Add( wxBitmap( gauge_xpm )); #endif wxButton *button = (wxButton*)NULL; @@ -268,8 +274,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : m_notebook->SetImageList(imagelist); m_notebook->SetBackgroundColour("cadet blue"); - wxPanel *panel = new wxPanel(m_notebook); + wxPanel *panel = (wxPanel*) NULL; + panel = new wxPanel(m_notebook); panel->SetBackgroundColour("cadet blue"); + panel->SetForegroundColour("blue"); m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 5, choices ); m_listbox->SetBackgroundColour("wheat"); (void)new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); @@ -283,7 +291,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : m_notebook->AddPage(panel, "wxList", FALSE, Image_List); panel = new wxPanel(m_notebook); - panel->SetBackgroundColour("cadet blue"); +// panel->SetBackgroundColour("cadet blue"); +// panel->SetForegroundColour("blue"); m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 5, choices ); m_choice->SetBackgroundColour("wheat"); (void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); @@ -296,9 +305,10 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice); panel = new wxPanel(m_notebook); - panel->SetBackgroundColour("cadet blue"); +// panel->SetBackgroundColour("cadet blue"); +// panel->SetForegroundColour("blue"); m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 5, choices ); - m_combo->SetBackgroundColour("wheat"); +// m_combo->SetBackgroundColour("wheat"); (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(340,30), wxSize(140,30) ); (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(140,30) ); @@ -309,11 +319,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo); panel = new wxPanel(m_notebook); - panel->SetBackgroundColour("cadet blue"); +// panel->SetBackgroundColour("cadet blue"); +// panel->SetForegroundColour("blue"); wxTextCtrl *tc = new wxTextCtrl( panel, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(350,28)); - tc->SetBackgroundColour("wheat"); +// tc->SetBackgroundColour("wheat"); tc = new wxTextCtrl( panel, ID_TEXT, "And here.", wxPoint(10,50), wxSize(350,160), wxTE_MULTILINE ); - tc->SetBackgroundColour("wheat"); +// tc->SetBackgroundColour("wheat"); m_notebook->AddPage(panel, "wxTextCtrl" , FALSE, Image_Text); wxString choices2[] = @@ -323,11 +334,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : }; panel = new wxPanel(m_notebook); - panel->SetBackgroundColour("cadet blue"); +// panel->SetBackgroundColour("cadet blue"); +// panel->SetForegroundColour("blue"); m_radio = new wxRadioBox( panel, ID_RADIOBOX, "That", wxPoint(10,160), wxSize(-1,-1), 2, choices2, 1, wxRA_HORIZONTAL ); - m_radio->SetBackgroundColour("wheat"); +// m_radio->SetBackgroundColour("wheat"); m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 5, choices, 1, wxRA_VERTICAL ); - m_radio->SetBackgroundColour("wheat"); +// m_radio->SetBackgroundColour("wheat"); (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(140,30) ); (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(180,80), wxSize(140,30) ); (void)new wxButton( panel, ID_RADIOBOX_FONT, "Set Italic font", wxPoint(180,130), wxSize(140,30) ); @@ -336,9 +348,14 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio); panel = new wxPanel(m_notebook); - panel->SetBackgroundColour("cadet blue"); - (void)new wxStaticBox( panel, -1, "StaticBox", wxPoint(10,10), wxSize(160,130) ); - m_notebook->AddPage(panel, "wxStaticBox", FALSE, Image_Static); +// panel->SetBackgroundColour("cadet blue"); +// panel->SetForegroundColour("blue"); + (void)new wxStaticBox( panel, -1, "wxGauge and wxSlider", wxPoint(10,10), wxSize(180,130) ); + m_gauge = new wxGauge( panel, -1, 200, wxPoint(18,50), wxSize(155,-1) ); +// m_gauge->SetBackgroundColour("wheat"); + m_slider = new wxSlider( panel, -1, 0, 0, 200, wxPoint(18,90), wxSize(155,-1) ); +// m_slider->SetBackgroundColour("wheat"); + m_notebook->AddPage(panel, "wxGauge", FALSE, Image_Gauge); } void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) ) diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp index 21225efa06..c26d67adbe 100644 --- a/src/generic/panelg.cpp +++ b/src/generic/panelg.cpp @@ -173,3 +173,4 @@ bool wxPanel::SetFocusToNextChild(wxNode *node, bool bForward) return TRUE; } + diff --git a/src/gtk.inc b/src/gtk.inc index 325e088d86..9aa61d874d 100644 --- a/src/gtk.inc +++ b/src/gtk.inc @@ -129,8 +129,7 @@ LIB_CPP_SRC=\ generic/splitter.cpp \ generic/statusbr.cpp \ generic/tabg.cpp \ - generic/textdlgg.cpp - + generic/textdlgg.cpp LIB_C_SRC=\ common/extended.c \ diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp index 71c35e39ca..431e677569 100644 --- a/src/gtk/bmpbuttn.cpp +++ b/src/gtk/bmpbuttn.cpp @@ -130,3 +130,7 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap ) gtk_pixmap_set( g_pixmap, m_bitmap.GetPixmap(), mask ); } +void wxBitmapButton::ApplyWidgetStyle() +{ +} + diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 2a26bcc065..249465f366 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -74,6 +74,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -106,34 +107,10 @@ void wxButton::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxButton::SetFont( const wxFont &font ) +void wxButton::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetFont( font ); - - gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); -} - -void wxButton::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - + SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); -} - -void wxButton::SetForegroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetForegroundColour( colour ); - - if (!m_foregroundColour.Ok()) return; - gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } diff --git a/src/gtk/checkbox.cpp b/src/gtk/checkbox.cpp index 2fbd52f552..d75e1c9cfb 100644 --- a/src/gtk/checkbox.cpp +++ b/src/gtk/checkbox.cpp @@ -72,6 +72,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetLabel( label ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -113,23 +114,11 @@ void wxCheckBox::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxCheckBox::SetFont( const wxFont &font ) +void wxCheckBox::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid checkbox" ); - - wxControl::SetFont( font ); - + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } -void wxCheckBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid checkbox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( m_widget, m_widgetStyle ); -} diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 3a09b3b8fb..6cc9718298 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -70,20 +70,22 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, for (int i = 0; i < n; i++) { GtkWidget *item = gtk_menu_item_new_with_label( choices[i] ); - gtk_signal_connect( GTK_OBJECT( item ), "activate", - GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); - gtk_menu_append( GTK_MENU(menu), item ); - gtk_widget_show( item ); gtk_widget_realize( item ); gtk_widget_realize( GTK_BIN(item)->child ); + + gtk_widget_show( item ); + + gtk_signal_connect( GTK_OBJECT( item ), "activate", + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); } gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu ); PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -102,11 +104,7 @@ void wxChoice::Append( const wxString &item ) gtk_widget_realize( menu_item ); gtk_widget_realize( GTK_BIN(menu_item)->child ); - if (m_widgetStyle) - { - gtk_widget_set_style( menu_item, m_widgetStyle ); - gtk_widget_set_style( GTK_BIN(menu_item)->child, m_widgetStyle ); - } + if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT( menu_item ), "activate", GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); @@ -259,34 +257,9 @@ void wxChoice::SetStringSelection( const wxString &string ) if (n != -1) SetSelection( n ); } -void wxChoice::SetFont( const wxFont &font ) +void wxChoice::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid choice" ); - - wxControl::SetFont( font ); - - GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - GList *child = menu_shell->children; - while (child) - { - GtkBin *bin = GTK_BIN( child->data ); - GtkWidget *label = (GtkWidget *) NULL; - if (bin->child) label = bin->child; - if (!label) label = GTK_BUTTON(m_widget)->child; - - gtk_widget_set_style( label, GetWidgetStyle() ); - - child = child->next; - } -} - -void wxChoice::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid choice" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; + SetWidgetStyle(); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); @@ -297,9 +270,15 @@ void wxChoice::SetBackgroundColour( const wxColour &colour ) while (child) { gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle ); + + GtkBin *bin = GTK_BIN( child->data ); + GtkWidget *label = (GtkWidget *) NULL; + if (bin->child) label = bin->child; + if (!label) label = GTK_BUTTON(m_widget)->child; + + gtk_widget_set_style( label, m_widgetStyle ); + child = child->next; } } - - diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 55a18563cb..38e40a9642 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -104,6 +104,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_realize( GTK_COMBO(m_widget)->button ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -135,11 +136,7 @@ void wxComboBox::Append( const wxString &item, char *clientData ) GtkWidget *list_item = gtk_list_item_new_with_label( item ); - if (m_widgetStyle) - { - gtk_widget_set_style( list_item, m_widgetStyle ); - gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle ); - } + if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); @@ -438,21 +435,21 @@ void wxComboBox::OnSize( wxSizeEvent &event ) gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height ); } -void wxComboBox::SetFont( const wxFont &font ) +void wxComboBox::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); + SetWidgetStyle(); - wxWindow::SetFont( font ); - + gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle ); gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle ); + gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); - GList *child = list->children; while (child) { - GtkBin *bin = (GtkBin*) child->data; - + gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); + + GtkBin *bin = GTK_BIN(child->data); gtk_widget_set_style( bin->child, m_widgetStyle ); child = child->next; @@ -469,27 +466,3 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) return ( (window == GTK_ENTRY( GTK_COMBO(m_widget)->entry )->text_area) || (window == GTK_COMBO(m_widget)->button->window ) ); } - -void wxComboBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - -// gtk_widget_set_style( m_widget, m_widgetStyle ); - - gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle ); - gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle ); - gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); - - GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children; - while (child) - { - gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); - - child = child->next; - } -} - diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 3e09742ebc..bdeafd1bd3 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -287,5 +287,3 @@ void wxDialog::SetIcon( const wxIcon &icon ) gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); } - - diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index eca7015891..a8c1aacb2d 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -361,8 +361,20 @@ GdkFont *wxFont::GetInternalFont(float scale) const } else { - font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_fontId, M_FONTDATA->m_style, - M_FONTDATA->m_weight, M_FONTDATA->m_underlined ); + if ((int_scale == 100) && + (M_FONTDATA->m_style == wxSWISS) && + (M_FONTDATA->m_pointSize == 12) && + (M_FONTDATA->m_weight == wxNORMAL) && + (M_FONTDATA->m_underlined == FALSE) && + (M_FONTDATA->m_style == wxNORMAL)) + { + font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); + } + else + { + font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_fontId, M_FONTDATA->m_style, + M_FONTDATA->m_weight, M_FONTDATA->m_underlined ); + } M_FONTDATA->m_scaled_xfonts.Append( int_scale, (wxObject*)font ); } if (!font) diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 757555d715..838f26607c 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -575,4 +575,3 @@ void wxFrame::SetIcon( const wxIcon &icon ) gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); } - diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp index bc6f74b995..82e27351ce 100644 --- a/src/gtk/gauge.cpp +++ b/src/gtk/gauge.cpp @@ -68,3 +68,9 @@ int wxGauge::GetValue(void) const return m_gaugePos; } +void wxGauge::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 5651b1f977..995a81a402 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -126,6 +126,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_widget_realize( GTK_WIDGET(m_list) ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -143,11 +144,7 @@ void wxListBox::Append( const wxString &item, char *clientData ) GtkWidget *list_item = gtk_list_item_new_with_label( item ); - if (m_widgetStyle) - { - gtk_widget_set_style( list_item, m_widgetStyle ); - gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle ); - } + if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); @@ -466,27 +463,9 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window ) return FALSE; } -void wxListBox::SetFont( const wxFont &font ) +void wxListBox::ApplyWidgetStyle() { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); - - wxControl::SetFont( font ); - - GList *child = m_list->children; - while (child) - { - gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle ); - child = child->next; - } -} - -void wxListBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_list != NULL, "invalid listbox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; + SetWidgetStyle(); GdkWindow *window = GTK_WIDGET(m_list)->window; m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); @@ -496,8 +475,8 @@ void wxListBox::SetBackgroundColour( const wxColour &colour ) GList *child = m_list->children; while (child) { + gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle ); gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); child = child->next; } } - diff --git a/src/gtk/notebook.cpp b/src/gtk/notebook.cpp index f318ba6d2c..ec2257fb24 100644 --- a/src/gtk/notebook.cpp +++ b/src/gtk/notebook.cpp @@ -456,23 +456,9 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) ) return TRUE; } -void wxNotebook::SetFont( const wxFont &font ) +void wxNotebook::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid notebook" ); - - wxControl::SetFont( font ); - - gtk_widget_set_style( m_widget, m_widgetStyle ); -} - -void wxNotebook::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid notebook" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - + SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); } diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 2d00f6d3e8..fab780db60 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -164,6 +164,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, SetLabel( title ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -460,46 +461,25 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented."); } -void wxRadioBox::SetFont( const wxFont &font ) +void wxRadioBox::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid radiobox" ); + SetWidgetStyle(); - wxControl::SetFont( font ); - gtk_widget_set_style( m_widget, m_widgetStyle ); wxNode *node = m_boxes.First(); while (node) { - GtkButton *button = GTK_BUTTON( node->Data() ); + GtkWidget *widget = GTK_WIDGET( node->Data() ); + gtk_widget_set_style( widget, m_widgetStyle ); + GtkButton *button = GTK_BUTTON( node->Data() ); gtk_widget_set_style( button->child, m_widgetStyle ); node = node->Next(); } } -void wxRadioBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid radiobox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( m_widget, m_widgetStyle ); - - wxNode *node = m_boxes.First(); - while (node) - { - GtkWidget *button = GTK_WIDGET( node->Data() ); - - gtk_widget_set_style( button, m_widgetStyle ); - - node = node->Next(); - } -} - bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) { if (window == m_widget->window) return TRUE; diff --git a/src/gtk/radiobut.cpp b/src/gtk/radiobut.cpp index a08d452336..4091543d8e 100644 --- a/src/gtk/radiobut.cpp +++ b/src/gtk/radiobut.cpp @@ -62,6 +62,9 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab PostCreation(); + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); + Show( TRUE ); return TRUE; @@ -100,23 +103,11 @@ void wxRadioButton::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxRadioButton::SetFont( const wxFont &font ) +void wxRadioButton::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid radiobutton" ); - - wxControl::SetFont( font ); - + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } -void wxRadioButton::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid radiobutton" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( m_widget, m_widgetStyle ); -} diff --git a/src/gtk/scrolbar.cpp b/src/gtk/scrolbar.cpp index 827cc538d3..e5e2cd59f7 100644 --- a/src/gtk/scrolbar.cpp +++ b/src/gtk/scrolbar.cpp @@ -261,3 +261,10 @@ bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window ) (window == range->step_forw) || (window == range->step_back) ); } + +void wxScrollBar::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 3413b18b50..44200eda98 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -166,7 +166,7 @@ wxFont wxSystemSettings::GetSystemFont( int index ) case wxSYS_DEFAULT_GUI_FONT: { if (!g_systemFont) - g_systemFont = new wxFont( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); + g_systemFont = new wxFont( 10, wxSWISS, wxNORMAL, wxNORMAL ); return *g_systemFont; } } diff --git a/src/gtk/slider.cpp b/src/gtk/slider.cpp index 3c3e199010..7450b6ac34 100644 --- a/src/gtk/slider.cpp +++ b/src/gtk/slider.cpp @@ -90,6 +90,8 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, else m_widget = gtk_vscale_new( (GtkAdjustment *) NULL ); + gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE ); + m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) ); gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed", @@ -100,6 +102,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -187,23 +190,6 @@ int wxSlider::GetLineSize(void) const return 0; } -// not supported in wxGTK (and GTK) - -void wxSlider::GetSize( int *x, int *y ) const -{ - wxWindow::GetSize( x, y ); -} - -void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags ) -{ - wxWindow::SetSize( x, y, width, height, sizeFlags ); -} - -void wxSlider::GetPosition( int *x, int *y ) const -{ - wxWindow::GetPosition( x, y ); -} - void wxSlider::SetTick( int WXUNUSED(tickPos) ) { } @@ -249,4 +235,8 @@ bool wxSlider::IsOwnGtkWindow( GdkWindow *window ) (window == range->step_back) ); } - +void wxSlider::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp index 321ca0ed04..524bfe575b 100644 --- a/src/gtk/statbmp.cpp +++ b/src/gtk/statbmp.cpp @@ -21,14 +21,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl) wxStaticBitmap::wxStaticBitmap(void) { -}; +} wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { Create( parent, id, bitmap, pos, size, style, name ); -}; +} bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos, const wxSize &size, @@ -62,7 +62,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi Show( TRUE ); return TRUE; -}; +} void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) { @@ -74,5 +74,4 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); } -}; - +} diff --git a/src/gtk/statbox.cpp b/src/gtk/statbox.cpp index 0f720039d3..59282af991 100644 --- a/src/gtk/statbox.cpp +++ b/src/gtk/statbox.cpp @@ -44,6 +44,9 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetLabel(label); + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); + Show( TRUE ); return TRUE; @@ -55,3 +58,10 @@ void wxStaticBox::SetLabel( const wxString &label ) GtkFrame *frame = GTK_FRAME( m_widget ); gtk_frame_set_label( frame, GetLabel() ); } + +void wxStaticBox::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk/stattext.cpp b/src/gtk/stattext.cpp index e8c2e346d3..48a3173820 100644 --- a/src/gtk/stattext.cpp +++ b/src/gtk/stattext.cpp @@ -91,6 +91,9 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe PostCreation(); + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); + Show( TRUE ); return TRUE; @@ -110,3 +113,10 @@ void wxStaticText::SetLabel( const wxString &label ) gtk_label_set( GTK_LABEL(m_widget), m_label ); } + +void wxStaticText::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index ebd439de82..6b6ed2ffe2 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -150,6 +150,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, Show( TRUE ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); return TRUE; } @@ -617,11 +618,16 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window ) return (window == GTK_ENTRY(m_text)->text_area); } -void wxTextCtrl::SetFont( const wxFont &font ) +void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) ) { wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); - wxControl::SetFont( font ); + // doesn't work +} + +void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) ) +{ + wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); // doesn't work } @@ -641,8 +647,16 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour ) gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_clear( window ); } +} + +void wxTextCtrl::ApplyWidgetStyle() +{ + if (m_windowStyle & wxTE_MULTILINE) + { + } else { + SetWidgetStyle(); gtk_widget_set_style( m_text, m_widgetStyle ); } } diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 707a1682ec..995e34d9fb 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1102,7 +1102,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_cursor = new wxCursor( wxCURSOR_ARROW ); m_font = *wxSWISS_FONT; // m_backgroundColour = wxWHITE; - m_foregroundColour = wxBLACK; +// m_foregroundColour = wxBLACK; m_windowStyle = style; m_windowName = name; m_constraints = (wxLayoutConstraints *) NULL; @@ -1965,19 +1965,8 @@ void wxWindow::SetBackgroundColour( const wxColour &colour ) gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_clear( window ); } - else - { - GtkStyle *style = GetWidgetStyle(); - m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); - style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); - style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); - style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); - style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); - } + + ApplyWidgetStyle(); } wxColour wxWindow::GetForegroundColour() const @@ -1992,23 +1981,51 @@ void wxWindow::SetForegroundColour( const wxColour &colour ) m_foregroundColour = colour; if (!m_foregroundColour.Ok()) return; - if (!m_wxwindow) + ApplyWidgetStyle(); +} + +GtkStyle *wxWindow::GetWidgetStyle() +{ + if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); + + m_widgetStyle = + gtk_style_copy( + gtk_widget_get_style( m_widget ) ); + + return m_widgetStyle; +} + +void wxWindow::SetWidgetStyle() +{ + GtkStyle *style = GetWidgetStyle(); + + gdk_font_unref( style->font ); + style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); + + if (m_foregroundColour.Ok()) { - GtkStyle *style = GetWidgetStyle(); m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); } + + if (m_backgroundColour.Ok()) + { + m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); + style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); + style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); + style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); + style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); + } } -GtkStyle *wxWindow::GetWidgetStyle() +void wxWindow::ApplyWidgetStyle() { - if (!m_widgetStyle) - m_widgetStyle = - gtk_style_copy( - gtk_widget_get_style( m_widget ) ); - return m_widgetStyle; } bool wxWindow::Validate() @@ -2172,10 +2189,8 @@ void wxWindow::SetFont( const wxFont &font ) m_font = font; else m_font = *wxSWISS_FONT; - - GtkStyle *style = GetWidgetStyle(); - gdk_font_unref( style->font ); - style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); + + ApplyWidgetStyle(); } wxFont *wxWindow::GetFont() diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index 71c35e39ca..431e677569 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -130,3 +130,7 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap ) gtk_pixmap_set( g_pixmap, m_bitmap.GetPixmap(), mask ); } +void wxBitmapButton::ApplyWidgetStyle() +{ +} + diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 2a26bcc065..249465f366 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -74,6 +74,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -106,34 +107,10 @@ void wxButton::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxButton::SetFont( const wxFont &font ) +void wxButton::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetFont( font ); - - gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); -} - -void wxButton::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - + SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); -} - -void wxButton::SetForegroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetForegroundColour( colour ); - - if (!m_foregroundColour.Ok()) return; - gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index 2fbd52f552..d75e1c9cfb 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -72,6 +72,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetLabel( label ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -113,23 +114,11 @@ void wxCheckBox::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxCheckBox::SetFont( const wxFont &font ) +void wxCheckBox::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid checkbox" ); - - wxControl::SetFont( font ); - + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } -void wxCheckBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid checkbox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( m_widget, m_widgetStyle ); -} diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index 3a09b3b8fb..6cc9718298 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -70,20 +70,22 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id, for (int i = 0; i < n; i++) { GtkWidget *item = gtk_menu_item_new_with_label( choices[i] ); - gtk_signal_connect( GTK_OBJECT( item ), "activate", - GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); - gtk_menu_append( GTK_MENU(menu), item ); - gtk_widget_show( item ); gtk_widget_realize( item ); gtk_widget_realize( GTK_BIN(item)->child ); + + gtk_widget_show( item ); + + gtk_signal_connect( GTK_OBJECT( item ), "activate", + GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); } gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu ); PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -102,11 +104,7 @@ void wxChoice::Append( const wxString &item ) gtk_widget_realize( menu_item ); gtk_widget_realize( GTK_BIN(menu_item)->child ); - if (m_widgetStyle) - { - gtk_widget_set_style( menu_item, m_widgetStyle ); - gtk_widget_set_style( GTK_BIN(menu_item)->child, m_widgetStyle ); - } + if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT( menu_item ), "activate", GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); @@ -259,34 +257,9 @@ void wxChoice::SetStringSelection( const wxString &string ) if (n != -1) SetSelection( n ); } -void wxChoice::SetFont( const wxFont &font ) +void wxChoice::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid choice" ); - - wxControl::SetFont( font ); - - GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); - GList *child = menu_shell->children; - while (child) - { - GtkBin *bin = GTK_BIN( child->data ); - GtkWidget *label = (GtkWidget *) NULL; - if (bin->child) label = bin->child; - if (!label) label = GTK_BUTTON(m_widget)->child; - - gtk_widget_set_style( label, GetWidgetStyle() ); - - child = child->next; - } -} - -void wxChoice::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid choice" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; + SetWidgetStyle(); GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) ); @@ -297,9 +270,15 @@ void wxChoice::SetBackgroundColour( const wxColour &colour ) while (child) { gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle ); + + GtkBin *bin = GTK_BIN( child->data ); + GtkWidget *label = (GtkWidget *) NULL; + if (bin->child) label = bin->child; + if (!label) label = GTK_BUTTON(m_widget)->child; + + gtk_widget_set_style( label, m_widgetStyle ); + child = child->next; } } - - diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 55a18563cb..38e40a9642 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -104,6 +104,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_realize( GTK_COMBO(m_widget)->button ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -135,11 +136,7 @@ void wxComboBox::Append( const wxString &item, char *clientData ) GtkWidget *list_item = gtk_list_item_new_with_label( item ); - if (m_widgetStyle) - { - gtk_widget_set_style( list_item, m_widgetStyle ); - gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle ); - } + if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); @@ -438,21 +435,21 @@ void wxComboBox::OnSize( wxSizeEvent &event ) gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height ); } -void wxComboBox::SetFont( const wxFont &font ) +void wxComboBox::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); + SetWidgetStyle(); - wxWindow::SetFont( font ); - + gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle ); gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle ); + gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); - GList *child = list->children; while (child) { - GtkBin *bin = (GtkBin*) child->data; - + gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); + + GtkBin *bin = GTK_BIN(child->data); gtk_widget_set_style( bin->child, m_widgetStyle ); child = child->next; @@ -469,27 +466,3 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) return ( (window == GTK_ENTRY( GTK_COMBO(m_widget)->entry )->text_area) || (window == GTK_COMBO(m_widget)->button->window ) ); } - -void wxComboBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid combobox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - -// gtk_widget_set_style( m_widget, m_widgetStyle ); - - gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle ); - gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle ); - gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); - - GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children; - while (child) - { - gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); - - child = child->next; - } -} - diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 3e09742ebc..bdeafd1bd3 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -287,5 +287,3 @@ void wxDialog::SetIcon( const wxIcon &icon ) gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); } - - diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index eca7015891..a8c1aacb2d 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -361,8 +361,20 @@ GdkFont *wxFont::GetInternalFont(float scale) const } else { - font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_fontId, M_FONTDATA->m_style, - M_FONTDATA->m_weight, M_FONTDATA->m_underlined ); + if ((int_scale == 100) && + (M_FONTDATA->m_style == wxSWISS) && + (M_FONTDATA->m_pointSize == 12) && + (M_FONTDATA->m_weight == wxNORMAL) && + (M_FONTDATA->m_underlined == FALSE) && + (M_FONTDATA->m_style == wxNORMAL)) + { + font = gdk_font_load( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); + } + else + { + font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_fontId, M_FONTDATA->m_style, + M_FONTDATA->m_weight, M_FONTDATA->m_underlined ); + } M_FONTDATA->m_scaled_xfonts.Append( int_scale, (wxObject*)font ); } if (!font) diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 757555d715..838f26607c 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -575,4 +575,3 @@ void wxFrame::SetIcon( const wxIcon &icon ) gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); } - diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp index bc6f74b995..82e27351ce 100644 --- a/src/gtk1/gauge.cpp +++ b/src/gtk1/gauge.cpp @@ -68,3 +68,9 @@ int wxGauge::GetValue(void) const return m_gaugePos; } +void wxGauge::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 5651b1f977..995a81a402 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -126,6 +126,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, gtk_widget_realize( GTK_WIDGET(m_list) ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -143,11 +144,7 @@ void wxListBox::Append( const wxString &item, char *clientData ) GtkWidget *list_item = gtk_list_item_new_with_label( item ); - if (m_widgetStyle) - { - gtk_widget_set_style( list_item, m_widgetStyle ); - gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle ); - } + if (m_widgetStyle) ApplyWidgetStyle(); gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); @@ -466,27 +463,9 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window ) return FALSE; } -void wxListBox::SetFont( const wxFont &font ) +void wxListBox::ApplyWidgetStyle() { - wxCHECK_RET( m_list != NULL, "invalid listbox" ); - - wxControl::SetFont( font ); - - GList *child = m_list->children; - while (child) - { - gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle ); - child = child->next; - } -} - -void wxListBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_list != NULL, "invalid listbox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; + SetWidgetStyle(); GdkWindow *window = GTK_WIDGET(m_list)->window; m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) ); @@ -496,8 +475,8 @@ void wxListBox::SetBackgroundColour( const wxColour &colour ) GList *child = m_list->children; while (child) { + gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle ); gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); child = child->next; } } - diff --git a/src/gtk1/notebook.cpp b/src/gtk1/notebook.cpp index f318ba6d2c..ec2257fb24 100644 --- a/src/gtk1/notebook.cpp +++ b/src/gtk1/notebook.cpp @@ -456,23 +456,9 @@ bool wxNotebook::DoPhase( int WXUNUSED(nPhase) ) return TRUE; } -void wxNotebook::SetFont( const wxFont &font ) +void wxNotebook::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid notebook" ); - - wxControl::SetFont( font ); - - gtk_widget_set_style( m_widget, m_widgetStyle ); -} - -void wxNotebook::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid notebook" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - + SetWidgetStyle(); gtk_widget_set_style( m_widget, m_widgetStyle ); } diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 2d00f6d3e8..fab780db60 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -164,6 +164,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, SetLabel( title ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -460,46 +461,25 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented."); } -void wxRadioBox::SetFont( const wxFont &font ) +void wxRadioBox::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid radiobox" ); + SetWidgetStyle(); - wxControl::SetFont( font ); - gtk_widget_set_style( m_widget, m_widgetStyle ); wxNode *node = m_boxes.First(); while (node) { - GtkButton *button = GTK_BUTTON( node->Data() ); + GtkWidget *widget = GTK_WIDGET( node->Data() ); + gtk_widget_set_style( widget, m_widgetStyle ); + GtkButton *button = GTK_BUTTON( node->Data() ); gtk_widget_set_style( button->child, m_widgetStyle ); node = node->Next(); } } -void wxRadioBox::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid radiobox" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( m_widget, m_widgetStyle ); - - wxNode *node = m_boxes.First(); - while (node) - { - GtkWidget *button = GTK_WIDGET( node->Data() ); - - gtk_widget_set_style( button, m_widgetStyle ); - - node = node->Next(); - } -} - bool wxRadioBox::IsOwnGtkWindow( GdkWindow *window ) { if (window == m_widget->window) return TRUE; diff --git a/src/gtk1/radiobut.cpp b/src/gtk1/radiobut.cpp index a08d452336..4091543d8e 100644 --- a/src/gtk1/radiobut.cpp +++ b/src/gtk1/radiobut.cpp @@ -62,6 +62,9 @@ bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& lab PostCreation(); + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); + Show( TRUE ); return TRUE; @@ -100,23 +103,11 @@ void wxRadioButton::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxRadioButton::SetFont( const wxFont &font ) +void wxRadioButton::ApplyWidgetStyle() { - wxCHECK_RET( m_widget != NULL, "invalid radiobutton" ); - - wxControl::SetFont( font ); - + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } -void wxRadioButton::SetBackgroundColour( const wxColour &colour ) -{ - wxCHECK_RET( m_widget != NULL, "invalid radiobutton" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( m_widget, m_widgetStyle ); -} diff --git a/src/gtk1/scrolbar.cpp b/src/gtk1/scrolbar.cpp index 827cc538d3..e5e2cd59f7 100644 --- a/src/gtk1/scrolbar.cpp +++ b/src/gtk1/scrolbar.cpp @@ -261,3 +261,10 @@ bool wxScrollBar::IsOwnGtkWindow( GdkWindow *window ) (window == range->step_forw) || (window == range->step_back) ); } + +void wxScrollBar::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk1/settings.cpp b/src/gtk1/settings.cpp index 3413b18b50..44200eda98 100644 --- a/src/gtk1/settings.cpp +++ b/src/gtk1/settings.cpp @@ -166,7 +166,7 @@ wxFont wxSystemSettings::GetSystemFont( int index ) case wxSYS_DEFAULT_GUI_FONT: { if (!g_systemFont) - g_systemFont = new wxFont( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" ); + g_systemFont = new wxFont( 10, wxSWISS, wxNORMAL, wxNORMAL ); return *g_systemFont; } } diff --git a/src/gtk1/slider.cpp b/src/gtk1/slider.cpp index 3c3e199010..7450b6ac34 100644 --- a/src/gtk1/slider.cpp +++ b/src/gtk1/slider.cpp @@ -90,6 +90,8 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, else m_widget = gtk_vscale_new( (GtkAdjustment *) NULL ); + gtk_scale_set_draw_value( GTK_SCALE( m_widget ), FALSE ); + m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) ); gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed", @@ -100,6 +102,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id, PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -187,23 +190,6 @@ int wxSlider::GetLineSize(void) const return 0; } -// not supported in wxGTK (and GTK) - -void wxSlider::GetSize( int *x, int *y ) const -{ - wxWindow::GetSize( x, y ); -} - -void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags ) -{ - wxWindow::SetSize( x, y, width, height, sizeFlags ); -} - -void wxSlider::GetPosition( int *x, int *y ) const -{ - wxWindow::GetPosition( x, y ); -} - void wxSlider::SetTick( int WXUNUSED(tickPos) ) { } @@ -249,4 +235,8 @@ bool wxSlider::IsOwnGtkWindow( GdkWindow *window ) (window == range->step_back) ); } - +void wxSlider::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp index 321ca0ed04..524bfe575b 100644 --- a/src/gtk1/statbmp.cpp +++ b/src/gtk1/statbmp.cpp @@ -21,14 +21,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl) wxStaticBitmap::wxStaticBitmap(void) { -}; +} wxStaticBitmap::wxStaticBitmap( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { Create( parent, id, bitmap, pos, size, style, name ); -}; +} bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxPoint &pos, const wxSize &size, @@ -62,7 +62,7 @@ bool wxStaticBitmap::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bi Show( TRUE ); return TRUE; -}; +} void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) { @@ -74,5 +74,4 @@ void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap(); gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask ); } -}; - +} diff --git a/src/gtk1/statbox.cpp b/src/gtk1/statbox.cpp index 0f720039d3..59282af991 100644 --- a/src/gtk1/statbox.cpp +++ b/src/gtk1/statbox.cpp @@ -44,6 +44,9 @@ bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label SetLabel(label); + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); + Show( TRUE ); return TRUE; @@ -55,3 +58,10 @@ void wxStaticBox::SetLabel( const wxString &label ) GtkFrame *frame = GTK_FRAME( m_widget ); gtk_frame_set_label( frame, GetLabel() ); } + +void wxStaticBox::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk1/stattext.cpp b/src/gtk1/stattext.cpp index e8c2e346d3..48a3173820 100644 --- a/src/gtk1/stattext.cpp +++ b/src/gtk1/stattext.cpp @@ -91,6 +91,9 @@ bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &labe PostCreation(); + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); + Show( TRUE ); return TRUE; @@ -110,3 +113,10 @@ void wxStaticText::SetLabel( const wxString &label ) gtk_label_set( GTK_LABEL(m_widget), m_label ); } + +void wxStaticText::ApplyWidgetStyle() +{ + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); +} + diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index ebd439de82..6b6ed2ffe2 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -150,6 +150,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, Show( TRUE ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); return TRUE; } @@ -617,11 +618,16 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window ) return (window == GTK_ENTRY(m_text)->text_area); } -void wxTextCtrl::SetFont( const wxFont &font ) +void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) ) { wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); - wxControl::SetFont( font ); + // doesn't work +} + +void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) ) +{ + wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); // doesn't work } @@ -641,8 +647,16 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour ) gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_clear( window ); } +} + +void wxTextCtrl::ApplyWidgetStyle() +{ + if (m_windowStyle & wxTE_MULTILINE) + { + } else { + SetWidgetStyle(); gtk_widget_set_style( m_text, m_widgetStyle ); } } diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 707a1682ec..995e34d9fb 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -1102,7 +1102,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_cursor = new wxCursor( wxCURSOR_ARROW ); m_font = *wxSWISS_FONT; // m_backgroundColour = wxWHITE; - m_foregroundColour = wxBLACK; +// m_foregroundColour = wxBLACK; m_windowStyle = style; m_windowName = name; m_constraints = (wxLayoutConstraints *) NULL; @@ -1965,19 +1965,8 @@ void wxWindow::SetBackgroundColour( const wxColour &colour ) gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_clear( window ); } - else - { - GtkStyle *style = GetWidgetStyle(); - m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); - style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); - style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); - style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); - style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); - style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); - } + + ApplyWidgetStyle(); } wxColour wxWindow::GetForegroundColour() const @@ -1992,23 +1981,51 @@ void wxWindow::SetForegroundColour( const wxColour &colour ) m_foregroundColour = colour; if (!m_foregroundColour.Ok()) return; - if (!m_wxwindow) + ApplyWidgetStyle(); +} + +GtkStyle *wxWindow::GetWidgetStyle() +{ + if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); + + m_widgetStyle = + gtk_style_copy( + gtk_widget_get_style( m_widget ) ); + + return m_widgetStyle; +} + +void wxWindow::SetWidgetStyle() +{ + GtkStyle *style = GetWidgetStyle(); + + gdk_font_unref( style->font ); + style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); + + if (m_foregroundColour.Ok()) { - GtkStyle *style = GetWidgetStyle(); m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); style->fg[GTK_STATE_NORMAL] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); } + + if (m_backgroundColour.Ok()) + { + m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); + style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor(); + style->bg[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_PRELIGHT] = *m_backgroundColour.GetColor(); + style->bg[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_ACTIVE] = *m_backgroundColour.GetColor(); + style->bg[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); + style->base[GTK_STATE_INSENSITIVE] = *m_backgroundColour.GetColor(); + } } -GtkStyle *wxWindow::GetWidgetStyle() +void wxWindow::ApplyWidgetStyle() { - if (!m_widgetStyle) - m_widgetStyle = - gtk_style_copy( - gtk_widget_get_style( m_widget ) ); - return m_widgetStyle; } bool wxWindow::Validate() @@ -2172,10 +2189,8 @@ void wxWindow::SetFont( const wxFont &font ) m_font = font; else m_font = *wxSWISS_FONT; - - GtkStyle *style = GetWidgetStyle(); - gdk_font_unref( style->font ); - style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); + + ApplyWidgetStyle(); } wxFont *wxWindow::GetFont() -- 2.45.2