edelib: edelib/Window.h Source File

edelib 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

Window.h
1 /*
2 * $Id: Window.h 2925 2009-11-10 11:06:08Z karijes $
3 *
4 * Window class
5 * Copyright (c) 2005-2007 edelib authors
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef __EDELIB_WINDOW_H__
22 #define __EDELIB_WINDOW_H__
23
24 #include "XSettingsClient.h"
25 #include <FL/Fl_Double_Window.H>
26
27 EDELIB_NS_BEGIN
28
34 enum WindowComponents {
35 WIN_INIT_NONE = (1 << 1),
36 WIN_INIT_ICON_THEME = (1 << 2),
37 WIN_INIT_IMAGES = (1 << 3),
38 WIN_INIT_ALL = (WIN_INIT_ICON_THEME | WIN_INIT_IMAGES)
39 };
40
41 #ifndef SKIP_DOCS
42 typedef bool (WindowXSettingsCallback)(const char* name, XSettingsAction action,
43 const XSettingsSetting* setting, void* data);
44 #endif
45
73 class EDELIB_API Window : public Fl_Double_Window {
74 private:
75 bool sbuffer;
76 int loaded_components;
77
78 XSettingsClient* xs;
79
80 WindowXSettingsCallback* xs_cb;
81 WindowXSettingsCallback* xs_cb_old;
82 void* xs_cb_data;
83
84 const char* const* icon_pixmap;
85
86 void init(int component);
87 public:
91 Window(int X, int Y, int W, int H, const char* l = 0, int component = WIN_INIT_ALL);
92
96 Window(int W, int H, const char* l = 0, int component = WIN_INIT_ALL);
97
101 virtual ~Window();
102
106 int component(void) { return loaded_components; }
107
114 void xsettings_callback(WindowXSettingsCallback cb, void* data = NULL) { xs_cb = cb; xs_cb_data = data; }
115
119 WindowXSettingsCallback* xsettings_callback(void) { return xs_cb; }
120
124 void* xsettings_callback_data(void) { return xs_cb_data; }
125
131 void pause_xsettings_callback(void) { xs_cb_old = xs_cb; xs_cb = NULL; }
132
138 void restore_xsettings_callback(void) { xs_cb = xs_cb_old; }
139
145 void window_icon(const char* const * pix) { icon_pixmap = pix; }
146
150 const char* const* window_icon(void) { return icon_pixmap; }
151
155 virtual void show(void);
156
160 virtual void show(int argc, char** argv) { Fl_Window::show(argc, argv); }
161
165 void single_buffer(bool s) { sbuffer = s; }
166
170 bool single_buffer(void) { return sbuffer; }
171
175 bool double_buffer(void) { return !single_buffer(); }
176
181 virtual void flush(void) {
182 if(!sbuffer)
183 Fl_Double_Window::flush();
184 else
185 Fl_Window::flush();
186 }
187
192 virtual void resize(int X, int Y, int W, int H) {
193 if(!sbuffer)
194 Fl_Double_Window::resize(X, Y, W, H);
195 else
196 Fl_Window::resize(X, Y, W, H);
197 }
198
203 virtual void hide(void) {
204 if(!sbuffer)
205 Fl_Double_Window::hide();
206 else
207 Fl_Window::hide();
208 }
209 };
210
211 EDELIB_NS_END
212 #endif
edelib::Window::restore_xsettings_callback
void restore_xsettings_callback(void)
Definition: Window.h:138
edelib::WIN_INIT_NONE
Do not load anything except XSETTINGS code.
Definition: Window.h:35
edelib::Window::window_icon
const char *const * window_icon(void)
Definition: Window.h:150
edelib::Window::component
int component(void)
Definition: Window.h:106
edelib::Window::xsettings_callback
WindowXSettingsCallback * xsettings_callback(void)
Definition: Window.h:119
edelib::WIN_INIT_IMAGES
Call fl_register_images.
Definition: Window.h:37
edelib::Window
Window class.
Definition: Window.h:73
edelib::WindowComponents
WindowComponents
Components used to be loaded with the window.
Definition: Window.h:34
edelib::XSettingsAction
XSettingsAction
Flags telling what was done with setting.
Definition: XSettingsClient.h:33
edelib::WIN_INIT_ALL
Load above.
Definition: Window.h:38
edelib::Window::single_buffer
void single_buffer(bool s)
Definition: Window.h:165
edelib::Window::xsettings_callback_data
void * xsettings_callback_data(void)
Definition: Window.h:124
edelib::Window::single_buffer
bool single_buffer(void)
Definition: Window.h:170
edelib::XSettingsSetting
Structure for tracking XSETTINGS values.
Definition: XSettingsCommon.h:61
edelib::Window::pause_xsettings_callback
void pause_xsettings_callback(void)
Definition: Window.h:131
edelib::Window::window_icon
void window_icon(const char *const *pix)
Definition: Window.h:145
edelib::Window::show
virtual void show(int argc, char **argv)
Definition: Window.h:160
edelib::Window::hide
virtual void hide(void)
Definition: Window.h:203
edelib::Window::double_buffer
bool double_buffer(void)
Definition: Window.h:175
edelib::Window::flush
virtual void flush(void)
Definition: Window.h:181
edelib::Window::resize
virtual void resize(int X, int Y, int W, int H)
Definition: Window.h:192
edelib::XSettingsClient
Client part of XSETTINGS protocol.
Definition: XSettingsClient.h:109
edelib::Window::xsettings_callback
void xsettings_callback(WindowXSettingsCallback cb, void *data=((void *) 0))
Definition: Window.h:114