diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-19 20:29:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:42 +0300 |
commit | c632452430cb3f886da38fa315cb27a3a3a10d2c (patch) | |
tree | bdaeac586877e77046ef38dd4ad7a97a6b4e7af0 /src/gui/widgets | |
parent | dbba47eabe087d503426b5c5862aaa9263861ea5 (diff) | |
download | mv-c632452430cb3f886da38fa315cb27a3a3a10d2c.tar.gz mv-c632452430cb3f886da38fa315cb27a3a3a10d2c.tar.bz2 mv-c632452430cb3f886da38fa315cb27a3a3a10d2c.tar.xz mv-c632452430cb3f886da38fa315cb27a3a3a10d2c.zip |
Allow get colors from Widget2.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget2.cpp | 31 | ||||
-rw-r--r-- | src/gui/widgets/widget2.h | 35 |
3 files changed, 34 insertions, 34 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 7d6dc3f13..f8f3de2a0 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -499,7 +499,7 @@ int BrowserBox::calcHeight() const signed char c = row.at(start + 2); bool valid; - const gcn::Color col = Theme::getThemeColor(c, valid); + const gcn::Color col = Theme::getThemeCharColor(c, valid); if (c == '>') { diff --git a/src/gui/widgets/widget2.cpp b/src/gui/widgets/widget2.cpp deleted file mode 100644 index 6b38b0cf5..000000000 --- a/src/gui/widgets/widget2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2012 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * 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 - * 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, see <http://www.gnu.org/licenses/>. - */ - -#include "gui/widgets/widget2.h" - -#include "debug.h" - -Widget2::Widget2() -{ -} - -Widget2::~Widget2() -{ -} diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 68a45ae30..0bf7ae87a 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -21,12 +21,43 @@ #ifndef GUI_WIDGET2_H #define GUI_WIDGET2_H +#include "gui/theme.h" + class Widget2 { public: - Widget2(); + Widget2() + { + } + + ~Widget2() + { + } + + inline const gcn::Color &getThemeColor(const int type, + const int alpha = 255) + { + return Theme::getThemeColor(type * mPalette, alpha); + } + + inline const gcn::Color &getThemeCharColor(const signed char c, + bool &valid) + { + const int colorId = Theme::getIdByChar(c, valid); + if (valid) + return Theme::getThemeColor(colorId * mPalette); + else + return Palette::BLACK; + } + + void setPalette(int p) + { + if (p >= 1 && p <= THEME_PALETTES) + mPalette = p; + } - ~Widget2(); + private: + int mPalette; }; #endif |