diff options
Diffstat (limited to 'src/gui/widgets/colorpage.cpp')
-rw-r--r-- | src/gui/widgets/colorpage.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index 11dd1f07e..501b3dea7 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -20,20 +20,20 @@ #include "gui/widgets/colorpage.h" -#include "gui/widgets/colormodel.h" +#include "gui/models/colormodel.h" -#include <guichan/font.hpp> +#include "gui/font.h" #include "debug.h" ColorPage::ColorPage(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin) : ListBox(widget, listModel, skin) { mItemPadding = mSkin ? mSkin->getOption("itemPadding") : 1; mRowHeight = 13; - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); if (font) mRowHeight = font->getHeight() + 2 * mItemPadding; if (mListModel) @@ -47,43 +47,42 @@ ColorPage::~ColorPage() { } -void ColorPage::draw(gcn::Graphics *graphics) +void ColorPage::draw(Graphics *graphics) { BLOCK_START("ColorPage::draw") const ColorModel *const model = static_cast<ColorModel* const>( mListModel); - Graphics *const g = static_cast<Graphics *const>(graphics); mHighlightColor.a = static_cast<int>(mAlpha * 255.0F); graphics->setColor(mHighlightColor); updateAlpha(); - gcn::Font *const font = getFont(); + Font *const font = getFont(); const int rowHeight = getRowHeight(); const int width = mDimension.width; if (mSelected >= 0) { - graphics->fillRectangle(gcn::Rectangle(mPadding, + graphics->fillRectangle(Rect(mPadding, rowHeight * mSelected + mPadding, mDimension.width - 2 * mPadding, rowHeight)); const ColorPair *const colors = model->getColorAt(mSelected); - g->setColorAll(*colors->color1, *colors->color2); + graphics->setColorAll(*colors->color1, *colors->color2); const std::string str = mListModel->getElementAt(mSelected); font->drawString(graphics, str, (width - font->getWidth(str)) / 2, mSelected * rowHeight + mPadding); } - g->setColorAll(mForegroundColor, mForegroundColor2); + graphics->setColorAll(mForegroundColor, mForegroundColor2); const int sz = mListModel->getNumberOfElements(); for (int i = 0, y = mPadding; i < sz; ++i, y += rowHeight) { if (i != mSelected) { const ColorPair *const colors = model->getColorAt(i); - g->setColorAll(*colors->color1, *colors->color2); + graphics->setColorAll(*colors->color1, *colors->color2); const std::string str = mListModel->getElementAt(i); font->drawString(graphics, str, (width - font->getWidth(str)) / 2, y); |