summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-04 22:41:19 -0700
committerJared Adams <jaxad0127@gmail.com>2010-03-12 14:49:27 -0700
commit781b3c9f17708cc5fe08eb3c9ee38d596364d97c (patch)
tree833797c9b9168ab58864ffe4cf8ed028060e44a2 /src/gui/widgets
parent96b64757954f07d196599b3c1131a6603982c930 (diff)
downloadMana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.tar.gz
Mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.tar.bz2
Mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.tar.xz
Mana-781b3c9f17708cc5fe08eb3c9ee38d596364d97c.zip
Split Palette into Theme and UserPalette
Themes can now control the colors they use. Colors in the Viewport (being names, particles, etc) can still be changed by the user. Also make ProgressBars more easily colored. DyePalette was made more flexible in the process. Also fixes comparing strings of different lengths insensitively. Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp6
-rw-r--r--src/gui/widgets/browserbox.cpp14
-rw-r--r--src/gui/widgets/button.cpp4
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/gui/widgets/checkbox.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp6
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/label.cpp4
-rw-r--r--src/gui/widgets/listbox.cpp6
-rw-r--r--src/gui/widgets/progressbar.cpp26
-rw-r--r--src/gui/widgets/progressbar.h13
-rw-r--r--src/gui/widgets/progressindicator.cpp6
-rw-r--r--src/gui/widgets/shoplistbox.cpp14
-rw-r--r--src/gui/widgets/tab.cpp14
-rw-r--r--src/gui/widgets/tab.h6
-rw-r--r--src/gui/widgets/table.cpp8
-rw-r--r--src/gui/widgets/textbox.cpp4
-rw-r--r--src/gui/widgets/textfield.cpp2
-rw-r--r--src/gui/widgets/textpreview.cpp4
-rw-r--r--src/gui/widgets/whispertab.cpp4
-rw-r--r--src/gui/widgets/window.cpp2
24 files changed, 87 insertions, 70 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 17651137..0235d104 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -74,8 +74,8 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
- graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
- (int)(mAlpha * 255.0f)));
+ graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
+ (int) (mAlpha * 255.0f)));
graphics->setFont(getFont());
const int fontHeight = getFont()->getHeight();
@@ -89,7 +89,7 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
int width = 0;
// Draw the list elements
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
for (int i = 0, y = 0;
i < model->getNumberOfElements();
++i, y += fontHeight)
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index de4f7a40..d43afed7 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -21,7 +21,7 @@
#include "gui/widgets/browserbox.h"
-#include "gui/palette.h"
+#include "gui/theme.h"
#include "gui/widgets/linkhandler.h"
@@ -268,7 +268,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
if (mOpaque)
{
- graphics->setColor(guiPalette->getColor(Palette::BACKGROUND));
+ graphics->setColor(Theme::getThemeColor(Theme::BACKGROUND));
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
@@ -276,7 +276,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
{
if ((mHighMode & BACKGROUND))
{
- graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT));
+ graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT));
graphics->fillRectangle(gcn::Rectangle(
mLinks[mSelectedLink].x1,
mLinks[mSelectedLink].y1,
@@ -287,7 +287,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
if ((mHighMode & UNDERLINE))
{
- graphics->setColor(guiPalette->getColor(Palette::HYPERLINK));
+ graphics->setColor(Theme::getThemeColor(Theme::HYPERLINK));
graphics->drawLine(
mLinks[mSelectedLink].x1,
mLinks[mSelectedLink].y2,
@@ -305,8 +305,8 @@ void BrowserBox::draw(gcn::Graphics *graphics)
char const *hyphen = "~";
int hyphenWidth = font->getWidth(hyphen);
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
- const gcn::Color textColor = guiPalette->getColor(Palette::TEXT);
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
+ const gcn::Color textColor = Theme::getThemeColor(Theme::TEXT);
TextRowsHeightIterator h = mTextRowsHeights.begin();
for (TextRowIterator i = mTextRows.begin();
@@ -373,7 +373,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
{
const char c = row.at(start + 2);
bool valid;
- const gcn::Color col = guiPalette->getColor(c, valid);
+ const gcn::Color col = Theme::getThemeColor(c, valid);
if (c == '>')
{
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index aff46b2a..26e0ad90 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -160,9 +160,9 @@ void Button::draw(gcn::Graphics *graphics)
drawImageRect(0, 0, getWidth(), getHeight(), button[mode]);
if (mode == BUTTON_DISABLED)
- graphics->setColor(guiPalette->getColor(Palette::BUTTON_DISABLED));
+ graphics->setColor(Theme::getThemeColor(Theme::BUTTON_DISABLED));
else
- graphics->setColor(guiPalette->getColor(Palette::BUTTON));
+ graphics->setColor(Theme::getThemeColor(Theme::BUTTON));
int textX;
int textY = getHeight() / 2 - getFont()->getHeight() / 2;
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index ee4197eb..39ea6887 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -197,7 +197,7 @@ void ChatTab::chatLog(std::string line, int own, bool ignoreRecord)
chatWindow->mRecorder->record(line.substr(3));
if (this != getTabbedArea()->getSelectedTab() &&
own != BY_PLAYER)
- setHighlighted(true);
+ setFlash(true);
}
void ChatTab::chatLog(const std::string &nick, const std::string &msg)
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 3a4133bb..7fd3931e 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -115,7 +115,7 @@ class ChatTab : public Tab
friend class ChatWindow;
friend class WhisperWindow;
- virtual void setCurrent() { setHighlighted(false); }
+ virtual void setCurrent() { setFlash(false); }
virtual void handleInput(const std::string &msg);
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 5ca38727..f9002166 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -83,7 +83,7 @@ void CheckBox::draw(gcn::Graphics* graphics)
drawBox(graphics);
graphics->setFont(getFont());
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
const int h = getHeight() + getHeight() / 2;
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 57a09ed2..6c3417e7 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -143,15 +143,15 @@ void DropDown::draw(gcn::Graphics* graphics)
const int alpha = (int) (mAlpha * 255.0f);
gcn::Color faceColor = getBaseColor();
faceColor.a = alpha;
- const gcn::Color *highlightColor =
- &guiPalette->getColor(Palette::HIGHLIGHT, alpha);
+ const gcn::Color *highlightColor = &Theme::getThemeColor(Theme::HIGHLIGHT,
+ alpha);
gcn::Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
if (mListBox->getListModel() && mListBox->getSelected() >= 0)
{
graphics->setFont(getFont());
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
graphics->drawText(mListBox->getListModel()->getElementAt(mListBox->getSelected()), 1, 0);
}
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index aadc6f24..2b07ad1e 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -92,7 +92,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
// Draw emote keyboard shortcut.
const char *key = SDL_GetKeyName(
(SDLKey) keyboard.getKeyValue(keyboard.KEY_EMOTE_1 + i));
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
g->drawText(key, emoteX + 2, emoteY + 2, gcn::Graphics::LEFT);
if (emoteShortcut->getEmote(i))
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 0a211d29..5163fc45 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -141,7 +141,7 @@ void ItemContainer::draw(gcn::Graphics *graphics)
caption = "Eq.";
if (item->isEquipped())
- g->setColor(guiPalette->getColor(Palette::ITEM_EQUIPPED));
+ g->setColor(Theme::getThemeColor(Theme::ITEM_EQUIPPED));
else
g->setColor(gcn::Color(0, 0, 0));
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index da5d11c5..92e3e2e5 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -87,7 +87,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
// Draw item keyboard shortcut.
const char *key = SDL_GetKeyName(
(SDLKey) keyboard.getKeyValue(keyboard.KEY_SHORTCUT_1 + i));
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
g->drawText(key, itemX + 2, itemY + 2, gcn::Graphics::LEFT);
if (itemShortcut->getItem(i) < 0)
@@ -111,7 +111,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
g->drawImage(image, itemX, itemY);
if (item->isEquipped())
- g->setColor(guiPalette->getColor(Palette::ITEM_EQUIPPED));
+ g->setColor(Theme::getThemeColor(Theme::ITEM_EQUIPPED));
g->drawText(caption, itemX + mBoxWidth / 2,
itemY + mBoxHeight - 14, gcn::Graphics::CENTER);
}
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 464ecf69..4c607edf 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -20,7 +20,7 @@
#include "gui/widgets/label.h"
-#include "gui/palette.h"
+#include "gui/theme.h"
Label::Label()
{
@@ -33,6 +33,6 @@ Label::Label(const std::string &caption) :
void Label::draw(gcn::Graphics *graphics)
{
- setForegroundColor(guiPalette->getColor(Palette::TEXT));
+ setForegroundColor(Theme::getThemeColor(Theme::TEXT));
gcn::Label::draw(static_cast<gcn::Graphics*>(graphics));
}
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 138cf3a0..eed6b8d0 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -59,8 +59,8 @@ void ListBox::draw(gcn::Graphics *graphics)
updateAlpha();
- graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
- (int)(mAlpha * 255.0f)));
+ graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
+ (int) (mAlpha * 255.0f)));
graphics->setFont(getFont());
const int fontHeight = getFont()->getHeight();
@@ -71,7 +71,7 @@ void ListBox::draw(gcn::Graphics *graphics)
getWidth(), fontHeight));
// Draw the list elements
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
for (int i = 0, y = 0; i < mListModel->getNumberOfElements();
++i, y += fontHeight)
{
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 99a8c36a..028658ab 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -41,11 +41,10 @@ float ProgressBar::mAlpha = 1.0;
ProgressBar::ProgressBar(float progress,
int width, int height,
- const gcn::Color &color):
+ int color):
gcn::Widget(),
mSmoothProgress(true),
- mColor(color),
- mColorToGo(color),
+ mProgressPalette(color),
mSmoothColorChange(true)
{
// The progress value is directly set at load time:
@@ -54,6 +53,9 @@ ProgressBar::ProgressBar(float progress,
mProgress = mProgressToGo = progress;
+ mColor = mColorToGo = Theme::getProgressColor(color >= 0 ? color : 0,
+ mProgress);
+
setSize(width, height);
if (mInstances == 0)
@@ -156,6 +158,22 @@ void ProgressBar::setProgress(float progress)
if (!mSmoothProgress)
mProgress = p;
+
+ if (mProgressPalette >= 0)
+ {
+ mColorToGo = Theme::getProgressColor(mProgressPalette, progress);
+ }
+}
+
+void ProgressBar::setProgressPalette(int progressPalette)
+{
+ int oldPalette = mProgressPalette;
+ mProgressPalette = progressPalette;
+
+ if (mProgressPalette != oldPalette && mProgressPalette >= 0)
+ {
+ mColorToGo = Theme::getProgressColor(mProgressPalette, mProgressToGo);
+ }
}
void ProgressBar::setColor(const gcn::Color &color)
@@ -192,7 +210,7 @@ void ProgressBar::render(Graphics *graphics, const gcn::Rectangle &area,
TextRenderer::renderText(graphics, text, textX, textY,
gcn::Graphics::CENTER,
- guiPalette->getColor(Palette::PROGRESS_BAR),
+ Theme::getThemeColor(Theme::PROGRESS_BAR),
gui->getFont(), true, false);
}
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index a6bb49d9..56bcb0a0 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -42,7 +42,7 @@ class ProgressBar : public gcn::Widget
*/
ProgressBar(float progress = 0.0f,
int width = 40, int height = 7,
- const gcn::Color &color = gcn::Color(150, 150, 150));
+ int color = -1);
~ProgressBar();
@@ -72,17 +72,15 @@ class ProgressBar : public gcn::Widget
float getProgress() const { return mProgress; }
/**
- * Change the color of the progress bar.
+ * Change the ProgressPalette for this ProgressBar to follow or -1 to
+ * disable this and manage color manually.
*/
- void setColor(const gcn::Color &color);
+ void setProgressPalette(int progressPalette);
/**
* Change the color of the progress bar.
- *
- * This is an overload provided for convenience.
*/
- inline void setColor(int r, int g, int b)
- { setColor(gcn::Color(r, g, b)); }
+ void setColor(const gcn::Color &color);
/**
* Returns the color of the progress bar.
@@ -124,6 +122,7 @@ class ProgressBar : public gcn::Widget
float mProgress, mProgressToGo;
bool mSmoothProgress;
+ int mProgressPalette; /** < Entry in ProgressPalette or -1 for none. */
gcn::Color mColor;
gcn::Color mColorToGo;
bool mSmoothColorChange;
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index 1941da4a..6bda617f 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -20,15 +20,15 @@
#include "progressindicator.h"
+#include "graphics.h"
+#include "simpleanimation.h"
+
#include "gui/theme.h"
#include "resources/animation.h"
#include "resources/imageset.h"
#include "resources/resourcemanager.h"
-#include "graphics.h"
-#include "simpleanimation.h"
-
#include <guichan/widgets/label.hpp>
ProgressIndicator::ProgressIndicator()
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index fc9fc4d4..2f5fab34 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -26,7 +26,7 @@
#include "shopitem.h"
#include "gui/itempopup.h"
-#include "gui/palette.h"
+#include "gui/theme.h"
#include "gui/viewport.h"
#include "gui/widgets/shopitems.h"
@@ -76,7 +76,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
int alpha = (int)(mAlpha * 255.0f);
const gcn::Color* highlightColor =
- &guiPalette->getColor(Palette::HIGHLIGHT, alpha);
+ &Theme::getThemeColor(Theme::HIGHLIGHT, alpha);
Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
@@ -89,19 +89,19 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
{
gcn::Color temp;
const gcn::Color* backgroundColor =
- &guiPalette->getColor(Palette::BACKGROUND, alpha);
+ &Theme::getThemeColor(Theme::BACKGROUND, alpha);
if (mShopItems &&
mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck)
{
if (i != mSelected)
{
- backgroundColor = &guiPalette->getColor(Palette::SHOP_WARNING,
- alpha);
+ backgroundColor = &Theme::getThemeColor(Theme::SHOP_WARNING,
+ alpha);
}
else
{
- temp = guiPalette->getColor(Palette::SHOP_WARNING, alpha);
+ temp = Theme::getThemeColor(Theme::SHOP_WARNING, alpha);
temp.r = (temp.r + highlightColor->r) / 2;
temp.g = (temp.g + highlightColor->g) / 2;
temp.b = (temp.g + highlightColor->b) / 2;
@@ -125,7 +125,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
graphics->drawImage(icon, 1, y);
}
}
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
graphics->drawText(mListModel->getElementAt(i), ITEM_ICON_SIZE + 5,
y + (ITEM_ICON_SIZE - getFont()->getHeight()) / 2);
}
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index d770dbfe..2ab126dd 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -63,7 +63,7 @@ static TabData const data[TAB_COUNT] = {
ImageRect Tab::tabImg[TAB_COUNT];
Tab::Tab() : gcn::Tab(),
- mTabColor(&guiPalette->getColor(Palette::TAB))
+ mTabColor(&Theme::getThemeColor(Theme::TAB))
{
init();
}
@@ -85,7 +85,7 @@ void Tab::init()
{
setFocusable(false);
setFrameSize(0);
- mHighlighted = false;
+ mFlash = false;
if (mInstances == 0)
{
@@ -148,15 +148,15 @@ void Tab::draw(gcn::Graphics *graphics)
{
mode = TAB_SELECTED;
// if tab is selected, it doesnt need to highlight activity
- mHighlighted = false;
+ mFlash = false;
}
else if (mHasMouse)
{
mode = TAB_HIGHLIGHTED;
}
- if (mHighlighted)
+ if (mFlash)
{
- mLabel->setForegroundColor(guiPalette->getColor(Palette::TAB_HIGHLIGHT));
+ mLabel->setForegroundColor(Theme::getThemeColor(Theme::TAB_FLASH));
}
}
@@ -175,7 +175,7 @@ void Tab::setTabColor(const gcn::Color *color)
mTabColor = color;
}
-void Tab::setHighlighted(bool high)
+void Tab::setFlash(bool flash)
{
- mHighlighted = high;
+ mFlash = flash;
}
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index 7b372e04..433084f9 100644
--- a/src/gui/widgets/tab.h
+++ b/src/gui/widgets/tab.h
@@ -53,9 +53,9 @@ class Tab : public gcn::Tab
void setTabColor(const gcn::Color *color);
/**
- * Set tab highlighted
+ * Set tab flashing state
*/
- void setHighlighted(bool high);
+ void setFlash(bool flash);
protected:
friend class TabbedArea;
@@ -70,7 +70,7 @@ class Tab : public gcn::Tab
static float mAlpha;
const gcn::Color *mTabColor;
- bool mHighlighted;
+ bool mFlash;
};
#endif
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index 0bc4f3d1..f0887ed7 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -23,8 +23,8 @@
#include "configuration.h"
-#include "gui/palette.h"
#include "gui/sdlinput.h"
+#include "gui/theme.h"
#include "utils/dtor.h"
@@ -275,7 +275,7 @@ void GuiTable::draw(gcn::Graphics* graphics)
if (mOpaque)
{
- graphics->setColor(guiPalette->getColor(Palette::BACKGROUND,
+ graphics->setColor(Theme::getThemeColor(Theme::BACKGROUND,
(int)(mAlpha * 255.0f)));
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
}
@@ -321,8 +321,8 @@ void GuiTable::draw(gcn::Graphics* graphics)
widget->setDimension(bounds);
- graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
- (int)(mAlpha * 255.0f)));
+ graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
+ (int)(mAlpha * 255.0f)));
if (mLinewiseMode && r == mSelectedRow && c == 0)
{
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 9f79c963..f248f35d 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -21,14 +21,14 @@
#include "gui/widgets/textbox.h"
-#include "gui/palette.h"
+#include "gui/theme.h"
#include <guichan/font.hpp>
#include <sstream>
TextBox::TextBox() :
- mTextColor(&guiPalette->getColor(Palette::TEXT))
+ mTextColor(&Theme::getThemeColor(Theme::TEXT))
{
setOpaque(false);
setFrameSize(0);
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 1fab4eb7..4453f522 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -108,7 +108,7 @@ void TextField::draw(gcn::Graphics *graphics)
mXScroll);
}
- graphics->setColor(guiPalette->getColor(Palette::TEXT));
+ graphics->setColor(Theme::getThemeColor(Theme::TEXT));
graphics->setFont(getFont());
graphics->drawText(mText, 1 - mXScroll, 1);
}
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 209752b2..10426d7c 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -37,9 +37,9 @@ TextPreview::TextPreview(const std::string &text):
{
mTextAlpha = false;
mFont = gui->getFont();
- mTextColor = &guiPalette->getColor(Palette::TEXT);
+ mTextColor = &Theme::getThemeColor(Theme::TEXT);
mTextBGColor = NULL;
- mBGColor = &guiPalette->getColor(Palette::BACKGROUND);
+ mBGColor = &Theme::getThemeColor(Theme::BACKGROUND);
mOpaque = false;
}
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 124b3165..858a2e6b 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -24,7 +24,7 @@
#include "commandhandler.h"
#include "localplayer.h"
-#include "gui/palette.h"
+#include "gui/theme.h"
#include "net/chathandler.h"
#include "net/net.h"
@@ -36,7 +36,7 @@ WhisperTab::WhisperTab(const std::string &nick) :
ChatTab(nick),
mNick(nick)
{
- setTabColor(&guiPalette->getColor(Palette::WHISPER));
+ setTabColor(&Theme::getThemeColor(Theme::WHISPER));
}
WhisperTab::~WhisperTab()
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index b3d6bd02..2db3afb5 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -122,7 +122,7 @@ void Window::draw(gcn::Graphics *graphics)
// Draw title
if (mShowTitle)
{
- g->setColor(guiPalette->getColor(Palette::TEXT));
+ g->setColor(Theme::getThemeColor(Theme::TEXT));
g->setFont(getFont());
g->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
}