aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/FbWindow.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/FbWindow.hh')
-rw-r--r--src/FbTk/FbWindow.hh96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
new file mode 100644
index 0000000..fbd6d85
--- /dev/null
+++ b/src/FbTk/FbWindow.hh
@@ -0,0 +1,96 @@
1// FbWindow.hh for FbTk - fluxbox toolkit
2// Copyright (c) 2002 Henrik Kinnunen (fluxgen at users.sourceforge.net)
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: FbWindow.hh,v 1.1 2002/12/03 16:25:25 fluxgen Exp $
23
24#ifndef FBTK_FBWINDOW_HH
25#define FBTK_FBWINDOW_HH
26
27#include <X11/Xlib.h>
28
29namespace FbTk {
30
31class Color;
32
33/**
34 Wrapper for X window
35 */
36class FbWindow {
37public:
38
39 FbWindow();
40 FbWindow(const FbWindow &win_copy);
41 FbWindow(int screen_num,
42 int x, int y, size_t width, size_t height, long eventmask,
43 bool overrride_redirect = false,
44 int depth = CopyFromParent,
45 int class_type = InputOutput);
46 FbWindow(const FbWindow &parent,
47 int x, int y, size_t width, size_t height, long eventmask,
48 bool overrride_redirect = false,
49 int depth = CopyFromParent,
50 int class_type = InputOutput);
51
52
53 virtual ~FbWindow();
54 void setBackgroundColor(const FbTk::Color &bg_color);
55 void setBackgroundPixmap(Pixmap bg_pixmap);
56 void setBorderColor(const FbTk::Color &border_color);
57 void setBorderWidth(size_t size);
58 /// set window name (for title)
59 void setName(const char *name);
60 void setEventMask(long mask);
61 /// clear window with background pixmap or color
62 void clear();
63 /// assign a new X window to this
64 FbWindow &operator = (Window win);
65 void hide();
66 void show();
67 virtual void move(int x, int y);
68 virtual void resize(size_t width, size_t height);
69 virtual void moveResize(int x, int y, size_t width, size_t height);
70 void lower();
71 void raise();
72
73 Window window() const { return m_window; }
74 int x() const { return m_x; }
75 int y() const { return m_y; }
76 size_t width() const { return m_width; }
77 size_t height() const { return m_height; }
78 /// compare X window
79 bool operator == (Window win) const { return m_window == win; }
80private:
81 void updateGeometry();
82 void create(Window parent, int x, int y, size_t width, size_t height, long eventmask,
83 bool override_redirect,
84 int depth,
85 int class_type);
86 static Display *s_display;
87 Window m_window; ///< X window
88 int m_x, m_y; ///< position
89 size_t m_width, m_height;
90};
91
92bool operator == (Window win, const FbWindow &fbwin);
93
94}; // end namespace FbTk
95
96#endif // FBTK_FBWINDOW_HH