diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2010-09-08 18:17:21 (GMT) |
commit | 690d926ac444243611cd875fb84fabb4e6db2cf2 (patch) | |
tree | c8ef84056b295071f9a9207ffea5393c6cf4ad4d /src/FbTk/MenuItem.hh | |
parent | 1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff) | |
download | fluxbox-690d926ac444243611cd875fb84fabb4e6db2cf2.zip fluxbox-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/MenuItem.hh')
-rw-r--r-- | src/FbTk/MenuItem.hh | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/FbTk/MenuItem.hh b/src/FbTk/MenuItem.hh index 9150849..2149559 100644 --- a/src/FbTk/MenuItem.hh +++ b/src/FbTk/MenuItem.hh | |||
@@ -41,7 +41,7 @@ template <class T> class ThemeProxy; | |||
41 | class MenuItem : public FbTk::ITypeAheadable { | 41 | class MenuItem : public FbTk::ITypeAheadable { |
42 | public: | 42 | public: |
43 | MenuItem() | 43 | MenuItem() |
44 | : m_label(""), | 44 | : m_label(BiDiString("")), |
45 | m_menu(0), | 45 | m_menu(0), |
46 | m_submenu(0), | 46 | m_submenu(0), |
47 | m_enabled(true), | 47 | m_enabled(true), |
@@ -49,7 +49,7 @@ public: | |||
49 | m_close_on_click(true), | 49 | m_close_on_click(true), |
50 | m_toggle_item(false) | 50 | m_toggle_item(false) |
51 | { } | 51 | { } |
52 | explicit MenuItem(const FbString &label) | 52 | explicit MenuItem(const BiDiString &label) |
53 | : m_label(label), | 53 | : m_label(label), |
54 | m_menu(0), | 54 | m_menu(0), |
55 | m_submenu(0), | 55 | m_submenu(0), |
@@ -59,7 +59,7 @@ public: | |||
59 | m_toggle_item(false) | 59 | m_toggle_item(false) |
60 | { } | 60 | { } |
61 | 61 | ||
62 | MenuItem(const FbString &label, Menu &host_menu) | 62 | MenuItem(const BiDiString &label, Menu &host_menu) |
63 | : m_label(label), | 63 | : m_label(label), |
64 | m_menu(&host_menu), | 64 | m_menu(&host_menu), |
65 | m_submenu(0), | 65 | m_submenu(0), |
@@ -69,7 +69,7 @@ public: | |||
69 | m_toggle_item(false) | 69 | m_toggle_item(false) |
70 | { } | 70 | { } |
71 | /// create a menu item with a specific command to be executed on click | 71 | /// create a menu item with a specific command to be executed on click |
72 | MenuItem(const FbString &label, RefCount<Command<void> > &cmd, Menu *menu = 0) | 72 | MenuItem(const BiDiString &label, RefCount<Command<void> > &cmd, Menu *menu = 0) |
73 | : m_label(label), | 73 | : m_label(label), |
74 | m_menu(menu), | 74 | m_menu(menu), |
75 | m_submenu(0), | 75 | m_submenu(0), |
@@ -80,7 +80,7 @@ public: | |||
80 | m_toggle_item(false) | 80 | m_toggle_item(false) |
81 | { } | 81 | { } |
82 | 82 | ||
83 | MenuItem(const FbString &label, Menu *submenu, Menu *host_menu = 0) | 83 | MenuItem(const BiDiString &label, Menu *submenu, Menu *host_menu = 0) |
84 | : m_label(label), | 84 | : m_label(label), |
85 | m_menu(host_menu), | 85 | m_menu(host_menu), |
86 | m_submenu(submenu), | 86 | m_submenu(submenu), |
@@ -94,7 +94,7 @@ public: | |||
94 | void setCommand(RefCount<Command<void> > &cmd) { m_command = cmd; } | 94 | void setCommand(RefCount<Command<void> > &cmd) { m_command = cmd; } |
95 | virtual void setSelected(bool selected) { m_selected = selected; } | 95 | virtual void setSelected(bool selected) { m_selected = selected; } |
96 | virtual void setEnabled(bool enabled) { m_enabled = enabled; } | 96 | virtual void setEnabled(bool enabled) { m_enabled = enabled; } |
97 | virtual void setLabel(const FbString &label) { m_label = label; } | 97 | virtual void setLabel(const BiDiString &label) { m_label = label; } |
98 | virtual void setToggleItem(bool val) { m_toggle_item = val; } | 98 | virtual void setToggleItem(bool val) { m_toggle_item = val; } |
99 | void setCloseOnClick(bool val) { m_close_on_click = val; } | 99 | void setCloseOnClick(bool val) { m_close_on_click = val; } |
100 | void setIcon(const std::string &filename, int screen_num); | 100 | void setIcon(const std::string &filename, int screen_num); |
@@ -103,7 +103,7 @@ public: | |||
103 | @name accessors | 103 | @name accessors |
104 | */ | 104 | */ |
105 | //@{ | 105 | //@{ |
106 | virtual const std::string &label() const { return m_label; } | 106 | virtual const FbTk::BiDiString& label() const { return m_label; } |
107 | virtual const PixmapWithMask *icon() const { | 107 | virtual const PixmapWithMask *icon() const { |
108 | return m_icon.get() ? m_icon->pixmap.get() : 0; | 108 | return m_icon.get() ? m_icon->pixmap.get() : 0; |
109 | } | 109 | } |
@@ -115,7 +115,7 @@ public: | |||
115 | // iType functions | 115 | // iType functions |
116 | virtual void setIndex(int index) { m_index = index; } | 116 | virtual void setIndex(int index) { m_index = index; } |
117 | virtual int getIndex() { return m_index; } | 117 | virtual int getIndex() { return m_index; } |
118 | const std::string &iTypeString() const { return m_label; } | 118 | const FbString &iTypeString() const { return m_label.visual(); } |
119 | virtual void drawLine(FbDrawable &draw, | 119 | virtual void drawLine(FbDrawable &draw, |
120 | const FbTk::ThemeProxy<MenuTheme> &theme, | 120 | const FbTk::ThemeProxy<MenuTheme> &theme, |
121 | size_t size, | 121 | size_t size, |
@@ -148,7 +148,7 @@ public: | |||
148 | Menu *menu() { return m_menu; } | 148 | Menu *menu() { return m_menu; } |
149 | 149 | ||
150 | private: | 150 | private: |
151 | FbString m_label; ///< label of this item | 151 | BiDiString m_label; ///< label of this item |
152 | Menu *m_menu; ///< the menu we live in | 152 | Menu *m_menu; ///< the menu we live in |
153 | Menu *m_submenu; ///< a submenu, 0 if we don't have one | 153 | Menu *m_submenu; ///< a submenu, 0 if we don't have one |
154 | RefCount<Command<void> > m_command; ///< command to be executed | 154 | RefCount<Command<void> > m_command; ///< command to be executed |