summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp8
-rw-r--r--src/gui/widgets/avatarlistbox.h8
-rw-r--r--src/gui/widgets/browserbox.cpp14
-rw-r--r--src/gui/widgets/browserbox.h20
-rw-r--r--src/gui/widgets/button.cpp12
-rw-r--r--src/gui/widgets/button.h10
-rw-r--r--src/gui/widgets/channeltab.h8
-rw-r--r--src/gui/widgets/chattab.h8
-rw-r--r--src/gui/widgets/checkbox.h10
-rw-r--r--src/gui/widgets/container.cpp2
-rw-r--r--src/gui/widgets/container.h2
-rw-r--r--src/gui/widgets/desktop.cpp4
-rw-r--r--src/gui/widgets/desktop.h6
-rw-r--r--src/gui/widgets/dropdown.h20
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.h10
-rw-r--r--src/gui/widgets/flowcontainer.cpp4
-rw-r--r--src/gui/widgets/flowcontainer.h4
-rw-r--r--src/gui/widgets/icon.cpp4
-rw-r--r--src/gui/widgets/icon.h2
-rw-r--r--src/gui/widgets/inttextfield.h2
-rw-r--r--src/gui/widgets/itemcontainer.cpp4
-rw-r--r--src/gui/widgets/itemcontainer.h26
-rw-r--r--src/gui/widgets/itemlinkhandler.h4
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp10
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h14
-rw-r--r--src/gui/widgets/label.h2
-rw-r--r--src/gui/widgets/layout.cpp12
-rw-r--r--src/gui/widgets/layout.h2
-rw-r--r--src/gui/widgets/layouthelper.h4
-rw-r--r--src/gui/widgets/listbox.h14
-rw-r--r--src/gui/widgets/passwordfield.h2
-rw-r--r--src/gui/widgets/playerbox.cpp2
-rw-r--r--src/gui/widgets/playerbox.h8
-rw-r--r--src/gui/widgets/popup.cpp2
-rw-r--r--src/gui/widgets/popup.h8
-rw-r--r--src/gui/widgets/progressbar.h6
-rw-r--r--src/gui/widgets/progressindicator.cpp2
-rw-r--r--src/gui/widgets/progressindicator.h6
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/radiobutton.h10
-rw-r--r--src/gui/widgets/resizegrip.cpp2
-rw-r--r--src/gui/widgets/resizegrip.h4
-rw-r--r--src/gui/widgets/scrollarea.h32
-rw-r--r--src/gui/widgets/shopitems.cpp4
-rw-r--r--src/gui/widgets/shopitems.h6
-rw-r--r--src/gui/widgets/shoplistbox.cpp4
-rw-r--r--src/gui/widgets/shoplistbox.h10
-rw-r--r--src/gui/widgets/shortcutcontainer.h12
-rw-r--r--src/gui/widgets/slider.h10
-rw-r--r--src/gui/widgets/spacer.h2
-rw-r--r--src/gui/widgets/tab.h4
-rw-r--r--src/gui/widgets/tabbedarea.cpp18
-rw-r--r--src/gui/widgets/tabbedarea.h20
-rw-r--r--src/gui/widgets/table.cpp18
-rw-r--r--src/gui/widgets/table.h24
-rw-r--r--src/gui/widgets/tablemodel.cpp4
-rw-r--r--src/gui/widgets/tablemodel.h12
-rw-r--r--src/gui/widgets/textbox.h2
-rw-r--r--src/gui/widgets/textfield.cpp8
-rw-r--r--src/gui/widgets/textfield.h12
-rw-r--r--src/gui/widgets/textpreview.cpp4
-rw-r--r--src/gui/widgets/textpreview.h2
-rw-r--r--src/gui/widgets/vertcontainer.cpp2
-rw-r--r--src/gui/widgets/vertcontainer.h6
-rw-r--r--src/gui/widgets/whispertab.h14
-rw-r--r--src/gui/widgets/window.cpp10
-rw-r--r--src/gui/widgets/window.h20
-rw-r--r--src/gui/widgets/windowcontainer.cpp6
-rw-r--r--src/gui/widgets/windowcontainer.h6
70 files changed, 289 insertions, 289 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index eac7ad13..d397ecfb 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -34,8 +34,8 @@
#include <guichan/font.hpp>
int AvatarListBox::instances = 0;
-Image *AvatarListBox::onlineIcon = 0;
-Image *AvatarListBox::offlineIcon = 0;
+Image *AvatarListBox::onlineIcon = nullptr;
+Image *AvatarListBox::offlineIcon = nullptr;
AvatarListBox::AvatarListBox(AvatarListModel *model):
ListBox(model)
@@ -67,11 +67,11 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
if (!mListModel)
return;
- AvatarListModel* model = static_cast<AvatarListModel*>(mListModel);
+ auto* model = static_cast<AvatarListModel*>(mListModel);
updateAlpha();
- Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
+ auto *graphics = static_cast<Graphics*>(gcnGraphics);
graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
(int) (mAlpha * 255.0f)));
diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h
index ec6cc6c5..ab402329 100644
--- a/src/gui/widgets/avatarlistbox.h
+++ b/src/gui/widgets/avatarlistbox.h
@@ -36,7 +36,7 @@ class AvatarListModel : public gcn::ListModel
public:
virtual Avatar *getAvatarAt(int i) = 0;
- std::string getElementAt(int i)
+ std::string getElementAt(int i) override
{ return getAvatarAt(i)->getName(); }
};
@@ -45,14 +45,14 @@ class AvatarListBox : public ListBox
public:
AvatarListBox(AvatarListModel *model);
- ~AvatarListBox();
+ ~AvatarListBox() override;
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *gcnGraphics);
+ void draw(gcn::Graphics *gcnGraphics) override;
- void mousePressed(gcn::MouseEvent &event);
+ void mousePressed(gcn::MouseEvent &event) override;
private:
static int instances;
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 29847639..d5b853b2 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -86,7 +86,7 @@ void BrowserBox::addRow(const std::string &row)
const int fontHeight = font->getHeight();
int lineHeight = fontHeight;
- if (TrueTypeFont *ttf = dynamic_cast<TrueTypeFont*>(font))
+ if (auto *ttf = dynamic_cast<TrueTypeFont*>(font))
lineHeight = ttf->getLineHeight();
// Use links and user defined colors
@@ -185,7 +185,7 @@ void BrowserBox::addRow(const std::string &row)
int tildeWidth = font->getWidth(tilde);
int x = 0;
- for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); i++)
+ for (auto i = mTextRows.begin(); i != mTextRows.end(); i++)
{
std::string row = *i;
for (unsigned int j = 0; j < row.size(); ++j)
@@ -259,7 +259,7 @@ struct MouseOverLink
void BrowserBox::mousePressed(gcn::MouseEvent &event)
{
if (!mLinkHandler) return;
- LinkIterator i = find_if(mLinks.begin(), mLinks.end(),
+ auto i = find_if(mLinks.begin(), mLinks.end(),
MouseOverLink(event.getX(), event.getY()));
if (i != mLinks.end())
@@ -268,7 +268,7 @@ void BrowserBox::mousePressed(gcn::MouseEvent &event)
void BrowserBox::mouseMoved(gcn::MouseEvent &event)
{
- LinkIterator i = find_if(mLinks.begin(), mLinks.end(),
+ auto i = find_if(mLinks.begin(), mLinks.end(),
MouseOverLink(event.getX(), event.getY()));
mSelectedLink = (i != mLinks.end())
@@ -316,7 +316,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
}
}
- for (LinePartIterator i = mLineParts.begin();
+ for (auto i = mLineParts.begin();
i != mLineParts.end();
i ++)
{
@@ -377,7 +377,7 @@ int BrowserBox::calcHeight()
const int tildeWidth = font->getWidth("~");
int lineHeight = fontHeight;
- if (TrueTypeFont *ttf = dynamic_cast<TrueTypeFont*>(font))
+ if (auto *ttf = dynamic_cast<TrueTypeFont*>(font))
lineHeight = ttf->getLineHeight();
gcn::Color selColor = Theme::getThemeColor(Theme::TEXT);
@@ -385,7 +385,7 @@ int BrowserBox::calcHeight()
mLineParts.clear();
- for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); i++)
+ for (auto i = mTextRows.begin(); i != mTextRows.end(); i++)
{
const std::string row = *(i);
bool wrapped = false;
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index 46af14ab..5f29e72a 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -74,7 +74,7 @@ class BrowserBox : public gcn::Widget,
public:
BrowserBox(unsigned int mode = AUTO_SIZE, bool opaque = true);
- ~BrowserBox();
+ ~BrowserBox() override;
/**
* Sets the handler for links.
@@ -124,13 +124,13 @@ class BrowserBox : public gcn::Widget,
/**
* Handles mouse actions.
*/
- void mousePressed(gcn::MouseEvent &event);
- void mouseMoved(gcn::MouseEvent &event);
+ void mousePressed(gcn::MouseEvent &event) override;
+ void mouseMoved(gcn::MouseEvent &event) override;
/**
* Draws the browser box.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
void updateHeight();
@@ -176,7 +176,7 @@ class BrowserBox : public gcn::Widget,
BACKGROUND = 2
};
- typedef std::list<std::string> TextRows;
+ using TextRows = std::list<std::string>;
TextRows &getRows()
{ return mTextRows; }
@@ -187,15 +187,15 @@ class BrowserBox : public gcn::Widget,
private:
int calcHeight();
- typedef TextRows::iterator TextRowIterator;
+ using TextRowIterator = TextRows::iterator;
TextRows mTextRows;
- typedef std::list<LinePart> LinePartList;
- typedef LinePartList::iterator LinePartIterator;
+ using LinePartList = std::list<LinePart>;
+ using LinePartIterator = LinePartList::iterator;
LinePartList mLineParts;
- typedef std::vector<BrowserLink> Links;
- typedef Links::iterator LinkIterator;
+ using Links = std::vector<BrowserLink>;
+ using LinkIterator = Links::iterator;
Links mLinks;
LinkHandler *mLinkHandler;
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 9247f67a..fb0d4cbe 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -38,7 +38,7 @@
int Button::mInstances = 0;
float Button::mAlpha = 1.0;
ImageRect *Button::mButton;
-TextPopup *Button::mTextPopup = 0;
+TextPopup *Button::mTextPopup = nullptr;
enum{
BUTTON_STANDARD, // 0
@@ -63,7 +63,7 @@ static ButtonData const data[BUTTON_COUNT] = {
};
Button::Button():
- mButtonIcon(0)
+ mButtonIcon(nullptr)
{
init();
adjustSize();
@@ -72,7 +72,7 @@ Button::Button():
Button::Button(const std::string &caption, const std::string &actionEventId,
gcn::ActionListener *listener):
gcn::Button(caption),
- mButtonIcon(0)
+ mButtonIcon(nullptr)
{
init();
setActionEventId(actionEventId);
@@ -127,10 +127,10 @@ void Button::removeButtonIcon(bool adjustButtonSize)
for (int mode = 0; mode < BUTTON_COUNT; ++mode)
{
delete mButtonIcon[mode];
- mButtonIcon[mode] = 0;
+ mButtonIcon[mode] = nullptr;
}
delete[] mButtonIcon;
- mButtonIcon = 0;
+ mButtonIcon = nullptr;
if (adjustButtonSize)
adjustSize();
@@ -189,7 +189,7 @@ Button::~Button()
// Remove the popup
delete mTextPopup;
- mTextPopup = 0;
+ mTextPopup = nullptr;
}
// Don' try to readjust the size when it's about to be deleted.
removeButtonIcon(false);
diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h
index f31c3436..e4a28d80 100644
--- a/src/gui/widgets/button.h
+++ b/src/gui/widgets/button.h
@@ -48,12 +48,12 @@ class Button : public gcn::Button
Button(const std::string &caption, const std::string &actionEventId,
gcn::ActionListener *listener);
- ~Button();
+ ~Button() override;
/**
* Draws the button.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Update the alpha value to the button components.
@@ -82,9 +82,9 @@ class Button : public gcn::Button
void setButtonPopupText(const std::string &text)
{ mPopupText = text; }
- void logic();
- void mouseMoved(gcn::MouseEvent &event);
- void mouseExited(gcn::MouseEvent &event);
+ void logic() override;
+ void mouseMoved(gcn::MouseEvent &event) override;
+ void mouseExited(gcn::MouseEvent &event) override;
private:
void init();
diff --git a/src/gui/widgets/channeltab.h b/src/gui/widgets/channeltab.h
index ad27c4c8..ec8af1cd 100644
--- a/src/gui/widgets/channeltab.h
+++ b/src/gui/widgets/channeltab.h
@@ -35,19 +35,19 @@ class ChannelTab : public ChatTab
Channel *getChannel() const { return mChannel; }
- void showHelp();
+ void showHelp() override;
bool handleCommand(const std::string &type,
- const std::string &args);
+ const std::string &args) override;
protected:
friend class Channel;
ChannelTab(Channel *channel);
- ~ChannelTab();
+ ~ChannelTab() override;
- void handleInput(const std::string &msg);
+ void handleInput(const std::string &msg) override;
private:
Channel *mChannel;
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 200ad55a..3d19a9ad 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -38,7 +38,7 @@ class ChatTab : public Tab, public AutoCompleteLister, public EventListener
{
public:
ChatTab(const std::string &name);
- ~ChatTab();
+ ~ChatTab() override;
/**
* Adds a line of text to our message list. Parameters:
@@ -98,17 +98,17 @@ class ChatTab : public Tab, public AutoCompleteLister, public EventListener
{ return false; }
- void getAutoCompleteList(std::vector<std::string> &names) const;
+ void getAutoCompleteList(std::vector<std::string> &names) const override;
virtual void saveToLogFile(std::string &msg);
- void event(Event::Channel channel, const Event &event);
+ void event(Event::Channel channel, const Event &event) override;
protected:
friend class ChatWindow;
friend class WhisperWindow;
- virtual void setCurrent() { setFlash(false); }
+ void setCurrent() override { setFlash(false); }
virtual void handleInput(const std::string &msg);
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index 62e196c8..6eb53c38 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -36,12 +36,12 @@ class CheckBox : public gcn::CheckBox
public:
CheckBox(const std::string &caption, bool selected = false);
- ~CheckBox();
+ ~CheckBox() override;
/**
* Draws the caption, then calls drawBox to draw the check box.
*/
- void draw(gcn::Graphics* graphics);
+ void draw(gcn::Graphics* graphics) override;
/**
* Update the alpha value to the checkbox components.
@@ -51,17 +51,17 @@ class CheckBox : public gcn::CheckBox
/**
* Draws the check box, not the caption.
*/
- void drawBox(gcn::Graphics* graphics);
+ void drawBox(gcn::Graphics* graphics) override;
/**
* Called when the mouse enteres the widget area.
*/
- void mouseEntered(gcn::MouseEvent& event);
+ void mouseEntered(gcn::MouseEvent& event) override;
/**
* Called when the mouse leaves the widget area.
*/
- void mouseExited(gcn::MouseEvent& event);
+ void mouseExited(gcn::MouseEvent& event) override;
private:
static int instances;
diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp
index e1b99af7..74b82f07 100644
--- a/src/gui/widgets/container.cpp
+++ b/src/gui/widgets/container.cpp
@@ -24,7 +24,7 @@
#include "gui/widgets/layouthelper.h"
Container::Container():
- mLayoutHelper(0)
+ mLayoutHelper(nullptr)
{
setOpaque(false);
}
diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h
index 46b719a1..6c5caa3a 100644
--- a/src/gui/widgets/container.h
+++ b/src/gui/widgets/container.h
@@ -42,7 +42,7 @@ class Container : public gcn::Container
{
public:
Container();
- ~Container();
+ ~Container() override;
protected:
/**
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 07d1d887..3b26ef3a 100644
--- a/src/gui/widgets/desktop.cpp
+++ b/src/gui/widgets/desktop.cpp
@@ -37,7 +37,7 @@
#include "utils/stringutils.h"
Desktop::Desktop()
- : mWallpaper(0)
+ : mWallpaper(nullptr)
{
addWidgetListener(this);
@@ -74,7 +74,7 @@ void Desktop::widgetResized(const gcn::Event &)
void Desktop::draw(gcn::Graphics *graphics)
{
- Graphics *g = static_cast<Graphics *>(graphics);
+ auto *g = static_cast<Graphics *>(graphics);
if (!mWallpaper || (getWidth() > mWallpaper->getWidth() ||
getHeight() > mWallpaper->getHeight()))
diff --git a/src/gui/widgets/desktop.h b/src/gui/widgets/desktop.h
index 8ecb7e03..e10813ef 100644
--- a/src/gui/widgets/desktop.h
+++ b/src/gui/widgets/desktop.h
@@ -47,16 +47,16 @@ class Desktop : public Container, gcn::WidgetListener
{
public:
Desktop();
- ~Desktop();
+ ~Desktop() override;
/**
* Has to be called after updates have been loaded.
*/
void reloadWallpaper();
- void widgetResized(const gcn::Event &);
+ void widgetResized(const gcn::Event &) override;
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
private:
void setBestFittingWallpaper();
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index ebc76184..f0b721f6 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -43,34 +43,34 @@ class DropDown : public gcn::DropDown
* @param listModel the ListModel to use.
* @see ListModel
*/
- DropDown(gcn::ListModel *listModel = 0);
+ DropDown(gcn::ListModel *listModel = nullptr);
- ~DropDown();
+ ~DropDown() override;
/**
* Update the alpha value to the graphic components.
*/
void updateAlpha();
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
- void drawFrame(gcn::Graphics *graphics);
+ void drawFrame(gcn::Graphics *graphics) override;
// Inherited from FocusListener
- void focusLost(const gcn::Event& event);
+ void focusLost(const gcn::Event& event) override;
// Inherited from KeyListener
- void keyPressed(gcn::KeyEvent& keyEvent);
+ void keyPressed(gcn::KeyEvent& keyEvent) override;
// Inherited from MouseListener
- void mousePressed(gcn::MouseEvent& mouseEvent);
+ void mousePressed(gcn::MouseEvent& mouseEvent) override;
- void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override;
- void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override;
protected:
/**
@@ -78,7 +78,7 @@ class DropDown : public gcn::DropDown
*
* @param graphics a Graphics object to draw with.
*/
- void drawButton(gcn::Graphics *graphics);
+ void drawButton(gcn::Graphics *graphics) override;
// Add own Images.
static int instances;
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index cdb2d3c4..fa74cf20 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -79,7 +79,7 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics)
mBackgroundImg->setAlpha(mAlpha);
}
- Graphics *g = static_cast<Graphics*>(graphics);
+ auto *g = static_cast<Graphics*>(graphics);
graphics->setFont(getFont());
diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h
index cc388580..2d62b500 100644
--- a/src/gui/widgets/emoteshortcutcontainer.h
+++ b/src/gui/widgets/emoteshortcutcontainer.h
@@ -38,27 +38,27 @@ class EmoteShortcutContainer : public ShortcutContainer
public:
EmoteShortcutContainer();
- virtual ~EmoteShortcutContainer();
+ ~EmoteShortcutContainer() override;
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Handles mouse when dragged.
*/
- void mouseDragged(gcn::MouseEvent &event);
+ void mouseDragged(gcn::MouseEvent &event) override;
/**
* Handles mouse when pressed.
*/
- void mousePressed(gcn::MouseEvent &event);
+ void mousePressed(gcn::MouseEvent &event) override;
/**
* Handles mouse release.
*/
- void mouseReleased(gcn::MouseEvent &event);
+ void mouseReleased(gcn::MouseEvent &event) override;
private:
std::vector<const ImageSprite*> mEmoteImg;
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
index d04c5153..bf34c4c7 100644
--- a/src/gui/widgets/flowcontainer.cpp
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -57,7 +57,7 @@ void FlowContainer::widgetResized(const gcn::Event &event)
int i = 0;
height = 0;
- for (WidgetList::iterator it = mWidgets.begin(); it != mWidgets.end(); it++)
+ for (auto it = mWidgets.begin(); it != mWidgets.end(); it++)
{
int x = i % mGridWidth * mBoxWidth;
(*it)->setPosition(x, height);
@@ -73,5 +73,5 @@ void FlowContainer::add(gcn::Widget *widget)
{
Container::add(widget);
widget->setSize(mBoxWidth, mBoxHeight);
- widgetResized(NULL);
+ widgetResized(nullptr);
}
diff --git a/src/gui/widgets/flowcontainer.h b/src/gui/widgets/flowcontainer.h
index 0109ab64..28d148d5 100644
--- a/src/gui/widgets/flowcontainer.h
+++ b/src/gui/widgets/flowcontainer.h
@@ -40,7 +40,7 @@ class FlowContainer : public Container,
* Invoked when a widget changes its size. This is used to determine
* the new height of the container.
*/
- void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
int getBoxWidth() const
{ return mBoxWidth; }
@@ -48,7 +48,7 @@ class FlowContainer : public Container,
int getBoxHeight() const
{ return mBoxHeight; }
- void add(gcn::Widget *widget);
+ void add(gcn::Widget *widget) override;
private:
int mBoxWidth;
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index 6b5120e6..5d7d62f7 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -27,7 +27,7 @@
#include "resources/resourcemanager.h"
Icon::Icon(const std::string &file)
- : mImage(0)
+ : mImage(nullptr)
{
mImage = ResourceManager::getInstance()->getImage(file);
if (mImage)
@@ -52,7 +52,7 @@ void Icon::draw(gcn::Graphics *g)
{
if (mImage)
{
- Graphics *graphics = static_cast<Graphics*>(g);
+ auto *graphics = static_cast<Graphics*>(g);
const int x = (getWidth() - mImage->getWidth()) / 2;
const int y = (getHeight() - mImage->getHeight()) / 2;
graphics->drawImage(mImage, x, y);
diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h
index 6945e4c9..896b26c1 100644
--- a/src/gui/widgets/icon.h
+++ b/src/gui/widgets/icon.h
@@ -59,7 +59,7 @@ class Icon : public gcn::Widget
/**
* Draws the Icon.
*/
- void draw(gcn::Graphics *g);
+ void draw(gcn::Graphics *g) override;
private:
Image *mImage;
diff --git a/src/gui/widgets/inttextfield.h b/src/gui/widgets/inttextfield.h
index 19058a46..d5829404 100644
--- a/src/gui/widgets/inttextfield.h
+++ b/src/gui/widgets/inttextfield.h
@@ -63,7 +63,7 @@ class IntTextField : public TextField
/**
* Responds to key presses.
*/
- void keyPressed(gcn::KeyEvent &event);
+ void keyPressed(gcn::KeyEvent &event) override;
private:
int mMin; /**< Minimum value */
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index f15fe682..5b373bb6 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -96,7 +96,7 @@ void ItemContainer::logic()
void ItemContainer::draw(gcn::Graphics *graphics)
{
- Graphics *g = static_cast<Graphics*>(graphics);
+ auto *g = static_cast<Graphics*>(graphics);
g->setFont(getFont());
@@ -209,7 +209,7 @@ Item *ItemContainer::getSelectedItem() const
Item *ItemContainer::getItemAt(int index) const
{
- std::map<int, Item*>::const_iterator i = mFilteredMap.find(index);
+ auto i = mFilteredMap.find(index);
return i == mFilteredMap.end() ? 0 : i->second;
}
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index aba12644..fe5b73e5 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -57,33 +57,33 @@ class ItemContainer : public gcn::Widget,
*/
ItemContainer(Inventory *inventory);
- virtual ~ItemContainer();
+ ~ItemContainer() override;
void hidePopup();
/**
* Necessary for checking how full the inventory is.
*/
- void logic();
+ void logic() override;
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
// KeyListener
- void keyPressed(gcn::KeyEvent &event);
- void keyReleased(gcn::KeyEvent &event);
+ void keyPressed(gcn::KeyEvent &event) override;
+ void keyReleased(gcn::KeyEvent &event) override;
// MouseListener
- void mousePressed(gcn::MouseEvent &event);
- void mouseDragged(gcn::MouseEvent &event);
- void mouseReleased(gcn::MouseEvent &event);
- void mouseMoved(gcn::MouseEvent &event);
- void mouseExited(gcn::MouseEvent &event);
+ void mousePressed(gcn::MouseEvent &event) override;
+ void mouseDragged(gcn::MouseEvent &event) override;
+ void mouseReleased(gcn::MouseEvent &event) override;
+ void mouseMoved(gcn::MouseEvent &event) override;
+ void mouseExited(gcn::MouseEvent &event) override;
// WidgetListener
- void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
/**
* Returns the selected item.
@@ -191,8 +191,8 @@ class ItemContainer : public gcn::Widget,
ItemPopup *mItemPopup;
- typedef std::list<gcn::SelectionListener*> SelectionListenerList;
- typedef SelectionListenerList::iterator SelectionListenerIterator;
+ using SelectionListenerList = std::list<gcn::SelectionListener *>;
+ using SelectionListenerIterator = SelectionListenerList::iterator;
SelectionListenerList mSelectionListeners;
};
diff --git a/src/gui/widgets/itemlinkhandler.h b/src/gui/widgets/itemlinkhandler.h
index e499f3e4..dd9eeedc 100644
--- a/src/gui/widgets/itemlinkhandler.h
+++ b/src/gui/widgets/itemlinkhandler.h
@@ -30,8 +30,8 @@ class ItemLinkHandler : public LinkHandler
{
public:
ItemLinkHandler();
- ~ItemLinkHandler();
- void handleLink(const std::string &link);
+ ~ItemLinkHandler() override;
+ void handleLink(const std::string &link) override;
private:
ItemPopup *mItemPopup;
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 396de3bd..a43596f8 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -43,7 +43,7 @@
ItemShortcutContainer::ItemShortcutContainer():
ShortcutContainer(),
mItemClicked(false),
- mItemMoved(NULL)
+ mItemMoved(nullptr)
{
addMouseListener(this);
addWidgetListener(this);
@@ -73,7 +73,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics)
mBackgroundImg->setAlpha(mAlpha);
}
- Graphics *g = static_cast<Graphics*>(graphics);
+ auto *g = static_cast<Graphics*>(graphics);
graphics->setFont(getFont());
@@ -196,7 +196,7 @@ void ItemShortcutContainer::mousePressed(gcn::MouseEvent &event)
// Convert relative to the window coordinates to absolute screen
// coordinates.
- viewport->showPopup(NULL, viewport->getMouseX(), viewport->getMouseY(), item);
+ viewport->showPopup(nullptr, viewport->getMouseX(), viewport->getMouseY(), item);
}
}
@@ -210,13 +210,13 @@ void ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event)
const int index = getIndexFromGrid(event.getX(), event.getY());
if (index == -1)
{
- mItemMoved = NULL;
+ mItemMoved = nullptr;
return;
}
if (mItemMoved)
{
itemShortcut->setItems(index, mItemMoved->getId());
- mItemMoved = NULL;
+ mItemMoved = nullptr;
}
else if (itemShortcut->getItem(index) && mItemClicked)
{
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index 2441d2f8..55d14977 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -40,31 +40,31 @@ class ItemShortcutContainer : public ShortcutContainer
public:
ItemShortcutContainer();
- virtual ~ItemShortcutContainer();
+ ~ItemShortcutContainer() override;
/**
* Draws the items.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Handles mouse when dragged.
*/
- void mouseDragged(gcn::MouseEvent &event);
+ void mouseDragged(gcn::MouseEvent &event) override;
/**
* Handles mouse when pressed.
*/
- void mousePressed(gcn::MouseEvent &event);
+ void mousePressed(gcn::MouseEvent &event) override;
/**
* Handles mouse release.
*/
- void mouseReleased(gcn::MouseEvent &event);
+ void mouseReleased(gcn::MouseEvent &event) override;
private:
- void mouseExited(gcn::MouseEvent &event);
- void mouseMoved(gcn::MouseEvent &event);
+ void mouseExited(gcn::MouseEvent &event) override;
+ void mouseMoved(gcn::MouseEvent &event) override;
bool mItemClicked;
Item *mItemMoved;
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index f30308cd..cb7a8b1c 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -44,7 +44,7 @@ class Label : public gcn::Label
/**
* Draws the label.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
};
#endif
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 68783ddc..ac8488e0 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -71,11 +71,11 @@ void LayoutCell::computeSizes()
{
assert(mType == ARRAY);
- for (std::vector< std::vector< LayoutCell * > >::iterator
+ for (auto
i = mArray->mCells.begin(), i_end = mArray->mCells.end();
i != i_end; ++i)
{
- for (std::vector< LayoutCell * >::iterator
+ for (auto
j = i->begin(), j_end = i->end(); j != j_end; ++j)
{
LayoutCell *cell = *j;
@@ -93,10 +93,10 @@ LayoutArray::LayoutArray(): mSpacing(4)
LayoutArray::~LayoutArray()
{
- for (std::vector< std::vector< LayoutCell * > >::iterator
+ for (auto
i = mCells.begin(), i_end = mCells.end(); i != i_end; ++i)
{
- for (std::vector< LayoutCell * >::iterator
+ for (auto
j = i->begin(), j_end = i->end(); j != j_end; ++j)
{
delete *j;
@@ -133,10 +133,10 @@ void LayoutArray::resizeGrid(int w, int h)
mSizes[0].resize(w, Layout::AUTO_DEF);
}
- for (std::vector< std::vector< LayoutCell * > >::iterator
+ for (auto
i = mCells.begin(), i_end = mCells.end(); i != i_end; ++i)
{
- i->resize(w, NULL);
+ i->resize(w, nullptr);
}
}
diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h
index 5652bdf5..8fd7a405 100644
--- a/src/gui/widgets/layout.h
+++ b/src/gui/widgets/layout.h
@@ -34,7 +34,7 @@ class LayoutCell;
class ContainerPlacer
{
public:
- ContainerPlacer(gcn::Container *c = NULL, LayoutCell *l = NULL):
+ ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *l = nullptr):
mContainer(c), mCell(l)
{}
diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h
index b8512212..26360a9a 100644
--- a/src/gui/widgets/layouthelper.h
+++ b/src/gui/widgets/layouthelper.h
@@ -36,7 +36,7 @@ class LayoutHelper : public gcn::WidgetListener
public:
explicit LayoutHelper(gcn::Container *container);
- ~LayoutHelper();
+ ~LayoutHelper() override;
/**
* Gets the layout handler.
@@ -68,7 +68,7 @@ class LayoutHelper : public gcn::WidgetListener
/**
* Called whenever the managed container changes size.
*/
- void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
private:
Layout mLayout; /**< Layout handler */
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index bc22da30..25787ca7 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -38,7 +38,7 @@ class ListBox : public gcn::ListBox
public:
ListBox(gcn::ListModel *listModel);
- ~ListBox();
+ ~ListBox() override;
/**
* Sets the font to render the text in.
@@ -53,7 +53,7 @@ class ListBox : public gcn::ListBox
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Update the alpha value to the graphic components.
@@ -62,17 +62,17 @@ class ListBox : public gcn::ListBox
// Inherited from KeyListener
- void keyPressed(gcn::KeyEvent& keyEvent);
+ void keyPressed(gcn::KeyEvent& keyEvent) override;
// Inherited from MouseListener
- void mousePressed(gcn::MouseEvent& mouseEvent);
+ void mousePressed(gcn::MouseEvent& mouseEvent) override;
- void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override;
- void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override;
- void mouseDragged(gcn::MouseEvent &event);
+ void mouseDragged(gcn::MouseEvent &event) override;
private:
gcn::Font *mFont;
diff --git a/src/gui/widgets/passwordfield.h b/src/gui/widgets/passwordfield.h
index 83e7e53b..4bed0e05 100644
--- a/src/gui/widgets/passwordfield.h
+++ b/src/gui/widgets/passwordfield.h
@@ -40,7 +40,7 @@ class PasswordField : public TextField
/**
* Draws the password field.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
};
#endif
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 4f341af0..1d3325ee 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -71,7 +71,7 @@ PlayerBox::~PlayerBox()
{
instances--;
- mBeing = 0;
+ mBeing = nullptr;
if (instances == 0)
{
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 070bd82b..68dd670e 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -39,9 +39,9 @@ class PlayerBox : public gcn::ScrollArea
* Constructor. Takes the initial player character that this box should
* display, which defaults to <code>NULL</code>.
*/
- PlayerBox(const Being *being = 0);
+ PlayerBox(const Being *being = nullptr);
- ~PlayerBox();
+ ~PlayerBox() override;
/**
* Sets a new player character to be displayed by this box. Setting the
@@ -54,12 +54,12 @@ class PlayerBox : public gcn::ScrollArea
/**
* Draws the scroll area.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Draws the background and border of the scroll area.
*/
- void drawFrame(gcn::Graphics *graphics);
+ void drawFrame(gcn::Graphics *graphics) override;
private:
const Being *mBeing; /**< The character used for display */
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 1c7cfdd1..298443e7 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -73,7 +73,7 @@ void Popup::setWindowContainer(WindowContainer *wc)
void Popup::draw(gcn::Graphics *graphics)
{
- Graphics *g = static_cast<Graphics*>(graphics);
+ auto *g = static_cast<Graphics*>(graphics);
g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder());
diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h
index 5ec6ecd0..af37b211 100644
--- a/src/gui/widgets/popup.h
+++ b/src/gui/widgets/popup.h
@@ -62,7 +62,7 @@ class Popup : public Container, public gcn::MouseListener
/**
* Destructor. Deletes all the added widgets.
*/
- ~Popup();
+ ~Popup() override;
/**
* Sets the window container to be used by new popups.
@@ -72,7 +72,7 @@ class Popup : public Container, public gcn::MouseListener
/**
* Draws the popup.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Sets the size of this popup.
@@ -84,7 +84,7 @@ class Popup : public Container, public gcn::MouseListener
*/
void setLocationRelativeTo(gcn::Widget *widget);
- void mouseMoved(gcn::MouseEvent &event);
+ void mouseMoved(gcn::MouseEvent &event) override;
/**
* Sets the minimum width of the popup.
@@ -142,7 +142,7 @@ class Popup : public Container, public gcn::MouseListener
// Inherited from BasicContainer
- virtual gcn::Rectangle getChildrenArea();
+ gcn::Rectangle getChildrenArea() override;
/**
* Sets the location to display the popup. Tries to horizontally center
diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h
index 56b2fe92..d3a4c100 100644
--- a/src/gui/widgets/progressbar.h
+++ b/src/gui/widgets/progressbar.h
@@ -44,12 +44,12 @@ class ProgressBar : public gcn::Widget
int width = 40, int height = 7,
int color = -1);
- ~ProgressBar();
+ ~ProgressBar() override;
/**
* Performs progress bar logic (fading colors)
*/
- void logic();
+ void logic() override;
/**
* Update the alpha value to the graphic components.
@@ -59,7 +59,7 @@ class ProgressBar : public gcn::Widget
/**
* Draws the progress bar.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Sets the current progress.
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index 9971d144..2495a62d 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -35,7 +35,7 @@ ProgressIndicator::ProgressIndicator()
ImageSet *images = Theme::getImageSetFromTheme("progress-indicator.png",
32, 32);
- Animation *anim = new Animation;
+ auto *anim = new Animation;
for (ImageSet::size_type i = 0; i < images->size(); ++i)
anim->addFrame(images->get(i), 100, 0, 0);
diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h
index cb469c07..13cab227 100644
--- a/src/gui/widgets/progressindicator.h
+++ b/src/gui/widgets/progressindicator.h
@@ -33,10 +33,10 @@ class ProgressIndicator : public gcn::Widget
{
public:
ProgressIndicator();
- ~ProgressIndicator();
+ ~ProgressIndicator() override;
- void logic();
- void draw(gcn::Graphics *graphics);
+ void logic() override;
+ void draw(gcn::Graphics *graphics) override;
private:
SimpleAnimation *mIndicator;
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index b0a92784..676daede 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -88,7 +88,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
radioCheckedHi->setAlpha(mAlpha);
}
- Image *box = NULL;
+ Image *box = nullptr;
if (isEnabled())
if (isSelected())
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index 5a868fea..014acd06 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -35,28 +35,28 @@ class RadioButton : public gcn::RadioButton
RadioButton(const std::string &caption,const std::string &group,
bool marked = false);
- ~RadioButton();
+ ~RadioButton() override;
/**
* Draws the radiobutton, not the caption.
*/
- void drawBox(gcn::Graphics* graphics);
+ void drawBox(gcn::Graphics* graphics) override;
/**
* Implementation of the draw methods.
* Thus, avoiding the rhomb around the radio button.
*/
- void draw(gcn::Graphics* graphics);
+ void draw(gcn::Graphics* graphics) override;
/**
* Called when the mouse enteres the widget area.
*/
- void mouseEntered(gcn::MouseEvent& event);
+ void mouseEntered(gcn::MouseEvent& event) override;
/**
* Called when the mouse leaves the widget area.
*/
- void mouseExited(gcn::MouseEvent& event);
+ void mouseExited(gcn::MouseEvent& event) override;
private:
static int instances;
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index da97ac69..1770fcb1 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -29,7 +29,7 @@
#include <guichan/graphics.hpp>
-Image *ResizeGrip::gripImage = 0;
+Image *ResizeGrip::gripImage = nullptr;
int ResizeGrip::mInstances = 0;
float ResizeGrip::mAlpha = 1.0;
diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h
index 9e478cd9..d2f8ca4d 100644
--- a/src/gui/widgets/resizegrip.h
+++ b/src/gui/widgets/resizegrip.h
@@ -38,12 +38,12 @@ class ResizeGrip : public gcn::Widget
public:
ResizeGrip(const std::string &image = "resize.png");
- ~ResizeGrip();
+ ~ResizeGrip() override;
/**
* Draws the resize grip.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
private:
static Image *gripImage; /**< Resize grip image */
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index d3e308c7..266b5a31 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -56,13 +56,13 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener
/**
* Destructor. Also deletes the content.
*/
- ~ScrollArea();
+ ~ScrollArea() override;
/**
* Logic function optionally adapts width or height of contents. This
* depends on the scrollbar settings.
*/
- void logic();
+ void logic() override;
/**
* Update the alpha value to the graphic components.
@@ -72,12 +72,12 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener
/**
* Draws the scroll area.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Draws the background and border of the scroll area.
*/
- void drawFrame(gcn::Graphics *graphics);
+ void drawFrame(gcn::Graphics *graphics) override;
/**
* Sets whether the widget should draw its background or not.
@@ -92,19 +92,19 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener
/**
* Called when the mouse moves in the widget area.
*/
- void mouseMoved(gcn::MouseEvent& event);
+ void mouseMoved(gcn::MouseEvent& event) override;
/**
* Called when the mouse enteres the widget area.
*/
- void mouseEntered(gcn::MouseEvent& event);
+ void mouseEntered(gcn::MouseEvent& event) override;
/**
* Called when the mouse leaves the widget area.
*/
- void mouseExited(gcn::MouseEvent& event);
+ void mouseExited(gcn::MouseEvent& event) override;
- void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
protected:
enum BUTTON_DIR {
@@ -120,14 +120,14 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener
void init();
void drawButton(gcn::Graphics *graphics, BUTTON_DIR dir);
- void drawUpButton(gcn::Graphics *graphics);
- void drawDownButton(gcn::Graphics *graphics);
- void drawLeftButton(gcn::Graphics *graphics);
- void drawRightButton(gcn::Graphics *graphics);
- void drawVBar(gcn::Graphics *graphics);
- void drawHBar(gcn::Graphics *graphics);
- void drawVMarker(gcn::Graphics *graphics);
- void drawHMarker(gcn::Graphics *graphics);
+ void drawUpButton(gcn::Graphics *graphics) override;
+ void drawDownButton(gcn::Graphics *graphics) override;
+ void drawLeftButton(gcn::Graphics *graphics) override;
+ void drawRightButton(gcn::Graphics *graphics) override;
+ void drawVBar(gcn::Graphics *graphics) override;
+ void drawHBar(gcn::Graphics *graphics) override;
+ void drawVMarker(gcn::Graphics *graphics) override;
+ void drawHMarker(gcn::Graphics *graphics) override;
static int instances;
static float mAlpha;
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index 59711754..91829131 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -52,7 +52,7 @@ void ShopItems::addItem(int id, int amount, int price)
void ShopItems::addItem(int inventoryIndex, int id, int quantity, int price)
{
- ShopItem *item = 0;
+ ShopItem *item = nullptr;
if (mMergeDuplicates)
{
item = findItem(id);
@@ -99,5 +99,5 @@ ShopItem *ShopItems::findItem(int id)
}
}
- return 0;
+ return nullptr;
}
diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h
index 338dc0cd..e213f67c 100644
--- a/src/gui/widgets/shopitems.h
+++ b/src/gui/widgets/shopitems.h
@@ -49,7 +49,7 @@ class ShopItems : public gcn::ListModel
*/
ShopItems(bool mergeDuplicates = false);
- ~ShopItems();
+ ~ShopItems() override;
/**
* Adds an item to the list.
@@ -70,14 +70,14 @@ class ShopItems : public gcn::ListModel
/**
* Returns the number of items in the shop.
*/
- int getNumberOfElements();
+ int getNumberOfElements() override;
/**
* Returns the name of item number i in the shop.
*
* @param i the index to retrieve
*/
- std::string getElementAt(int i);
+ std::string getElementAt(int i) override;
/**
* Returns the item number i in the shop.
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index e2e03e18..d6dd087a 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -87,7 +87,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
const gcn::Color &textColor =
Theme::getThemeColor(Theme::TEXT);
- Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
+ auto *graphics = static_cast<Graphics*>(gcnGraphics);
graphics->setFont(getFont());
const int fontHeight = getFont()->getHeight();
@@ -97,7 +97,7 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
i < mListModel->getNumberOfElements();
++i, y += mRowHeight)
{
- ShopItem *shopItem = mShopItems ? mShopItems->at(i) : 0;
+ ShopItem *shopItem = mShopItems ? mShopItems->at(i) : nullptr;
if (shopItem && mPlayerMoney < shopItem->getPrice() && mPriceCheck)
{
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index a1554c6e..c3d10a4a 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -44,17 +44,17 @@ class ShopListBox : public ListBox
*/
ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel);
- ~ShopListBox();
+ ~ShopListBox() override;
/**
* Draws the list box.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Returns the height of a row.
*/
- unsigned int getRowHeight() const { return mRowHeight; }
+ unsigned int getRowHeight() const override { return mRowHeight; }
/**
* gives information about the current player's money
@@ -75,12 +75,12 @@ class ShopListBox : public ListBox
/**
** Show ItemTooltip
*/
- void mouseMoved(gcn::MouseEvent &event);
+ void mouseMoved(gcn::MouseEvent &event) override;
/**
** Hide ItemTooltip
*/
- void mouseExited(gcn::MouseEvent &event);
+ void mouseExited(gcn::MouseEvent &event) override;
private:
int mPlayerMoney;
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index e7f05c48..f0f9b730 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -40,33 +40,33 @@ class ShortcutContainer : public gcn::Widget,
public:
ShortcutContainer();
- ~ShortcutContainer() {}
+ ~ShortcutContainer() override {}
/**
* Draws the shortcuts
*/
- virtual void draw(gcn::Graphics *graphics) = 0;
+ void draw(gcn::Graphics *graphics) override = 0;
/**
* Invoked when a widget changes its size. This is used to determine
* the new height of the container.
*/
- virtual void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
/**
* Handles mouse when dragged.
*/
- virtual void mouseDragged(gcn::MouseEvent &event) = 0;
+ void mouseDragged(gcn::MouseEvent &event) override = 0;
/**
* Handles mouse when pressed.
*/
- virtual void mousePressed(gcn::MouseEvent &event) = 0;
+ void mousePressed(gcn::MouseEvent &event) override = 0;
/**
* Handles mouse release.
*/
- virtual void mouseReleased(gcn::MouseEvent &event) = 0;
+ void mouseReleased(gcn::MouseEvent &event) override = 0;
int getMaxItems() const
{ return mMaxItems; }
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index a7ad6abf..d5b9d5ec 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -47,7 +47,7 @@ class Slider : public gcn::Slider
*/
Slider(double scaleStart, double scaleEnd);
- ~Slider();
+ ~Slider() override;
/**
* Update the alpha value to the graphic components.
@@ -57,22 +57,22 @@ class Slider : public gcn::Slider
/**
* Draws the slider.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Draws the marker.
*/
- void drawMarker(gcn::Graphics *graphics);
+ void drawMarker(gcn::Graphics *graphics) override;
/**
* Called when the mouse enteres the widget area.
*/
- void mouseEntered(gcn::MouseEvent& event);
+ void mouseEntered(gcn::MouseEvent& event) override;
/**
* Called when the mouse leaves the widget area.
*/
- void mouseExited(gcn::MouseEvent& event);
+ void mouseExited(gcn::MouseEvent& event) override;
private:
/**
diff --git a/src/gui/widgets/spacer.h b/src/gui/widgets/spacer.h
index 75a83afd..11e0ac66 100644
--- a/src/gui/widgets/spacer.h
+++ b/src/gui/widgets/spacer.h
@@ -47,7 +47,7 @@ class Spacer : public gcn::Widget
/**
* Draws nothing.
*/
- void draw(gcn::Graphics *g) {}
+ void draw(gcn::Graphics *g) override {}
};
#endif // SPACER_H
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index 49537e76..9dc5291e 100644
--- a/src/gui/widgets/tab.h
+++ b/src/gui/widgets/tab.h
@@ -35,7 +35,7 @@ class Tab : public gcn::Tab
{
public:
Tab();
- ~Tab();
+ ~Tab() override;
/**
* Update the alpha value to the graphic components.
@@ -45,7 +45,7 @@ class Tab : public gcn::Tab
/**
* Draw the tabbed area.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Set the normal color fo the tab's text.
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 52690657..cd2c0f03 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -41,7 +41,7 @@ TabbedArea::TabbedArea() : gcn::TabbedArea(),
add(mArrowButton[0]);
add(mArrowButton[1]);
- widgetResized(NULL);
+ widgetResized(nullptr);
}
int TabbedArea::getNumberOfTabs() const
@@ -51,7 +51,7 @@ int TabbedArea::getNumberOfTabs() const
Tab *TabbedArea::getTab(const std::string &name) const
{
- TabContainer::const_iterator itr = mTabs.begin(), itr_end = mTabs.end();
+ auto itr = mTabs.begin(), itr_end = mTabs.end();
while (itr != itr_end)
{
if ((*itr).first->getCaption() == name)
@@ -59,7 +59,7 @@ Tab *TabbedArea::getTab(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
void TabbedArea::draw(gcn::Graphics *graphics)
@@ -72,7 +72,7 @@ void TabbedArea::draw(gcn::Graphics *graphics)
gcn::Widget *TabbedArea::getWidget(const std::string &name) const
{
- TabContainer::const_iterator itr = mTabs.begin(), itr_end = mTabs.end();
+ auto itr = mTabs.begin(), itr_end = mTabs.end();
while (itr != itr_end)
{
if ((*itr).first->getCaption() == name)
@@ -81,7 +81,7 @@ gcn::Widget *TabbedArea::getWidget(const std::string &name) const
++itr;
}
- return NULL;
+ return nullptr;
}
gcn::Widget *TabbedArea::getCurrentWidget()
@@ -89,7 +89,7 @@ gcn::Widget *TabbedArea::getCurrentWidget()
if (gcn::Tab *tab = getSelectedTab())
return getWidget(tab->getCaption());
- return NULL;
+ return nullptr;
}
void TabbedArea::addTab(gcn::Tab* tab, gcn::Widget* widget)
@@ -119,7 +119,7 @@ void TabbedArea::removeTab(Tab *tab)
if (getNumberOfTabs() > 1)
setSelectedTab(std::max(0, getSelectedTabIndex() - 1));
else
- mSelectedTab = 0;
+ mSelectedTab = nullptr;
}
TabContainer::iterator iter;
@@ -163,7 +163,7 @@ void TabbedArea::mousePressed(gcn::MouseEvent &mouseEvent)
{
gcn::Widget *widget = mTabContainer->getWidgetAt(mouseEvent.getX(),
mouseEvent.getY());
- gcn::Tab *tab = dynamic_cast<gcn::Tab*>(widget);
+ auto *tab = dynamic_cast<gcn::Tab*>(widget);
if (tab)
{
@@ -180,7 +180,7 @@ void TabbedArea::setSelectedTab(gcn::Tab *tab)
if (Tab *newTab = dynamic_cast<Tab*>(tab))
newTab->setCurrent();
- widgetResized(NULL);
+ widgetResized(nullptr);
}
void TabbedArea::widgetResized(const gcn::Event &event)
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index b43078a4..53bb2bb2 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -44,7 +44,7 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
/**
* Draw the tabbed area.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Return how many tabs have been created.
@@ -74,7 +74,7 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
* @param tab The tab widget for the tab.
* @param widget The widget to view when the tab is selected.
*/
- void addTab(gcn::Tab* tab, gcn::Widget* widget);
+ void addTab(gcn::Tab* tab, gcn::Widget* widget) override;
/**
* Add a tab. Overridden since it needs to create an instance of Tab
@@ -83,7 +83,7 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
* @param caption The Caption to display
* @param widget The widget to show when tab is selected
*/
- void addTab(const std::string &caption, gcn::Widget *widget);
+ void addTab(const std::string &caption, gcn::Widget *widget) override;
/**
* Overload the remove tab function as it's broken in guichan 0.8.
@@ -93,27 +93,27 @@ class TabbedArea : public gcn::TabbedArea, public gcn::WidgetListener
/**
* Overload the logic function since it's broken in guichan 0.8.
*/
- void logic();
+ void logic() override;
int getContainerHeight() const
{ return mWidgetContainer->getHeight(); }
- void setSelectedTab(unsigned int index)
+ void setSelectedTab(unsigned int index) override
{ gcn::TabbedArea::setSelectedTab(index); }
- void setSelectedTab(gcn::Tab *tab);
+ void setSelectedTab(gcn::Tab *tab) override;
- void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
void adjustTabPositions();
- void action(const gcn::ActionEvent& actionEvent);
+ void action(const gcn::ActionEvent& actionEvent) override;
// Inherited from MouseListener
- void mousePressed(gcn::MouseEvent &mouseEvent);
+ void mousePressed(gcn::MouseEvent &mouseEvent) override;
private:
- typedef std::vector< std::pair<gcn::Tab*, gcn::Widget*> > TabContainer;
+ using TabContainer = std::vector<std::pair<gcn::Tab *, gcn::Widget *>>;
/** The tab arrows */
Button *mArrowButton[2];
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index 08aae006..465fbc61 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -40,9 +40,9 @@ class GuiTableActionListener : public gcn::ActionListener
public:
GuiTableActionListener(GuiTable *_table, gcn::Widget *_widget, int _row, int _column);
- virtual ~GuiTableActionListener();
+ ~GuiTableActionListener() override;
- virtual void action(const gcn::ActionEvent& actionEvent);
+ void action(const gcn::ActionEvent& actionEvent) override;
protected:
GuiTable *mTable;
@@ -70,7 +70,7 @@ GuiTableActionListener::~GuiTableActionListener()
if (mWidget)
{
mWidget->removeActionListener(this);
- mWidget->_setParent(NULL);
+ mWidget->_setParent(nullptr);
}
}
@@ -87,10 +87,10 @@ GuiTable::GuiTable(TableModel *initial_model, gcn::Color background,
mWrappingEnabled(false),
mOpaque(opacity),
mBackgroundColor(background),
- mModel(NULL),
+ mModel(nullptr),
mSelectedRow(0),
mSelectedColumn(0),
- mTopWidget(NULL)
+ mTopWidget(nullptr)
{
setModel(initial_model);
setFocusable(true);
@@ -367,7 +367,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget)
{
gcn::Widget::moveToBottom(widget);
if (widget == mTopWidget)
- mTopWidget = NULL;
+ mTopWidget = nullptr;
}
gcn::Rectangle GuiTable::getChildrenArea() const
@@ -484,7 +484,7 @@ void GuiTable::modelUpdated(bool completed)
}
else
{ // before the update?
- mTopWidget = NULL; // No longer valid in general
+ mTopWidget = nullptr; // No longer valid in general
uninstallActionListeners();
}
}
@@ -503,10 +503,10 @@ gcn::Widget *GuiTable::getWidgetAt(int x, int y) const
if (w && w->isFocusable())
return w;
else
- return NULL; // Grab the event locally
+ return nullptr; // Grab the event locally
}
else
- return NULL;
+ return nullptr;
}
int GuiTable::getRowForY(int y) const
diff --git a/src/gui/widgets/table.h b/src/gui/widgets/table.h
index 1a412b6f..a9202022 100644
--- a/src/gui/widgets/table.h
+++ b/src/gui/widgets/table.h
@@ -50,10 +50,10 @@ class GuiTable : public gcn::Widget,
friend class GuiTableActionListener;
public:
- GuiTable(TableModel * initial_model = NULL, gcn::Color background = 0xffffff,
+ GuiTable(TableModel * initial_model = nullptr, gcn::Color background = 0xffffff,
bool opacity = true);
- virtual ~GuiTable();
+ ~GuiTable() override;
/**
* Retrieves the active table model
@@ -101,18 +101,18 @@ public:
void setLinewiseSelection(bool linewise);
// Inherited from Widget
- virtual void draw(gcn::Graphics* graphics);
+ void draw(gcn::Graphics* graphics) override;
virtual gcn::Widget *getWidgetAt(int x, int y) const;
- virtual void moveToTop(gcn::Widget *child);
+ void moveToTop(gcn::Widget *child) override;
- virtual void moveToBottom(gcn::Widget *child);
+ void moveToBottom(gcn::Widget *child) override;
- virtual void _setFocusHandler(gcn::FocusHandler* focusHandler);
+ void _setFocusHandler(gcn::FocusHandler* focusHandler) override;
// Inherited from KeyListener
- virtual void keyPressed(gcn::KeyEvent& keyEvent);
+ void keyPressed(gcn::KeyEvent& keyEvent) override;
/**
* Sets the table to be opaque, that is sets the table
@@ -131,16 +131,16 @@ public:
virtual bool isOpaque() const {return mOpaque;}
// Inherited from MouseListener
- virtual void mousePressed(gcn::MouseEvent& mouseEvent);
+ void mousePressed(gcn::MouseEvent& mouseEvent) override;
- virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent) override;
- virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent);
+ void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) override;
- virtual void mouseDragged(gcn::MouseEvent& mouseEvent);
+ void mouseDragged(gcn::MouseEvent& mouseEvent) override;
// Constraints inherited from TableModelListener
- virtual void modelUpdated(bool);
+ void modelUpdated(bool) override;
protected:
/** Frees all action listeners on inner widgets. */
diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp
index 501e9c31..5273e929 100644
--- a/src/gui/widgets/tablemodel.cpp
+++ b/src/gui/widgets/tablemodel.cpp
@@ -37,13 +37,13 @@ void TableModel::removeListener(TableModelListener *listener)
void TableModel::signalBeforeUpdate()
{
- for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
+ for (auto it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(false);
}
void TableModel::signalAfterUpdate()
{
- for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
+ for (auto it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(true);
}
diff --git a/src/gui/widgets/tablemodel.h b/src/gui/widgets/tablemodel.h
index ca657415..2e36992a 100644
--- a/src/gui/widgets/tablemodel.h
+++ b/src/gui/widgets/tablemodel.h
@@ -101,7 +101,7 @@ class StaticTableModel : public TableModel
{
public:
StaticTableModel(int width, int height);
- virtual ~StaticTableModel();
+ ~StaticTableModel() override;
/**
* Inserts a widget into the table model.
@@ -130,13 +130,13 @@ public:
*/
virtual void resize();
- virtual int getRows() const;
- virtual int getColumns() const;
- virtual int getRowHeight() const;
+ int getRows() const override;
+ int getColumns() const override;
+ int getRowHeight() const override;
virtual int getWidth() const;
virtual int getHeight() const;
- virtual int getColumnWidth(int index) const;
- virtual gcn::Widget *getElementAt(int row, int column) const;
+ int getColumnWidth(int index) const override;
+ gcn::Widget *getElementAt(int row, int column) const override;
protected:
int mRows, mColumns;
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index dc003036..bcf09ee2 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -52,7 +52,7 @@ class TextBox : public gcn::TextBox
/**
* Draws the text.
*/
- void draw(gcn::Graphics *graphics)
+ void draw(gcn::Graphics *graphics) override
{
setForegroundColor(*mTextColor);
gcn::TextBox::draw(graphics);
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 35ce09c5..1609e002 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -46,8 +46,8 @@ ImageRect TextField::skin;
TextField::TextField(const std::string &text, bool loseFocusOnTab):
gcn::TextField(text),
mNumeric(false),
- mAutoComplete(NULL),
- mHistory(NULL)
+ mAutoComplete(nullptr),
+ mHistory(nullptr)
{
setFrameSize(2);
@@ -203,7 +203,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent)
if (mHistory && !mHistory->atEnd())
{
// Move forward through the history
- TextHistoryIterator prevHist = mHistory->current++;
+ auto prevHist = mHistory->current++;
if (!mHistory->atEnd())
{
@@ -324,7 +324,7 @@ void TextField::autoComplete()
if (newName == "" && mHistory)
{
- TextHistoryIterator i = mHistory->history.begin();
+ auto i = mHistory->history.begin();
std::vector<std::string> nameList;
while (i != mHistory->history.end())
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index bf60cbc3..b1b7a6a4 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -30,8 +30,8 @@ class TextInput;
class ImageRect;
class TextField;
-typedef std::list<std::string> TextHistoryList;
-typedef TextHistoryList::iterator TextHistoryIterator;
+using TextHistoryList = std::list<std::string>;
+using TextHistoryIterator = TextHistoryList::iterator;
struct TextHistory {
TextHistoryList history; /**< Command history. */
@@ -80,12 +80,12 @@ class TextField : public gcn::TextField
* Constructor, initializes the text field with the given string.
*/
TextField(const std::string &text = "", bool loseFocusOnTab = true);
- ~TextField();
+ ~TextField() override;
/**
* Draws the text field.
*/
- virtual void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Update the alpha value to the graphic components.
@@ -95,7 +95,7 @@ class TextField : public gcn::TextField
/**
* Draws the background and border.
*/
- void drawFrame(gcn::Graphics *graphics);
+ void drawFrame(gcn::Graphics *graphics) override;
/**
* Determine whether the field should be numeric or not
@@ -114,7 +114,7 @@ class TextField : public gcn::TextField
/**
* Processes one keypress.
*/
- void keyPressed(gcn::KeyEvent &keyEvent);
+ void keyPressed(gcn::KeyEvent &keyEvent) override;
/**
* Handle text input (should possibly be new event in Guichan).
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index b0963d30..d6ef172c 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -38,7 +38,7 @@ TextPreview::TextPreview(const std::string &text):
mTextAlpha = false;
mFont = gui->getFont();
mTextColor = &Theme::getThemeColor(Theme::TEXT);
- mTextBGColor = NULL;
+ mTextBGColor = nullptr;
mBGColor = &Theme::getThemeColor(Theme::BACKGROUND);
mOpaque = false;
}
@@ -64,7 +64,7 @@ void TextPreview::draw(gcn::Graphics* graphics)
if (mTextBGColor && typeid(*mFont) == typeid(TrueTypeFont))
{
- TrueTypeFont *font = static_cast<TrueTypeFont*>(mFont);
+ auto *font = static_cast<TrueTypeFont*>(mFont);
int x = font->getWidth(mText) + 1 + 2 * ((mOutline || mShadow) ? 1 :0);
int y = font->getHeight() + 1 + 2 * ((mOutline || mShadow) ? 1 : 0);
graphics->setColor(gcn::Color((int) mTextBGColor->r,
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index 6a0cb28b..0cda7c8b 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -110,7 +110,7 @@ class TextPreview : public gcn::Widget
*
* @param graphics graphics to draw into
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Set opacity for this widget (whether or not to show the background
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp
index e21e9d75..ad87788f 100644
--- a/src/gui/widgets/vertcontainer.cpp
+++ b/src/gui/widgets/vertcontainer.cpp
@@ -45,7 +45,7 @@ void VertContainer::clear()
void VertContainer::widgetResized(const gcn::Event &event)
{
- for (WidgetListIterator it = mWidgets.begin(); it != mWidgets.end(); it++)
+ for (auto it = mWidgets.begin(); it != mWidgets.end(); it++)
{
(*it)->setWidth(getWidth());
}
diff --git a/src/gui/widgets/vertcontainer.h b/src/gui/widgets/vertcontainer.h
index c2403afb..439f7ca1 100644
--- a/src/gui/widgets/vertcontainer.h
+++ b/src/gui/widgets/vertcontainer.h
@@ -34,9 +34,9 @@ class VertContainer : public Container, public gcn::WidgetListener
{
public:
VertContainer(int spacing);
- virtual void add(gcn::Widget *widget);
- virtual void clear();
- void widgetResized(const gcn::Event &event);
+ void add(gcn::Widget *widget) override;
+ void clear() override;
+ void widgetResized(const gcn::Event &event) override;
private:
int mSpacing;
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index a0dcfc14..0f01bacc 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -34,12 +34,12 @@ class WhisperTab : public ChatTab
public:
const std::string &getNick() const { return mNick; }
- void showHelp();
+ void showHelp() override;
bool handleCommand(const std::string &type,
- const std::string &args);
+ const std::string &args) override;
- void saveToLogFile(std::string &msg);
+ void saveToLogFile(std::string &msg) override;
protected:
friend class ChatWindow;
@@ -51,13 +51,13 @@ class WhisperTab : public ChatTab
*/
WhisperTab(const std::string &nick);
- ~WhisperTab();
+ ~WhisperTab() override;
- void handleInput(const std::string &msg);
+ void handleInput(const std::string &msg) override;
- void handleCommand(const std::string &msg);
+ void handleCommand(const std::string &msg) override;
- bool checkNotify(Own) const
+ bool checkNotify(Own) const override
{ return true; }
private:
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index c8788c75..05638470 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -44,9 +44,9 @@ int Window::mouseResize = 0;
Window::Window(const std::string &caption, bool modal, Window *parent,
const std::string &skin):
gcn::Window(caption),
- mGrip(0),
+ mGrip(nullptr),
mParent(parent),
- mLayout(NULL),
+ mLayout(nullptr),
mWindowName("window"),
mShowTitle(true),
mModal(modal),
@@ -114,7 +114,7 @@ void Window::setWindowContainer(WindowContainer *wc)
void Window::draw(gcn::Graphics *graphics)
{
- Graphics *g = static_cast<Graphics*>(graphics);
+ auto *g = static_cast<Graphics*>(graphics);
g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder());
@@ -260,7 +260,7 @@ void Window::setResizable(bool r)
{
remove(mGrip);
delete mGrip;
- mGrip = 0;
+ mGrip = nullptr;
}
}
@@ -757,7 +757,7 @@ void Window::reflowLayout(int w, int h)
assert(mLayout);
mLayout->reflow(w, h);
delete mLayout;
- mLayout = NULL;
+ mLayout = nullptr;
setContentSize(w, h);
}
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index fc44ec5f..fe2b217c 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -57,12 +57,12 @@ class Window : public gcn::Window, gcn::WidgetListener
* @param skin The location where the window's skin XML can be found.
*/
Window(const std::string &caption = "Window", bool modal = false,
- Window *parent = NULL, const std::string &skin = "window.xml");
+ Window *parent = nullptr, const std::string &skin = "window.xml");
/**
* Destructor. Deletes all the added widgets.
*/
- ~Window();
+ ~Window() override;
/**
* Sets the window container to be used by new windows.
@@ -72,7 +72,7 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Draws the window.
*/
- void draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics) override;
/**
* Sets the size of this window.
@@ -100,12 +100,12 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Called whenever the widget changes size.
*/
- void widgetResized(const gcn::Event &event);
+ void widgetResized(const gcn::Event &event) override;
/**
* Called whenever the widget is hidden.
*/
- virtual void widgetHidden(const gcn::Event &event);
+ void widgetHidden(const gcn::Event &event) override;
/**
* Sets whether or not the window has a close button.
@@ -215,31 +215,31 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Starts window resizing when appropriate.
*/
- void mousePressed(gcn::MouseEvent &event);
+ void mousePressed(gcn::MouseEvent &event) override;
/**
* Implements window resizing and makes sure the window is not
* dragged/resized outside of the screen.
*/
- void mouseDragged(gcn::MouseEvent &event);
+ void mouseDragged(gcn::MouseEvent &event) override;
/**
* Implements custom cursor image changing context, based on mouse
* relative position.
*/
- void mouseMoved(gcn::MouseEvent &event);
+ void mouseMoved(gcn::MouseEvent &event) override;
/**
* When the mouse button has been let go, this ensures that the mouse
* custom cursor is restored back to it's standard image.
*/
- void mouseReleased(gcn::MouseEvent &event);
+ void mouseReleased(gcn::MouseEvent &event) override;
/**
* When the mouse leaves the window this ensures that the custom cursor
* is restored back to it's standard image.
*/
- void mouseExited(gcn::MouseEvent &event);
+ void mouseExited(gcn::MouseEvent &event) override;
/**
* Sets the name of the window. This is not the window title.
diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp
index 5cff4999..c7ac5d99 100644
--- a/src/gui/widgets/windowcontainer.cpp
+++ b/src/gui/widgets/windowcontainer.cpp
@@ -25,7 +25,7 @@
#include "utils/dtor.h"
-WindowContainer *windowContainer = NULL;
+WindowContainer *windowContainer = nullptr;
void WindowContainer::logic()
{
@@ -43,7 +43,7 @@ void WindowContainer::scheduleDelete(gcn::Widget *widget)
void WindowContainer::adjustAfterResize(int oldScreenWidth,
int oldScreenHeight)
{
- for (WidgetListIterator i = mWidgets.begin(); i != mWidgets.end(); ++i)
- if (Window *window = dynamic_cast<Window*>(*i))
+ for (auto i = mWidgets.begin(); i != mWidgets.end(); ++i)
+ if (auto *window = dynamic_cast<Window*>(*i))
window->adjustPositionAfterResize(oldScreenWidth, oldScreenHeight);
}
diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h
index 1da5a2cd..3e01bb36 100644
--- a/src/gui/widgets/windowcontainer.h
+++ b/src/gui/widgets/windowcontainer.h
@@ -37,7 +37,7 @@ class WindowContainer : public Container
* Do GUI logic. This functions adds automatic deletion of objects that
* volunteered to be deleted.
*/
- void logic();
+ void logic() override;
/**
* Schedule a widget for deletion. It will be deleted at the start of
@@ -55,8 +55,8 @@ class WindowContainer : public Container
/**
* List of widgets that are scheduled to be deleted.
*/
- typedef std::list<gcn::Widget*> Widgets;
- typedef Widgets::iterator WidgetIterator;
+ using Widgets = std::list<gcn::Widget *>;
+ using WidgetIterator = Widgets::iterator;
Widgets mDeathList;
};