aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/IntMenuItem.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/IntMenuItem.hh')
-rw-r--r--src/FbTk/IntMenuItem.hh14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/FbTk/IntMenuItem.hh b/src/FbTk/IntMenuItem.hh
index 9d2d2ba..2df3f14 100644
--- a/src/FbTk/IntMenuItem.hh
+++ b/src/FbTk/IntMenuItem.hh
@@ -23,6 +23,7 @@
23#define FBTK_INTMENUITEM_HH 23#define FBTK_INTMENUITEM_HH
24 24
25#include "MenuItem.hh" 25#include "MenuItem.hh"
26#include "StringUtil.hh"
26 27
27namespace FbTk { 28namespace FbTk {
28 29
@@ -39,15 +40,6 @@ public:
39 setCloseOnClick(false); 40 setCloseOnClick(false);
40 } 41 }
41 42
42 /* Utility, but doesn't get found in anonymous namespace? */
43 std::string appendIntValue(const std::string &label, int value) {
44 char *buff = new char[label.size() + 16];
45 sprintf(buff, "%s: %d", label.c_str(), value);
46 std::string ret(buff);
47 delete [] buff;
48 return ret;
49 }
50
51 void click(int button, int time, unsigned int mods) { 43 void click(int button, int time, unsigned int mods) {
52 static int last_time = -201; 44 static int last_time = -201;
53 int inc_val = 1; 45 int inc_val = 1;
@@ -86,11 +78,11 @@ public:
86 } 78 }
87 79
88 void updateLabel() { 80 void updateLabel() {
89 setLabel(appendIntValue(m_org_label, m_res)); 81 setLabel(m_org_label.logical() + ": " + FbTk::StringUtil::number2String(m_res));
90 } 82 }
91 83
92private: 84private:
93 std::string m_org_label; ///< original label 85 FbTk::BiDiString m_org_label; ///< original label
94 const int m_max; ///< maximum value the integer can have 86 const int m_max; ///< maximum value the integer can have
95 const int m_min; ///< minimum value the integer can have 87 const int m_min; ///< minimum value the integer can have
96 Accessor<int> &m_res; ///< resource item to be changed 88 Accessor<int> &m_res; ///< resource item to be changed