diff options
author | fluxgen <fluxgen> | 2002-08-20 02:05:17 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-08-20 02:05:17 (GMT) |
commit | 952d7717cd1a2a00d873719dd104277f674db15b (patch) | |
tree | 57ebbcc03b21368a21877d7f3fba17070a35ebf7 /util/fbrun/FbRun.hh | |
parent | 4d3ee5364af5ceccdee89809dbe13a41720bf781 (diff) | |
download | fluxbox_pavel-952d7717cd1a2a00d873719dd104277f674db15b.zip fluxbox_pavel-952d7717cd1a2a00d873719dd104277f674db15b.tar.bz2 |
first
Diffstat (limited to 'util/fbrun/FbRun.hh')
-rw-r--r-- | util/fbrun/FbRun.hh | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/util/fbrun/FbRun.hh b/util/fbrun/FbRun.hh new file mode 100644 index 0000000..d15e009 --- /dev/null +++ b/util/fbrun/FbRun.hh | |||
@@ -0,0 +1,76 @@ | |||
1 | // FbRun.hh | ||
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen@linuxmail.org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | // $Id: FbRun.hh,v 1.1 2002/08/20 02:04:34 fluxgen Exp $ | ||
23 | |||
24 | #ifndef FBRUN_HH | ||
25 | #define FBRUN_HH | ||
26 | |||
27 | #include "EventHandler.hh" | ||
28 | #include "Font.hh" | ||
29 | |||
30 | #include <string> | ||
31 | |||
32 | /** | ||
33 | Creates and managed a run window | ||
34 | TODO: a command history | ||
35 | */ | ||
36 | class FbRun: public FbTk::EventHandler<XEvent> { | ||
37 | public: | ||
38 | FbRun(Display *disp, int x = 0, int y = 0, size_t width = 200); | ||
39 | ~FbRun(); | ||
40 | void handleEvent(XEvent * const ev); | ||
41 | void setText(const std::string &text); | ||
42 | void setTitle(const std::string &title); | ||
43 | void move(int x, int y); | ||
44 | void resize(size_t width, size_t height); | ||
45 | /// hide window | ||
46 | void hide(); | ||
47 | /// show window | ||
48 | void show(); | ||
49 | /// load and reconfigure for new font | ||
50 | bool loadFont(const std::string &fontname); | ||
51 | void setForeground(const XColor &color); | ||
52 | void setBackground(const XColor &color); | ||
53 | const FbTk::Font &font() const { return m_font; } | ||
54 | /// execute command and exit | ||
55 | void run(const std::string &execstring); | ||
56 | /// is this object done? | ||
57 | bool end() const { return m_end; } | ||
58 | private: | ||
59 | void drawString(int x, int y, const char *text, size_t len); | ||
60 | void getSize(size_t &width, size_t &height); | ||
61 | void createWindow(int x, int y, size_t width, size_t height); | ||
62 | void redrawLabel(); | ||
63 | /// set no maximizable for this window | ||
64 | void setNoMaximize(); | ||
65 | |||
66 | FbTk::Font m_font; ///< font used to draw command text | ||
67 | Window m_win; ///< toplevel window | ||
68 | Display *m_display; ///< display connection | ||
69 | std::string m_runtext; ///< command to execute | ||
70 | size_t m_width, m_height; ///< size of window | ||
71 | int m_bevel; ///< distance to window edge from font in pixels | ||
72 | GC m_gc; | ||
73 | bool m_end; | ||
74 | }; | ||
75 | |||
76 | #endif // FBRUN_HH | ||