From 550b9760ddecf9bfc013708b2bf612e3aa07e4b3 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 16 Dec 2002 11:17:26 +0000 Subject: parent and showSubwindows function --- src/FbTk/FbWindow.cc | 20 ++++++++++++++++---- src/FbTk/FbWindow.hh | 9 ++++++++- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWindow.cc,v 1.2 2002/12/03 21:59:58 fluxgen Exp $ +// $Id: FbWindow.cc,v 1.3 2002/12/16 11:17:26 fluxgen Exp $ #include "FbWindow.hh" @@ -32,7 +32,8 @@ namespace FbTk { Display *FbWindow::s_display = 0; -FbWindow::FbWindow():m_window(0) { +FbWindow::FbWindow():m_parent(0), m_screen_num(0), m_window(0) { + if (s_display == 0) s_display = App::instance()->display(); } @@ -41,7 +42,9 @@ FbWindow::FbWindow(int screen_num, int x, int y, size_t width, size_t height, long eventmask, bool override_redirect, int depth, - int class_type) { + int class_type): + m_screen_num(screen_num), + m_parent(0) { create(RootWindow(FbTk::App::instance()->display(), screen_num), x, y, width, height, eventmask, @@ -51,7 +54,9 @@ FbWindow::FbWindow(int screen_num, FbWindow::FbWindow(const FbWindow &parent, int x, int y, size_t width, size_t height, long eventmask, bool override_redirect, - int depth, int class_type) { + int depth, int class_type): + m_parent(&parent), + m_screen_num(parent.screenNumber()) { create(parent.window(), x, y, width, height, eventmask, override_redirect, depth, class_type); @@ -106,6 +111,10 @@ void FbWindow::show() { XMapWindow(s_display, m_window); } +void FbWindow::showSubwindows() { + XMapSubwindows(s_display, m_window); +} + void FbWindow::hide() { XUnmapWindow(s_display, m_window); } @@ -138,6 +147,9 @@ void FbWindow::raise() { XRaiseWindow(s_display, m_window); } +int FbWindow::screenNumber() const { + return m_screen_num; +} void FbWindow::updateGeometry() { if (m_window == 0) 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbWindow.hh,v 1.3 2002/12/13 20:29:31 fluxgen Exp $ +// $Id: FbWindow.hh,v 1.4 2002/12/16 11:14:08 fluxgen Exp $ #ifndef FBTK_FBWINDOW_HH #define FBTK_FBWINDOW_HH @@ -64,23 +64,28 @@ public: FbWindow &operator = (Window win); void hide(); void show(); + void showSubwindows(); + virtual void move(int x, int y); virtual void resize(size_t width, size_t height); virtual void moveResize(int x, int y, size_t width, size_t height); void lower(); void raise(); + const FbWindow *parent() const { return m_parent; } Window window() const { return m_window; } int x() const { return m_x; } int y() const { return m_y; } size_t width() const { return m_width; } size_t height() const { return m_height; } + int screenNumber() const; /// compare X window bool operator == (Window win) const { return m_window == win; } bool operator != (Window win) const { return m_window != win; } /// compare two windows bool operator == (const FbWindow &win) const { return m_window == win.m_window; } bool operator != (const FbWindow &win) const { return m_window != win.m_window; } + private: void updateGeometry(); void create(Window parent, int x, int y, size_t width, size_t height, long eventmask, @@ -88,6 +93,8 @@ private: int depth, int class_type); static Display *s_display; + const FbWindow *m_parent; + int m_screen_num; Window m_window; ///< X window int m_x, m_y; ///< position size_t m_width, m_height; -- cgit v0.11.2