2
// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
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:
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
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.
22
// $Id: FbRun.hh 4043 2005-06-03 07:25:48Z mathias $
27
#include "FbTk/EventHandler.hh"
28
#include "FbTk/Font.hh"
29
#include "FbTk/FbWindow.hh"
30
#include "FbTk/TextBox.hh"
31
#include "FbTk/GContext.hh"
32
#include "FbTk/FbPixmap.hh"
38
Creates and managed a run window
40
class FbRun: public FbTk::TextBox {
42
FbRun(int x = 0, int y = 0, size_t width = 200);
44
void handleEvent(XEvent * const ev);
45
void setTitle(const std::string &title);
46
void resize(unsigned int width, unsigned int height);
48
/// load and reconfigure for new font
49
bool loadFont(const std::string &fontname);
50
void setForegroundColor(const FbTk::Color &color);
51
void setAntialias(bool val) { /*m_font.setAntialias(val);*/ }
52
const FbTk::Font &font() const { return m_font; }
53
/// execute command and exit
54
void run(const std::string &execstring);
55
/// is this application done?
56
bool end() const { return m_end; }
59
@return true on success, else false
61
bool loadHistory(const char *filename);
66
void keyPressEvent(XKeyEvent &ev);
70
void nextHistoryItem();
71
void prevHistoryItem();
72
void drawString(int x, int y, const char *text, size_t len);
73
void getSize(size_t &width, size_t &height);
74
void createWindow(int x, int y, size_t width, size_t height);
76
/// set no maximizable for this window
79
void insertCharacter(char key);
80
void adjustStartPos();
82
void firstHistoryItem();
83
void lastHistoryItem();
84
void tabCompleteHistory();
85
void tabCompleteApps();
87
FbTk::Font m_font; ///< font used to draw command text
88
Display *m_display; ///< display connection
90
FbTk::GContext m_gc; ///< graphic context
91
bool m_end; ///< marks when this object is done
92
std::vector<std::string> m_history; ///< history list of commands
93
std::string m_history_file; ///< holds filename for command history file
94
size_t m_current_history_item; ///< holds current position in command history
96
typedef std::vector<std::string> AppsContainer;
97
typedef AppsContainer::iterator AppsContainerIt;
98
AppsContainer m_apps; ///< holds all apps in $PATH
99
size_t m_current_apps_item; ///< holds current position in apps-history
103
FbTk::FbPixmap m_pixmap;