diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-05 17:47:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-19 18:46:08 +0300 |
commit | 40764f894c6ef0def1d0eb0677d064da13701bcd (patch) | |
tree | 4400b0b56d20ebb3e66187990a01615a0c2adb3a /src | |
parent | 0b31fa647c786513c9addc5f8c55708f05226e03 (diff) | |
download | manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.gz manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.bz2 manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.tar.xz manaplus-40764f894c6ef0def1d0eb0677d064da13701bcd.zip |
Redesign Misc setup page.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gui/setup_audio.h | 2 | ||||
-rw-r--r-- | src/gui/setup_chat.h | 2 | ||||
-rw-r--r-- | src/gui/setup_colors.h | 1 | ||||
-rw-r--r-- | src/gui/setup_joystick.h | 2 | ||||
-rw-r--r-- | src/gui/setup_keyboard.h | 2 | ||||
-rw-r--r-- | src/gui/setup_other.cpp | 490 | ||||
-rw-r--r-- | src/gui/setup_other.h | 94 | ||||
-rw-r--r-- | src/gui/setup_players.h | 1 | ||||
-rw-r--r-- | src/gui/setup_theme.h | 2 | ||||
-rw-r--r-- | src/gui/setup_video.h | 3 | ||||
-rw-r--r-- | src/gui/setupitem.cpp | 305 | ||||
-rw-r--r-- | src/gui/setupitem.h | 175 | ||||
-rw-r--r-- | src/gui/widgets/setuptab.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/setuptabscroll.cpp | 64 | ||||
-rw-r--r-- | src/gui/widgets/setuptabscroll.h | 28 |
17 files changed, 647 insertions, 532 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e72f4fe36..82dab226b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -299,6 +299,8 @@ SET(SRCS gui/serverdialog.h gui/setup.cpp gui/setup.h + gui/setupitem.cpp + gui/setupitem.h gui/setup_audio.cpp gui/setup_audio.h gui/setup_colors.cpp diff --git a/src/Makefile.am b/src/Makefile.am index f62324c63..0ddee0bd0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -302,6 +302,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/serverdialog.h \ gui/setup.cpp \ gui/setup.h \ + gui/setupitem.cpp \ + gui/setupitem.h \ gui/setup_audio.cpp \ gui/setup_audio.h \ gui/setup_colors.cpp \ diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h index 70264f876..53aa017b6 100644 --- a/src/gui/setup_audio.h +++ b/src/gui/setup_audio.h @@ -29,7 +29,7 @@ #include <guichan/actionlistener.hpp> -class Setup_Audio : public SetupTab, public gcn::ActionListener +class Setup_Audio : public SetupTab { public: Setup_Audio(); diff --git a/src/gui/setup_chat.h b/src/gui/setup_chat.h index db1472e9c..1ee325117 100644 --- a/src/gui/setup_chat.h +++ b/src/gui/setup_chat.h @@ -32,7 +32,7 @@ class IntTextField; class EditDialog; -class Setup_Chat : public SetupTab, public gcn::ActionListener +class Setup_Chat : public SetupTab { public: Setup_Chat(); diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h index 6ff7e1bb7..08c558c78 100644 --- a/src/gui/setup_colors.h +++ b/src/gui/setup_colors.h @@ -41,7 +41,6 @@ class TextField; class TextPreview; class Setup_Colors : public SetupTab, - public gcn::ActionListener, public gcn::SelectionListener { public: diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index 0771d3478..d18d5a7fb 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.h @@ -29,7 +29,7 @@ #include <guichan/actionlistener.hpp> -class Setup_Joystick : public SetupTab, public gcn::ActionListener +class Setup_Joystick : public SetupTab { public: Setup_Joystick(); diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h index 9b0c12307..bffa13cf6 100644 --- a/src/gui/setup_keyboard.h +++ b/src/gui/setup_keyboard.h @@ -29,7 +29,7 @@ #include <string> -class Setup_Keyboard : public SetupTab, public gcn::ActionListener +class Setup_Keyboard : public SetupTab { public: /** diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index e499e3c8c..07409ee80 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -2,6 +2,7 @@ * The Mana World * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011 The ManaPlus Developers * * This file is part of The Mana World. * @@ -21,482 +22,113 @@ */ #include "gui/setup_other.h" -#include "gui/editdialog.h" -#include "gui/widgets/button.h" -#include "gui/widgets/checkbox.h" -#include "gui/widgets/horizontcontainer.h" -#include "gui/widgets/label.h" +#include "gui/setupitem.h" + #include "gui/widgets/layouthelper.h" #include "gui/widgets/scrollarea.h" -#include "gui/widgets/textfield.h" -#include "gui/widgets/vertcontainer.h" #include "configuration.h" -#include "localplayer.h" #include "log.h" #include "utils/gettext.h" #include "debug.h" -#define ACTION_SHOW_TAKEDDAMAGE "taked damage" -#define ACTION_ONLY_REACHABLE "only reachable" -#define ACTION_ERRORS_IN_DEBUG "errors in debug" -#define ACTION_HIGHLIGHT_PORTALS "highlight portals" -#define ACTION_HIGHLIGHT_ATTACK_RANGE "highlight attack" -#define ACTION_HIGHLIGHT_MONSTER_ATTACK_RANGE "highlight monster attack" -#define ACTION_CYCLE_PLAYERS "cycle players" -#define ACTION_CYCLE_MONSTERS "cycle monsters" -#define ACTION_ENABLE_BOTCHECKER "bot checker" -#define ACTION_FLOORITEMS_HIGHLIGHT "floor items" -#define ACTION_MOVE_PROGRAM "move program" -#define ACTION_EDIT_PROGRAM "edit program" -#define ACTION_EDIT_PROGRAM_OK "edit program ok" -#define ACTION_AFK "move afk" -#define ACTION_EDIT_AFK "edit afk" -#define ACTION_EDIT_AFK_OK "edit afk ok" -#define ACTION_ENABLE_AFK "enable afk" -#define ACTION_TRADEBOT "trade bot" -#define ACTION_BUGGY_SERVERS "buggy servers" -#define ACTION_DEBUG_LOG "debug log" -#define ACTION_SERVER_ATTACK "server attack" -#define ACTION_FIX_POS "fix pos" -#define ACTION_ATTACK_MOVING "attack moving" -#define ACTION_QUICK_STATS "quick stats" -#define ACTION_WARP_PARTICLE "warp particle" -#define ACTION_AUTO_SHOP "auto shop" -#define ACTION_SHOW_MOB_HP "show mob hp" -#define ACTION_SHOW_OWN_HP "show own hp" -#define ACTION_SHOW_JOB_EXP "show job exp" -#define ACTION_SHOW_BEING_POPUP "show being popup" -#define ACTION_SHOW_EXTENDED_MINIMAPS "show extended minimaps" -#define ACTION_ENABLE_ATTACK_FILTER "attack filter" - -Setup_Other::Setup_Other(): - mShowMonstersTakedDamage(config.getBoolValue("showMonstersTakedDamage")), - mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")), - mHighlightPortals(config.getBoolValue("highlightMapPortals")), - mHighlightAttackRange(config.getBoolValue("highlightAttackRange")), - mHighlightMonsterAttackRange( - config.getBoolValue("highlightMonsterAttackRange")), - mCyclePlayers(config.getBoolValue("cyclePlayers")), - mCycleMonsters(config.getBoolValue("cycleMonsters")), - mEnableBotChecker(config.getBoolValue("enableBotCheker")), - mFloorItemsHighlight(config.getBoolValue("floorItemsHighlight")), - mMoveProgram(config.getStringValue("crazyMoveProgram")), - mAfk(config.getStringValue("afkMessage")), - mTradeBot(config.getBoolValue("tradebot")), - mBuggyServers(serverConfig.getValueBool("enableBuggyServers", true)), - mDebugLog(config.getBoolValue("debugLog")), - mServerAttack(config.getBoolValue("serverAttack")), - mAutofixPos(config.getBoolValue("autofixPos")), - mAttackMoving(config.getBoolValue("attackMoving")), - mQuickStats(config.getBoolValue("quickStats")), - mWarpParticle(config.getBoolValue("warpParticle")), - mAutoShop(config.getBoolValue("autoShop")), - mShowMobHP(config.getBoolValue("showMobHP")), - mShowOwnHP(config.getBoolValue("showOwnHP")), - mShowJobExp(config.getBoolValue("showJobExp")), - mShowBeingPopup(config.getBoolValue("showBeingPopup")), - mShowExtMinimaps(config.getBoolValue("showExtMinimaps")), - mEnableAttackFilter(config.getBoolValue("enableAttackFilter")), - mEditDialog(0) +Setup_Other::Setup_Other() { setName(_("Misc")); - mShowMonstersTakedDamageCheckBox = new CheckBox( - _("Show damage inflicted to monsters"), - mShowMonstersTakedDamage, - this, ACTION_SHOW_TAKEDDAMAGE); - - mTargetOnlyReachableCheckBox = new CheckBox( - _("Auto target only reachable monsters"), - mTargetOnlyReachable, - this, ACTION_ONLY_REACHABLE); - - mHighlightPortalsCheckBox = new CheckBox(_("Highlight map portals"), - mHighlightPortals, - this, ACTION_HIGHLIGHT_PORTALS); - - mHighlightAttackRangeCheckBox = new CheckBox( - _("Highlight player attack range"), - mHighlightAttackRange, - this, ACTION_HIGHLIGHT_ATTACK_RANGE); - - mHighlightMonsterAttackRangeCheckBox = new CheckBox( - _("Highlight monster attack range"), - mHighlightMonsterAttackRange, - this, ACTION_HIGHLIGHT_MONSTER_ATTACK_RANGE); - - mCyclePlayersCheckBox = new CheckBox(_("Cycle player targets"), - mCyclePlayers, this, ACTION_CYCLE_PLAYERS); - - mCycleMonstersCheckBox = new CheckBox(_("Cycle monster targets"), - mCycleMonsters, this, ACTION_CYCLE_MONSTERS); - - mEnableBotCheckerCheckBox = new CheckBox(_("Enable bot checker"), - mEnableBotChecker, this, ACTION_ENABLE_BOTCHECKER); - - mFloorItemsHighlightCheckBox = new CheckBox(_("Highlight floor items"), - mFloorItemsHighlight, this, ACTION_FLOORITEMS_HIGHLIGHT); - - mMoveProgramLabel = new Label(_("Crazy move A program")); - - mMoveProgramField = new TextField(mMoveProgram, true, - this, ACTION_MOVE_PROGRAM); - - mMoveProgramButton = new Button(_("Edit"), ACTION_EDIT_PROGRAM, this); - - mAfkField = new TextField(mAfk, true, this, ACTION_AFK); - - mAfkButton = new Button(_("Edit"), ACTION_EDIT_AFK, this); - - mTradeBotCheckBox = new CheckBox(_("Enable shop mode"), - mTradeBot, this, ACTION_TRADEBOT); - - mBuggyServersCheckBox = new CheckBox(_("Enable buggy servers protection"), - mBuggyServers, this, ACTION_BUGGY_SERVERS); - - mDebugLogCheckBox = new CheckBox(_("Enable debug log"), - mDebugLog, this, ACTION_DEBUG_LOG); - - mServerAttackCheckBox = new CheckBox(_("Enable server side attack"), - mServerAttack, this, ACTION_SERVER_ATTACK); - - mAutofixPosCheckBox = new CheckBox(_("Auto fix position"), - mAutofixPos, this, ACTION_FIX_POS); - - mAttackMovingCheckBox = new CheckBox(_("Attack while moving"), - mAttackMoving, this, ACTION_ATTACK_MOVING); - - mQuickStatsCheckBox = new CheckBox(_("Enable quick stats"), - mQuickStats, this, ACTION_QUICK_STATS); - - mWarpParticleCheckBox = new CheckBox(_("Show warps particles"), - mWarpParticle, this, ACTION_WARP_PARTICLE); - - mAutoShopCheckBox = new CheckBox(_("Accept sell/buy requests"), - mAutoShop, this, ACTION_AUTO_SHOP); - - mShowMobHPCheckBox = new CheckBox(_("Show monster hp bar"), - mShowMobHP, this, ACTION_SHOW_MOB_HP); - - mShowOwnHPCheckBox = new CheckBox(_("Show own hp bar"), - mShowOwnHP, this, ACTION_SHOW_OWN_HP); - - mShowJobExpCheckBox = new CheckBox(_("Show job exp messages"), - mShowJobExp, this, ACTION_SHOW_JOB_EXP); - - mShowBeingPopupCheckBox = new CheckBox(_("Show players popups"), - mShowBeingPopup, this, ACTION_SHOW_BEING_POPUP); - - mShowExtMinimapsCheckBox = new CheckBox(_("Show extended minimaps"), - mShowExtMinimaps, this, ACTION_SHOW_EXTENDED_MINIMAPS); - - mEnableAttackFilterCheckBox = new CheckBox(_("Enable attack filter"), - mEnableAttackFilter, this, ACTION_ENABLE_ATTACK_FILTER); - LayoutHelper h(this); ContainerPlacer place = h.getPlacer(0, 0); place(0, 0, mScroll, 10, 10); + new SetupItemCheckBox(_("Show damage inflicted to monsters"), "", + "showMonstersTakedDamage", this, "showMonstersTakedDamageEvent"); - mContainer->add(mShowMonstersTakedDamageCheckBox); - mContainer->add(mServerAttackCheckBox); - mContainer->add(mTargetOnlyReachableCheckBox); - mContainer->add(mAutofixPosCheckBox); - mContainer->add(mHighlightPortalsCheckBox); - mContainer->add(mAttackMovingCheckBox); - mContainer->add(mFloorItemsHighlightCheckBox); - mContainer->add(mQuickStatsCheckBox); - mContainer->add(mHighlightAttackRangeCheckBox); - mContainer->add(mWarpParticleCheckBox); - mContainer->add(mHighlightMonsterAttackRangeCheckBox); - mContainer->add(mAutoShopCheckBox); - mContainer->add(mCyclePlayersCheckBox); - mContainer->add(mShowMobHPCheckBox); - mContainer->add(mCycleMonstersCheckBox); - mContainer->add(mShowOwnHPCheckBox); - mContainer->add(mEnableBotCheckerCheckBox); - mContainer->add(mShowJobExpCheckBox); - - HorizontContainer *hc1 = new HorizontContainer(32, 2); - mDeleteWidgets.push_back(hc1); - mMoveProgramField->setWidth(200); - hc1->add(mMoveProgramLabel); - hc1->add(mMoveProgramField); - hc1->add(mMoveProgramButton); - - mContainer->add(hc1, true, 4); - - mContainer->add(mShowBeingPopupCheckBox); - mContainer->add(mShowExtMinimapsCheckBox); - - HorizontContainer *hc2 = new HorizontContainer(32, 2); - mDeleteWidgets.push_back(hc2); - mAfkField->setWidth(200); - hc2->add(mAfkField); - hc2->add(mAfkButton); - - mContainer->add(hc2, true, 4); - - mContainer->add(mEnableAttackFilterCheckBox); - mContainer->add(mTradeBotCheckBox); - mContainer->add(mBuggyServersCheckBox); - mContainer->add(mDebugLogCheckBox); - - setDimension(gcn::Rectangle(0, 0, 550, 350)); -} - -void Setup_Other::action(const gcn::ActionEvent &event) -{ - if (event.getId() == ACTION_SHOW_TAKEDDAMAGE) - { - mShowMonstersTakedDamage = mShowMonstersTakedDamageCheckBox - ->isSelected(); - } - else if (event.getId() == ACTION_ONLY_REACHABLE) - { - mTargetOnlyReachable = mTargetOnlyReachableCheckBox->isSelected(); - } - else if (event.getId() == ACTION_HIGHLIGHT_PORTALS) - { - mHighlightPortals = mHighlightPortalsCheckBox->isSelected(); - } - else if (event.getId() == ACTION_HIGHLIGHT_ATTACK_RANGE) - { - mHighlightAttackRange = mHighlightAttackRangeCheckBox->isSelected(); - } - else if (event.getId() == ACTION_HIGHLIGHT_MONSTER_ATTACK_RANGE) - { - mHighlightMonsterAttackRange = mHighlightMonsterAttackRangeCheckBox - ->isSelected(); - } - else if (event.getId() == ACTION_CYCLE_PLAYERS) - { - mCyclePlayers = mCyclePlayersCheckBox->isSelected(); - } - else if (event.getId() == ACTION_CYCLE_MONSTERS) - { - mCycleMonsters = mCycleMonstersCheckBox->isSelected(); - } - else if (event.getId() == ACTION_ENABLE_BOTCHECKER) - { - mEnableBotChecker = mEnableBotCheckerCheckBox->isSelected(); - } - else if (event.getId() == ACTION_FLOORITEMS_HIGHLIGHT) - { - mFloorItemsHighlight = mFloorItemsHighlightCheckBox->isSelected(); - } - else if (event.getId() == ACTION_MOVE_PROGRAM) - { - mMoveProgram = mMoveProgramField->getText(); - } - else if (event.getId() == ACTION_EDIT_PROGRAM) - { - mEditDialog = new EditDialog(_("Crazy Move A"), - mMoveProgramField->getText(), ACTION_EDIT_PROGRAM_OK); - mEditDialog->addActionListener(this); - } - else if (event.getId() == ACTION_EDIT_PROGRAM_OK) - { - mMoveProgramField->setText(mEditDialog->getMsg()); - } - else if (event.getId() == ACTION_AFK) - { - mAfk = mAfkField->getText(); - } - else if (event.getId() == ACTION_EDIT_AFK) - { - mEditDialog = new EditDialog(_("Afk message"), mAfkField->getText(), - ACTION_EDIT_AFK_OK); - mEditDialog->addActionListener(this); - } - else if (event.getId() == ACTION_EDIT_AFK_OK) - { - mAfkField->setText(mEditDialog->getMsg()); - } - else if (event.getId() == ACTION_TRADEBOT) - { - mTradeBot = mTradeBotCheckBox->isSelected(); - } - else if (event.getId() == ACTION_BUGGY_SERVERS) - { - mBuggyServers = mBuggyServersCheckBox->isSelected(); - } - else if (event.getId() == ACTION_DEBUG_LOG) - { - mDebugLog = mDebugLogCheckBox->isSelected(); - } - else if (event.getId() == ACTION_SERVER_ATTACK) - { - mServerAttack = mServerAttackCheckBox->isSelected(); - } - else if (event.getId() == ACTION_FIX_POS) - { - mAutofixPos = mAutofixPosCheckBox->isSelected(); - } - else if (event.getId() == ACTION_ATTACK_MOVING) - { - mAttackMoving = mAttackMovingCheckBox->isSelected(); - } - else if (event.getId() == ACTION_QUICK_STATS) - { - mQuickStats = mQuickStatsCheckBox->isSelected(); - } - else if (event.getId() == ACTION_WARP_PARTICLE) - { - mWarpParticle = mWarpParticleCheckBox->isSelected(); - } - else if (event.getId() == ACTION_AUTO_SHOP) - { - mAutoShop = mAutoShopCheckBox->isSelected(); - } - else if (event.getId() == ACTION_SHOW_MOB_HP) - { - mShowMobHP = mShowMobHPCheckBox->isSelected(); - } - else if (event.getId() == ACTION_SHOW_OWN_HP) - { - mShowOwnHP = mShowOwnHPCheckBox->isSelected(); - } - else if (event.getId() == ACTION_SHOW_JOB_EXP) - { - mShowJobExp = mShowJobExpCheckBox->isSelected(); - } - else if (event.getId() == ACTION_SHOW_BEING_POPUP) - { - mShowBeingPopup = mShowBeingPopupCheckBox->isSelected(); - } - else if (event.getId() == ACTION_SHOW_EXTENDED_MINIMAPS) - { - mShowExtMinimaps = mShowExtMinimapsCheckBox->isSelected(); - } - else if (event.getId() == ACTION_ENABLE_ATTACK_FILTER) - { - mEnableAttackFilter = mEnableAttackFilterCheckBox->isSelected(); - } -} + new SetupItemCheckBox(_("Enable server side attack"), "", + "serverAttack", this, "serverAttackEvent"); -void Setup_Other::cancel() -{ - mShowMonstersTakedDamage = config.getBoolValue( - "showMonstersTakedDamage"); - mShowMonstersTakedDamageCheckBox->setSelected(mShowMonstersTakedDamage); + new SetupItemCheckBox(_("Auto target only reachable monsters"), "", + "targetOnlyReachable", this, "targetOnlyReachableEvent"); - mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable"); - mTargetOnlyReachableCheckBox->setSelected(mTargetOnlyReachable); + new SetupItemCheckBox(_("Auto fix position"), "", + "autofixPos", this, "autofixPosEvent"); - mHighlightPortals = config.getBoolValue("highlightMapPortals"); - mHighlightPortalsCheckBox->setSelected(mHighlightPortals); + new SetupItemCheckBox(_("Highlight map portals"), "", + "highlightMapPortals", this, "highlightMapPortalsEvent"); - mHighlightAttackRange = config.getBoolValue("highlightAttackRange"); - mHighlightAttackRangeCheckBox->setSelected(mHighlightAttackRange); + new SetupItemCheckBox(_("Attack while moving"), "", + "attackMoving", this, "attackMovingEvent"); - mHighlightMonsterAttackRange = config.getBoolValue( - "highlightMonsterAttackRange"); - mHighlightMonsterAttackRangeCheckBox->setSelected( - mHighlightMonsterAttackRange); + new SetupItemCheckBox(_("Highlight floor items"), "", + "floorItemsHighlight", this, "floorItemsHighlightEvent"); - mCyclePlayers = config.getBoolValue("cyclePlayers"); - mCyclePlayersCheckBox->setSelected(mCyclePlayers); + new SetupItemCheckBox(_("Enable quick stats"), "", + "quickStats", this, "quickStatsEvent"); - mCycleMonsters = config.getBoolValue("cycleMonsters"); - mCycleMonstersCheckBox->setSelected(mCycleMonsters); + new SetupItemCheckBox(_("Highlight player attack range"), "", + "highlightAttackRange", this, "highlightAttackRangeEvent"); - mEnableBotChecker = config.getBoolValue("enableBotCheker"); - mEnableBotCheckerCheckBox->setSelected(mEnableBotChecker); + new SetupItemCheckBox(_("Show warps particles"), "", + "warpParticle", this, "warpParticleEvent"); - mFloorItemsHighlight = config.getBoolValue("floorItemsHighlight"); - mFloorItemsHighlightCheckBox->setSelected(mFloorItemsHighlight); + new SetupItemCheckBox(_("Highlight monster attack range"), "", + "highlightMonsterAttackRange", this, + "highlightMonsterAttackRangeEvent"); - mMoveProgram = config.getStringValue("crazyMoveProgram"); - mMoveProgramField->setText(mMoveProgram); + new SetupItemCheckBox(_("Accept sell/buy requests"), "", + "autoShop", this, "autoShopEvent"); - mAfk = config.getStringValue("afkMessage"); - mAfkField->setText(mAfk); + new SetupItemCheckBox(_("Cycle player targets"), "", + "cyclePlayers", this, "cyclePlayersEvent"); - mTradeBot = config.getBoolValue("tradebot"); - mTradeBotCheckBox->setSelected(mTradeBot); + new SetupItemCheckBox(_("Show monster hp bar"), "", + "showMobHP", this, "showMobHPEvent"); - mBuggyServers = serverConfig.getValueBool("enableBuggyServers", true); - mBuggyServersCheckBox->setSelected(mBuggyServers); + new SetupItemCheckBox(_("Cycle monster targets"), "", + "cycleMonsters", this, "cycleMonstersEvent"); - mDebugLog = config.getBoolValue("debugLog"); - mDebugLogCheckBox->setSelected(mDebugLog); + new SetupItemCheckBox(_("Show own hp bar"), "", + "showOwnHP", this, "showOwnHPEvent"); - mServerAttack = config.getBoolValue("serverAttack"); - mServerAttackCheckBox->setSelected(mServerAttack); + new SetupItemCheckBox(_("Enable bot checker"), "", + "enableBotCheker", this, "enableBotChekerEvent"); - mAutofixPos = config.getBoolValue("autofixPos"); - mAutofixPosCheckBox->setSelected(mAutofixPos); + new SetupItemCheckBox(_("Show job exp messages"), "", + "showJobExp", this, "showJobExpEvent"); - mAttackMoving = config.getBoolValue("attackMoving"); - mAttackMovingCheckBox->setSelected(mAttackMoving); - mQuickStats = config.getBoolValue("quickStats"); - mQuickStatsCheckBox->setSelected(mQuickStats); + new SetupItemTextField(_("Crazy move A program"), "", + "crazyMoveProgram", this, "crazyMoveProgramEvent"); - mWarpParticle = config.getBoolValue("warpParticle"); - mWarpParticleCheckBox->setSelected(mWarpParticle); + new SetupItemCheckBox(_("Show players popups"), "", + "showBeingPopup", this, "showBeingPopupEvent"); - mAutoShop = config.getBoolValue("autoShop"); - mAutoShopCheckBox->setSelected(mAutoShop); + new SetupItemCheckBox(_("Show extended minimaps"), "", + "showExtMinimaps", this, "showExtMinimapsEvent"); - mShowMobHP = config.getBoolValue("showMobHP"); - mShowMobHPCheckBox->setSelected(mShowMobHP); + new SetupItemTextField(_("Afk message"), "", + "afkMessage", this, "afkMessageEvent"); - mShowOwnHP = config.getBoolValue("showOwnHP"); - mShowOwnHPCheckBox->setSelected(mShowOwnHP); + new SetupItemCheckBox(_("Enable attack filter"), "", + "enableAttackFilter", this, "enableAttackFilterEvent"); - mShowJobExp = config.getBoolValue("showJobExp"); - mShowJobExpCheckBox->setSelected(mShowJobExp); + new SetupItemCheckBox(_("Enable shop mode"), "", + "tradebot", this, "tradebotEvent"); - mShowBeingPopup = config.getBoolValue("showBeingPopup"); - mShowBeingPopupCheckBox->setSelected(mShowBeingPopup); + new SetupItemCheckBox(_("Enable buggy servers protection"), "", + "enableBuggyServers", this, "enableBuggyServersEvent", false); - mShowExtMinimaps = config.getBoolValue("showExtMinimaps"); - mShowExtMinimapsCheckBox->setSelected(mShowExtMinimaps); + new SetupItemCheckBox(_("Enable debug log"), "", + "debugLog", this, "debugLogEvent"); - mEnableAttackFilter = config.getBoolValue("enableAttackFilter"); - mEnableAttackFilterCheckBox->setSelected(mEnableAttackFilter); + setDimension(gcn::Rectangle(0, 0, 550, 350)); } void Setup_Other::apply() { - config.setValue("showMonstersTakedDamage", mShowMonstersTakedDamage); - config.setValue("targetOnlyReachable", mTargetOnlyReachable); - config.setValue("highlightMapPortals", mHighlightPortals); - config.setValue("highlightAttackRange", mHighlightAttackRange); - config.setValue("highlightMonsterAttackRange", - mHighlightMonsterAttackRange); - config.setValue("cyclePlayers", mCyclePlayers); - config.setValue("cycleMonsters", mCycleMonsters); - config.setValue("enableBotCheker", mEnableBotChecker); - config.setValue("floorItemsHighlight", mFloorItemsHighlight); - config.setValue("crazyMoveProgram", mMoveProgramField->getText()); - config.setValue("afkMessage", mAfkField->getText()); - config.setValue("tradebot", mTradeBot); - serverConfig.setValue("enableBuggyServers", mBuggyServers); - config.setValue("debugLog", mDebugLog); - config.setValue("serverAttack", mServerAttack); - config.setValue("autofixPos", mAutofixPos); - config.setValue("attackMoving", mAttackMoving); - config.setValue("quickStats", mQuickStats); - config.setValue("warpParticle", mWarpParticle); - config.setValue("autoShop", mAutoShop); - config.setValue("showMobHP", mShowMobHP); - config.setValue("showOwnHP", mShowOwnHP); - config.setValue("showJobExp", mShowJobExp); - config.setValue("showBeingPopup", mShowBeingPopup); - config.setValue("showExtMinimaps", mShowExtMinimaps); - config.setValue("enableAttackFilter", mEnableAttackFilter); - logger->setDebugLog(mDebugLog); -} + SetupTabScroll::apply(); -void Setup_Other::externalUpdated() -{ - mBuggyServers = serverConfig.getValueBool("enableBuggyServers", true); - mBuggyServersCheckBox->setSelected(mBuggyServers); -}
\ No newline at end of file + logger->setDebugLog(config.getBoolValue("debugLog")); +} diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h index 04ae7fed3..945a2de46 100644 --- a/src/gui/setup_other.h +++ b/src/gui/setup_other.h @@ -2,6 +2,7 @@ * The Mana World * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011 The ManaPlus Developers * * This file is part of The Mana World. * @@ -32,103 +33,12 @@ class EditDialog; class TextField; -class Setup_Other : public SetupTabScroll, public gcn::ActionListener +class Setup_Other : public SetupTabScroll { public: Setup_Other(); void apply(); - void cancel(); - - void action(const gcn::ActionEvent &event); - - virtual void externalUpdated(); - - private: - gcn::CheckBox *mShowMonstersTakedDamageCheckBox; - bool mShowMonstersTakedDamage; - - gcn::CheckBox *mTargetOnlyReachableCheckBox; - bool mTargetOnlyReachable; - - gcn::CheckBox *mHighlightPortalsCheckBox; - bool mHighlightPortals; - - gcn::CheckBox *mHighlightAttackRangeCheckBox; - bool mHighlightAttackRange; - - gcn::CheckBox *mHighlightMonsterAttackRangeCheckBox; - bool mHighlightMonsterAttackRange; - - gcn::CheckBox *mCyclePlayersCheckBox; - bool mCyclePlayers; - - gcn::CheckBox *mCycleMonstersCheckBox; - bool mCycleMonsters; - - gcn::CheckBox *mEnableBotCheckerCheckBox; - bool mEnableBotChecker; - - gcn::CheckBox *mFloorItemsHighlightCheckBox; - bool mFloorItemsHighlight; - - gcn::Label *mMoveProgramLabel; - TextField *mMoveProgramField; - gcn::Button *mMoveProgramButton; - std::string mMoveProgram; - - gcn::TextField *mAfkField; - gcn::Button *mAfkButton; - std::string mAfk; - - gcn::CheckBox *mTradeBotCheckBox; - bool mTradeBot; - - gcn::CheckBox *mBuggyServersCheckBox; - bool mBuggyServers; - - gcn::CheckBox *mDebugLogCheckBox; - bool mDebugLog; - - gcn::CheckBox *mServerAttackCheckBox; - bool mServerAttack; - - gcn::CheckBox *mAutofixPosCheckBox; - bool mAutofixPos; - - gcn::CheckBox *mAttackMovingCheckBox; - bool mAttackMoving; - - gcn::CheckBox *mQuickStatsCheckBox; - bool mQuickStats; - - gcn::CheckBox *mWarpParticleCheckBox; - bool mWarpParticle; - - gcn::CheckBox *mAutoShopCheckBox; - bool mAutoShop; - - gcn::CheckBox *mShowMobHPCheckBox; - bool mShowMobHP; - - gcn::CheckBox *mShowOwnHPCheckBox; - bool mShowOwnHP; - - gcn::CheckBox *mShowJobExpCheckBox; - bool mShowJobExp; - - gcn::CheckBox *mShowBeingPopupCheckBox; - bool mShowBeingPopup; - - gcn::CheckBox *mShowExtMinimapsCheckBox; - bool mShowExtMinimaps; - - gcn::CheckBox *mEnableAttackFilterCheckBox; - bool mEnableAttackFilter; - - EditDialog *mEditDialog; - - std::list<gcn::Widget*> mDeleteWidgets; }; #endif diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h index afc902f1b..8cad7a771 100644 --- a/src/gui/setup_players.h +++ b/src/gui/setup_players.h @@ -42,7 +42,6 @@ class PlayerTableModel; class StaticTableModel; class Setup_Players : public SetupTab, - public gcn::ActionListener, public PlayerRelationsListener { public: diff --git a/src/gui/setup_theme.h b/src/gui/setup_theme.h index eb5cc39db..7eba723eb 100644 --- a/src/gui/setup_theme.h +++ b/src/gui/setup_theme.h @@ -34,7 +34,7 @@ class EditDialog; class DropDown; class ThemesModel; -class Setup_Theme : public SetupTab, public gcn::ActionListener +class Setup_Theme : public SetupTab { public: Setup_Theme(); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 1eba02b4f..a9271c65b 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -36,8 +36,7 @@ class ModeListModel; class OpenGLListModel; class TextDialog; -class Setup_Video : public SetupTab, public gcn::ActionListener, - public gcn::KeyListener +class Setup_Video : public SetupTab, public gcn::KeyListener { public: Setup_Video(); diff --git a/src/gui/setupitem.cpp b/src/gui/setupitem.cpp new file mode 100644 index 000000000..625be8580 --- /dev/null +++ b/src/gui/setupitem.cpp @@ -0,0 +1,305 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011 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/setupitem.h" + +#include "configuration.h" +#include "main.h" +#include "log.h" + +#include "gui/editdialog.h" + +#include "gui/widgets/button.h" +#include "gui/widgets/checkbox.h" +#include "gui/widgets/horizontcontainer.h" +#include "gui/widgets/label.h" +#include "gui/widgets/layouthelper.h" +#include "gui/widgets/tabbedarea.h" +#include "gui/widgets/textfield.h" +#include "gui/widgets/vertcontainer.h" + +#include "utils/dtor.h" +#include "utils/gettext.h" + + +SetupItem::SetupItem(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, bool mainConfig) : + mText(text), + mDescription(description), + mKeyName(keyName), + mParent(parent), + mEventName(eventName), + mMainConfig(mainConfig), + mUseDefault(false), + mValue(""), + mDefault(""), + mWidget(0) +{ +} + +SetupItem::SetupItem(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, std::string def, bool mainConfig) : + mText(text), + mDescription(description), + mKeyName(keyName), + mParent(parent), + mEventName(eventName), + mMainConfig(mainConfig), + mUseDefault(true), + mValue(""), + mDefault(def), + mWidget(0) +{ +} + +SetupItem::~SetupItem() +{ + +} + +Configuration *SetupItem::getConfig() +{ + if (mMainConfig) + return &config; + else + return &serverConfig; +} + +void SetupItem::load() +{ + Configuration *cfg = getConfig(); + if (mUseDefault) + mValue = cfg->getValue(mKeyName, mDefault); + else + mValue = cfg->getStringValue(mKeyName); +} + +void SetupItem::save() +{ + Configuration *cfg = getConfig(); + cfg->setValue(mKeyName, mValue); +} + +std::string SetupItem::getActionEventId() +{ + if (!mWidget) + return ""; + + return mWidget->getActionEventId(); +} + +void SetupItem::action(const gcn::ActionEvent &event) +{ + if (!mWidget) + return; + + if (event.getId() == mWidget->getActionEventId()) + action(); +} + +void SetupItem::action() +{ + fromWidget(); +} + +void SetupItem::apply(std::string eventName _UNUSED_) +{ + save(); +} + +void SetupItem::cancel(std::string eventName _UNUSED_) +{ + load(); + toWidget(); +} + +void SetupItem::externalUpdated(std::string eventName _UNUSED_) +{ + load(); + toWidget(); +} + +SetupItemCheckBox::SetupItemCheckBox(std::string text, std::string description, + std::string keyName, + SetupTabScroll *parent, + std::string eventName, bool mainConfig) : + SetupItem(text, description, keyName, parent, eventName, mainConfig) +{ + createControls(); +} + +SetupItemCheckBox::SetupItemCheckBox(std::string text, std::string description, + std::string keyName, + SetupTabScroll *parent, + std::string eventName, std::string def, + bool mainConfig) : + SetupItem(text, description, keyName, parent, eventName, def, mainConfig) +{ + createControls(); +} + +SetupItemCheckBox::~SetupItemCheckBox() +{ + mWidget = 0; +} + +void SetupItemCheckBox::createControls() +{ + load(); + mCheckBox = new CheckBox(mText, mValue != "0", mParent, mEventName); + mWidget = mCheckBox; + mParent->getContainer()->add(mWidget); + mParent->addControl(this); + mParent->addActionListener(this); + mWidget->addActionListener(this); +} + +void SetupItemCheckBox::fromWidget() +{ + if (!mCheckBox) + return; + + if (mCheckBox->isSelected()) + mValue = "1"; + else + mValue = "0"; +} + +void SetupItemCheckBox::toWidget() +{ + if (!mCheckBox) + return; + + mCheckBox->setSelected(mValue != "0"); +} + + +SetupItemTextField::SetupItemTextField(std::string text, + std::string description, + std::string keyName, + SetupTabScroll *parent, + std::string eventName, + bool mainConfig) : + SetupItem(text, description, keyName, parent, eventName, mainConfig), + mHorizont(0), + mLabel(0), + mTextField(0), + mButton(0), + mEditDialog(0) +{ + createControls(); +} + +SetupItemTextField::SetupItemTextField(std::string text, + std::string description, + std::string keyName, + SetupTabScroll *parent, + std::string eventName, std::string def, + bool mainConfig) : + SetupItem(text, description, keyName, parent, eventName, def, mainConfig), + mHorizont(0), + mLabel(0), + mTextField(0), + mButton(0), + mEditDialog(0) +{ + createControls(); +} + +SetupItemTextField::~SetupItemTextField() +{ + mHorizont = 0; + mWidget = 0; + mTextField = 0; + mLabel = 0; + mButton = 0; +} + +void SetupItemTextField::createControls() +{ + load(); + mHorizont = new HorizontContainer(32, 2); + + mLabel = new Label(mText); + mTextField = new TextField(mValue, true, mParent, mEventName); + mButton = new Button(_("Edit"), mEventName + "_EDIT", mParent); + mWidget = mTextField; + mTextField->setWidth(200); + mHorizont->add(mLabel); + mHorizont->add(mTextField); + mHorizont->add(mButton); + + mParent->getContainer()->add(mHorizont, true, 4); + mParent->addControl(this); + mParent->addControl(this, mEventName + "_EDIT"); + mParent->addControl(this, mEventName + "_EDIT_OK"); + mParent->addActionListener(this); + mWidget->addActionListener(this); + mButton->addActionListener(this); +} + +void SetupItemTextField::fromWidget() +{ + if (!mTextField) + return; + + mValue = mTextField->getText(); +} + +void SetupItemTextField::toWidget() +{ + if (!mTextField) + return; + + mTextField->setText(mValue); +} + +void SetupItemTextField::action(const gcn::ActionEvent &event) +{ + if (!mTextField) + return; + + if (event.getId() == mWidget->getActionEventId()) + { + fromWidget(); + } + else if (event.getId() == mEventName + "_EDIT") + { + mEditDialog = new EditDialog(mText, mTextField->getText(), + mEventName + "_EDIT_OK"); + mEditDialog->addActionListener(this); + } + else if (event.getId() == mEventName + "_EDIT_OK") + { + mTextField->setText(mEditDialog->getMsg()); + mEditDialog = 0; + } +} + +void SetupItemTextField::apply(std::string eventName) +{ + if (eventName != mEventName) + return; + + fromWidget(); + save(); +} diff --git a/src/gui/setupitem.h b/src/gui/setupitem.h new file mode 100644 index 000000000..d1cec0717 --- /dev/null +++ b/src/gui/setupitem.h @@ -0,0 +1,175 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011 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/>. + */ + +#ifndef SETUPITEM_H +#define SETUPITEM_H + +#include "gui/widgets/tabbedarea.h" + +#include "guichanfwd.h" + +#include "gui/widgets/setuptabscroll.h" +#include "gui/widgets/window.h" + +#include <guichan/actionlistener.hpp> +#include <guichan/widget.hpp> + +#include <list> + +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + +class CheckBox; +class Configuration; +class ContainerPlacer; +class EditDialog; +class HorizontContainer; +class Label; +class TextField; + +class SetupItem : public gcn::ActionListener +{ + public: + SetupItem(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, bool mainConfig); + + SetupItem(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, std::string def, bool mainConfig); + + ~SetupItem(); + + void load(); + + void save(); + + virtual void fromWidget() = 0; + + virtual void toWidget() = 0; + + void setWidget(gcn::Widget *widget) + { mWidget = widget; } + + gcn::Widget *getWidget() + { return mWidget; } + + Configuration *getConfig(); + + virtual std::string getActionEventId(); + + virtual void action(const gcn::ActionEvent &event); + + virtual void action(); + + virtual void apply(std::string eventName); + + virtual void cancel(std::string eventName); + + virtual void externalUpdated(std::string eventName); +// virtual int add(ContainerPlacer &place, int x, int y, int width); + + bool isMainConfig() + { return mMainConfig; } + + protected: + std::string mText; + + std::string mDescription; + + std::string mKeyName; + + SetupTabScroll *mParent; + + std::string mEventName; + + bool mMainConfig; + + bool mUseDefault; + + std::string mValue; + + std::string mDefault; + + gcn::Widget *mWidget; + + std::list<gcn::Widget*> mTempWidgets; +}; + +class SetupItemCheckBox : public SetupItem +{ + public: + SetupItemCheckBox(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, bool mainConfig = true); + + SetupItemCheckBox(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, std::string def, + bool mainConfig = true); + + ~SetupItemCheckBox(); + + void createControls(); + + void fromWidget(); + + void toWidget(); + + protected: + CheckBox *mCheckBox; +}; + +class SetupItemTextField : public SetupItem +{ + public: + SetupItemTextField(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, bool mainConfig = true); + + SetupItemTextField(std::string text, std::string description, + std::string keyName, SetupTabScroll *parent, + std::string eventName, std::string def, + bool mainConfig = true); + + ~SetupItemTextField(); + + void createControls(); + + void fromWidget(); + + void toWidget(); + + void action(const gcn::ActionEvent &event); + + void apply(std::string eventName); + + protected: + HorizontContainer *mHorizont; + Label *mLabel; + TextField *mTextField; + Button *mButton; + EditDialog *mEditDialog; +}; + +#endif diff --git a/src/gui/widgets/setuptab.h b/src/gui/widgets/setuptab.h index 73788ff6d..ddc0c8958 100644 --- a/src/gui/widgets/setuptab.h +++ b/src/gui/widgets/setuptab.h @@ -25,12 +25,14 @@ #include "gui/widgets/container.h" +#include <guichan/actionlistener.hpp> + #include <string> /** * A container for the contents of a tab in the setup window. */ -class SetupTab : public Container +class SetupTab : public Container, public gcn::ActionListener { public: SetupTab(); diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp index c46ebaf97..ece4fef8f 100644 --- a/src/gui/widgets/setuptabscroll.cpp +++ b/src/gui/widgets/setuptabscroll.cpp @@ -20,6 +20,8 @@ #include "gui/widgets/setuptabscroll.h" +#include "gui/setupitem.h" + #include "gui/widgets/layouthelper.h" #include "gui/widgets/scrollarea.h" #include "gui/widgets/vertcontainer.h" @@ -42,8 +44,68 @@ SetupTabScroll::SetupTabScroll() : SetupTabScroll::~SetupTabScroll() { -// delete mScroll; mScroll = 0; + delete mContainer; mContainer = 0; + + std::set<SetupItem*>::iterator it = mAllItems.begin(); + std::set<SetupItem*>::iterator it_end = mAllItems.end(); + while (it != it_end) + { + delete *it; + ++ it; + } + mAllItems.clear(); +} + +void SetupTabScroll::addControl(SetupItem *widget) +{ + std::map<std::string,SetupItem*>::iterator iter + = mItems.find(widget->getActionEventId()); + if (iter != mItems.end()) + { + delete (*iter).second; + mItems.erase(iter); + } + mItems[widget->getActionEventId()] = widget; + mAllItems.insert(widget); +} + +void SetupTabScroll::addControl(SetupItem *widget, std::string event) +{ + std::map<std::string,SetupItem*>::iterator iter + = mItems.find(event); + if (iter != mItems.end()) + { + delete (*iter).second; + mItems.erase(iter); + } + mItems[event] = widget; + mAllItems.insert(widget); +} + +void SetupTabScroll::apply() +{ + std::map<std::string,SetupItem*>::iterator iter; + for (iter = mItems.begin(); iter != mItems.end(); ++ iter) + (*iter).second->apply((*iter).first); +} + +void SetupTabScroll::cancel() +{ + std::map<std::string,SetupItem*>::iterator iter; + for (iter = mItems.begin(); iter != mItems.end(); ++ iter) + (*iter).second->cancel((*iter).first); +} + +void SetupTabScroll::externalUpdated() +{ + std::map<std::string,SetupItem*>::iterator iter; + for (iter = mItems.begin(); iter != mItems.end(); ++ iter) + { + SetupItem *widget = (*iter).second; + if (!widget->isMainConfig()) + (*iter).second->externalUpdated((*iter).first); + } } diff --git a/src/gui/widgets/setuptabscroll.h b/src/gui/widgets/setuptabscroll.h index 83a5e272c..119756969 100644 --- a/src/gui/widgets/setuptabscroll.h +++ b/src/gui/widgets/setuptabscroll.h @@ -23,6 +23,16 @@ #include "gui/widgets/setuptab.h" +#include <map> +#include <set> + +#ifdef __GNUC__ +#define _UNUSED_ __attribute__ ((unused)) +#else +#define _UNUSED_ +#endif + +class SetupItem; class ScrollArea; class VertContainer; @@ -33,9 +43,27 @@ class SetupTabScroll : public SetupTab ~SetupTabScroll(); + void addControl(SetupItem *widget); + + void addControl(SetupItem *widget, std::string event); + + VertContainer *getContainer() + { return mContainer; } + + virtual void apply(); + + virtual void cancel(); + + virtual void externalUpdated(); + + virtual void action(const gcn::ActionEvent &event _UNUSED_) + { } + protected: VertContainer *mContainer; ScrollArea *mScroll; + std::map<std::string,SetupItem*> mItems; + std::set<SetupItem*> mAllItems; }; #endif |