diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-20 17:53:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-20 18:49:07 +0300 |
commit | 775d6f983a18457b82747ac6c53123f84629ede5 (patch) | |
tree | 7a13a11156825d7186fa2305caf07854893adf0a /src/gui/widgets | |
parent | 0cc66ba20aa01f5319fcea108abdca5916c5c61b (diff) | |
download | manaverse-775d6f983a18457b82747ac6c53123f84629ede5.tar.gz manaverse-775d6f983a18457b82747ac6c53123f84629ede5.tar.bz2 manaverse-775d6f983a18457b82747ac6c53123f84629ede5.tar.xz manaverse-775d6f983a18457b82747ac6c53123f84629ede5.zip |
Add support for unselectable widgets.
If move mouse over or try to select, this widget will be ignored.
Set labels unselectable by default.
Set unselectable tabs in debug window.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/label.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/tabs/debugwindowtabs.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/widget.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/widget.h | 8 |
5 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index af6fa973d..6df442229 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -139,6 +139,7 @@ void Label::init() mPadding = mSkin->getPadding(); else mPadding = 0; + setSelectable(false); } void Label::draw(Graphics *const graphics) diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 3a34fc6a6..840dd84c6 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -237,6 +237,12 @@ class TabbedArea final : public ActionListener, void selectPrevTab(); + Widget *getTabContainer() const + { return mTabContainer; } + + Widget *getWidgetContainer() const + { return mWidgetContainer; } + private: typedef std::vector <std::pair<Tab*, Widget*> > TabContainer; diff --git a/src/gui/widgets/tabs/debugwindowtabs.h b/src/gui/widgets/tabs/debugwindowtabs.h index 43292bcd5..044a2884c 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.h +++ b/src/gui/widgets/tabs/debugwindowtabs.h @@ -44,7 +44,7 @@ class DebugTab notfinal : public Container protected: explicit DebugTab(const Widget2 *const widget) : Container(widget) - { } + { setSelectable(false); } }; class MapDebugTab final : public DebugTab diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index 986d97d99..4b4600dd6 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -105,7 +105,8 @@ Widget::Widget(const Widget2 *const widget) : mEnabled(true), mAllowLogic(true), mMouseConsume(true), - mRedraw(true) + mRedraw(true), + mSelectable(true) { mAllWidgets.push_back(this); mAllWidgetsSet.insert(this); diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index 6556cc385..4cae7369e 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -1023,6 +1023,12 @@ class Widget notfinal : public Widget2 void setRedraw(const bool b) noexcept2 { mRedraw = b; } + bool isSelectable() const noexcept2 A_WARN_UNUSED + { return mSelectable; } + + void setSelectable(const bool selectable) + { mSelectable = selectable; } + static void distributeWindowResizeEvent(); void windowResized(); @@ -1246,6 +1252,8 @@ class Widget notfinal : public Widget2 bool mRedraw; + bool mSelectable; + /** * Holds the global font used by the widget. */ |