From 82644cd319e46e35a7b4e3b4a61fac2465a2ea66 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 2 Jun 2014 22:15:12 +0300 Subject: Add missing final/notfinal to classes. --- src/gui/colorpair.h | 2 +- src/gui/fonts/textchunksmall.h | 2 +- src/gui/models/listmodel.h | 2 +- src/gui/models/tablemodel.cpp | 2 ++ src/gui/models/tablemodel.h | 20 ++------------------ src/gui/palette.h | 4 ++-- src/gui/rect.h | 2 +- src/gui/widgets/browserbox.cpp | 31 +++++++++++++++++-------------- src/gui/widgets/extendedlistboxitem.h | 4 +++- src/gui/widgets/guitable.h | 1 + src/gui/widgets/layoutcell.h | 2 +- src/gui/widgets/linkhandler.h | 2 +- src/gui/widgets/widget2.h | 2 +- 13 files changed, 34 insertions(+), 42 deletions(-) (limited to 'src/gui') diff --git a/src/gui/colorpair.h b/src/gui/colorpair.h index c0c699777..2685a372d 100644 --- a/src/gui/colorpair.h +++ b/src/gui/colorpair.h @@ -25,7 +25,7 @@ class Color; -struct ColorPair +struct ColorPair final { ColorPair(const Color* c1, const Color* c2) : color1(c1), diff --git a/src/gui/fonts/textchunksmall.h b/src/gui/fonts/textchunksmall.h index 0b3741b4c..aed31b4fa 100644 --- a/src/gui/fonts/textchunksmall.h +++ b/src/gui/fonts/textchunksmall.h @@ -27,7 +27,7 @@ #include "localconsts.h" -class TextChunkSmall +class TextChunkSmall final { public: TextChunkSmall(const std::string &text0, diff --git a/src/gui/models/listmodel.h b/src/gui/models/listmodel.h index dfce6d4d5..3f7b964c6 100644 --- a/src/gui/models/listmodel.h +++ b/src/gui/models/listmodel.h @@ -75,7 +75,7 @@ * like ListBox, make a derived class from this class that * represents your list. */ -class ListModel +class ListModel notfinal { public: /** diff --git a/src/gui/models/tablemodel.cpp b/src/gui/models/tablemodel.cpp index aad66a6ad..d9498bbd7 100644 --- a/src/gui/models/tablemodel.cpp +++ b/src/gui/models/tablemodel.cpp @@ -26,6 +26,8 @@ #include "gui/widgets/widget.h" +#include "listeners/tablemodellistener.h" + #include "debug.h" void TableModel::installListener(TableModelListener *const listener) diff --git a/src/gui/models/tablemodel.h b/src/gui/models/tablemodel.h index 032facadd..1f3f86af7 100644 --- a/src/gui/models/tablemodel.h +++ b/src/gui/models/tablemodel.h @@ -30,28 +30,12 @@ class Widget; -class TableModelListener -{ -public: - /** - * Must be invoked by the TableModel whenever a global change is about to - * occur or has occurred (e.g., when a row or column is being removed or - * added). - * - * This method is triggered twice, once before and once after the update. - * - * \param completed whether we are signalling the end of the update - */ - virtual void modelUpdated(const bool completed) = 0; - - virtual ~TableModelListener() - { } -}; +class TableModelListener; /** * A model for a regular table of widgets. */ -class TableModel +class TableModel notfinal { public: virtual ~TableModel() diff --git a/src/gui/palette.h b/src/gui/palette.h index bd974a94b..89267c238 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -45,7 +45,7 @@ /** * Class controlling the game's color palette. */ -class Palette +class Palette notfinal { public: /** Black Color Constant */ @@ -164,7 +164,7 @@ class Palette void advanceGradient(); - struct ColorElem + struct ColorElem final { ColorElem() : type(0), diff --git a/src/gui/rect.h b/src/gui/rect.h index 8aee82c9f..da9dabcae 100644 --- a/src/gui/rect.h +++ b/src/gui/rect.h @@ -71,7 +71,7 @@ * * @since 0.1.0 */ -class Rect +class Rect notfinal { public: /** diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index f0a10c77c..f6f86a42d 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -47,6 +47,23 @@ #include "debug.h" +namespace +{ + struct MouseOverLink final + { + MouseOverLink(const int x, const int y) : + mX(x), mY(y) + { } + + bool operator() (const BrowserLink &link) const + { + return (mX >= link.x1 && mX < link.x2 && + mY >= link.y1 && mY < link.y2); + } + int mX, mY; + }; +} // namespace + ImageSet *BrowserBox::mEmotes = nullptr; int BrowserBox::mInstances = 0; @@ -409,20 +426,6 @@ void BrowserBox::clearRows() updateHeight(); } -struct MouseOverLink -{ - MouseOverLink(const int x, const int y) : - mX(x), mY(y) - { } - - bool operator() (const BrowserLink &link) const - { - return (mX >= link.x1 && mX < link.x2 && - mY >= link.y1 && mY < link.y2); - } - int mX, mY; -}; - void BrowserBox::mousePressed(MouseEvent &event) { if (!mLinkHandler) diff --git a/src/gui/widgets/extendedlistboxitem.h b/src/gui/widgets/extendedlistboxitem.h index 4fdc59633..81fd35a50 100644 --- a/src/gui/widgets/extendedlistboxitem.h +++ b/src/gui/widgets/extendedlistboxitem.h @@ -23,7 +23,9 @@ #include -struct ExtendedListBoxItem +#include "localconsts.h" + +struct ExtendedListBoxItem final { ExtendedListBoxItem(const int row0, const std::string &text0, diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 64e0adae4..bea678706 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -29,6 +29,7 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" +#include "listeners/tablemodellistener.h" #include "gui/widgets/widget.h" diff --git a/src/gui/widgets/layoutcell.h b/src/gui/widgets/layoutcell.h index 7761e021c..ffc1f13a8 100644 --- a/src/gui/widgets/layoutcell.h +++ b/src/gui/widgets/layoutcell.h @@ -35,7 +35,7 @@ class Widget; * right, or centered in the cell. The process is similar for the vertical * alignment, except that top is represented by LEFT and bottom by RIGHT. */ -class LayoutCell +class LayoutCell notfinal { friend class Layout; friend class LayoutArray; diff --git a/src/gui/widgets/linkhandler.h b/src/gui/widgets/linkhandler.h index b373162a3..95fac1845 100644 --- a/src/gui/widgets/linkhandler.h +++ b/src/gui/widgets/linkhandler.h @@ -31,7 +31,7 @@ * A simple interface to windows that need to handle links from BrowserBox * widget. */ -class LinkHandler +class LinkHandler notfinal { public: virtual ~LinkHandler() diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 7890fd648..c29376239 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -25,7 +25,7 @@ #include "render/renderers.h" -class Widget2 +class Widget2 notfinal { public: virtual ~Widget2() -- cgit v1.2.3-70-g09d2