From 4353a8df6eb0c743f42a85364235195246225b76 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 28 Sep 2006 22:55:28 +0000 Subject: [PATCH] add compilation options to allow compiling in just the selected wxUniv themes and not all of them (which is still the default) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build/bakefiles/files.bkl | 21 ++++--- configure | 27 ++++++++ configure.in | 15 +++++ include/wx/chkconf.h | 58 ++--------------- include/wx/mac/setup0.h | 16 +++++ include/wx/motif/setup0.h | 16 +++++ include/wx/msw/setup0.h | 16 +++++ include/wx/msw/wince/setup.h | 16 +++++ include/wx/os2/setup0.h | 16 +++++ include/wx/palmos/setup0.h | 16 +++++ include/wx/setup_inc.h | 16 +++++ include/wx/univ/chkconf.h | 117 +++++++++++++++++++++++++++++++++++ src/univ/themes/gtk.cpp | 4 ++ src/univ/themes/metal.cpp | 4 ++ src/univ/themes/mono.cpp | 4 ++ src/univ/themes/win32.cpp | 4 ++ 16 files changed, 302 insertions(+), 64 deletions(-) create mode 100644 include/wx/univ/chkconf.h diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index d6cec7a95f..4aaa3d70e8 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1778,6 +1778,11 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! + src/generic/caret.cpp + src/generic/colour.cpp + src/generic/icon.cpp + src/generic/imaglist.cpp + src/generic/timer.cpp src/dfb/app.cpp src/dfb/bitmap.cpp src/dfb/brush.cpp @@ -1797,13 +1802,13 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/dfb/utils.cpp src/dfb/window.cpp src/dfb/wrapdfb.cpp - src/generic/caret.cpp - src/generic/colour.cpp - src/generic/icon.cpp - src/generic/imaglist.cpp - src/generic/timer.cpp + wx/generic/caret.h + wx/generic/colour.h + wx/generic/icon.h + wx/generic/imaglist.h + wx/generic/timer.h wx/dfb/app.h wx/dfb/bitmap.h wx/dfb/brush.h @@ -1823,11 +1828,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/dfb/toplevel.h wx/dfb/window.h wx/dfb/wrapdfb.h - wx/generic/caret.h - wx/generic/colour.h - wx/generic/icon.h - wx/generic/imaglist.h - wx/generic/timer.h @@ -2559,6 +2559,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/univ/button.h wx/univ/checkbox.h wx/univ/checklst.h + wx/univ/chkconf.h wx/univ/choice.h wx/univ/colschem.h wx/univ/combobox.h diff --git a/configure b/configure index 2d775f1472..4ee90333f8 100755 --- a/configure +++ b/configure @@ -1162,6 +1162,7 @@ Optional Packages: --with-gnomevfs use GNOME VFS for associating MIME types --with-hildon use Hildon framework for Nokia 770 --with-opengl use OpenGL (or Mesa) + --with-themes=all|list use only the specified comma-separated list of wxUniversal themes --with-dmalloc use dmalloc library (http://dmalloc.com/) --with-regex enable support for wxRegEx class --with-zlib use zlib for LZW compression @@ -3460,6 +3461,15 @@ echo "${ECHO_T}no" >&6 fi +if test "$wxUSE_UNIVERSAL" = "yes"; then + +# Check whether --with-themes or --without-themes was given. +if test "${with_themes+set}" = set; then + withval="$with_themes" + wxUNIV_THEMES="$withval" +fi; +fi + fi @@ -46420,6 +46430,23 @@ done if test "x$wxUSE_UNIVERSAL" = "xyes" ; then WXUNIV=1 + + case "$wxUNIV_THEMES" in + ''|all) + cat >>confdefs.h <<\_ACEOF +#define wxUSE_ALL_THEMES 1 +_ACEOF + + ;; + + *) + for t in `echo $wxUNIV_THEMES | tr , ' ' | tr a-z A-Z`; do + cat >>confdefs.h <<_ACEOF +#define wxUSE_THEME_$t 1 +_ACEOF + + done + esac else WXUNIV=0 fi diff --git a/configure.in b/configure.in index ac07c57bc2..23dc72730c 100644 --- a/configure.in +++ b/configure.in @@ -864,6 +864,10 @@ WX_ARG_WITH(gnomevfs, [ --with-gnomevfs use GNOME VFS for associat WX_ARG_WITH(hildon, [ --with-hildon use Hildon framework for Nokia 770], wxUSE_LIBHILDON) WX_ARG_WITH(opengl, [ --with-opengl use OpenGL (or Mesa)], wxUSE_OPENGL) +if test "$wxUSE_UNIVERSAL" = "yes"; then + AC_ARG_WITH(themes, [ --with-themes=all|list use only the specified comma-separated list of wxUniversal themes], [wxUNIV_THEMES="$withval"]) +fi + fi dnl for GUI only @@ -7337,6 +7341,17 @@ done if test "x$wxUSE_UNIVERSAL" = "xyes" ; then WXUNIV=1 + + case "$wxUNIV_THEMES" in + ''|all) + AC_DEFINE(wxUSE_ALL_THEMES) + ;; + + *) + for t in `echo $wxUNIV_THEMES | tr , ' ' | tr a-z A-Z`; do + AC_DEFINE_UNQUOTED(wxUSE_THEME_$t) + done + esac else WXUNIV=0 fi diff --git a/include/wx/chkconf.h b/include/wx/chkconf.h index 99189e5754..2c94762984 100644 --- a/include/wx/chkconf.h +++ b/include/wx/chkconf.h @@ -35,6 +35,10 @@ # include "wx/x11/chkconf.h" #endif +#ifdef __WXUNIVERSAL__ +# include "wx/univ/chkconf.h" +#endif + /* this global setting determines what should we do if the setting FOO requires BAR and BAR is not set: we can either silently unset FOO as well @@ -1234,60 +1238,6 @@ # endif #endif -/* wxUniv-specific dependencies */ -#if defined(__WXUNIVERSAL__) -# if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus" -# else -# undef wxUSE_POPUPWIN -# define wxUSE_POPUPWIN 1 -# endif -# endif - -# if wxUSE_COMBOBOX -# if !wxUSE_LISTBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxComboBox requires wxListBox in wxUniversal" -# else -# undef wxUSE_LISTBOX -# define wxUSE_LISTBOX 1 -# endif -# endif -# endif /* wxUSE_COMBOBOX */ - -# if wxUSE_RADIOBTN -# if !wxUSE_CHECKBOX -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal" -# else -# undef wxUSE_CHECKBOX -# define wxUSE_CHECKBOX 1 -# endif -# endif -# endif /* wxUSE_RADIOBTN */ - -# if wxUSE_TEXTCTRL -# if !wxUSE_CARET -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTextCtrl requires wxCaret in wxUniversal" -# else -# undef wxUSE_CARET -# define wxUSE_CARET 1 -# endif -# endif /* wxUSE_CARET */ - -# if !wxUSE_SCROLLBAR -# ifdef wxABORT_ON_CONFIG_ERROR -# error "wxTextCtrl requires wxScrollBar in wxUniversal" -# else -# undef wxUSE_SCROLLBAR -# define wxUSE_SCROLLBAR 1 -# endif -# endif /* wxUSE_SCROLLBAR */ -# endif /* wxUSE_TEXTCTRL */ -#endif /* __WXUNIVERSAL__ */ - /* wxGTK-specific dependencies */ #ifdef __WXGTK__ # ifndef __WXUNIVERSAL__ diff --git a/include/wx/mac/setup0.h b/include/wx/mac/setup0.h index 41f0246ee1..b43eaf53cd 100644 --- a/include/wx/mac/setup0.h +++ b/include/wx/mac/setup0.h @@ -1130,6 +1130,22 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + /* --- end common options --- */ // ---------------------------------------------------------------------------- diff --git a/include/wx/motif/setup0.h b/include/wx/motif/setup0.h index e5bb7f1052..b83e5dde1e 100644 --- a/include/wx/motif/setup0.h +++ b/include/wx/motif/setup0.h @@ -1129,6 +1129,22 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + /* --- end common options --- */ // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/setup0.h b/include/wx/msw/setup0.h index 650cb02469..30321ff610 100644 --- a/include/wx/msw/setup0.h +++ b/include/wx/msw/setup0.h @@ -1129,6 +1129,22 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + /* --- end common options --- */ // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/wince/setup.h b/include/wx/msw/wince/setup.h index 190c7ea32b..9ce9270e99 100644 --- a/include/wx/msw/wince/setup.h +++ b/include/wx/msw/wince/setup.h @@ -1129,6 +1129,22 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + /* --- end common options --- */ // ---------------------------------------------------------------------------- diff --git a/include/wx/os2/setup0.h b/include/wx/os2/setup0.h index ba8da03d5a..97b4256a8b 100644 --- a/include/wx/os2/setup0.h +++ b/include/wx/os2/setup0.h @@ -1129,6 +1129,22 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + /* --- end common options --- */ // ---------------------------------------------------------------------------- diff --git a/include/wx/palmos/setup0.h b/include/wx/palmos/setup0.h index 8bce0050c5..c42e08e02f 100644 --- a/include/wx/palmos/setup0.h +++ b/include/wx/palmos/setup0.h @@ -1129,6 +1129,22 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + /* --- end common options --- */ // ---------------------------------------------------------------------------- diff --git a/include/wx/setup_inc.h b/include/wx/setup_inc.h index f6fd74d224..62cc2a6a01 100644 --- a/include/wx/setup_inc.h +++ b/include/wx/setup_inc.h @@ -1125,3 +1125,19 @@ // Set to 1 to compile in wxPalette class #define wxUSE_PALETTE 1 +// ---------------------------------------------------------------------------- +// wxUniversal-only options +// ---------------------------------------------------------------------------- + +// Set to 1 to enable compilation of all themes, this is the default +#define wxUSE_ALL_THEMES 1 + +// Set to 1 to enable the compilation of individual theme if wxUSE_ALL_THEMES +// is unset, if it is set these options are not used; notice that metal theme +// uses Win32 one +#define wxUSE_THEME_GTK 0 +#define wxUSE_THEME_METAL 0 +#define wxUSE_THEME_MONO 0 +#define wxUSE_THEME_WIN32 0 + + diff --git a/include/wx/univ/chkconf.h b/include/wx/univ/chkconf.h new file mode 100644 index 0000000000..2aeea1f6d5 --- /dev/null +++ b/include/wx/univ/chkconf.h @@ -0,0 +1,117 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/chkconf.h +// Purpose: wxUniversal-specific configuration options checks +// Author: Vadim Zeitlin +// Created: 2006-09-28 (extracted from wx/chkconf.h) +// RCS-ID: $Id$ +// Copyright: (c) 2006 Vadim Zeitlin +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_CHKCONF_H_ +#define _WX_UNIV_CHKCONF_H_ + +#if (wxUSE_COMBOBOX || wxUSE_MENUS) && !wxUSE_POPUPWIN +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_POPUPWIN must be defined to use comboboxes/menus" +# else +# undef wxUSE_POPUPWIN +# define wxUSE_POPUPWIN 1 +# endif +#endif + +#if wxUSE_COMBOBOX +# if !wxUSE_LISTBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxComboBox requires wxListBox in wxUniversal" +# else +# undef wxUSE_LISTBOX +# define wxUSE_LISTBOX 1 +# endif +# endif +#endif /* wxUSE_COMBOBOX */ + +#if wxUSE_RADIOBTN +# if !wxUSE_CHECKBOX +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_RADIOBTN requires wxUSE_CHECKBOX in wxUniversal" +# else +# undef wxUSE_CHECKBOX +# define wxUSE_CHECKBOX 1 +# endif +# endif +#endif /* wxUSE_RADIOBTN */ + +#if wxUSE_TEXTCTRL +# if !wxUSE_CARET +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTextCtrl requires wxCaret in wxUniversal" +# else +# undef wxUSE_CARET +# define wxUSE_CARET 1 +# endif +# endif /* wxUSE_CARET */ + +# if !wxUSE_SCROLLBAR +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxTextCtrl requires wxScrollBar in wxUniversal" +# else +# undef wxUSE_SCROLLBAR +# define wxUSE_SCROLLBAR 1 +# endif +# endif /* wxUSE_SCROLLBAR */ +#endif /* wxUSE_TEXTCTRL */ + + +/* Themes checks */ +#ifndef wxUSE_ALL_THEMES +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_ALL_THEMES must be defined" +# else +# define wxUSE_ALL_THEMES 1 +# endif +#endif /* wxUSE_ALL_THEMES */ + +#ifndef wxUSE_THEME_GTK +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_GTK must be defined" +# else +# define wxUSE_THEME_GTK 1 +# endif +#endif /* wxUSE_THEME_GTK */ + +#ifndef wxUSE_THEME_METAL +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_METAL must be defined" +# else +# define wxUSE_THEME_METAL 1 +# endif +#endif /* wxUSE_THEME_METAL */ + +#ifndef wxUSE_THEME_MONO +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_MONO must be defined" +# else +# define wxUSE_THEME_MONO 1 +# endif +#endif /* wxUSE_THEME_MONO */ + +#ifndef wxUSE_THEME_WIN32 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "wxUSE_THEME_WIN32 must be defined" +# else +# define wxUSE_THEME_WIN32 1 +# endif +#endif /* wxUSE_THEME_WIN32 */ + +#if !wxUSE_ALL_THEMES && wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 +# ifdef wxABORT_ON_CONFIG_ERROR +# error "Metal theme requires Win32 one" +# else +# undef wxUSE_THEME_WIN32 +# define wxUSE_THEME_WIN32 1 +# endif +#endif /* wxUSE_THEME_METAL && !wxUSE_THEME_WIN32 */ + +#endif /* _WX_UNIV_CHKCONF_H_ */ + diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index b057da0efd..3e011c3a0e 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_ALL_THEMES || wxUSE_THEME_GTK + #ifndef WX_PRECOMP #include "wx/intl.h" #include "wx/log.h" @@ -2771,3 +2773,5 @@ bool wxGTKTextCtrlInputHandler::HandleKey(wxInputConsumer *control, } #endif // wxUSE_TEXTCTRL + +#endif // wxUSE_ALL_THEMES || wxUSE_THEME_GTK diff --git a/src/univ/themes/metal.cpp b/src/univ/themes/metal.cpp index e18104660c..252a6d7bb1 100644 --- a/src/univ/themes/metal.cpp +++ b/src/univ/themes/metal.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_ALL_THEMES || wxUSE_THEME_METAL + #ifndef WX_PRECOMP #include "wx/timer.h" #include "wx/intl.h" @@ -591,3 +593,5 @@ void wxMetalRenderer::DrawMetal(wxDC &dc, const wxRect &rect ) dc.DrawRectangle( rect.x, y, rect.width, 1 ); } } + +#endif // wxUSE_ALL_THEMES || wxUSE_THEME_METAL diff --git a/src/univ/themes/mono.cpp b/src/univ/themes/mono.cpp index b2d51f8ff6..ccb665577c 100644 --- a/src/univ/themes/mono.cpp +++ b/src/univ/themes/mono.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_ALL_THEMES || wxUSE_THEME_MONO + #ifndef WX_PRECOMP #include "wx/dc.h" #endif // WX_PRECOMP @@ -1047,3 +1049,5 @@ wxBitmap wxMonoArtProvider::CreateBitmap(const wxArtID& WXUNUSED(id), { return wxNullBitmap; } + +#endif // wxUSE_ALL_THEMES || wxUSE_THEME_MONO diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index 5aa723165f..a2ce8d2894 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -24,6 +24,8 @@ #pragma hdrstop #endif +#if wxUSE_ALL_THEMES || wxUSE_THEME_WIN32 + #ifndef WX_PRECOMP #include "wx/timer.h" #include "wx/intl.h" @@ -3772,3 +3774,5 @@ bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer *consumer, return wxStdInputHandler::HandleActivation(consumer, activated); } + +#endif // wxUSE_ALL_THEMES || wxUSE_THEME_WIN32 -- 2.45.2