aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/FbWindow.cc20
-rw-r--r--src/FbTk/FbWindow.hh9
2 files changed, 24 insertions, 5 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 4a3f66c..3a3040b 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -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.cc,v 1.2 2002/12/03 21:59:58 fluxgen Exp $ 22// $Id: FbWindow.cc,v 1.3 2002/12/16 11:17:26 fluxgen Exp $
23 23
24#include "FbWindow.hh" 24#include "FbWindow.hh"
25 25
@@ -32,7 +32,8 @@ namespace FbTk {
32 32
33Display *FbWindow::s_display = 0; 33Display *FbWindow::s_display = 0;
34 34
35FbWindow::FbWindow():m_window(0) { 35FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0) {
36
36 if (s_display == 0) 37 if (s_display == 0)
37 s_display = App::instance()->display(); 38 s_display = App::instance()->display();
38} 39}
@@ -41,7 +42,9 @@ FbWindow::FbWindow(int screen_num,
41 int x, int y, size_t width, size_t height, long eventmask, 42 int x, int y, size_t width, size_t height, long eventmask,
42 bool override_redirect, 43 bool override_redirect,
43 int depth, 44 int depth,
44 int class_type) { 45 int class_type):
46 m_screen_num(screen_num),
47 m_parent(0) {
45 48
46 create(RootWindow(FbTk::App::instance()->display(), screen_num), 49 create(RootWindow(FbTk::App::instance()->display(), screen_num),
47 x, y, width, height, eventmask, 50 x, y, width, height, eventmask,
@@ -51,7 +54,9 @@ FbWindow::FbWindow(int screen_num,
51FbWindow::FbWindow(const FbWindow &parent, 54FbWindow::FbWindow(const FbWindow &parent,
52 int x, int y, size_t width, size_t height, long eventmask, 55 int x, int y, size_t width, size_t height, long eventmask,
53 bool override_redirect, 56 bool override_redirect,
54 int depth, int class_type) { 57 int depth, int class_type):
58 m_parent(&parent),
59 m_screen_num(parent.screenNumber()) {
55 60
56 create(parent.window(), x, y, width, height, eventmask, 61 create(parent.window(), x, y, width, height, eventmask,
57 override_redirect, depth, class_type); 62 override_redirect, depth, class_type);
@@ -106,6 +111,10 @@ void FbWindow::show() {
106 XMapWindow(s_display, m_window); 111 XMapWindow(s_display, m_window);
107} 112}
108 113
114void FbWindow::showSubwindows() {
115 XMapSubwindows(s_display, m_window);
116}
117
109void FbWindow::hide() { 118void FbWindow::hide() {
110 XUnmapWindow(s_display, m_window); 119 XUnmapWindow(s_display, m_window);
111} 120}
@@ -138,6 +147,9 @@ void FbWindow::raise() {
138 XRaiseWindow(s_display, m_window); 147 XRaiseWindow(s_display, m_window);
139} 148}
140 149
150int FbWindow::screenNumber() const {
151 return m_screen_num;
152}
141void FbWindow::updateGeometry() { 153void FbWindow::updateGeometry() {
142 if (m_window == 0) 154 if (m_window == 0)
143 return; 155 return;
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index fb89382..e52bddd 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.3 2002/12/13 20:29:31 fluxgen Exp $ 22// $Id: FbWindow.hh,v 1.4 2002/12/16 11:14:08 fluxgen Exp $
23 23
24#ifndef FBTK_FBWINDOW_HH 24#ifndef FBTK_FBWINDOW_HH
25#define FBTK_FBWINDOW_HH 25#define FBTK_FBWINDOW_HH
@@ -64,23 +64,28 @@ public:
64 FbWindow &operator = (Window win); 64 FbWindow &operator = (Window win);
65 void hide(); 65 void hide();
66 void show(); 66 void show();
67 void showSubwindows();
68
67 virtual void move(int x, int y); 69 virtual void move(int x, int y);
68 virtual void resize(size_t width, size_t height); 70 virtual void resize(size_t width, size_t height);
69 virtual void moveResize(int x, int y, size_t width, size_t height); 71 virtual void moveResize(int x, int y, size_t width, size_t height);
70 void lower(); 72 void lower();
71 void raise(); 73 void raise();
72 74
75 const FbWindow *parent() const { return m_parent; }
73 Window window() const { return m_window; } 76 Window window() const { return m_window; }
74 int x() const { return m_x; } 77 int x() const { return m_x; }
75 int y() const { return m_y; } 78 int y() const { return m_y; }
76 size_t width() const { return m_width; } 79 size_t width() const { return m_width; }
77 size_t height() const { return m_height; } 80 size_t height() const { return m_height; }
81 int screenNumber() const;
78 /// compare X window 82 /// compare X window
79 bool operator == (Window win) const { return m_window == win; } 83 bool operator == (Window win) const { return m_window == win; }
80 bool operator != (Window win) const { return m_window != win; } 84 bool operator != (Window win) const { return m_window != win; }
81 /// compare two windows 85 /// compare two windows
82 bool operator == (const FbWindow &win) const { return m_window == win.m_window; } 86 bool operator == (const FbWindow &win) const { return m_window == win.m_window; }
83 bool operator != (const FbWindow &win) const { return m_window != win.m_window; } 87 bool operator != (const FbWindow &win) const { return m_window != win.m_window; }
88
84private: 89private:
85 void updateGeometry(); 90 void updateGeometry();
86 void create(Window parent, int x, int y, size_t width, size_t height, long eventmask, 91 void create(Window parent, int x, int y, size_t width, size_t height, long eventmask,
@@ -88,6 +93,8 @@ private:
88 int depth, 93 int depth,
89 int class_type); 94 int class_type);
90 static Display *s_display; 95 static Display *s_display;
96 const FbWindow *m_parent;
97 int m_screen_num;
91 Window m_window; ///< X window 98 Window m_window; ///< X window
92 int m_x, m_y; ///< position 99 int m_x, m_y; ///< position
93 size_t m_width, m_height; 100 size_t m_width, m_height;