From ddee3ee64d735005cc57a13633370efe971e7ce5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 19 Aug 2000 20:26:01 +0000 Subject: [PATCH] added wxColourScheme git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/univ/colschem.h | 53 ++++++++++++++++++++++++++++++++++++++ include/wx/univ/theme.h | 2 +- src/univ/themes/gtk.cpp | 30 +++++++++++++++++++-- src/univ/themes/win32.cpp | 30 +++++++++++++++++++-- 4 files changed, 110 insertions(+), 5 deletions(-) create mode 100644 include/wx/univ/colschem.h diff --git a/include/wx/univ/colschem.h b/include/wx/univ/colschem.h new file mode 100644 index 0000000000..2608889e97 --- /dev/null +++ b/include/wx/univ/colschem.h @@ -0,0 +1,53 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/univ/colschem.h +// Purpose: wxColourScheme class provides the colours to use for drawing +// Author: Vadim Zeitlin +// Modified by: +// Created: 19.08.00 +// RCS-ID: $Id$ +// Copyright: (c) 2000 Vadim Zeitlin +// Licence: wxWindows license +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_UNIV_COLSCHEM_H_ +#define _WX_UNIV_COLSCHEM_H_ + +#ifdef __GNUG__ + #pragma interface "colschem.h" +#endif + +#include "wx/colour.h" + +// ---------------------------------------------------------------------------- +// wxColourScheme +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxColourScheme +{ +public: + // the standard colours + enum StdColour + { + // these colours are used for drawing the shadows of 3D objects, use + // only FACE in the renderers which don't use 3D shading + DARK_SHADOW, + FACE, + HIGHLIGHT, + LIGHT, + SHADOW, + + // the default colours for the controls + CONTROL_TEXT, + HIGHLIGHT, + HIGHLIGHT_TEXT, + + MAX + }; + + virtual wxColour Get(StdColour col) = 0; +}; + +// some people just can't spell it correctly :-) +typedef wxColourScheme wxColorScheme; + +#endif // _WX_UNIV_COLSCHEM_H_ diff --git a/include/wx/univ/theme.h b/include/wx/univ/theme.h index f58b3b22ef..7ea066723b 100644 --- a/include/wx/univ/theme.h +++ b/include/wx/univ/theme.h @@ -24,7 +24,7 @@ class WXDLLEXPORT wxRenderer; class WXDLLEXPORT wxInputHandler; -class WXDLLEXPORT wxColourScheme { }; +class WXDLLEXPORT wxColourScheme; class WXDLLEXPORT wxTheme { diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index 412de963e2..4915dc50df 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -130,11 +130,13 @@ private: }; // ---------------------------------------------------------------------------- -// wxGTKColourScheme +// wxGTKColourScheme: uses the standard GTK colours // ---------------------------------------------------------------------------- class wxGTKColourScheme : public wxColourScheme { +public: + virtual wxColour Get(StdColour col); }; // ---------------------------------------------------------------------------- @@ -179,7 +181,7 @@ WX_IMPLEMENT_THEME(wxGTKTheme, gtk, wxTRANSLATE("GTK+ theme")); wxGTKTheme::wxGTKTheme() { m_renderer = new wxGTKRenderer; - m_scheme = NULL; + m_scheme = new wxGTKColourScheme; } wxGTKTheme::~wxGTKTheme() @@ -216,6 +218,30 @@ wxInputHandler *wxGTKTheme::GetInputHandler(const wxString& control) return handler; } +// ============================================================================ +// wxGTKColourScheme +// ============================================================================ + +wxColour wxGTKColourScheme::Get(wxGTKColourScheme::StdColour col) +{ + switch ( col ) + { + case DARK_SHADOW: return wxColour(0x7f7f7f); + case FACE: return wxColour(0xc0c0c0); + case HIGHLIGHT: return wxColour(0xe0e0e0); + case LIGHT: return wxColour(0xffffff); + case SHADOW: return wxColour(0xc0c0c0); + case CONTROL_TEXT: return wxColour(0x000000); + case HIGHLIGHT: return wxColour(0x0000ff); + case HIGHLIGHT_TEXT:return wxColour(0x00ffff); + + case MAX: + default: + wxFAIL_MSG(_T("invalid standard colour")); + return wxColour(0x000000); + } +} + // ============================================================================ // wxGTKRenderer // ============================================================================ diff --git a/src/univ/themes/win32.cpp b/src/univ/themes/win32.cpp index cb14b6e670..4fd605ff7f 100644 --- a/src/univ/themes/win32.cpp +++ b/src/univ/themes/win32.cpp @@ -124,11 +124,13 @@ private: }; // ---------------------------------------------------------------------------- -// wxWin32ColourScheme +// wxWin32ColourScheme: uses (default) Win32 colours // ---------------------------------------------------------------------------- class wxWin32ColourScheme : public wxColourScheme { +public: + virtual wxColour Get(StdColour col); }; // ---------------------------------------------------------------------------- @@ -173,7 +175,7 @@ WX_IMPLEMENT_THEME(wxWin32Theme, win32, wxTRANSLATE("Win32 theme")); wxWin32Theme::wxWin32Theme() { m_renderer = new wxWin32Renderer; - m_scheme = NULL; + m_scheme = new wxWin32ColourScheme; } wxWin32Theme::~wxWin32Theme() @@ -210,6 +212,30 @@ wxInputHandler *wxWin32Theme::GetInputHandler(const wxString& control) return handler; } +// ============================================================================ +// wxWin32ColourScheme +// ============================================================================ + +wxColour wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col) +{ + switch ( col ) + { + case DARK_SHADOW: return wxColour(0x7f7f7f); + case FACE: return wxColour(0xc0c0c0); + case HIGHLIGHT: return wxColour(0xe0e0e0); + case LIGHT: return wxColour(0xffffff); + case SHADOW: return wxColour(0xc0c0c0); + case CONTROL_TEXT: return wxColour(0x000000); + case HIGHLIGHT: return wxColour(0x0000ff); + case HIGHLIGHT_TEXT:return wxColour(0x00ffff); + + case MAX: + default: + wxFAIL_MSG(_T("invalid standard colour")); + return wxColour(0x000000); + } +} + // ============================================================================ // wxWin32Renderer // ============================================================================