| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: univ/colschem.cpp |
| 3 | // Purpose: (trivial) wxColourScheme implementation |
| 4 | // Author: Vadim Zeitlin |
| 5 | // Modified by: |
| 6 | // Created: 20.08.00 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) |
| 9 | // Licence: wxWindows license |
| 10 | /////////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | // =========================================================================== |
| 13 | // declarations |
| 14 | // =========================================================================== |
| 15 | |
| 16 | // --------------------------------------------------------------------------- |
| 17 | // headers |
| 18 | // --------------------------------------------------------------------------- |
| 19 | |
| 20 | #ifdef __GNUG__ |
| 21 | #pragma implementation "colschem.h" |
| 22 | #endif |
| 23 | |
| 24 | // For compilers that support precompilation, includes "wx.h". |
| 25 | #include "wx/wxprec.h" |
| 26 | |
| 27 | #ifdef __BORLANDC__ |
| 28 | #pragma hdrstop |
| 29 | #endif |
| 30 | |
| 31 | #ifndef WX_PRECOMP |
| 32 | #endif // WX_PRECOMP |
| 33 | |
| 34 | #include "wx/settings.h" |
| 35 | |
| 36 | #include "wx/univ/colschem.h" |
| 37 | #include "wx/univ/theme.h" |
| 38 | |
| 39 | // ============================================================================ |
| 40 | // implementation |
| 41 | // ============================================================================ |
| 42 | |
| 43 | // ---------------------------------------------------------------------------- |
| 44 | // wxColourScheme |
| 45 | // ---------------------------------------------------------------------------- |
| 46 | |
| 47 | wxColourScheme::~wxColourScheme() |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | // ---------------------------------------------------------------------------- |
| 52 | // wxSystemSettings |
| 53 | // ---------------------------------------------------------------------------- |
| 54 | |
| 55 | wxColour wxSystemSettings::GetColour(wxSystemColour index) |
| 56 | { |
| 57 | // the elements of this enum must be kept in sync with wxSystemColour |
| 58 | static const wxColourScheme::StdColour s_mapSysToThemeCol[] = |
| 59 | { |
| 60 | wxColourScheme::SCROLLBAR /* wxSYS_COLOUR_SCROLLBAR */, |
| 61 | wxColourScheme::WINDOW /* wxSYS_COLOUR_BACKGROUND */, |
| 62 | wxColourScheme::TITLEBAR_ACTIVE_TEXT /* wxSYS_COLOUR_ACTIVECAPTION */, |
| 63 | wxColourScheme::TITLEBAR_TEXT /* wxSYS_COLOUR_INACTIVECAPTION */, |
| 64 | wxColourScheme::MAX /* wxSYS_COLOUR_MENU */, |
| 65 | wxColourScheme::MAX /* wxSYS_COLOUR_WINDOW */, |
| 66 | wxColourScheme::MAX /* wxSYS_COLOUR_WINDOWFRAME */, |
| 67 | wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_MENUTEXT */, |
| 68 | wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_WINDOWTEXT */, |
| 69 | wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_CAPTIONTEXT */, |
| 70 | wxColourScheme::MAX /* wxSYS_COLOUR_ACTIVEBORDER */, |
| 71 | wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVEBORDER */, |
| 72 | wxColourScheme::MAX /* wxSYS_COLOUR_APPWORKSPACE */, |
| 73 | wxColourScheme::HIGHLIGHT /* wxSYS_COLOUR_HIGHLIGHT */, |
| 74 | wxColourScheme::HIGHLIGHT_TEXT /* wxSYS_COLOUR_HIGHLIGHTTEXT */, |
| 75 | wxColourScheme::CONTROL /* wxSYS_COLOUR_BTNFACE */, |
| 76 | wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_BTNSHADOW */, |
| 77 | wxColourScheme::CONTROL_TEXT_DISABLED /* wxSYS_COLOUR_GRAYTEXT */, |
| 78 | wxColourScheme::CONTROL_TEXT /* wxSYS_COLOUR_BTNTEXT */, |
| 79 | wxColourScheme::MAX /* wxSYS_COLOUR_INACTIVECAPTIONTEXT */, |
| 80 | wxColourScheme::SHADOW_HIGHLIGHT /* wxSYS_COLOUR_BTNHIGHLIGHT */, |
| 81 | wxColourScheme::SHADOW_DARK /* wxSYS_COLOUR_3DDKSHADOW */, |
| 82 | wxColourScheme::SHADOW_OUT /* wxSYS_COLOUR_3DLIGHT */, |
| 83 | wxColourScheme::MAX /* wxSYS_COLOUR_INFOTEXT */, |
| 84 | wxColourScheme::MAX /* wxSYS_COLOUR_INFOBK */, |
| 85 | wxColourScheme::WINDOW /* wxSYS_COLOUR_LISTBOX */, |
| 86 | }; |
| 87 | |
| 88 | wxCHECK_MSG( index < (int)WXSIZEOF(s_mapSysToThemeCol), wxNullColour, |
| 89 | _T("invalid wxSystemColour") ); |
| 90 | |
| 91 | wxColourScheme::StdColour col = s_mapSysToThemeCol[index]; |
| 92 | if ( col == wxColourScheme::MAX ) |
| 93 | { |
| 94 | // we don't have theme-equivalent for this colour |
| 95 | return wxSystemSettingsNative::GetColour(index); |
| 96 | } |
| 97 | |
| 98 | return wxTheme::Get()->GetColourScheme()->Get(col); |
| 99 | } |
| 100 | |