aboutsummaryrefslogtreecommitdiff
path: root/util/fbrun/FbRun.hh
diff options
context:
space:
mode:
Diffstat (limited to 'util/fbrun/FbRun.hh')
-rw-r--r--util/fbrun/FbRun.hh112
1 files changed, 56 insertions, 56 deletions
diff --git a/util/fbrun/FbRun.hh b/util/fbrun/FbRun.hh
index 41e5925..a577e45 100644
--- a/util/fbrun/FbRun.hh
+++ b/util/fbrun/FbRun.hh
@@ -19,79 +19,79 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbRun.hh,v 1.7 2002/11/27 21:56:02 fluxgen Exp $ 22// $Id: FbRun.hh,v 1.8 2002/12/05 00:07:38 fluxgen Exp $
23 23
24#ifndef FBRUN_HH 24#ifndef FBRUN_HH
25#define FBRUN_HH 25#define FBRUN_HH
26 26
27#include "EventHandler.hh" 27#include "EventHandler.hh"
28#include "Font.hh" 28#include "Font.hh"
29#include "FbWindow.hh"
29 30
30#include <string> 31#include <string>
31#include <vector> 32#include <vector>
32 33
33/** 34/**
34 Creates and managed a run window 35 Creates and managed a run window
35*/ 36*/
36class FbRun: public FbTk::EventHandler { 37class FbRun: public FbTk::EventHandler {
37public: 38public:
38 FbRun(int x = 0, int y = 0, size_t width = 200); 39 FbRun(int x = 0, int y = 0, size_t width = 200);
39 ~FbRun(); 40 ~FbRun();
40 void handleEvent(XEvent * const ev); 41 void handleEvent(XEvent * const ev);
41 void setText(const std::string &text); 42 void setText(const std::string &text);
42 void setTitle(const std::string &title); 43 void setTitle(const std::string &title);
43 void move(int x, int y); 44 void move(int x, int y);
44 void resize(size_t width, size_t height); 45 void resize(size_t width, size_t height);
45 size_t height() const { return m_height; } 46 size_t height() const { return m_win.height(); }
46 size_t width() const { return m_width; } 47 size_t width() const { return m_win.width(); }
47 /// hide window 48 /// hide window
48 void hide(); 49 void hide();
49 /// show window 50 /// show window
50 void show(); 51 void show();
51 /// load and reconfigure for new font 52 /// load and reconfigure for new font
52 bool loadFont(const std::string &fontname); 53 bool loadFont(const std::string &fontname);
53 void setForeground(const XColor &color); 54 void setForeground(const FbTk::Color &color);
54 void setBackground(const XColor &color); 55 void setBackground(const FbTk::Color &color);
55 void setAntialias(bool val) { m_font.setAntialias(val); } 56 void setAntialias(bool val) { m_font.setAntialias(val); }
56 const FbTk::Font &font() const { return m_font; } 57 const FbTk::Font &font() const { return m_font; }
57 /// execute command and exit 58 /// execute command and exit
58 void run(const std::string &execstring); 59 void run(const std::string &execstring);
59 /// is this application done? 60 /// is this application done?
60 bool end() const { return m_end; } 61 bool end() const { return m_end; }
61 /** 62 /**
62 loads history file. 63 loads history file.
63 @return true on success, else false 64 @return true on success, else false
64 */ 65 */
65 bool loadHistory(const char *filename); 66 bool loadHistory(const char *filename);
66 /** 67 /**
67 @name events 68 @name events
68 */ 69 */
69 ///@{ 70 ///@{
70 void exposeEvent(XExposeEvent &ev); 71 void exposeEvent(XExposeEvent &ev);
71 void keyPressEvent(XKeyEvent &ev); 72 void keyPressEvent(XKeyEvent &ev);
72 ///@} 73 ///@}
73 74
74private: 75private:
75 void nextHistoryItem(); 76 void nextHistoryItem();
76 void prevHistoryItem(); 77 void prevHistoryItem();
77 void drawString(int x, int y, const char *text, size_t len); 78 void drawString(int x, int y, const char *text, size_t len);
78 void getSize(size_t &width, size_t &height); 79 void getSize(size_t &width, size_t &height);
79 void createWindow(int x, int y, size_t width, size_t height); 80 void createWindow(int x, int y, size_t width, size_t height);
80 void redrawLabel(); 81 void redrawLabel();
81 /// set no maximizable for this window 82 /// set no maximizable for this window
82 void setNoMaximize(); 83 void setNoMaximize();
83 84
84 FbTk::Font m_font; ///< font used to draw command text 85 FbTk::Font m_font; ///< font used to draw command text
85 Window m_win; ///< toplevel window 86 FbTk::FbWindow m_win; ///< toplevel window
86 Display *m_display; ///< display connection 87 Display *m_display; ///< display connection
87 std::string m_runtext; ///< command to execute 88 std::string m_runtext; ///< command to execute
88 size_t m_width, m_height; ///< size of window 89 int m_bevel; ///< distance to window edge from font in pixels
89 int m_bevel; ///< distance to window edge from font in pixels 90 GC m_gc; ///< graphic context
90 GC m_gc; ///< graphic context 91 bool m_end; ///< marks when this object is done
91 bool m_end; ///< marks when this object is done 92 std::vector<std::string> m_history; ///< history list of commands
92 std::vector<std::string> m_history; ///< history list of commands 93 size_t m_current_history_item; ///< holds current position in command history
93 size_t m_current_history_item; ///< holds current position in command history 94 std::string m_history_file; ///< holds filename for command history file
94 std::string m_history_file; ///< holds filename for command history file
95}; 95};
96 96
97#endif // FBRUN_HH 97#endif // FBRUN_HH