summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/basiccontainer.cpp2
-rw-r--r--src/gui/widgets/basiccontainer.h3
-rw-r--r--src/gui/widgets/guitable.cpp2
-rw-r--r--src/gui/widgets/guitable.h2
-rw-r--r--src/gui/widgets/widget.cpp233
-rw-r--r--src/gui/widgets/widget.h160
6 files changed, 121 insertions, 281 deletions
diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp
index 1d71e976f..7032cd981 100644
--- a/src/gui/widgets/basiccontainer.cpp
+++ b/src/gui/widgets/basiccontainer.cpp
@@ -204,7 +204,7 @@ void BasicContainer::logic()
BLOCK_END("BasicContainer::logic")
}
-void BasicContainer::_setFocusHandler(FocusHandler* focusHandler)
+void BasicContainer::_setFocusHandler(FocusHandler *const focusHandler)
{
Widget::_setFocusHandler(focusHandler);
diff --git a/src/gui/widgets/basiccontainer.h b/src/gui/widgets/basiccontainer.h
index 7d7876b2f..3e3976a70 100644
--- a/src/gui/widgets/basiccontainer.h
+++ b/src/gui/widgets/basiccontainer.h
@@ -122,7 +122,8 @@ class BasicContainer : public Widget,
virtual void logic() override;
- virtual void _setFocusHandler(FocusHandler* focusHandler) override;
+ virtual void _setFocusHandler(FocusHandler *const focusHandler)
+ override;
void setInternalFocusHandler(FocusHandler* focusHandler);
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 128281fe9..dc097c031 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -588,7 +588,7 @@ int GuiTable::getColumnForX(int x) const
return column;
}
-void GuiTable::_setFocusHandler(FocusHandler* focusHandler)
+void GuiTable::_setFocusHandler(FocusHandler *const focusHandler)
{
// add check for focusHandler. may be need remove it?
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index 7cec854a8..42664fd77 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -120,7 +120,7 @@ public:
void moveToBottom(Widget *child) override final;
- void _setFocusHandler(FocusHandler* focusHandler) override final;
+ void _setFocusHandler(FocusHandler *const focusHandler) override final;
// Inherited from KeyListener
void keyPressed(KeyEvent& keyEvent) override final;
diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp
index 5b2024b1f..d1ca474c4 100644
--- a/src/gui/widgets/widget.cpp
+++ b/src/gui/widgets/widget.cpp
@@ -96,20 +96,19 @@ Widget::Widget(const Widget2 *const widget) :
mForegroundColor(0x000000),
mBackgroundColor(0xffffff),
mBaseColor(0x808090),
- mSelectionColor(0xc3d9ff),
+ mDimension(),
+ mActionEventId(),
+ mId(),
mFocusHandler(nullptr),
mInternalFocusHandler(nullptr),
mParent(nullptr),
- mDimension(),
+ mCurrentFont(nullptr),
mFrameSize(0),
- mActionEventId(),
mFocusable(false),
mVisible(true),
mTabIn(true),
mTabOut(true),
- mEnabled(true),
- mId(),
- mCurrentFont(nullptr)
+ mEnabled(true)
{
mWidgets.push_back(this);
mWidgetsSet.insert(this);
@@ -117,9 +116,7 @@ Widget::Widget(const Widget2 *const widget) :
Widget::~Widget()
{
- for (DeathListenerIterator iter = mDeathListeners.begin();
- iter != mDeathListeners.end();
- ++iter)
+ FOR_EACH (DeathListenerIterator, iter, mDeathListeners)
{
Event event(this);
(*iter)->death(event);
@@ -131,73 +128,39 @@ Widget::~Widget()
mWidgetsSet.erase(this);
}
-void Widget::drawFrame(Graphics* graphics)
-{
- BLOCK_START("Widget::drawFrame")
- const Color &faceColor = getBaseColor();
- Color highlightColor = faceColor + Color(0x303030);
- Color shadowColor = faceColor - Color(0x303030);
- const int alpha = getBaseColor().a;
- const int width = getWidth() + getFrameSize() * 2 - 1;
- const int height = getHeight() + getFrameSize() * 2 - 1;
- highlightColor.a = alpha;
- shadowColor.a = alpha;
-
- for (unsigned int i = 0; i < getFrameSize(); ++i)
- {
- graphics->setColor(shadowColor);
- graphics->drawLine(i, i, width - i, i);
- graphics->drawLine(i, i + 1, i, height - i - 1);
- graphics->setColor(highlightColor);
- graphics->drawLine(width - i, i + 1, width - i, height - i);
- graphics->drawLine(i, height - i, width - i - 1, height - i);
- }
- BLOCK_END("Widget::drawFrame")
-}
-
-void Widget::_setParent(Widget* parent)
-{
- mParent = parent;
-}
-
-void Widget::setWidth(int width)
+void Widget::setWidth(const int width)
{
Rect newDimension = mDimension;
newDimension.width = width;
-
setDimension(newDimension);
}
-void Widget::setHeight(int height)
+void Widget::setHeight(const int height)
{
Rect newDimension = mDimension;
newDimension.height = height;
-
setDimension(newDimension);
}
-void Widget::setX(int x)
+void Widget::setX(const int x)
{
Rect newDimension = mDimension;
newDimension.x = x;
-
setDimension(newDimension);
}
-void Widget::setY(int y)
+void Widget::setY(const int y)
{
Rect newDimension = mDimension;
newDimension.y = y;
-
setDimension(newDimension);
}
-void Widget::setPosition(int x, int y)
+void Widget::setPosition(const int x, const int y)
{
Rect newDimension = mDimension;
newDimension.x = x;
newDimension.y = y;
-
setDimension(newDimension);
}
@@ -212,36 +175,8 @@ void Widget::setDimension(const Rect& dimension)
distributeResizedEvent();
}
- if (mDimension.x != oldDimension.x
- || mDimension.y != oldDimension.y)
- {
+ if (mDimension.x != oldDimension.x || mDimension.y != oldDimension.y)
distributeMovedEvent();
- }
-}
-
-void Widget::setFrameSize(unsigned int frameSize)
-{
- mFrameSize = frameSize;
-}
-
-unsigned int Widget::getFrameSize() const
-{
- return mFrameSize;
-}
-
-const Rect& Widget::getDimension() const
-{
- return mDimension;
-}
-
-const std::string& Widget::getActionEventId() const
-{
- return mActionEventId;
-}
-
-void Widget::setActionEventId(const std::string& actionEventId)
-{
- mActionEventId = actionEventId;
}
bool Widget::isFocused() const
@@ -252,13 +187,10 @@ bool Widget::isFocused() const
return (mFocusHandler->isFocused(this));
}
-void Widget::setFocusable(bool focusable)
+void Widget::setFocusable(const bool focusable)
{
if (!focusable && isFocused())
- {
mFocusHandler->focusNone();
- }
-
mFocusable = focusable;
}
@@ -301,47 +233,7 @@ void Widget::setVisible(bool visible)
mVisible = visible;
}
-void Widget::setBaseColor(const Color& color)
-{
- mBaseColor = color;
-}
-
-const Color& Widget::getBaseColor() const
-{
- return mBaseColor;
-}
-
-void Widget::setForegroundColor(const Color& color)
-{
- mForegroundColor = color;
-}
-
-const Color& Widget::getForegroundColor() const
-{
- return mForegroundColor;
-}
-
-void Widget::setBackgroundColor(const Color& color)
-{
- mBackgroundColor = color;
-}
-
-const Color& Widget::getBackgroundColor() const
-{
- return mBackgroundColor;
-}
-
-void Widget::setSelectionColor(const Color& color)
-{
- mSelectionColor = color;
-}
-
-const Color& Widget::getSelectionColor() const
-{
- return mSelectionColor;
-}
-
-void Widget::_setFocusHandler(FocusHandler* focusHandler)
+void Widget::_setFocusHandler(FocusHandler *const focusHandler)
{
if (mFocusHandler)
{
@@ -355,67 +247,62 @@ void Widget::_setFocusHandler(FocusHandler* focusHandler)
mFocusHandler = focusHandler;
}
-FocusHandler* Widget::_getFocusHandler()
-{
- return mFocusHandler;
-}
-
-void Widget::addActionListener(ActionListener* actionListener)
+void Widget::addActionListener(ActionListener *const actionListener)
{
mActionListeners.push_back(actionListener);
}
-void Widget::removeActionListener(ActionListener* actionListener)
+void Widget::removeActionListener(ActionListener *const actionListener)
{
mActionListeners.remove(actionListener);
}
-void Widget::addDeathListener(DeathListener* deathListener)
+void Widget::addDeathListener(DeathListener *const deathListener)
{
mDeathListeners.push_back(deathListener);
}
-void Widget::removeDeathListener(DeathListener* deathListener)
+void Widget::removeDeathListener(DeathListener *const deathListener)
{
mDeathListeners.remove(deathListener);
}
-void Widget::addKeyListener(KeyListener* keyListener)
+void Widget::addKeyListener(KeyListener *const keyListener)
{
mKeyListeners.push_back(keyListener);
}
-void Widget::removeKeyListener(KeyListener* keyListener)
+void Widget::removeKeyListener(KeyListener *const keyListener)
{
mKeyListeners.remove(keyListener);
}
-void Widget::addFocusListener(FocusListener* focusListener)
+void Widget::addFocusListener(FocusListener *const focusListener)
{
mFocusListeners.push_back(focusListener);
}
-void Widget::removeFocusListener(FocusListener* focusListener)
+void Widget::removeFocusListener(FocusListener *const focusListener)
{
mFocusListeners.remove(focusListener);
}
-void Widget::addMouseListener(MouseListener* mouseListener)
+void Widget::addMouseListener(MouseListener *const mouseListener)
{
mMouseListeners.push_back(mouseListener);
}
-void Widget::removeMouseListener(MouseListener* mouseListener)
+void Widget::removeMouseListener(MouseListener *const mouseListener)
{
mMouseListeners.remove(mouseListener);
}
-void Widget::addWidgetListener(WidgetListener* widgetListener)
+void Widget::addWidgetListener(WidgetListener *const widgetListener)
{
mWidgetListeners.push_back(widgetListener);
}
-void Widget::removeWidgetListener(WidgetListener* widgetListener)
+void Widget::removeWidgetListener(WidgetListener *const widgetListener)
{
mWidgetListeners.remove(widgetListener);
}
@@ -446,19 +333,18 @@ Font* Widget::getFont() const
return mCurrentFont;
}
-void Widget::setGlobalFont(Font* font)
+void Widget::setGlobalFont(Font *const font)
{
mGlobalFont = font;
- for (std::list<Widget*>::const_iterator iter = mWidgets.begin();
- iter != mWidgets.end(); ++iter)
+ FOR_EACH (std::list<Widget*>::const_iterator, iter, mWidgets)
{
if (!(*iter)->mCurrentFont)
(*iter)->fontChanged();
}
}
-void Widget::setFont(Font* font)
+void Widget::setFont(Font *const font)
{
mCurrentFont = font;
fontChanged();
@@ -470,40 +356,14 @@ bool Widget::widgetExists(const Widget* widget)
!= mWidgetsSet.end();
}
-bool Widget::isTabInEnabled() const
-{
- return mTabIn;
-}
-
-void Widget::setTabInEnabled(bool enabled)
-{
- mTabIn = enabled;
-}
-
-bool Widget::isTabOutEnabled() const
-{
- return mTabOut;
-}
-
-void Widget::setTabOutEnabled(bool enabled)
-{
- mTabOut = enabled;
-}
-
-void Widget::setSize(int width, int height)
+void Widget::setSize(const int width, const int height)
{
Rect newDimension = mDimension;
newDimension.width = width;
newDimension.height = height;
-
setDimension(newDimension);
}
-void Widget::setEnabled(bool enabled)
-{
- mEnabled = enabled;
-}
-
bool Widget::isEnabled() const
{
return mEnabled && isVisible();
@@ -513,7 +373,6 @@ void Widget::requestModalFocus()
{
if (!mFocusHandler)
return;
-
mFocusHandler->requestModalFocus(this);
}
@@ -521,7 +380,6 @@ void Widget::requestModalMouseInputFocus()
{
if (!mFocusHandler)
return;
-
mFocusHandler->requestModalMouseInputFocus(this);
}
@@ -529,7 +387,6 @@ void Widget::releaseModalFocus()
{
if (!mFocusHandler)
return;
-
mFocusHandler->releaseModalFocus(this);
}
@@ -537,7 +394,6 @@ void Widget::releaseModalMouseInputFocus()
{
if (!mFocusHandler)
return;
-
mFocusHandler->releaseModalMouseInputFocus(this);
}
@@ -569,11 +425,6 @@ bool Widget::isModalMouseInputFocused() const
return mFocusHandler->getModalMouseInputFocused() == this;
}
-Widget *Widget::getWidgetAt(int x A_UNUSED, int y A_UNUSED)
-{
- return nullptr;
-}
-
const std::list<MouseListener*>& Widget::_getMouseListeners()
{
return mMouseListeners;
@@ -599,16 +450,14 @@ FocusHandler* Widget::_getInternalFocusHandler()
return mInternalFocusHandler;
}
-void Widget::setInternalFocusHandler(FocusHandler* focusHandler)
+void Widget::setInternalFocusHandler(FocusHandler *const focusHandler)
{
mInternalFocusHandler = focusHandler;
}
void Widget::distributeResizedEvent()
{
- for (WidgetListenerIterator iter = mWidgetListeners.begin();
- iter != mWidgetListeners.end();
- ++ iter)
+ FOR_EACH (WidgetListenerIterator, iter, mWidgetListeners)
{
Event event(this);
(*iter)->widgetResized(event);
@@ -617,9 +466,7 @@ void Widget::distributeResizedEvent()
void Widget::distributeMovedEvent()
{
- for (WidgetListenerIterator iter = mWidgetListeners.begin();
- iter != mWidgetListeners.end();
- ++ iter)
+ FOR_EACH (WidgetListenerIterator, iter, mWidgetListeners)
{
Event event(this);
(*iter)->widgetMoved(event);
@@ -628,9 +475,7 @@ void Widget::distributeMovedEvent()
void Widget::distributeHiddenEvent()
{
- for (WidgetListenerIterator iter = mWidgetListeners.begin();
- iter != mWidgetListeners.end();
- ++ iter)
+ FOR_EACH (WidgetListenerIterator, iter, mWidgetListeners)
{
Event event(this);
(*iter)->widgetHidden(event);
@@ -639,9 +484,7 @@ void Widget::distributeHiddenEvent()
void Widget::distributeActionEvent()
{
- for (ActionListenerIterator iter = mActionListeners.begin();
- iter != mActionListeners.end();
- ++iter)
+ FOR_EACH (ActionListenerIterator, iter, mActionListeners)
{
ActionEvent actionEvent(this, mActionEventId);
(*iter)->action(actionEvent);
@@ -650,16 +493,14 @@ void Widget::distributeActionEvent()
void Widget::distributeShownEvent()
{
- for (WidgetListenerIterator iter = mWidgetListeners.begin();
- iter != mWidgetListeners.end();
- ++iter)
+ FOR_EACH (WidgetListenerIterator, iter, mWidgetListeners)
{
Event event(this);
(*iter)->widgetShown(event);
}
}
-void Widget::showPart(Rect rectangle)
+void Widget::showPart(const Rect &rectangle)
{
if (mParent)
mParent->showWidgetPart(this, rectangle);
diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h
index 86bf0f773..beff5113b 100644
--- a/src/gui/widgets/widget.h
+++ b/src/gui/widgets/widget.h
@@ -148,7 +148,8 @@ class Widget : public Widget2
* @see setFrameSize, getFrameSize
* @since 0.8.0
*/
- virtual void drawFrame(Graphics* graphics);
+ virtual void drawFrame(Graphics* graphics)
+ { }
/**
* Sets the size of the widget's frame. The frame is not considered a part of
@@ -164,7 +165,8 @@ class Widget : public Widget2
* @see getFrameSize, drawFrame
* @since 0.8.0
*/
- void setFrameSize(unsigned int frameSize);
+ void setFrameSize(const unsigned int frameSize)
+ { mFrameSize = frameSize; }
/**
* Gets the size of the widget's frame. The frame is not considered a part of
@@ -180,7 +182,8 @@ class Widget : public Widget2
* @see setFrameSize, drawFrame
* @since 0.8.0
*/
- unsigned int getFrameSize() const A_WARN_UNUSED;
+ unsigned int getFrameSize() const A_WARN_UNUSED
+ { return mFrameSize; }
/**
* Called for all widgets in the gui each time Gui::logic is called.
@@ -210,7 +213,7 @@ class Widget : public Widget2
* setDimension, getDimensi
* @since 0.1.0
*/
- void setWidth(int width);
+ void setWidth(const int width);
/**
* Gets the width of the widget.
@@ -231,7 +234,7 @@ class Widget : public Widget2
* setDimension, getDimension
* @since 0.1.0
*/
- void setHeight(int height);
+ void setHeight(const int height);
/**
* Gets the height of the widget.
@@ -253,7 +256,7 @@ class Widget : public Widget2
* setDimension, getDimension
* @since 0.1.0
*/
- void setSize(int width, int height);
+ void setSize(const int width, const int height);
/**
* Sets the x coordinate of the widget. The coordinate is
@@ -263,7 +266,7 @@ class Widget : public Widget2
* @see getX, setY, getY, setPosition, setDimension, getDimension
* @since 0.1.0
*/
- void setX(int x);
+ void setX(const int x);
/**
* Gets the x coordinate of the widget. The coordinate is
@@ -284,7 +287,7 @@ class Widget : public Widget2
* @see setY, setX, getX, setPosition, setDimension, getDimension
* @since 0.1.0
*/
- void setY(int y);
+ void setY(const int y);
/**
* Gets the y coordinate of the widget. The coordinate is
@@ -306,7 +309,7 @@ class Widget : public Widget2
* @see setX, getX, setY, getY, setDimension, getDimension
* @since 0.1.0
*/
- void setPosition(int x, int y);
+ void setPosition(const int x, const int y);
/**
* Sets the dimension of the widget. The dimension is
@@ -326,7 +329,8 @@ class Widget : public Widget2
* @see getDimension, setX, getX, setY, getY, setPosition
* @since 0.1.0
*/
- const Rect& getDimension() const A_WARN_UNUSED;
+ const Rect& getDimension() const A_WARN_UNUSED
+ { return mDimension; }
/**
* Sets the widget to be fosusable, or not.
@@ -336,7 +340,7 @@ class Widget : public Widget2
* @see isFocusable
* @since 0.1.0
*/
- void setFocusable(bool focusable);
+ void setFocusable(const bool focusable);
/**
* Checks if a widget is focsable.
@@ -364,7 +368,8 @@ class Widget : public Widget2
* @see isEnabled
* @since 0.1.0
*/
- void setEnabled(bool enabled);
+ void setEnabled(const bool enabled)
+ { mEnabled = enabled; }
/**
* Checks if the widget is enabled. A disabled
@@ -402,7 +407,8 @@ class Widget : public Widget2
* @see getBaseColor
* @since 0.1.0
*/
- void setBaseColor(const Color& color);
+ void setBaseColor(const Color& color)
+ { mBaseColor = color; }
/**
* Gets the base color.
@@ -411,7 +417,8 @@ class Widget : public Widget2
* @see setBaseColor
* @since 0.1.0
*/
- const Color& getBaseColor() const A_WARN_UNUSED;
+ const Color& getBaseColor() const A_WARN_UNUSED
+ { return mBaseColor; }
/**
* Sets the foreground color.
@@ -420,7 +427,8 @@ class Widget : public Widget2
* @see getForegroundColor
* @since 0.1.0
*/
- void setForegroundColor(const Color& color);
+ void setForegroundColor(const Color& color)
+ { mForegroundColor = color; }
/**
* Gets the foreground color.
@@ -428,7 +436,8 @@ class Widget : public Widget2
* @see setForegroundColor
* @since 0.1.0
*/
- const Color& getForegroundColor() const A_WARN_UNUSED;
+ const Color& getForegroundColor() const A_WARN_UNUSED
+ { return mForegroundColor; }
/**
* Sets the background color.
@@ -437,7 +446,8 @@ class Widget : public Widget2
* @see setBackgroundColor
* @since 0.1.0
*/
- void setBackgroundColor(const Color& color);
+ void setBackgroundColor(const Color& color)
+ { mBackgroundColor = color; }
/**
* Gets the background color.
@@ -445,25 +455,8 @@ class Widget : public Widget2
* @see setBackgroundColor
* @since 0.1.0
*/
- const Color& getBackgroundColor() const A_WARN_UNUSED;
-
- /**
- * Sets the selection color.
- *
- * @param color The selection color.
- * @see getSelectionColor
- * @since 0.6.0
- */
- void setSelectionColor(const Color& color);
-
- /**
- * Gets the selection color.
- *
- * @return The selection color.
- * @see setSelectionColor
- * @since 0.6.0
- */
- const Color& getSelectionColor() const A_WARN_UNUSED;
+ const Color& getBackgroundColor() const A_WARN_UNUSED
+ { return mBackgroundColor; }
/**
* Requests focus for the widget. A widget will only recieve focus
@@ -492,7 +485,7 @@ class Widget : public Widget2
* @see _getFocusHandler
* @since 0.1.0
*/
- virtual void _setFocusHandler(FocusHandler* focusHandler);
+ virtual void _setFocusHandler(FocusHandler *const focusHandler);
/**
* Gets the focus handler used.
@@ -505,7 +498,8 @@ class Widget : public Widget2
* @see _setFocusHandler
* @since 0.1.0
*/
- virtual FocusHandler* _getFocusHandler() A_WARN_UNUSED;
+ virtual FocusHandler* _getFocusHandler() A_WARN_UNUSED
+ { return mFocusHandler; }
/**
* Adds an action listener to the widget. When an action event
@@ -516,7 +510,7 @@ class Widget : public Widget2
* @see removeActionListener
* @since 0.1.0
*/
- void addActionListener(ActionListener* actionListener);
+ void addActionListener(ActionListener *const actionListener);
/**
* Removes an added action listener from the widget.
@@ -525,7 +519,7 @@ class Widget : public Widget2
* @see addActionListener
* @since 0.1.0
*/
- void removeActionListener(ActionListener* actionListener);
+ void removeActionListener(ActionListener *const actionListener);
/**
* Adds a death listener to the widget. When a death event is
@@ -536,7 +530,7 @@ class Widget : public Widget2
* @see removeDeathListener
* @since 0.1.0
*/
- void addDeathListener(DeathListener* deathListener);
+ void addDeathListener(DeathListener *const deathListener);
/**
* Removes an added death listener from the widget.
@@ -545,7 +539,7 @@ class Widget : public Widget2
* @see addDeathListener
* @since 0.1.0
*/
- void removeDeathListener(DeathListener* deathListener);
+ void removeDeathListener(DeathListener *const deathListener);
/**
* Adds a mouse listener to the widget. When a mouse event is
@@ -556,7 +550,7 @@ class Widget : public Widget2
* @see removeMouseListener
* @since 0.1.0
*/
- void addMouseListener(MouseListener* mouseListener);
+ void addMouseListener(MouseListener *const mouseListener);
/**
* Removes an added mouse listener from the widget.
@@ -565,7 +559,7 @@ class Widget : public Widget2
* @see addMouseListener
* @since 0.1.0
*/
- void removeMouseListener(MouseListener* mouseListener);
+ void removeMouseListener(MouseListener *const mouseListener);
/**
* Adds a key listener to the widget. When a key event is
@@ -576,7 +570,7 @@ class Widget : public Widget2
* @see removeKeyListener
* @since 0.1.0
*/
- void addKeyListener(KeyListener* keyListener);
+ void addKeyListener(KeyListener *const keyListener);
/**
* Removes an added key listener from the widget.
@@ -585,7 +579,7 @@ class Widget : public Widget2
* @see addKeyListener
* @since 0.1.0
*/
- void removeKeyListener(KeyListener* keyListener);
+ void removeKeyListener(KeyListener *const keyListener);
/**
* Adds a focus listener to the widget. When a focus event is
@@ -596,7 +590,7 @@ class Widget : public Widget2
* @see removeFocusListener
* @since 0.7.0
*/
- void addFocusListener(FocusListener* focusListener);
+ void addFocusListener(FocusListener *const focusListener);
/**
* Removes an added focus listener from the widget.
@@ -605,7 +599,7 @@ class Widget : public Widget2
* @see addFocusListener
* @since 0.7.0
*/
- void removeFocusListener(FocusListener* focusListener);
+ void removeFocusListener(FocusListener *const focusListener);
/**
* Adds a widget listener to the widget. When a widget event is
@@ -616,7 +610,7 @@ class Widget : public Widget2
* @see removeWidgetListener
* @since 0.8.0
*/
- void addWidgetListener(WidgetListener* widgetListener);
+ void addWidgetListener(WidgetListener *const widgetListener);
/**
* Removes an added widget listener from the widget.
@@ -625,7 +619,7 @@ class Widget : public Widget2
* @see addWidgetListener
* @since 0.8.0
*/
- void removeWidgetListener(WidgetListener* widgetListener);
+ void removeWidgetListener(WidgetListener *const widgetListener);
/**
* Sets the action event identifier of the widget. The identifier is
@@ -639,7 +633,8 @@ class Widget : public Widget2
* @see getActionEventId
* @since 0.6.0
*/
- void setActionEventId(const std::string& actionEventId);
+ void setActionEventId(const std::string& actionEventId)
+ { mActionEventId = actionEventId; }
/**
* Gets the action event identifier of the widget.
@@ -648,7 +643,8 @@ class Widget : public Widget2
* @see setActionEventId
* @since 0.6.0
*/
- const std::string& getActionEventId() const;
+ const std::string& getActionEventId() const
+ { return mActionEventId; }
/**
* Gets the absolute position on the screen for the widget.
@@ -670,7 +666,8 @@ class Widget : public Widget2
* @see getParent
* @since 0.1.0
*/
- virtual void _setParent(Widget* parent);
+ virtual void _setParent(Widget* parent)
+ { mParent = parent; }
/**
* Gets the font set for the widget. If no font has been set,
@@ -690,7 +687,7 @@ class Widget : public Widget2
* @see getGlobalFont
* @since 0.1.0
*/
- static void setGlobalFont(Font* font);
+ static void setGlobalFont(Font *const font);
/**
* Sets the font for the widget. If NULL is passed, the global font
@@ -700,7 +697,7 @@ class Widget : public Widget2
* @see getFont
* @since 0.1.0
*/
- void setFont(Font* font);
+ void setFont(Font *const font);
/**
* Called when the font has changed. If the change is global,
@@ -732,7 +729,8 @@ class Widget : public Widget2
* @see setTabInEnabled
* @since 0.1.0
*/
- bool isTabInEnabled() const A_WARN_UNUSED;
+ bool isTabInEnabled() const A_WARN_UNUSED
+ { return mTabIn; }
/**
* Sets tab in enabled, or not. Tab in means that you can set focus
@@ -744,7 +742,8 @@ class Widget : public Widget2
* @see isTabInEnabled
* @since 0.1.0
*/
- void setTabInEnabled(bool enabled);
+ void setTabInEnabled(const bool enabled)
+ { mTabIn = enabled; }
/**
* Checks if tab out is enabled. Tab out means that you can lose
@@ -756,7 +755,8 @@ class Widget : public Widget2
* @see setTabOutEnabled
* @since 0.1.0
*/
- bool isTabOutEnabled() const A_WARN_UNUSED;
+ bool isTabOutEnabled() const A_WARN_UNUSED
+ { return mTabOut; }
/**
* Sets tab out enabled. Tab out means that you can lose
@@ -768,7 +768,8 @@ class Widget : public Widget2
* @see isTabOutEnabled
* @since 0.1.0
*/
- void setTabOutEnabled(bool enabled);
+ void setTabOutEnabled(const bool enabled)
+ { mTabOut = enabled; }
/**
* Requests modal focus. When a widget has modal focus, only that
@@ -842,7 +843,9 @@ class Widget : public Widget2
* if no widget is found.
* @since 0.6.0
*/
- virtual Widget *getWidgetAt(int x, int y) A_WARN_UNUSED;
+ virtual Widget *getWidgetAt(int x A_UNUSED,
+ int y A_UNUSED) A_WARN_UNUSED
+ { return nullptr; }
/**
* Gets the mouse listeners of the widget.
@@ -912,7 +915,7 @@ class Widget : public Widget2
* @see getInternalFocusHandler
* @since 0.1.0
*/
- void setInternalFocusHandler(FocusHandler* internalFocusHandler);
+ void setInternalFocusHandler(FocusHandler *const internalFocusHandler);
/**
* Moves a widget to the top of this widget. The moved widget will be
@@ -1002,7 +1005,7 @@ class Widget : public Widget2
* @param rectangle The rectangle to be shown.
* @since 0.8.0
*/
- virtual void showPart(Rect rectangle);
+ virtual void showPart(const Rect &rectangle);
protected:
/**
@@ -1146,9 +1149,19 @@ class Widget : public Widget2
Color mBaseColor;
/**
- * Holds the selection color of the widget.
+ * Holds the dimension of the widget.
+ */
+ Rect mDimension;
+
+ /**
+ * Holds the action event of the widget.
+ */
+ std::string mActionEventId;
+
+ /**
+ * Holds the id of the widget.
*/
- Color mSelectionColor;
+ std::string mId;
/**
* Holds the focus handler used by the widget.
@@ -1168,9 +1181,9 @@ class Widget : public Widget2
Widget* mParent;
/**
- * Holds the dimension of the widget.
+ * Holds the font used by the widget.
*/
- Rect mDimension;
+ Font* mCurrentFont;
/**
* Holds the frame size of the widget.
@@ -1178,11 +1191,6 @@ class Widget : public Widget2
unsigned int mFrameSize;
/**
- * Holds the action event of the widget.
- */
- std::string mActionEventId;
-
- /**
* True if the widget focusable, false otherwise.
*/
bool mFocusable;
@@ -1208,16 +1216,6 @@ class Widget : public Widget2
bool mEnabled;
/**
- * Holds the id of the widget.
- */
- std::string mId;
-
- /**
- * Holds the font used by the widget.
- */
- Font* mCurrentFont;
-
- /**
* Holds the global font used by the widget.
*/
static Font* mGlobalFont;