Window.h
/*
* $Id: Window.h 2925 2009-11-10 11:06:08Z karijes $
*
* Window class
* Copyright (c) 2005-2007 edelib authors
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __EDELIB_WINDOW_H__
#define __EDELIB_WINDOW_H__
#include "XSettingsClient.h"
#include <FL/Fl_Double_Window.H>
EDELIB_NS_BEGIN
enum WindowComponents {
WIN_INIT_NONE = (1 << 1),
WIN_INIT_ICON_THEME = (1 << 2),
WIN_INIT_IMAGES = (1 << 3),
WIN_INIT_ALL = (WIN_INIT_ICON_THEME | WIN_INIT_IMAGES)
};
#ifndef SKIP_DOCS
typedef bool (WindowXSettingsCallback)(const char* name, XSettingsAction action,
const XSettingsSetting* setting, void* data);
#endif
class EDELIB_API Window : public Fl_Double_Window {
private:
bool sbuffer;
int loaded_components;
XSettingsClient* xs;
WindowXSettingsCallback* xs_cb;
WindowXSettingsCallback* xs_cb_old;
void* xs_cb_data;
const char* const* icon_pixmap;
void init(int component);
public:
Window(int X, int Y, int W, int H, const char* l = 0, int component = WIN_INIT_ALL);
Window(int W, int H, const char* l = 0, int component = WIN_INIT_ALL);
virtual ~Window();
int component(void) { return loaded_components; }
void xsettings_callback(WindowXSettingsCallback cb, void* data = NULL) { xs_cb = cb; xs_cb_data = data; }
WindowXSettingsCallback* xsettings_callback(void) { return xs_cb; }
void* xsettings_callback_data(void) { return xs_cb_data; }
void pause_xsettings_callback(void) { xs_cb_old = xs_cb; xs_cb = NULL; }
void restore_xsettings_callback(void) { xs_cb = xs_cb_old; }
void window_icon(const char* const * pix) { icon_pixmap = pix; }
const char* const* window_icon(void) { return icon_pixmap; }
virtual void show(void);
virtual void show(int argc, char** argv) { Fl_Window::show(argc, argv); }
void single_buffer(bool s) { sbuffer = s; }
bool single_buffer(void) { return sbuffer; }
bool double_buffer(void) { return !single_buffer(); }
virtual void flush(void) {
if(!sbuffer)
Fl_Double_Window::flush();
else
Fl_Window::flush();
}
virtual void resize(int X, int Y, int W, int H) {
if(!sbuffer)
Fl_Double_Window::resize(X, Y, W, H);
else
Fl_Window::resize(X, Y, W, H);
}
virtual void hide(void) {
if(!sbuffer)
Fl_Double_Window::hide();
else
Fl_Window::hide();
}
};
EDELIB_NS_END
#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