1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/*
Copyright (C) 2009-2010 wxLauncher Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SKIN_H
#define SKIN_H
#include <wx/wx.h>
#include <wx/filename.h>
#include "apis/EventHandlers.h"
#include "datastructures/NewsSource.h"
/** TC skin has changed. */
LAUNCHER_DECLARE_EVENT_TYPE(EVT_TC_SKIN_CHANGED);
/** Holds a skin's information. */
/** The Set() functions return true on success, false otherwise. */
class Skin {
public:
Skin();
const wxString& GetWindowTitle() const { return this->windowTitle; }
bool SetWindowTitle(const wxString& windowTitle);
const wxIcon& GetWindowIcon() const { return this->windowIcon; }
bool SetWindowIcon(const wxIcon& windowIcon);
const wxBitmap& GetBanner() const { return this->banner; }
bool SetBanner(const wxBitmap& banner);
const wxString& GetWelcomeText() const { return this->welcomeText; }
bool SetWelcomeText(const wxString& welcomeText);
const wxBitmap& GetModImage() const { return this->modImage; }
bool SetModImage(const wxBitmap& modImage);
const wxBitmap& GetSmallModImage() const { return this->smallModImage; }
bool SetSmallModImage(const wxBitmap& smallModImage);
const wxBitmap& GetOkIcon() const { return this->okIcon; }
bool SetOkIcon(const wxBitmap& okIcon);
const wxBitmap& GetWarningIcon() const { return this->warningIcon; }
bool SetWarningIcon(const wxBitmap& warningIcon);
const wxBitmap& GetBigWarningIcon() const { return this->bigWarningIcon; }
bool SetBigWarningIcon(const wxBitmap& bigWarningIcon);
const wxBitmap& GetErrorIcon() const { return this->errorIcon; }
bool SetErrorIcon(const wxBitmap& errorIcon);
const wxBitmap& GetInfoIcon() const { return this->infoIcon; }
bool SetInfoIcon(const wxBitmap& infoIcon);
const wxBitmap& GetBigInfoIcon() const { return this->bigInfoIcon; }
bool SetBigInfoIcon(const wxBitmap& bigInfoIcon);
const wxBitmap& GetHelpIcon() const { return this->helpIcon; }
bool SetHelpIcon(const wxBitmap& helpIcon);
const wxBitmap& GetBigHelpIcon() const { return this->bigHelpIcon; }
bool SetBigHelpIcon(const wxBitmap& bigHelpIcon);
const wxBitmap& GetIdealIcon() const { return this->idealIcon; }
bool SetIdealIcon(const wxBitmap& idealIcon);
const NewsSource* GetNewsSource() const { return this->newsSource; }
bool SetNewsSource(const NewsSource* newsSource);
private:
static bool CheckStatusBarIconDimensions(const wxBitmap& icon);
static bool CheckBigIconDimensions(const wxBitmap& icon);
wxString windowTitle;
wxIcon windowIcon;
wxBitmap banner;
wxString welcomeText;
/** The 255x112 and 182x80 versions of the default mod image. */
wxBitmap modImage;
wxBitmap smallModImage;
wxBitmap okIcon;
wxBitmap warningIcon;
wxBitmap bigWarningIcon;
wxBitmap errorIcon;
wxBitmap infoIcon;
wxBitmap bigInfoIcon;
wxBitmap helpIcon;
wxBitmap bigHelpIcon;
wxBitmap idealIcon;
const NewsSource* newsSource;
};
/** Class used to manage the skinning of the launcher. The skinnable parts of
the app register with the skin system, so that when the skin changes, they can
be updated if needed. */
class SkinSystem {
public:
static bool Initialize();
static void DeInitialize();
static bool IsInitialized();
static SkinSystem* GetSkinSystem();
~SkinSystem();
static void RegisterTCSkinChanged(wxEvtHandler *handler);
static void UnRegisterTCSkinChanged(wxEvtHandler *handler);
const wxString& GetWindowTitle() const;
const wxIcon& GetWindowIcon() const;
const wxBitmap& GetBanner() const;
const wxString& GetWelcomeText() const;
const wxBitmap& GetModImage() const;
const wxBitmap& GetSmallModImage() const;
const wxBitmap& GetOkIcon() const;
const wxBitmap& GetWarningIcon() const;
const wxBitmap& GetBigWarningIcon() const;
const wxBitmap& GetErrorIcon() const;
const wxBitmap& GetInfoIcon() const;
const wxBitmap& GetBigInfoIcon() const;
const wxBitmap& GetHelpIcon() const;
const wxBitmap& GetBigHelpIcon() const;
const wxBitmap& GetIdealIcon() const;
const NewsSource& GetNewsSource() const;
const wxFont& GetFont() const { return this->font; }
const wxFont& GetMessageFont() const { return this->messageFont; }
void SetTCSkin(const Skin* skin);
void ResetTCSkin();
static wxBitmap MakeModListImage(const wxBitmap &orig);
static wxBitmap MakeModInfoDialogImage(const wxBitmap &orig);
static bool SearchFile(wxFileName& filename, wxString currentTC,
wxString shortmodname, wxString filepath);
/** Dimensions for banner image on welcome page. */
static const int BannerMaxWidth = 630;
static const int BannerHeight = 150;
/** Dimensions for mod images, depending on where the image appears. */
static const int ModInfoDialogImageWidth = 255;
static const int ModInfoDialogImageHeight = 112;
static const int ModListImageWidth = 182;
static const int ModListImageHeight = 80;
static const int StatusBarIconWidth = 24;
static const int StatusBarIconHeight = 24;
static const int BigIconWidth = 64;
static const int BigIconHeight = 64;
static const int HelpIconWidth = 32;
static const int HelpIconHeight = 32;
static const int IdealIconWidth = 24;
static const int IdealIconHeight = 24;
private:
SkinSystem();
static SkinSystem* skinSystem;
static EventHandlers TCSkinChangedHandlers;
static void GenerateTCSkinChanged();
void InitializeDefaultSkin();
Skin defaultSkin;
const Skin* TCSkin;
wxFont font;
wxFont messageFont;
};
#endif
|