diff options
Diffstat (limited to 'src/gui/widgets/tabs')
36 files changed, 274 insertions, 253 deletions
diff --git a/src/gui/widgets/tabs/chattab.cpp b/src/gui/widgets/tabs/chattab.cpp index 331101209..fe979ae5a 100644 --- a/src/gui/widgets/tabs/chattab.cpp +++ b/src/gui/widgets/tabs/chattab.cpp @@ -24,6 +24,7 @@ #include "chatlogger.h" #include "client.h" +#include "commands.h" #include "commandhandler.h" #include "configuration.h" #include "soundconsts.h" @@ -50,12 +51,13 @@ static const unsigned int MAX_WORD_SIZE = 50; -ChatTab::ChatTab(const Widget2 *const widget, const std::string &name, +ChatTab::ChatTab(const Widget2 *const widget, + const std::string &name, const std::string &channel) : Tab(widget), mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), - mScrollArea(new ScrollArea(mTextOutput, false)), + mScrollArea(new ScrollArea(this, mTextOutput, false)), mChannelName(channel), mAllowHightlight(true), mRemoveNames(false), @@ -405,7 +407,7 @@ void ChatTab::chatInput(const std::string &message) void ChatTab::scroll(const int amount) { const int range = mScrollArea->getHeight() / 8 * amount; - gcn::Rectangle scr; + Rect scr; scr.y = mScrollArea->getVerticalScrollAmount() + range; scr.height = abs(range); mTextOutput->showPart(scr); diff --git a/src/gui/widgets/tabs/chattab.h b/src/gui/widgets/tabs/chattab.h index 651e69d6b..a46279483 100644 --- a/src/gui/widgets/tabs/chattab.h +++ b/src/gui/widgets/tabs/chattab.h @@ -58,7 +58,8 @@ class ChatTab : public Tab /** * Constructor. */ - ChatTab(const Widget2 *const widget, const std::string &name, + ChatTab(const Widget2 *const widget, + const std::string &name, const std::string &channel); A_DELETE_COPY(ChatTab) diff --git a/src/gui/widgets/tabs/guildchattab.h b/src/gui/widgets/tabs/guildchattab.h index fbfd3a032..cfcf901ca 100644 --- a/src/gui/widgets/tabs/guildchattab.h +++ b/src/gui/widgets/tabs/guildchattab.h @@ -28,7 +28,8 @@ /** * A tab for a guild chat channel. */ -class GuildChatTab final : public ChatTab, public ConfigListener +class GuildChatTab final : public ChatTab, + public ConfigListener { public: explicit GuildChatTab(const Widget2 *const widget); diff --git a/src/gui/widgets/tabs/langtab.cpp b/src/gui/widgets/tabs/langtab.cpp index fb6a5e12b..f5064be8c 100644 --- a/src/gui/widgets/tabs/langtab.cpp +++ b/src/gui/widgets/tabs/langtab.cpp @@ -26,7 +26,8 @@ #include "debug.h" -LangTab::LangTab(const Widget2 *const widget, const std::string &lang) : +LangTab::LangTab(const Widget2 *const widget, + const std::string &lang) : // TRANSLATORS: lang chat tab name ChatTab(widget, _("Lang"), lang + " ") { diff --git a/src/gui/widgets/tabs/langtab.h b/src/gui/widgets/tabs/langtab.h index 275b69399..e036e4dd8 100644 --- a/src/gui/widgets/tabs/langtab.h +++ b/src/gui/widgets/tabs/langtab.h @@ -26,7 +26,8 @@ class LangTab final : public ChatTab { public: - LangTab(const Widget2 *const widget, const std::string &lang); + LangTab(const Widget2 *const widget, + const std::string &lang); A_DELETE_COPY(LangTab) diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp index 1bb119ee4..6cf675635 100644 --- a/src/gui/widgets/tabs/setup_audio.cpp +++ b/src/gui/widgets/tabs/setup_audio.cpp @@ -30,28 +30,15 @@ #include "gui/viewport.h" +#include "gui/models/soundsmodel.h" + #include "gui/widgets/layouthelper.h" -#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "utils/gettext.h" #include "debug.h" -class SoundsModel final : public NamesModel -{ -public: - SoundsModel() : - NamesModel() - { - mNames.push_back(gettext("(no sound)")); - Theme::fillSoundsList(mNames); - } - - ~SoundsModel() - { } -}; - Setup_Audio::Setup_Audio(const Widget2 *const widget) : SetupTabScroll(widget), mSoundModel(new SoundsModel), @@ -168,7 +155,7 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) : new SetupItemCheckBox(_("Download music"), "", "download-music", this, "download-musicEvent"); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } Setup_Audio::~Setup_Audio() diff --git a/src/gui/widgets/tabs/setup_audio.h b/src/gui/widgets/tabs/setup_audio.h index 839734b39..b3736e814 100644 --- a/src/gui/widgets/tabs/setup_audio.h +++ b/src/gui/widgets/tabs/setup_audio.h @@ -25,6 +25,8 @@ #include "gui/widgets/setupitem.h" +#include "gui/widgets/tabs/setuptabscroll.h" + class Setup_Audio final : public SetupTabScroll { public: @@ -37,7 +39,7 @@ class Setup_Audio final : public SetupTabScroll void apply() override final; private: - gcn::ListModel *mSoundModel; + ListModel *mSoundModel; SetupItemNames *mChannelsList; }; diff --git a/src/gui/widgets/tabs/setup_chat.cpp b/src/gui/widgets/tabs/setup_chat.cpp index 3aa6d39d2..7ac88ab0a 100644 --- a/src/gui/widgets/tabs/setup_chat.cpp +++ b/src/gui/widgets/tabs/setup_chat.cpp @@ -195,7 +195,7 @@ Setup_Chat::Setup_Chat(const Widget2 *const widget) : new SetupItemCheckBox(_("Show motd server message on start"), "", "showmotd", this, "showmotdEvent"); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } void Setup_Chat::apply() diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 1094f5e29..ac6bf2837 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -21,7 +21,8 @@ #include "gui/widgets/tabs/setup_colors.h" -#include "gui/sdlfont.h" +#include "gui/font.h" +#include "gui/gui.h" #include "gui/userpalette.h" #include "gui/widgets/browserbox.h" @@ -47,34 +48,35 @@ const char *const Setup_Colors::rawmsg = Setup_Colors::Setup_Colors(const Widget2 *const widget) : SetupTab(widget), - gcn::SelectionListener(), + SelectionListener(), mColorBox(new ListBox(this, userPalette, "")), - mScroll(new ScrollArea(mColorBox, true, "setup_colors_background.xml")), + mScroll(new ScrollArea(this, mColorBox, + true, "setup_colors_background.xml")), mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), mTextPreview(new TextPreview(this, gettext(rawmsg))), - mPreviewBox(new ScrollArea(mPreview, true, + mPreviewBox(new ScrollArea(this, mPreview, true, "setup_colors_preview_background.xml")), mSelected(-1), // TRANSLATORS: colors tab. label. mGradTypeLabel(new Label(this, _("Type:"))), - mGradTypeSlider(new Slider(0, 3)), + mGradTypeSlider(new Slider(this, 0, 3)), mGradTypeText(new Label(this)), // TRANSLATORS: colors tab. label. mGradDelayLabel(new Label(this, _("Delay:"))), - mGradDelaySlider(new Slider(20, 100)), + mGradDelaySlider(new Slider(this, 20, 100)), mGradDelayText(new TextField(this)), // TRANSLATORS: colors tab. label. mRedLabel(new Label(this, _("Red:"))), - mRedSlider(new Slider(0, 255)), + mRedSlider(new Slider(this, 0, 255)), mRedText(new TextField(this)), // TRANSLATORS: colors tab. label. mGreenLabel(new Label(this, _("Green:"))), - mGreenSlider(new Slider(0, 255)), + mGreenSlider(new Slider(this, 0, 255)), mGreenText(new TextField(this)), // TRANSLATORS: colors tab. label. mBlueLabel(new Label(this, _("Blue:"))), - mBlueSlider(new Slider(0, 255)), + mBlueSlider(new Slider(this, 0, 255)), mBlueText(new TextField(this)) { mColorBox->postInit(); @@ -101,7 +103,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : // TRANSLATORS: color type std::string longText = _("Static"); - const gcn::Font *const font = getFont(); + const Font *const font = getFont(); if (getFont()->getWidth(_("Pulse")) > font->getWidth(longText)) { // TRANSLATORS: color type @@ -190,7 +192,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mGradTypeText->setCaption(""); - setDimension(gcn::Rectangle(0, 0, 365, 350)); + setDimension(Rect(0, 0, 365, 350)); } Setup_Colors::~Setup_Colors() @@ -207,7 +209,7 @@ Setup_Colors::~Setup_Colors() } } -void Setup_Colors::action(const gcn::ActionEvent &event) +void Setup_Colors::action(const ActionEvent &event) { const std::string &eventId = event.getId(); if (eventId == "slider_grad") @@ -244,14 +246,14 @@ void Setup_Colors::action(const gcn::ActionEvent &event) } } -void Setup_Colors::valueChanged(const gcn::SelectionEvent &event A_UNUSED) +void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) { if (!userPalette) return; mSelected = mColorBox->getSelected(); const int type = userPalette->getColorTypeAt(mSelected); - const gcn::Color *col = &userPalette->getColor(type); + const Color *col = &userPalette->getColor(type); const Palette::GradientType grad = userPalette->getGradientType(type); const int delay = userPalette->getGradientDelay(type); @@ -381,7 +383,7 @@ void Setup_Colors::cancel() userPalette->rollback(); const int type = userPalette->getColorTypeAt(mSelected); - const gcn::Color *const col = &userPalette->getColor(type); + const Color *const col = &userPalette->getColor(type); mGradTypeSlider->setValue2(userPalette->getGradientType(type)); const int delay = userPalette->getGradientDelay(type); setEntry(mGradDelaySlider, mGradDelayText, delay); @@ -442,7 +444,7 @@ void Setup_Colors::updateColor() } else if (grad == Palette::PULSE) { - userPalette->setTestColor(type, gcn::Color( + userPalette->setTestColor(type, Color( static_cast<int>(mRedSlider->getValue()), static_cast<int>(mGreenSlider->getValue()), static_cast<int>(mBlueSlider->getValue()))); diff --git a/src/gui/widgets/tabs/setup_colors.h b/src/gui/widgets/tabs/setup_colors.h index b2f860415..ce491706c 100644 --- a/src/gui/widgets/tabs/setup_colors.h +++ b/src/gui/widgets/tabs/setup_colors.h @@ -24,9 +24,7 @@ #include "gui/widgets/tabs/setuptab.h" -#include <guichan/selectionlistener.hpp> - -#include <string> +#include "listeners/selectionlistener.h" class BrowserBox; class Label; @@ -37,7 +35,7 @@ class TextField; class TextPreview; class Setup_Colors final : public SetupTab, - public gcn::SelectionListener + public SelectionListener { public: explicit Setup_Colors(const Widget2 *const widget); @@ -50,9 +48,9 @@ class Setup_Colors final : public SetupTab, void cancel() override final; - void action(const gcn::ActionEvent &event) override final; + void action(const ActionEvent &event) override final; - void valueChanged(const gcn::SelectionEvent &event) override final; + void valueChanged(const SelectionEvent &event) override final; private: static const char *const rawmsg; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 9ce6fd616..b04937881 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -28,6 +28,7 @@ #include "input/inputmanager.h" #include "input/keyboardconfig.h" +#include "gui/gui.h" #include "gui/setupactiondata.h" #include "gui/windows/okdialog.h" @@ -38,7 +39,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tabstrip.h" -#include <guichan/listmodel.hpp> +#include "gui/models/listmodel.h" #include "debug.h" @@ -50,7 +51,7 @@ static const int setupGroups = 9; * * \ingroup Interface */ -class KeyListModel final : public gcn::ListModel +class KeyListModel final : public ListModel { public: KeyListModel() : @@ -103,7 +104,8 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : // TRANSLATORS: button in input settings tab mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys", this)), mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10)), - mScrollArea(new ScrollArea(mKeyList, true, "setup_input_background.xml")), + mScrollArea(new ScrollArea(this, mKeyList, + true, "setup_input_background.xml")), mKeySetting(false), mActionDataSize(new int [9]) { @@ -125,7 +127,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : mKeyListModel->setSize(mActionDataSize[0]); refreshKeys(); if (gui) - mKeyList->setFont(reinterpret_cast<gcn::Font*>(gui->getHelpFont())); + mKeyList->setFont(gui->getHelpFont()); mKeyList->addActionListener(this); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); @@ -162,7 +164,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : if (config.getIntValue("screenwidth") >= 730) width += 100; - setDimension(gcn::Rectangle(0, 0, width, 350)); + setDimension(Rect(0, 0, width, 350)); } Setup_Input::~Setup_Input() @@ -213,7 +215,7 @@ void Setup_Input::cancel() refreshKeys(); } -void Setup_Input::action(const gcn::ActionEvent &event) +void Setup_Input::action(const ActionEvent &event) { const std::string id = event.getId(); diff --git a/src/gui/widgets/tabs/setup_input.h b/src/gui/widgets/tabs/setup_input.h index 135cb3339..43ec53b56 100644 --- a/src/gui/widgets/tabs/setup_input.h +++ b/src/gui/widgets/tabs/setup_input.h @@ -55,7 +55,7 @@ class Setup_Input final : public SetupTab void cancel() override final; - void action(const gcn::ActionEvent &event) override final; + void action(const ActionEvent &event) override final; /** * Get an update on the assigned key. diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp index 6f023a488..b3d7b78b9 100644 --- a/src/gui/widgets/tabs/setup_joystick.cpp +++ b/src/gui/widgets/tabs/setup_joystick.cpp @@ -26,12 +26,13 @@ #include "input/joystick.h" +#include "gui/models/namesmodel.h" + #include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" #include "gui/widgets/dropdown.h" #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" -#include "gui/widgets/namesmodel.h" #include "utils/gettext.h" @@ -93,7 +94,7 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) : place(0, 4, mCalibrateLabel); place(0, 5, mCalibrateButton); - setDimension(gcn::Rectangle(0, 0, 365, 75)); + setDimension(Rect(0, 0, 365, 75)); } Setup_Joystick::~Setup_Joystick() @@ -102,9 +103,9 @@ Setup_Joystick::~Setup_Joystick() mNamesModel = nullptr; } -void Setup_Joystick::action(const gcn::ActionEvent &event) +void Setup_Joystick::action(const ActionEvent &event) { - const gcn::Widget *const source = event.getSource(); + const Widget *const source = event.getSource(); if (source == mJoystickEnabled) { setTempEnabled(mJoystickEnabled->isSelected()); diff --git a/src/gui/widgets/tabs/setup_joystick.h b/src/gui/widgets/tabs/setup_joystick.h index 5c7b764ec..ac6caef24 100644 --- a/src/gui/widgets/tabs/setup_joystick.h +++ b/src/gui/widgets/tabs/setup_joystick.h @@ -44,7 +44,7 @@ class Setup_Joystick final : public SetupTab void cancel() override final; - void action(const gcn::ActionEvent &event) override final; + void action(const ActionEvent &event) override final; void setTempEnabled(const bool sel); diff --git a/src/gui/widgets/tabs/setup_mods.cpp b/src/gui/widgets/tabs/setup_mods.cpp index ada0ef686..b30b84c16 100644 --- a/src/gui/widgets/tabs/setup_mods.cpp +++ b/src/gui/widgets/tabs/setup_mods.cpp @@ -44,7 +44,7 @@ Setup_Mods::Setup_Mods(const Widget2 *const widget) : ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, mScroll, 10, 10); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } Setup_Mods::~Setup_Mods() diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 985baa744..e4801506c 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -22,8 +22,9 @@ #include "gui/widgets/tabs/setup_other.h" +#include "gui/models/namesmodel.h" + #include "gui/widgets/layouthelper.h" -#include "gui/widgets/namesmodel.h" #include "gui/widgets/setupitem.h" #include "gui/widgets/scrollarea.h" @@ -390,7 +391,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : new SetupItemDropDown(_("Screen density override"), "", "screenDensity", this, "screenDensityEvent", mDensityList, 100); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } Setup_Other::~Setup_Other() diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp index 271501e38..5a0566ec2 100644 --- a/src/gui/widgets/tabs/setup_perfomance.cpp +++ b/src/gui/widgets/tabs/setup_perfomance.cpp @@ -22,8 +22,9 @@ #include "gui/widgets/tabs/setup_perfomance.h" +#include "gui/models/namesmodel.h" + #include "gui/widgets/layouthelper.h" -#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/setupitem.h" @@ -153,7 +154,7 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : "", "uselonglivesounds", this, "uselonglivesoundsEvent"); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } Setup_Perfomance::~Setup_Perfomance() diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp index d4f29fa2c..01bb60f53 100644 --- a/src/gui/widgets/tabs/setup_players.cpp +++ b/src/gui/widgets/tabs/setup_players.cpp @@ -100,5 +100,5 @@ Setup_Players::Setup_Players(const Widget2 *const widget) : new SetupItemCheckBox(_("Use special diagonal speed in players moving"), "", "useDiagonalSpeed", this, "useDiagonalSpeedEvent"); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 89d1f5beb..1458ecd25 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -26,6 +26,9 @@ #include "being/localplayer.h" +#include "gui/models/ignorechoiceslistmodel.h" +#include "gui/models/playerrelationlistmodel.h" + #include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" #include "gui/widgets/dropdown.h" @@ -60,43 +63,6 @@ static const char *const table_titles[COLUMNS_NR] = N_("Relation") }; -static const char *const RELATION_NAMES[PlayerRelation::RELATIONS_NR] = -{ - // TRANSLATORS: relation type - N_("Neutral"), - // TRANSLATORS: relation type - N_("Friend"), - // TRANSLATORS: relation type - N_("Disregarded"), - // TRANSLATORS: relation type - N_("Ignored"), - // TRANSLATORS: relation type - N_("Erased"), - // TRANSLATORS: relation type - N_("Blacklisted"), - // TRANSLATORS: relation type - N_("Enemy") -}; - -class PlayerRelationListModel final : public gcn::ListModel -{ -public: - ~PlayerRelationListModel() - { } - - int getNumberOfElements() override final - { - return PlayerRelation::RELATIONS_NR; - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return ""; - return gettext(RELATION_NAMES[i]); - } -}; - class PlayerTableModel final : public Widget2, public TableModel { public: @@ -165,7 +131,7 @@ public: player_names->size()); r < sz; ++r) { const std::string name = (*player_names)[r]; - gcn::Widget *const widget = new Label(this, name); + Widget *const widget = new Label(this, name); mWidgets.push_back(widget); DropDown *const choicebox = new DropDown(this, mListModel); @@ -186,7 +152,7 @@ public: } - gcn::Widget *getElementAt(int row, int column) const override final + Widget *getElementAt(int row, int column) const override final { return mWidgets[WIDGET_AT(row, column)]; } @@ -209,35 +175,10 @@ public: protected: StringVect *mPlayers; - std::vector<gcn::Widget *> mWidgets; + std::vector<Widget *> mWidgets; PlayerRelationListModel *mListModel; }; -/** - * Class for choosing one of the various `what to do when ignoring a player' options - */ -class IgnoreChoicesListModel final : public gcn::ListModel -{ -public: - ~IgnoreChoicesListModel() - { } - - int getNumberOfElements() override final - { - return static_cast<int>(player_relations.getPlayerIgnoreStrategies() - ->size()); - } - - std::string getElementAt(int i) override final - { - if (i >= getNumberOfElements() || i < 0) - return "???"; - - return (*player_relations.getPlayerIgnoreStrategies()) - [i]->mDescription; - } -}; - static const std::string ACTION_DELETE("delete"); static const std::string ACTION_TABLE("table"); static const std::string ACTION_STRATEGY("strategy"); @@ -249,7 +190,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : mPlayerTableModel(new PlayerTableModel(this)), mPlayerTable(new GuiTable(this, mPlayerTableModel)), mPlayerTitleTable(new GuiTable(this, mPlayerTableTitleModel)), - mPlayerScrollArea(new ScrollArea(mPlayerTable)), + mPlayerScrollArea(new ScrollArea(this, mPlayerTable)), // TRANSLATORS: relation dialog button mDefaultTrading(new CheckBox(this, _("Allow trading"), player_relations.getDefault() & PlayerRelation::TRADE)), @@ -319,7 +260,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : player_relations.addListener(this); - setDimension(gcn::Rectangle(0, 0, 500, 350)); + setDimension(Rect(0, 0, 500, 350)); } Setup_Relations::~Setup_Relations() @@ -370,7 +311,7 @@ void Setup_Relations::cancel() { } -void Setup_Relations::action(const gcn::ActionEvent &event) +void Setup_Relations::action(const ActionEvent &event) { const std::string &eventId = event.getId(); if (eventId == ACTION_TABLE) diff --git a/src/gui/widgets/tabs/setup_relations.h b/src/gui/widgets/tabs/setup_relations.h index c9d8e50a3..9fc197ffc 100644 --- a/src/gui/widgets/tabs/setup_relations.h +++ b/src/gui/widgets/tabs/setup_relations.h @@ -27,19 +27,17 @@ #include "gui/widgets/tabs/setuptab.h" +#include "listeners/playerrelationslistener.h" + class Button; class CheckBox; class DropDown; class GuiTable; +class ListModel; class PlayerTableModel; class ScrollArea; class StaticTableModel; -namespace gcn -{ - class ListModel; -} - class Setup_Relations final : public SetupTab, public PlayerRelationsListener { @@ -56,7 +54,7 @@ public: void reset(); - void action(const gcn::ActionEvent &event) override final; + void action(const ActionEvent &event) override final; void updatedPlayer(const std::string &name); @@ -76,7 +74,7 @@ private: Button *mDeleteButton; - gcn::ListModel *mIgnoreActionChoicesModel; + ListModel *mIgnoreActionChoicesModel; DropDown *mIgnoreActionChoicesBox; }; diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index d7cc4b4df..424828694 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -22,14 +22,18 @@ #include "gui/widgets/tabs/setup_theme.h" +#include "gui/gui.h" + #include "gui/windows/okdialog.h" +#include "gui/models/extendedlistmodel.h" +#include "gui/models/fontsmodel.h" +#include "gui/models/themesmodel.h" + #include "gui/widgets/button.h" #include "gui/widgets/dropdown.h" -#include "gui/widgets/extendedlistmodel.h" #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" -#include "gui/widgets/namesmodel.h" #include "configuration.h" @@ -51,31 +55,6 @@ const char* ACTION_JAPAN_FONT = "japanese font"; const char* ACTION_CHINA_FONT = "chinese font"; const char* ACTION_INFO = "info"; -class ThemesModel final : public NamesModel -{ -public: - ThemesModel() : - NamesModel() - { - mNames.push_back(gettext("(default)")); - Theme::fillSkinsList(mNames); - } - - ~ThemesModel() - { } -}; - -class FontsModel final : public NamesModel -{ -public: - FontsModel() : - NamesModel() - { Theme::fillFontsList(mNames); } - - ~FontsModel() - { } -}; - const int maxFontSizes = 16; const char *SIZE_NAME[maxFontSizes] = @@ -114,7 +93,7 @@ const char *SIZE_NAME[maxFontSizes] = N_("Huge (23)"), }; -class FontSizeChoiceListModel final : public gcn::ListModel +class FontSizeChoiceListModel final : public ListModel { public: ~FontSizeChoiceListModel() @@ -387,7 +366,7 @@ Setup_Theme::Setup_Theme(const Widget2 *const widget) : else if (size > maxWidth) size = maxWidth; - setDimension(gcn::Rectangle(0, 0, size, 500)); + setDimension(Rect(0, 0, size, 500)); } Setup_Theme::~Setup_Theme() @@ -433,7 +412,7 @@ void Setup_Theme::updateInfo() mInfoButton->setEnabled(!mThemeInfo.empty()); } -void Setup_Theme::action(const gcn::ActionEvent &event) +void Setup_Theme::action(const ActionEvent &event) { const std::string &eventId = event.getId(); if (eventId == ACTION_THEME) diff --git a/src/gui/widgets/tabs/setup_theme.h b/src/gui/widgets/tabs/setup_theme.h index a7f3ad101..5e8fe7c2a 100644 --- a/src/gui/widgets/tabs/setup_theme.h +++ b/src/gui/widgets/tabs/setup_theme.h @@ -46,7 +46,7 @@ class Setup_Theme final : public SetupTab void cancel() override final; - void action(const gcn::ActionEvent &event) override final; + void action(const ActionEvent &event) override final; void updateInfo(); diff --git a/src/gui/widgets/tabs/setup_touch.cpp b/src/gui/widgets/tabs/setup_touch.cpp index 5d995f914..fb50ab4d5 100644 --- a/src/gui/widgets/tabs/setup_touch.cpp +++ b/src/gui/widgets/tabs/setup_touch.cpp @@ -20,7 +20,11 @@ #include "gui/widgets/tabs/setup_touch.h" +#include "gui/models/namesmodel.h" +#include "gui/models/touchactionmodel.h" + #include "gui/widgets/layouthelper.h" +#include "gui/widgets/setuptouchitem.h" #include "gui/widgets/scrollarea.h" #include "utils/gettext.h" @@ -117,7 +121,7 @@ Setup_Touch::Setup_Touch(const Widget2 *const widget) : key, this, event, mActionsList, 250); } - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } Setup_Touch::~Setup_Touch() diff --git a/src/gui/widgets/tabs/setup_touch.h b/src/gui/widgets/tabs/setup_touch.h index 9adc2d5cd..ef1afdda3 100644 --- a/src/gui/widgets/tabs/setup_touch.h +++ b/src/gui/widgets/tabs/setup_touch.h @@ -21,7 +21,10 @@ #ifndef GUI_WIDGETS_TABS_SETUP_TOUCH_H #define GUI_WIDGETS_TABS_SETUP_TOUCH_H -#include "gui/widgets/setuptouchitem.h" +#include "gui/widgets/tabs/setuptabscroll.h" + +class NamesModel; +class TouchActionsModel; class Setup_Touch final : public SetupTabScroll { diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 45ada01df..f55dceaa4 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -46,7 +46,7 @@ #include "test/testmain.h" -#include <guichan/listmodel.hpp> +#include "gui/models/listmodel.h" #include <algorithm> @@ -54,7 +54,7 @@ extern Graphics *mainGraphics; -class ModeListModel final : public gcn::ListModel +class ModeListModel final : public ListModel { public: ModeListModel(); @@ -159,7 +159,7 @@ int ModeListModel::getIndexOf(const std::string &widthXHeightMode) return -1; } -class OpenGLListModel final : public gcn::ListModel +class OpenGLListModel final : public ListModel { public: ~OpenGLListModel() @@ -178,7 +178,7 @@ public: Setup_Video::Setup_Video(const Widget2 *const widget) : SetupTab(widget), - gcn::KeyListener(), + KeyListener(), mFullScreenEnabled(config.getBoolValue("screen")), mOpenGLEnabled(intToRenderType(config.getIntValue("opengl"))), mFps(config.getIntValue("fpslimit")), @@ -191,9 +191,9 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : mOpenGLDropDown(new DropDown(widget, mOpenGLListModel)), // TRANSLATORS: video settings checkbox mFpsCheckBox(new CheckBox(this, _("FPS limit:"))), - mFpsSlider(new Slider(2, 160)), + mFpsSlider(new Slider(this, 2, 160)), mFpsLabel(new Label(this)), - mAltFpsSlider(new Slider(2, 160)), + mAltFpsSlider(new Slider(this, 2, 160)), // TRANSLATORS: video settings label mAltFpsLabel(new Label(this, _("Alt FPS limit: "))), #if !defined(ANDROID) && !defined(__APPLE__) @@ -224,7 +224,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : // TRANSLATORS: video settings tab name setName(_("Video")); - ScrollArea *const scrollArea = new ScrollArea(mModeList, + ScrollArea *const scrollArea = new ScrollArea(this, mModeList, true, "setup_video_background.xml"); scrollArea->setWidth(150); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -304,7 +304,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : if (config.getIntValue("screenwidth") >= 730) width += 100; - setDimension(gcn::Rectangle(0, 0, width, 300)); + setDimension(Rect(0, 0, width, 300)); } Setup_Video::~Setup_Video() @@ -445,7 +445,7 @@ void Setup_Video::cancel() config.setValue("noframe", mNoFrame); } -void Setup_Video::action(const gcn::ActionEvent &event) +void Setup_Video::action(const ActionEvent &event) { const std::string &id = event.getId(); diff --git a/src/gui/widgets/tabs/setup_video.h b/src/gui/widgets/tabs/setup_video.h index 22d55c121..250fac0e0 100644 --- a/src/gui/widgets/tabs/setup_video.h +++ b/src/gui/widgets/tabs/setup_video.h @@ -25,7 +25,7 @@ #include "gui/widgets/tabs/setuptab.h" -#include <guichan/keylistener.hpp> +#include "listeners/keylistener.h" class Button; class CheckBox; @@ -37,7 +37,8 @@ class OpenGLListModel; class Slider; class TextDialog; -class Setup_Video final : public SetupTab, public gcn::KeyListener +class Setup_Video final : public SetupTab, + public KeyListener { public: explicit Setup_Video(const Widget2 *const widget); @@ -50,7 +51,7 @@ class Setup_Video final : public SetupTab, public gcn::KeyListener void cancel() override final; - void action(const gcn::ActionEvent &event) override final; + void action(const ActionEvent &event) override final; private: bool mFullScreenEnabled; diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp index ac608f756..9666b224a 100644 --- a/src/gui/widgets/tabs/setup_visual.cpp +++ b/src/gui/widgets/tabs/setup_visual.cpp @@ -21,8 +21,9 @@ #include "gui/widgets/tabs/setup_visual.h" +#include "gui/models/namesmodel.h" + #include "gui/widgets/layouthelper.h" -#include "gui/widgets/namesmodel.h" #include "gui/widgets/scrollarea.h" #include "client.h" @@ -202,7 +203,7 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : new SetupItemCheckBox(_("Allow screensaver to run"), "", "allowscreensaver", this, "allowscreensaverEvent"); - setDimension(gcn::Rectangle(0, 0, 550, 350)); + setDimension(Rect(0, 0, 550, 350)); } Setup_Visual::~Setup_Visual() diff --git a/src/gui/widgets/tabs/setup_visual.h b/src/gui/widgets/tabs/setup_visual.h index 2d40d3a08..1229757dd 100644 --- a/src/gui/widgets/tabs/setup_visual.h +++ b/src/gui/widgets/tabs/setup_visual.h @@ -24,6 +24,8 @@ #include "gui/widgets/setupitem.h" +#include "gui/widgets/tabs/setuptabscroll.h" + class NamesModel; class Setup_Visual final : public SetupTabScroll diff --git a/src/gui/widgets/tabs/setuptab.cpp b/src/gui/widgets/tabs/setuptab.cpp index c445e2ad7..6de77d7a0 100644 --- a/src/gui/widgets/tabs/setuptab.cpp +++ b/src/gui/widgets/tabs/setuptab.cpp @@ -26,8 +26,8 @@ SetupTab::SetupTab(const Widget2 *const widget) : Container(widget), - gcn::ActionListener(), - gcn::WidgetListener(), + ActionListener(), + WidgetListener(), mName() { setOpaque(false); diff --git a/src/gui/widgets/tabs/setuptab.h b/src/gui/widgets/tabs/setuptab.h index 388b0a988..4d6049b6a 100644 --- a/src/gui/widgets/tabs/setuptab.h +++ b/src/gui/widgets/tabs/setuptab.h @@ -25,8 +25,8 @@ #include "gui/widgets/container.h" -#include <guichan/actionlistener.hpp> -#include <guichan/widgetlistener.hpp> +#include "listeners/actionlistener.h" +#include "listeners/widgetlistener.h" #include <string> @@ -36,8 +36,8 @@ * A container for the contents of a tab in the setup window. */ class SetupTab : public Container, - public gcn::ActionListener, - public gcn::WidgetListener + public ActionListener, + public WidgetListener { public: A_DELETE_COPY(SetupTab) diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp index 659ef5824..9c185b2bb 100644 --- a/src/gui/widgets/tabs/setuptabscroll.cpp +++ b/src/gui/widgets/tabs/setuptabscroll.cpp @@ -29,7 +29,7 @@ SetupTabScroll::SetupTabScroll(const Widget2 *const widget) : SetupTab(widget), mContainer(new VertContainer(this, 25, false, 8)), - mScroll(new ScrollArea(mContainer, false)), + mScroll(new ScrollArea(this, mContainer, false)), mItems(), mAllItems(), mPreferredFirstItemSize(200) @@ -146,7 +146,7 @@ void SetupTabScroll::externalUnloaded() } } -void SetupTabScroll::widgetResized(const gcn::Event &event A_UNUSED) +void SetupTabScroll::widgetResized(const Event &event A_UNUSED) { mScroll->setWidth(getWidth() - 12); mScroll->setHeight(getHeight() - 12 - 12); diff --git a/src/gui/widgets/tabs/setuptabscroll.h b/src/gui/widgets/tabs/setuptabscroll.h index fb7de574d..f7aa628c9 100644 --- a/src/gui/widgets/tabs/setuptabscroll.h +++ b/src/gui/widgets/tabs/setuptabscroll.h @@ -56,14 +56,14 @@ class SetupTabScroll : public SetupTab virtual void externalUnloaded() override; - virtual void action(const gcn::ActionEvent &event A_UNUSED) + virtual void action(const ActionEvent &event A_UNUSED) override final { } int getPreferredFirstItemSize() const A_WARN_UNUSED { return mPreferredFirstItemSize; } - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; void reread(const std::string &name); diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 4f1703d31..96ae76787 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -20,14 +20,61 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #include "gui/widgets/tabs/tab.h" #include "client.h" #include "graphicsvertexes.h" +#include "gui/gui.h" + #include "gui/widgets/label.h" #include "gui/widgets/tabbedarea.h" +#include "resources/image.h" + #include "debug.h" int Tab::mInstances = 0; @@ -44,10 +91,9 @@ static std::string const data[Tab::TAB_COUNT] = Skin *Tab::tabImg[Tab::TAB_COUNT]; Tab::Tab(const Widget2 *const widget) : - gcn::BasicContainer(), - Widget2(widget), - gcn::MouseListener(), - gcn::WidgetListener(), + gcn::BasicContainer(widget), + MouseListener(), + WidgetListener(), mLabel(new Label(this)), mTabbedArea(nullptr), mTabColor(&getThemeColor(Theme::TAB)), @@ -153,7 +199,7 @@ void Tab::updateAlpha() } } -void Tab::draw(gcn::Graphics *graphics) +void Tab::draw(Graphics *graphics) { BLOCK_START("Tab::draw") int mode = TAB_STANDARD; @@ -204,19 +250,19 @@ void Tab::draw(gcn::Graphics *graphics) updateAlpha(); - Graphics *const g = static_cast<Graphics*>(graphics); - // draw tab if (isBatchDrawRenders(openGLMode)) { const ImageRect &rect = skin->getBorder(); - if (mRedraw || mode != mMode || g->getRedraw()) + if (mRedraw || mode != mMode || graphics->getRedraw()) { mMode = mode; mRedraw = false; mVertexes->clear(); - g->calcWindow(mVertexes, 0, 0, - mDimension.width, mDimension.height, rect); + graphics->calcWindow(mVertexes, + 0, 0, + mDimension.width, mDimension.height, + rect); if (mImage) { @@ -224,25 +270,28 @@ void Tab::draw(gcn::Graphics *graphics) if (skin1) { const int padding = skin1->getPadding(); - g->calcTileCollection(mVertexes, mImage, - padding, padding); + graphics->calcTileCollection(mVertexes, + mImage, + padding, + padding); } } } - g->drawTileCollection(mVertexes); + graphics->drawTileCollection(mVertexes); } else { - g->drawImageRect(0, 0, - mDimension.width, mDimension.height, skin->getBorder()); + graphics->drawImageRect(0, 0, + mDimension.width, mDimension.height, + skin->getBorder()); if (mImage) { const Skin *const skin1 = tabImg[TAB_STANDARD]; if (skin1) { const int padding = skin1->getPadding(); - g->drawImage2(mImage, padding, padding); + graphics->drawImage(mImage, padding, padding); } } } @@ -251,17 +300,17 @@ void Tab::draw(gcn::Graphics *graphics) BLOCK_END("Tab::draw") } -void Tab::widgetResized(const gcn::Event &event A_UNUSED) +void Tab::widgetResized(const Event &event A_UNUSED) { mRedraw = true; } -void Tab::widgetMoved(const gcn::Event &event A_UNUSED) +void Tab::widgetMoved(const Event &event A_UNUSED) { mRedraw = true; } -void Tab::setLabelFont(gcn::Font *const font) +void Tab::setLabelFont(Font *const font) { if (!mLabel) return; @@ -324,12 +373,12 @@ const std::string &Tab::getCaption() const return mLabel->getCaption(); } -void Tab::mouseEntered(gcn::MouseEvent& mouseEvent A_UNUSED) +void Tab::mouseEntered(MouseEvent& mouseEvent A_UNUSED) { mHasMouse = true; } -void Tab::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) +void Tab::mouseExited(MouseEvent& mouseEvent A_UNUSED) { mHasMouse = false; } diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 118b1f0e2..1f52cde88 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -20,14 +20,56 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson + * + * + * Per Larsson a.k.a finalman + * Olof Naessén a.k.a jansem/yakslem + * + * Visit: http://guichan.sourceforge.net + * + * License: (BSD) + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of Guichan nor the names of its contributors may + * be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + #ifndef GUI_WIDGETS_TABS_TAB_H #define GUI_WIDGETS_TABS_TAB_H -#include "gui/widgets/widget2.h" +#include "gui/base/basiccontainer.hpp" -#include <guichan/basiccontainer.hpp> -#include <guichan/mouselistener.hpp> -#include <guichan/widgetlistener.hpp> +#include "listeners/mouselistener.h" +#include "listeners/widgetlistener.h" #include "localconsts.h" @@ -40,9 +82,8 @@ class TabbedArea; * A tab, the same as the Guichan tab in 0.8, but extended */ class Tab : public gcn::BasicContainer, - public Widget2, - public gcn::MouseListener, - public gcn::WidgetListener + public MouseListener, + public WidgetListener { public: explicit Tab(const Widget2 *const widget); @@ -68,13 +109,13 @@ class Tab : public gcn::BasicContainer, /** * Draw the tabbed area. */ - void draw(gcn::Graphics *graphics) override final; + void draw(Graphics *graphics) override final; /** * Set the normal color for the tab's text. */ - void setTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setTabColor(const Color *const color1, + const Color *const color2) { mTabColor = color1; mTabOutlineColor = color2; @@ -83,8 +124,8 @@ class Tab : public gcn::BasicContainer, /** * Set the highlighted color for the tab's text. */ - void setHighlightedTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setHighlightedTabColor(const Color *const color1, + const Color *const color2) { mTabHighlightedColor = color1; mTabHighlightedOutlineColor = color2; @@ -93,8 +134,8 @@ class Tab : public gcn::BasicContainer, /** * Set the selected color for the tab's text. */ - void setSelectedTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setSelectedTabColor(const Color *const color1, + const Color *const color2) { mTabSelectedColor = color1; mTabSelectedOutlineColor = color2; @@ -103,8 +144,8 @@ class Tab : public gcn::BasicContainer, /** * Set the flash color for the tab's text. */ - void setFlashTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setFlashTabColor(const Color *const color1, + const Color *const color2) { mFlashColor = color1; mFlashOutlineColor = color2; @@ -113,8 +154,8 @@ class Tab : public gcn::BasicContainer, /** * Set the player flash color for the tab's text. */ - void setPlayerFlashTabColor(const gcn::Color *const color1, - const gcn::Color *const color2) + void setPlayerFlashTabColor(const Color *const color1, + const Color *const color2) { mPlayerFlashColor = color1; mPlayerFlashOutlineColor = color2; @@ -129,11 +170,11 @@ class Tab : public gcn::BasicContainer, int getFlash() const A_WARN_UNUSED { return mFlash; } - void widgetResized(const gcn::Event &event) override final; + void widgetResized(const Event &event) override final; - void widgetMoved(const gcn::Event &event) override final; + void widgetMoved(const Event &event) override final; - void setLabelFont(gcn::Font *const font); + void setLabelFont(Font *const font); Label *getLabel() const A_WARN_UNUSED { return mLabel; } @@ -148,9 +189,9 @@ class Tab : public gcn::BasicContainer, const std::string &getCaption() const A_WARN_UNUSED; - void mouseEntered(gcn::MouseEvent &mouseEvent) override final; + void mouseEntered(MouseEvent &mouseEvent) override final; - void mouseExited(gcn::MouseEvent &mouseEvent) override final; + void mouseExited(MouseEvent &mouseEvent) override final; void setImage(Image *const image); @@ -173,16 +214,16 @@ class Tab : public gcn::BasicContainer, static int mInstances; /**< Number of tab instances */ static float mAlpha; - const gcn::Color *mTabColor; - const gcn::Color *mTabOutlineColor; - const gcn::Color *mTabHighlightedColor; - const gcn::Color *mTabHighlightedOutlineColor; - const gcn::Color *mTabSelectedColor; - const gcn::Color *mTabSelectedOutlineColor; - const gcn::Color *mFlashColor; - const gcn::Color *mFlashOutlineColor; - const gcn::Color *mPlayerFlashColor; - const gcn::Color *mPlayerFlashOutlineColor; + const Color *mTabColor; + const Color *mTabOutlineColor; + const Color *mTabHighlightedColor; + const Color *mTabHighlightedOutlineColor; + const Color *mTabSelectedColor; + const Color *mTabSelectedOutlineColor; + const Color *mFlashColor; + const Color *mFlashOutlineColor; + const Color *mPlayerFlashColor; + const Color *mPlayerFlashOutlineColor; int mFlash; ImageCollection *mVertexes; Image *mImage; diff --git a/src/gui/widgets/tabs/whispertab.cpp b/src/gui/widgets/tabs/whispertab.cpp index ec02bb70f..023d94110 100644 --- a/src/gui/widgets/tabs/whispertab.cpp +++ b/src/gui/widgets/tabs/whispertab.cpp @@ -34,7 +34,8 @@ #include "debug.h" -WhisperTab::WhisperTab(const Widget2 *const widget, const std::string &nick) : +WhisperTab::WhisperTab(const Widget2 *const widget, + const std::string &nick) : ChatTab(widget, nick, ""), mNick(nick) { diff --git a/src/gui/widgets/tabs/whispertab.h b/src/gui/widgets/tabs/whispertab.h index 5dbb05a4e..84b55ae58 100644 --- a/src/gui/widgets/tabs/whispertab.h +++ b/src/gui/widgets/tabs/whispertab.h @@ -57,7 +57,8 @@ class WhisperTab final : public ChatTab * * @param nick the name of the player this tab is whispering to */ - WhisperTab(const Widget2 *const widget, const std::string &nick); + WhisperTab(const Widget2 *const widget, + const std::string &nick); ~WhisperTab(); |