aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/TextBox.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/TextBox.hh
parent1e8fe2bc14856fa16508686a28a85e72cb0e422c (diff)
downloadfluxbox-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/TextBox.hh')
-rw-r--r--src/FbTk/TextBox.hh9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/FbTk/TextBox.hh b/src/FbTk/TextBox.hh
index d313dca..7b42bd1 100644
--- a/src/FbTk/TextBox.hh
+++ b/src/FbTk/TextBox.hh
@@ -24,8 +24,7 @@
24 24
25#include "FbWindow.hh" 25#include "FbWindow.hh"
26#include "EventHandler.hh" 26#include "EventHandler.hh"
27 27#include "FbString.hh"
28#include <string>
29 28
30namespace FbTk { 29namespace FbTk {
31 30
@@ -37,7 +36,7 @@ public:
37 TextBox(const FbWindow &parent, const Font &font, const std::string &text); 36 TextBox(const FbWindow &parent, const Font &font, const std::string &text);
38 virtual ~TextBox(); 37 virtual ~TextBox();
39 38
40 void setText(const std::string &text); 39 void setText(const FbTk::BiDiString &text);
41 void setFont(const Font &font); 40 void setFont(const Font &font);
42 void setGC(GC gc); 41 void setGC(GC gc);
43 void setCursorPosition(int cursor); 42 void setCursorPosition(int cursor);
@@ -60,7 +59,7 @@ public:
60 void buttonPressEvent(XButtonEvent &event); 59 void buttonPressEvent(XButtonEvent &event);
61 void keyPressEvent(XKeyEvent &event); 60 void keyPressEvent(XKeyEvent &event);
62 61
63 const std::string &text() const { return m_text; } 62 const FbString &text() const { return m_text.logical(); }
64 const Font &font() const { return *m_font; } 63 const Font &font() const { return *m_font; }
65 GC gc() const { return m_gc; } 64 GC gc() const { return m_gc; }
66 int cursorPosition() const { return m_cursor_pos; } 65 int cursorPosition() const { return m_cursor_pos; }
@@ -76,7 +75,7 @@ private:
76 void adjustPos(); 75 void adjustPos();
77 76
78 const FbTk::Font *m_font; 77 const FbTk::Font *m_font;
79 std::string m_text; 78 BiDiString m_text;
80 GC m_gc; 79 GC m_gc;
81 std::string::size_type m_cursor_pos, m_start_pos, m_end_pos; 80 std::string::size_type m_cursor_pos, m_start_pos, m_end_pos;
82}; 81};