summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-01 20:49:03 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-02 00:37:51 +0300
commit4df121e6dcdf53436f50ce81dd60096ce0138a2c (patch)
tree7cadc707bb49e4c148ba9c182075697a9643e20a /src/gui/widgets
parented3410d7eb61593a2235ddba97ce257c85e405a6 (diff)
downloadmanaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.gz
manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.bz2
manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.tar.xz
manaplus-4df121e6dcdf53436f50ce81dd60096ce0138a2c.zip
Add const to more classes.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp6
-rw-r--r--src/gui/widgets/avatarlistbox.h2
-rw-r--r--src/gui/widgets/button.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/layout.cpp2
-rw-r--r--src/gui/widgets/layout.h2
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/popup.h2
-rw-r--r--src/gui/widgets/scrollarea.cpp2
-rw-r--r--src/gui/widgets/setupitem.cpp5
-rw-r--r--src/gui/widgets/setupitem.h4
-rw-r--r--src/gui/widgets/slider.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/tab.cpp2
15 files changed, 20 insertions, 19 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index b33233d73..b54b3d945 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -45,7 +45,7 @@ int AvatarListBox::instances = 0;
Image *AvatarListBox::onlineIcon = nullptr;
Image *AvatarListBox::offlineIcon = nullptr;
-AvatarListBox::AvatarListBox(AvatarListModel *model):
+AvatarListBox::AvatarListBox(AvatarListModel *const model) :
ListBox(model),
mShowGender(config.getBoolValue("showgender")),
mShowLevel(config.getBoolValue("showlevel")),
@@ -344,8 +344,8 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
const Avatar *const avatar = model->getAvatarAt(selected);
if (avatar)
{
- Being *const being = actorSpriteManager->findBeingByName(
- avatar->getName(), Being::PLAYER);
+ const Being *const being = actorSpriteManager
+ ->findBeingByName(avatar->getName(), Being::PLAYER);
if (being)
viewport->showPopup(being);
else
diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h
index b2b135a9c..0148a24d0 100644
--- a/src/gui/widgets/avatarlistbox.h
+++ b/src/gui/widgets/avatarlistbox.h
@@ -46,7 +46,7 @@ public:
class AvatarListBox : public ListBox, public ConfigListener
{
public:
- AvatarListBox(AvatarListModel *model);
+ AvatarListBox(AvatarListModel *const model);
~AvatarListBox();
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 2f475db88..3f253932b 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -196,7 +196,7 @@ Button::~Button()
if (mInstances == 0 && Theme::instance())
{
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
for (int mode = 0; mode < BUTTON_COUNT; mode ++)
theme->unloadRect(button[mode]);
}
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index bb18ff2dd..0aab1f165 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -139,7 +139,7 @@ DropDown::~DropDown()
void DropDown::updateAlpha()
{
- float alpha = std::max(Client::getGuiAlpha(),
+ const float alpha = std::max(Client::getGuiAlpha(),
Theme::instance()->getMinimumOpacity());
if (mAlpha != alpha)
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index d530a1594..04c6de606 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -391,7 +391,7 @@ void ItemShortcutContainer::mouseMoved(gcn::MouseEvent &event)
else if (itemId < SKILL_MIN_ID && spellManager)
{
mItemPopup->setVisible(false);
- TextCommand *const spell = spellManager->getSpellByItem(itemId);
+ const TextCommand *const spell = spellManager->getSpellByItem(itemId);
if (spell && viewport)
{
mSpellPopup->setItem(spell);
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 1597cdc33..bfb190e41 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -226,7 +226,7 @@ LayoutCell &LayoutArray::place(gcn::Widget *const widget, const int x,
void LayoutArray::align(int &pos, int &size, const int dim,
LayoutCell const &cell, const int *const sizes,
- int sizeCount) const
+ const int sizeCount) const
{
int size_max = sizes[0];
int cnt = cell.mExtent[dim];
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index a30cff1e1..71de85320 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -130,7 +130,7 @@ class LayoutArray
* Gets the position and size of a widget along a given axis
*/
void align(int &pos, int &size, const int dim, LayoutCell const &cell,
- const int *const sizes, int sizeCount) const;
+ const int *const sizes, const int sizeCount) const;
/**
* Ensures the private vectors are large enough.
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 2a4065ac2..8c0e938ba 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -138,7 +138,7 @@ void Popup::setContentSize(int width, int height)
mRedraw = true;
}
-void Popup::setLocationRelativeTo(gcn::Widget *const widget)
+void Popup::setLocationRelativeTo(const gcn::Widget *const widget)
{
if (!widget)
return;
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 61aac98c1..2442aa220 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -83,7 +83,7 @@ class Popup : public Container, public gcn::MouseListener,
/**
* Sets the location relative to the given widget.
*/
- void setLocationRelativeTo(gcn::Widget *const widget);
+ void setLocationRelativeTo(const gcn::Widget *const widget);
void mouseMoved(gcn::MouseEvent &event);
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index b752eb245..28532927b 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -91,7 +91,7 @@ ScrollArea::~ScrollArea()
delete getContent();
instances--;
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
if (theme)
{
theme->unloadRect(background);
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index a835bf51a..f569fddb5 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -125,7 +125,7 @@ void SetupItem::load()
}
}
-void SetupItem::save()
+void SetupItem::save() const
{
Configuration *const cfg = getConfig();
cfg->setValue(mKeyName, mValue);
@@ -629,7 +629,8 @@ SetupItemSlider::SetupItemSlider(std::string text, std::string description,
}
SetupItemSlider::SetupItemSlider(std::string text, std::string description,
- std::string keyName, SetupTabScroll *parent,
+ std::string keyName,
+ SetupTabScroll *const parent,
std::string eventName,
const double min, const double max,
std::string def, const int width,
diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h
index 32304ac22..f1ec4d23b 100644
--- a/src/gui/widgets/setupitem.h
+++ b/src/gui/widgets/setupitem.h
@@ -72,7 +72,7 @@ class SetupItem : public gcn::ActionListener
void load();
- void save();
+ void save() const;
virtual void fromWidget() = 0;
@@ -288,7 +288,7 @@ class SetupItemSlider : public SetupItem
const bool mainConfig = true);
SetupItemSlider(std::string text, std::string description,
- std::string keyName, SetupTabScroll *parent,
+ std::string keyName, SetupTabScroll *const parent,
std::string eventName,
const double min, const double max,
std::string def, const int width = 150,
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index c5eac9769..da6cb31f6 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -62,7 +62,7 @@ Slider::~Slider()
mInstances--;
if (mInstances == 0 && Theme::instance())
{
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
for (int mode = 0; mode < 2; mode ++)
theme->unloadRect(buttons[mode]);
}
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index ec79ccb93..2a3799ca8 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -279,7 +279,7 @@ void SpellShortcutContainer::mouseMoved(gcn::MouseEvent &event)
(mNumber * SPELL_SHORTCUT_ITEMS) + index);
mSpellPopup->setVisible(false);
- TextCommand *const spell = spellManager->getSpell(itemId);
+ const TextCommand *const spell = spellManager->getSpell(itemId);
if (spell && !spell->isEmpty())
{
mSpellPopup->setItem(spell);
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index bf37a643e..eb470cc02 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -78,7 +78,7 @@ Tab::~Tab()
mInstances--;
if (mInstances == 0 && Theme::instance())
{
- Theme *const theme = Theme::instance();
+ const Theme *const theme = Theme::instance();
for (int mode = 0; mode < TAB_COUNT; mode ++)
theme->unloadRect(tabImg[mode]);
}