aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/IntMenuItem.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-08 18:17:21 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-08 18:17:21 (GMT)
commit690d926ac444243611cd875fb84fabb4e6db2cf2 (patch)
treec8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/FbTk/IntMenuItem.hh
parent1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff)
downloadfluxbox_pavel-690d926ac444243611cd875fb84fabb4e6db2cf2.zip
fluxbox_pavel-690d926ac444243611cd875fb84fabb4e6db2cf2.tar.bz2
introduced FbTk::BidiString
a 'BidiString' holds both the logical content and the visual reordered version of the content of a string. this helps to reduce the number of calls to reorder the string before drawing it (as introduced in the patch from Ken Bloom) and to be more consistent in menus and textboxes (drawing cursors and underlining text).
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