summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-21 12:42:59 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-21 12:42:59 +0300
commit35d0dbde1ddfda0a05c7607265c53d430ee3d3d0 (patch)
treea46c1f53b668f10e72c0cd006ba315c1f00b042c
parent04bfd360ab78962aa49fa49246e285a06c8f8621 (diff)
downloadmv-35d0dbde1ddfda0a05c7607265c53d430ee3d3d0.tar.gz
mv-35d0dbde1ddfda0a05c7607265c53d430ee3d3d0.tar.bz2
mv-35d0dbde1ddfda0a05c7607265c53d430ee3d3d0.tar.xz
mv-35d0dbde1ddfda0a05c7607265c53d430ee3d3d0.zip
Add support for buttons in shortcutwindow.
-rw-r--r--src/gui/windows/shortcutwindow.cpp15
-rw-r--r--src/gui/windows/shortcutwindow.h5
2 files changed, 18 insertions, 2 deletions
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index 26bd4b89e..1dac7ea1f 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -25,6 +25,7 @@
#include "gui/windows/setupwindow.h"
#include "gui/widgets/tabbedarea.h"
+#include "gui/widgets/button.h"
#include "gui/widgets/layout.h"
#include "gui/widgets/layouttype.h"
#include "gui/widgets/scrollarea.h"
@@ -52,7 +53,8 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title,
mItems(content),
mScrollArea(new ScrollArea(this, mItems, false)),
mTabs(nullptr),
- mPages()
+ mPages(),
+ mButtonIndex(0)
{
setWindowName(title);
setTitleBarHeight(getPadding() + getTitlePadding());
@@ -107,7 +109,8 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title,
mItems(nullptr),
mScrollArea(nullptr),
mTabs(new TabbedArea(this)),
- mPages()
+ mPages(),
+ mButtonIndex(0)
{
mTabs->postInit();
setWindowName(title);
@@ -147,6 +150,14 @@ ShortcutWindow::~ShortcutWindow()
delete2(mItems);
}
+void ShortcutWindow::addButton(const std::string &text,
+ const std::string &eventName,
+ ActionListener *const listener)
+{
+ place(mButtonIndex++, 5, new Button(this, text, eventName, listener));
+ Window::widgetResized(Event(nullptr));
+}
+
void ShortcutWindow::addTab(const std::string &name,
ShortcutContainer *const content)
{
diff --git a/src/gui/windows/shortcutwindow.h b/src/gui/windows/shortcutwindow.h
index 6a585745a..139db109e 100644
--- a/src/gui/windows/shortcutwindow.h
+++ b/src/gui/windows/shortcutwindow.h
@@ -72,6 +72,10 @@ class ShortcutWindow final : public Window
void prevTab();
+ void addButton(const std::string &text,
+ const std::string &eventName,
+ ActionListener *const listener);
+
#ifdef USE_PROFILER
void logicChildren();
#endif
@@ -83,6 +87,7 @@ class ShortcutWindow final : public Window
ScrollArea *mScrollArea;
TabbedArea *mTabs;
std::vector<ShortcutContainer*> mPages;
+ int mButtonIndex;
static int mBoxesWidth;
};