summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-20 02:30:20 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-20 13:55:43 +0300
commitb6b4ea19929e7e67d987041aa129366f4fed3a6d (patch)
tree8bcc999ef4ae32aabd10a4109fb5e8c57067c18d /src/gui
parent0153e8fa499b7bbdd712339bfb3921ead15a37a2 (diff)
downloadmanaplus-b6b4ea19929e7e67d987041aa129366f4fed3a6d.tar.gz
manaplus-b6b4ea19929e7e67d987041aa129366f4fed3a6d.tar.bz2
manaplus-b6b4ea19929e7e67d987041aa129366f4fed3a6d.tar.xz
manaplus-b6b4ea19929e7e67d987041aa129366f4fed3a6d.zip
Add palette inheritance to progressbar class.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/inventorywindow.cpp4
-rw-r--r--src/gui/ministatuswindow.cpp3
-rw-r--r--src/gui/specialswindow.cpp2
-rw-r--r--src/gui/statuswindow.cpp8
-rw-r--r--src/gui/updaterwindow.cpp2
-rw-r--r--src/gui/widgets/playerbox.cpp2
-rw-r--r--src/gui/widgets/playerbox.h4
-rw-r--r--src/gui/widgets/progressbar.cpp4
-rw-r--r--src/gui/widgets/progressbar.h2
9 files changed, 16 insertions, 15 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index ea53ee48a..19aa95e58 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -106,7 +106,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
mRetrieveButton(nullptr),
mCloseButton(nullptr),
mWeightBar(nullptr),
- mSlotsBar(new ProgressBar(0.0f, 100, 0, Theme::PROG_INVY_SLOTS)),
+ mSlotsBar(new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_INVY_SLOTS)),
mFilter(nullptr),
mSortModel(new SortListModel()),
mSortDropDown(new DropDown(this, mSortModel, this, "sort")),
@@ -183,7 +183,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
mOutfitButton = new Button(this, _("Outfits"), "outfit", this);
mShopButton = new Button(this, _("Shop"), "shop", this);
mEquipmentButton = new Button(this, _("Equipment"), "equipment", this);
- mWeightBar = new ProgressBar(0.0f, 100, 0, Theme::PROG_WEIGHT);
+ mWeightBar = new ProgressBar(this, 0.0f, 100, 0, Theme::PROG_WEIGHT);
place(0, 0, mWeightBar, 4);
mSlotsBarCell = &place(4, 0, mSlotsBar, 5);
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 6309f10c1..99bbcaa1c 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -139,7 +139,8 @@ ProgressBar *MiniStatusWindow::createBar(const float progress,
const int color, std::string name,
std::string description)
{
- ProgressBar *const bar = new ProgressBar(progress, width, height, color);
+ ProgressBar *const bar = new ProgressBar(this,
+ progress, width, height, color);
bar->setActionEventId(name);
bar->setId(description);
mBars.push_back(bar);
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index 05aea6b96..1aaeba685 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -239,7 +239,7 @@ SpecialEntry::SpecialEntry(SpecialInfo *const info) :
progress = static_cast<float>(info->rechargeCurrent)
/ static_cast<float>(info->rechargeNeeded);
}
- mRechargeBar = new ProgressBar(progress, 100, 0, Theme::PROG_MP);
+ mRechargeBar = new ProgressBar(this, progress, 100, 0, Theme::PROG_MP);
mRechargeBar->setSmoothProgress(false);
mRechargeBar->setPosition(0, 13);
add(mRechargeBar);
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index d47d5928f..1fb6d7836 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -171,13 +171,13 @@ StatusWindow::StatusWindow() :
if (!max)
max = 1;
- mHpBar = new ProgressBar(max ?
+ mHpBar = new ProgressBar(this, max ?
static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::HP))
/ static_cast<float>(max):
static_cast<float>(0), 80, 0, Theme::PROG_HP);
max = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
- mXpBar = new ProgressBar(max ?
+ mXpBar = new ProgressBar(this, max ?
static_cast<float>(PlayerInfo::getAttribute(PlayerInfo::EXP))
/ static_cast<float>(max):
static_cast<float>(0), 80, 0, Theme::PROG_EXP);
@@ -190,7 +190,7 @@ StatusWindow::StatusWindow() :
{
max = PlayerInfo::getAttribute(PlayerInfo::MAX_MP);
mMpLabel = new Label(this, _("MP:"));
- mMpBar = new ProgressBar(max ? static_cast<float>(
+ mMpBar = new ProgressBar(this, max ? static_cast<float>(
PlayerInfo::getAttribute(PlayerInfo::MAX_MP))
/ static_cast<float>(max) : static_cast<float>(0),
80, 0, Net::getPlayerHandler()->canUseMagic() ?
@@ -223,7 +223,7 @@ StatusWindow::StatusWindow() :
{
mJobLvlLabel = new Label(this, strprintf(_("Job: %d"), 0));
mJobLabel = new Label(this, _("Job:"));
- mJobBar = new ProgressBar(0.0f, 80, 0, Theme::PROG_JOB);
+ mJobBar = new ProgressBar(this, 0.0f, 80, 0, Theme::PROG_JOB);
place(5, 0, mJobLvlLabel, 3);
place(5, 2, mJobLabel).setPadding(3);
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index cddc689a2..e156f98be 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -159,7 +159,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost,
mLabel(new Label(this, _("Connecting..."))),
mCancelButton(new Button(this, _("Cancel"), "cancel", this)),
mPlayButton(new Button(this, _("Play"), "play", this)),
- mProgressBar(new ProgressBar(0.0, 310, 0)),
+ mProgressBar(new ProgressBar(this, 0.0, 310, 0)),
mBrowserBox(new BrowserBox(this)),
mScrollArea(new ScrollArea(mBrowserBox, true, "update_background.xml")),
mUpdateServerPath(mUpdateHost)
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 5156b4bb6..697174fa2 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -36,8 +36,8 @@
#include "debug.h"
PlayerBox::PlayerBox(Being *const being, const std::string &skin) :
- ScrollArea(),
Widget2(),
+ ScrollArea(),
mBeing(being),
mAlpha(1.0),
mSkin(nullptr),
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 9f9a784ec..bc93b2e3f 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -40,8 +40,8 @@ class Skin;
*
* \ingroup GUI
*/
-class PlayerBox final : public gcn::ScrollArea,
- public Widget2
+class PlayerBox final : public Widget2,
+ public gcn::ScrollArea
{
public:
/**
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 485529c2c..75aa3063c 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -40,11 +40,11 @@
int ProgressBar::mInstances = 0;
float ProgressBar::mAlpha = 1.0;
-ProgressBar::ProgressBar(float progress,
+ProgressBar::ProgressBar(const Widget2 *const widget, float progress,
const int width, const int height,
const int color):
gcn::Widget(),
- Widget2(),
+ Widget2(widget),
gcn::WidgetListener(),
mProgress(progress),
mProgressToGo(progress),
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index 646aec97f..c754bcb6b 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -50,7 +50,7 @@ class ProgressBar final : public gcn::Widget,
/**
* Constructor, initializes the progress with the given value.
*/
- ProgressBar(float progress = 0.0f,
+ ProgressBar(const Widget2 *const widget, float progress = 0.0f,
const int width = 40, const int height = 7,
const int color = -1);