summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorMajin Sniper <majinsniper@gmx.de>2009-03-12 22:42:42 +0100
committerJared Adams <jaxad0127@gmail.com>2009-03-12 19:38:55 -0600
commit3b1fbbe072e4da86be4c8f8f22655d04565379d2 (patch)
tree9bae46138230c01fd2998395e146556f9a9db05b /src/gui
parentb9191530c81595b0ad3d2faa6c4d21d75a720c29 (diff)
downloadmana-3b1fbbe072e4da86be4c8f8f22655d04565379d2.tar.gz
mana-3b1fbbe072e4da86be4c8f8f22655d04565379d2.tar.bz2
mana-3b1fbbe072e4da86be4c8f8f22655d04565379d2.tar.xz
mana-3b1fbbe072e4da86be4c8f8f22655d04565379d2.zip
Make use of the new available colors
This patch lets all being derivatives use the palette to set their name's colors. Text Particle Effects all respect the new settings. Some widgets were updated to use the colors.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/gui.cpp5
-rw-r--r--src/gui/listbox.cpp2
-rw-r--r--src/gui/shoplistbox.cpp2
-rw-r--r--src/gui/speechbubble.cpp5
-rw-r--r--src/gui/speechbubble.h4
-rw-r--r--src/gui/table.cpp2
-rw-r--r--src/gui/textbox.cpp5
-rw-r--r--src/gui/textbox.h15
-rw-r--r--src/gui/widgets/dropdown.cpp16
-rw-r--r--src/gui/widgets/textpreview.cpp2
10 files changed, 36 insertions, 22 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index e14642dd..4081eeac 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -46,11 +46,6 @@
Gui *gui = 0;
Viewport *viewport = 0; /**< Viewport on the map. */
SDLInput *guiInput = 0;
-/*
-// Fonts used in showing hits
-gcn::Font *hitRedFont = 0;
-gcn::Font *hitBlueFont = 0;
-gcn::Font *hitYellowFont = 0;*/
// Bolded font
gcn::Font *boldFont = 0;
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 23d43066..7ba84ee7 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -56,7 +56,7 @@ void ListBox::draw(gcn::Graphics *graphics)
getWidth(), fontHeight));
// Draw the list elements
- graphics->setColor(gcn::Color(0, 0, 0, 255));
+ graphics->setColor(guiPalette->getColor(Palette::TEXT));
for (int i = 0, y = 0; i < mListModel->getNumberOfElements();
++i, y += fontHeight)
{
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 19c8a7b4..aa42c294 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -78,7 +78,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
{
gcn::Color temp;
const gcn::Color* backgroundColor =
- &guiPalette->getColor(Palette::BACKGROUND, alpha);
+ &guiPalette->getColor(Palette::BACKGROUND, alpha);
if (mShopItems &&
mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck)
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index 9ee91166..5f05971d 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -45,6 +45,7 @@ SpeechBubble::SpeechBubble():
mSpeechBox = new TextBox;
mSpeechBox->setEditable(false);
mSpeechBox->setOpaque(false);
+ mSpeechBox->setTextColor(&guiPalette->getColor(Palette::CHAT));
mSpeechArea = new ScrollArea(mSpeechBox);
@@ -60,11 +61,11 @@ SpeechBubble::SpeechBubble():
setLocationRelativeTo(getParent());
}
-void SpeechBubble::setCaption(const std::string &name, const gcn::Color &color)
+void SpeechBubble::setCaption(const std::string &name, const gcn::Color *color)
{
mCaption->setCaption(name);
mCaption->adjustSize();
- mCaption->setForegroundColor(color);
+ mCaption->setForegroundColor(*color);
}
void SpeechBubble::setText(std::string text, bool showName)
diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h
index 573e61f0..34e00722 100644
--- a/src/gui/speechbubble.h
+++ b/src/gui/speechbubble.h
@@ -22,6 +22,7 @@
#ifndef SPEECHBUBBLE_H
#define SPEECHBUBBLE_H
+#include "palette.h"
#include "window.h"
class ScrollArea;
@@ -33,7 +34,8 @@ class SpeechBubble : public Window
SpeechBubble();
void setCaption(const std::string &name,
- const gcn::Color &color = 0x000000);
+ const gcn::Color *color =
+ &guiPalette->getColor(Palette::TEXT));
void setText(std::string text, bool showName = true);
void setLocation(int x, int y);
unsigned int getNumRows();
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index ece470b1..5fc96dbd 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -338,6 +338,8 @@ void GuiTable::draw(gcn::Graphics* graphics)
{
graphics->setColor(guiPalette->getColor(Palette::HIGHLIGHT,
(int)(mAlpha * 127.0f)));
+ graphics->fillRectangle(gcn::Rectangle(0, y_offset,
+ x_offset, height));
}
y_offset += height;
diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp
index a4024de3..10f727e3 100644
--- a/src/gui/textbox.cpp
+++ b/src/gui/textbox.cpp
@@ -23,10 +23,11 @@
#include <guichan/font.hpp>
+#include "palette.h"
#include "textbox.h"
-TextBox::TextBox():
- gcn::TextBox()
+TextBox::TextBox() :
+ gcn::TextBox(), mTextColor(&guiPalette->getColor(Palette::TEXT))
{
setOpaque(false);
setFrameSize(0);
diff --git a/src/gui/textbox.h b/src/gui/textbox.h
index 10a81fc0..5884e11c 100644
--- a/src/gui/textbox.h
+++ b/src/gui/textbox.h
@@ -39,6 +39,11 @@ class TextBox : public gcn::TextBox
*/
TextBox();
+ inline void setTextColor(const gcn::Color* color)
+ {
+ mTextColor = color;
+ }
+
/**
* Sets the text after wrapping it to the current width of the widget.
*/
@@ -49,8 +54,18 @@ class TextBox : public gcn::TextBox
*/
int getMinWidth() { return mMinWidth; }
+ /**
+ * Draws the text.
+ */
+ inline void draw(gcn::Graphics *graphics)
+ {
+ setForegroundColor(*mTextColor);
+ gcn::TextBox::draw(graphics);
+ }
+
private:
int mMinWidth;
+ const gcn::Color* mTextColor;
};
#endif
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 022da0f0..b736591c 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -139,24 +139,20 @@ void DropDown::draw(gcn::Graphics* graphics)
}
}
-// bool valid;
const int alpha = (int)(mAlpha * 255.0f);
gcn::Color faceColor = getBaseColor();
faceColor.a = alpha;
- gcn::Color highlightColor = guiPalette->getColor(Palette::HIGHLIGHT, alpha);
+ const gcn::Color* highlightColor = &guiPalette->getColor(Palette::HIGHLIGHT,
+ alpha);
gcn::Color shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
if (mOpaque)
{
- gcn::Color col = getBackgroundColor();
- col.a = alpha;
- graphics->setColor(col);
+ graphics->setColor(guiPalette->getColor(Palette::BACKGROUND, alpha));
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), h));
- col = getForegroundColor();
- col.a = alpha;
- graphics->setColor(col);
+ graphics->setColor(guiPalette->getColor(Palette::TEXT, alpha));
}
graphics->setFont(getFont());
@@ -168,7 +164,7 @@ void DropDown::draw(gcn::Graphics* graphics)
if (isFocused())
{
- graphics->setColor(highlightColor);
+ graphics->setColor(*highlightColor);
graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth() - h, h));
}
@@ -180,7 +176,7 @@ void DropDown::draw(gcn::Graphics* graphics)
// Draw two lines separating the ListBox with selected
// element view.
- graphics->setColor(highlightColor);
+ graphics->setColor(*highlightColor);
graphics->drawLine(0, h, getWidth(), h);
graphics->setColor(shadowColor);
graphics->drawLine(0, h + 1, getWidth(), h + 1);
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 28d7fd35..4fcaa4a7 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -19,6 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <typeinfo>
+
#include "textpreview.h"
#include "../gui.h"