summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/FbWindow.hh34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index 0422c9d..ea79286 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -19,7 +19,7 @@
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: FbWindow.hh,v 1.12 2003/04/29 08:51:27 fluxgen Exp $ 22// $Id: FbWindow.hh,v 1.13 2003/05/10 13:24:59 fluxgen Exp $
23 23
24#ifndef FBTK_FBWINDOW_HH 24#ifndef FBTK_FBWINDOW_HH
25#define FBTK_FBWINDOW_HH 25#define FBTK_FBWINDOW_HH
@@ -33,15 +33,28 @@ namespace FbTk {
33class Color; 33class Color;
34 34
35/// Wrapper for X window 35/// Wrapper for X window
36/**
37 * Example:
38 * FbWindow window(0, 10, 10, 100, 100, ExposeMask | ButtonPressMask); \n
39 * this will create a window on screen 0, position 10 10, size 100 100 \n
40 * and with eventmask Expose and ButtonPress. \n
41 * You need to register it to some eventhandler so you can catch events: \n
42 * EventManager::instance()->add(your_eventhandler, window); \n
43 * @see EventHandler
44 * @see EventManager
45 */
36class FbWindow: public FbDrawable { 46class FbWindow: public FbDrawable {
37public: 47public:
38 FbWindow(); 48 FbWindow();
49
39 FbWindow(const FbWindow &win_copy); 50 FbWindow(const FbWindow &win_copy);
51
40 FbWindow(int screen_num, 52 FbWindow(int screen_num,
41 int x, int y, unsigned int width, unsigned int height, long eventmask, 53 int x, int y, unsigned int width, unsigned int height, long eventmask,
42 bool overrride_redirect = false, 54 bool overrride_redirect = false,
43 int depth = CopyFromParent, 55 int depth = CopyFromParent,
44 int class_type = InputOutput); 56 int class_type = InputOutput);
57
45 FbWindow(const FbWindow &parent, 58 FbWindow(const FbWindow &parent,
46 int x, int y, 59 int x, int y,
47 unsigned int width, unsigned int height, 60 unsigned int width, unsigned int height,
@@ -55,7 +68,7 @@ public:
55 void setBackgroundPixmap(Pixmap bg_pixmap); 68 void setBackgroundPixmap(Pixmap bg_pixmap);
56 void setBorderColor(const FbTk::Color &border_color); 69 void setBorderColor(const FbTk::Color &border_color);
57 void setBorderWidth(unsigned int size); 70 void setBorderWidth(unsigned int size);
58 /// set window name (for title) 71 /// set window name (title)
59 void setName(const char *name); 72 void setName(const char *name);
60 void setEventMask(long mask); 73 void setEventMask(long mask);
61 /// clear window with background pixmap or color 74 /// clear window with background pixmap or color
@@ -72,15 +85,18 @@ public:
72 virtual void lower(); 85 virtual void lower();
73 virtual void raise(); 86 virtual void raise();
74 87
75 88 /// @return parent FbWindow
76 const FbWindow *parent() const { return m_parent; } 89 const FbWindow *parent() const { return m_parent; }
90 /// @return real X window
77 inline Window window() const { return m_window; } 91 inline Window window() const { return m_window; }
92 /// @return drawable (the X window)
78 inline Drawable drawable() const { return window(); } 93 inline Drawable drawable() const { return window(); }
79 int x() const { return m_x; } 94 int x() const { return m_x; }
80 int y() const { return m_y; } 95 int y() const { return m_y; }
81 unsigned int width() const { return m_width; } 96 unsigned int width() const { return m_width; }
82 unsigned int height() const { return m_height; } 97 unsigned int height() const { return m_height; }
83 unsigned int borderWidth() const { return m_border_width; } 98 unsigned int borderWidth() const { return m_border_width; }
99 int depth() const { return m_depth; }
84 int screenNumber() const; 100 int screenNumber() const;
85 /// compare X window 101 /// compare X window
86 bool operator == (Window win) const { return m_window == win; } 102 bool operator == (Window win) const { return m_window == win; }
@@ -90,7 +106,9 @@ public:
90 bool operator != (const FbWindow &win) const { return m_window != win.m_window; } 106 bool operator != (const FbWindow &win) const { return m_window != win.m_window; }
91 107
92protected: 108protected:
109 /// creates a window with x window client (m_window = client)
93 explicit FbWindow(Window client); 110 explicit FbWindow(Window client);
111
94private: 112private:
95 void updateGeometry(); 113 void updateGeometry();
96 void create(Window parent, int x, int y, unsigned int width, unsigned int height, 114 void create(Window parent, int x, int y, unsigned int width, unsigned int height,
@@ -98,18 +116,20 @@ private:
98 bool override_redirect, 116 bool override_redirect,
99 int depth, 117 int depth,
100 int class_type); 118 int class_type);
101 static Display *s_display; 119 static Display *s_display; ///< display connection
102 const FbWindow *m_parent; 120 const FbWindow *m_parent; ///< parent FbWindow
103 int m_screen_num; 121 int m_screen_num; ///< screen num on which this window exist
104 Window m_window; ///< the X window 122 Window m_window; ///< the X window
105 int m_x, m_y; ///< position of window 123 int m_x, m_y; ///< position of window
106 unsigned int m_width, m_height; ///< size of window 124 unsigned int m_width, m_height; ///< size of window
107 unsigned int m_border_width; // border size 125 unsigned int m_border_width; ///< border size
126 int m_depth; ///< bit depth
108 bool m_destroy; ///< wheter the x window was created before 127 bool m_destroy; ///< wheter the x window was created before
109}; 128};
110 129
111bool operator == (Window win, const FbWindow &fbwin); 130bool operator == (Window win, const FbWindow &fbwin);
112 131
132/// helper class for some STL routines
113class ChangeProperty { 133class ChangeProperty {
114public: 134public:
115 ChangeProperty(Display *disp, Atom prop, int mode, 135 ChangeProperty(Display *disp, Atom prop, int mode,