rm prefixes for all elements in the otk namepsace

This commit is contained in:
Dana Jansens 2003-01-11 19:17:13 +00:00
parent 684405eec8
commit 8f8acc2493
49 changed files with 877 additions and 16528 deletions

View file

@ -18,37 +18,37 @@ extern "C" {
namespace otk { namespace otk {
OtkApplication::OtkApplication(int argc, char **argv) Application::Application(int argc, char **argv)
: OtkEventDispatcher(), : EventDispatcher(),
_dockable(false), _dockable(false),
_appwidget_count(0) _appwidget_count(0)
{ {
argc = argc; (void)argc;
argv = argv; (void)argv;
OBDisplay::initialize(0); Display::initialize(0);
const ScreenInfo *s_info = const ScreenInfo *s_info =
OBDisplay::screenInfo(DefaultScreen(OBDisplay::display)); Display::screenInfo(DefaultScreen(Display::display));
_timer_manager = new OBTimerQueueManager(); _timer_manager = new TimerQueueManager();
_img_ctrl = new BImageControl(_timer_manager, s_info, True, 4, 5, 200); _img_ctrl = new ImageControl(_timer_manager, s_info, True, 4, 5, 200);
_style_conf = new Configuration(False); _style_conf = new Configuration(False);
_style = new Style(_img_ctrl); _style = new Style(_img_ctrl);
loadStyle(); loadStyle();
} }
OtkApplication::~OtkApplication() Application::~Application()
{ {
delete _style_conf; delete _style_conf;
delete _img_ctrl; delete _img_ctrl;
delete _timer_manager; delete _timer_manager;
delete _style; delete _style;
OBDisplay::destroy(); Display::destroy();
} }
void OtkApplication::loadStyle(void) void Application::loadStyle(void)
{ {
// find the style name as a property // find the style name as a property
std::string style = "/usr/local/share/openbox/styles/artwiz"; std::string style = "/usr/local/share/openbox/styles/artwiz";
@ -60,12 +60,12 @@ void OtkApplication::loadStyle(void)
_style->load(*_style_conf); _style->load(*_style_conf);
} }
void OtkApplication::run(void) void Application::run(void)
{ {
if (_appwidget_count <= 0) { if (_appwidget_count <= 0) {
std::cerr << "ERROR: No main widgets exist. You must create and show() " << std::cerr << "ERROR: No main widgets exist. You must create and show() " <<
"an OtkAppWidget for the OtkApplication before calling " << "an AppWidget for the Application before calling " <<
"OtkApplication::run().\n"; "Application::run().\n";
::exit(1); ::exit(1);
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __application_hh #ifndef __application_hh
#define __application_hh #define __application_hh
@ -10,14 +11,14 @@
namespace otk { namespace otk {
class OtkAppWidget; class AppWidget;
class OtkApplication : public OtkEventDispatcher { class Application : public EventDispatcher {
public: public:
OtkApplication(int argc, char **argv); Application(int argc, char **argv);
virtual ~OtkApplication(); virtual ~Application();
virtual void run(void); virtual void run(void);
// more bummy cool functionality // more bummy cool functionality
@ -25,21 +26,21 @@ public:
void setDockable(bool dockable) { _dockable = dockable; } void setDockable(bool dockable) { _dockable = dockable; }
inline bool isDockable(void) const { return _dockable; } inline bool isDockable(void) const { return _dockable; }
inline otk::Style *getStyle(void) const { return _style; } inline Style *getStyle(void) const { return _style; }
// more accessors // more accessors
private: private:
void loadStyle(void); void loadStyle(void);
OBTimerQueueManager *_timer_manager; TimerQueueManager *_timer_manager;
BImageControl *_img_ctrl; ImageControl *_img_ctrl;
Configuration *_style_conf; Configuration *_style_conf;
Style *_style; Style *_style;
bool _dockable; bool _dockable;
int _appwidget_count; int _appwidget_count;
friend class OtkAppWidget; friend class AppWidget;
}; };
} }

View file

@ -13,44 +13,44 @@ extern "C" {
namespace otk { namespace otk {
OtkAppWidget::OtkAppWidget(OtkApplication *app, Direction direction, AppWidget::AppWidget(Application *app, Direction direction,
Cursor cursor, int bevel_width) Cursor cursor, int bevel_width)
: OtkWidget(app, app->getStyle(), direction, cursor, bevel_width), : Widget(app, app->getStyle(), direction, cursor, bevel_width),
_application(app) _application(app)
{ {
assert(app); assert(app);
_wm_protocols = XInternAtom(OBDisplay::display, "WM_PROTOCOLS", false); _wm_protocols = XInternAtom(Display::display, "WM_PROTOCOLS", false);
_wm_delete = XInternAtom(OBDisplay::display, "WM_DELETE_WINDOW", false); _wm_delete = XInternAtom(Display::display, "WM_DELETE_WINDOW", false);
// set WM Protocols on the window // set WM Protocols on the window
Atom protocols[2]; Atom protocols[2];
protocols[0] = _wm_protocols; protocols[0] = _wm_protocols;
protocols[1] = _wm_delete; protocols[1] = _wm_delete;
XSetWMProtocols(OBDisplay::display, window(), protocols, 2); XSetWMProtocols(Display::display, window(), protocols, 2);
} }
OtkAppWidget::~OtkAppWidget() AppWidget::~AppWidget()
{ {
} }
void OtkAppWidget::show(void) void AppWidget::show(void)
{ {
OtkWidget::show(true); Widget::show(true);
_application->_appwidget_count++; _application->_appwidget_count++;
} }
void OtkAppWidget::hide(void) void AppWidget::hide(void)
{ {
OtkWidget::hide(); Widget::hide();
_application->_appwidget_count--; _application->_appwidget_count--;
} }
void OtkAppWidget::clientMessageHandler(const XClientMessageEvent &e) void AppWidget::clientMessageHandler(const XClientMessageEvent &e)
{ {
OtkEventHandler::clientMessageHandler(e); EventHandler::clientMessageHandler(e);
if (e.message_type == _wm_protocols && if (e.message_type == _wm_protocols &&
static_cast<Atom>(e.data.l[0]) == _wm_delete) static_cast<Atom>(e.data.l[0]) == _wm_delete)
hide(); hide();

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __appwidget_hh #ifndef __appwidget_hh
#define __appwidget_hh #define __appwidget_hh
@ -5,14 +6,14 @@
namespace otk { namespace otk {
class OtkApplication; class Application;
class OtkAppWidget : public OtkWidget { class AppWidget : public Widget {
public: public:
OtkAppWidget(OtkApplication *app, Direction direction = Horizontal, AppWidget(Application *app, Direction direction = Horizontal,
Cursor cursor = 0, int bevel_width = 1); Cursor cursor = 0, int bevel_width = 1);
virtual ~OtkAppWidget(); virtual ~AppWidget();
virtual void show(void); virtual void show(void);
virtual void hide(void); virtual void hide(void);
@ -21,7 +22,7 @@ public:
private: private:
OtkApplication *_application; Application *_application;
Atom _wm_protocols; Atom _wm_protocols;
Atom _wm_delete; Atom _wm_delete;
}; };

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __assassin_hh #ifndef __assassin_hh
#define __assassin_hh #define __assassin_hh

View file

@ -8,20 +8,20 @@
namespace otk { namespace otk {
OtkButton::OtkButton(OtkWidget *parent) Button::Button(Widget *parent)
: OtkFocusLabel(parent), _pressed(false), _pressed_focus_tx(0), : FocusLabel(parent), _pressed(false), _pressed_focus_tx(0),
_pressed_unfocus_tx(0), _unpr_focus_tx(0), _unpr_unfocus_tx(0) _pressed_unfocus_tx(0), _unpr_focus_tx(0), _unpr_unfocus_tx(0)
{ {
} }
OtkButton::~OtkButton() Button::~Button()
{ {
} }
void OtkButton::setStyle(Style *style) void Button::setStyle(Style *style)
{ {
OtkFocusLabel::setStyle(style); FocusLabel::setStyle(style);
setTexture(style->getButtonFocus()); setTexture(style->getButtonFocus());
setUnfocusTexture(style->getButtonUnfocus()); setUnfocusTexture(style->getButtonUnfocus());
@ -30,51 +30,51 @@ void OtkButton::setStyle(Style *style)
} }
void OtkButton::press(unsigned int mouse_button) void Button::press(unsigned int mouse_button)
{ {
if (_pressed) return; if (_pressed) return;
if (_pressed_focus_tx) if (_pressed_focus_tx)
OtkFocusWidget::setTexture(_pressed_focus_tx); FocusWidget::setTexture(_pressed_focus_tx);
if (_pressed_unfocus_tx) if (_pressed_unfocus_tx)
OtkFocusWidget::setUnfocusTexture(_pressed_unfocus_tx); FocusWidget::setUnfocusTexture(_pressed_unfocus_tx);
_pressed = true; _pressed = true;
_mouse_button = mouse_button; _mouse_button = mouse_button;
} }
void OtkButton::release(unsigned int mouse_button) void Button::release(unsigned int mouse_button)
{ {
if (_mouse_button != mouse_button) return; // wrong button if (_mouse_button != mouse_button) return; // wrong button
OtkFocusWidget::setTexture(_unpr_focus_tx); FocusWidget::setTexture(_unpr_focus_tx);
OtkFocusWidget::setUnfocusTexture(_unpr_unfocus_tx); FocusWidget::setUnfocusTexture(_unpr_unfocus_tx);
_pressed = false; _pressed = false;
} }
void OtkButton::setTexture(BTexture *texture) void Button::setTexture(Texture *texture)
{ {
OtkFocusWidget::setTexture(texture); FocusWidget::setTexture(texture);
_unpr_focus_tx = texture; _unpr_focus_tx = texture;
} }
void OtkButton::setUnfocusTexture(BTexture *texture) void Button::setUnfocusTexture(Texture *texture)
{ {
OtkFocusWidget::setUnfocusTexture(texture); FocusWidget::setUnfocusTexture(texture);
_unpr_unfocus_tx = texture; _unpr_unfocus_tx = texture;
} }
void OtkButton::buttonPressHandler(const XButtonEvent &e) void Button::buttonPressHandler(const XButtonEvent &e)
{ {
press(e.button); press(e.button);
update(); update();
OtkFocusWidget::buttonPressHandler(e); FocusWidget::buttonPressHandler(e);
} }
void OtkButton::buttonReleaseHandler(const XButtonEvent &e) void Button::buttonReleaseHandler(const XButtonEvent &e)
{ {
release(e.button); release(e.button);
update(); update();
OtkFocusWidget::buttonReleaseHandler(e); FocusWidget::buttonReleaseHandler(e);
} }
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __button_hh #ifndef __button_hh
#define __button_hh #define __button_hh
@ -5,25 +6,25 @@
namespace otk { namespace otk {
class OtkButton : public OtkFocusLabel { class Button : public FocusLabel {
public: public:
OtkButton(OtkWidget *parent); Button(Widget *parent);
~OtkButton(); ~Button();
inline const otk::BTexture *getPressedFocusTexture(void) const inline const Texture *getPressedFocusTexture(void) const
{ return _pressed_focus_tx; } { return _pressed_focus_tx; }
void setPressedFocusTexture(otk::BTexture *texture) void setPressedFocusTexture(Texture *texture)
{ _pressed_focus_tx = texture; } { _pressed_focus_tx = texture; }
inline const otk::BTexture *getPressedUnfocusTexture(void) const inline const Texture *getPressedUnfocusTexture(void) const
{ return _pressed_unfocus_tx; } { return _pressed_unfocus_tx; }
void setPressedUnfocusTexture(otk::BTexture *texture) void setPressedUnfocusTexture(Texture *texture)
{ _pressed_unfocus_tx = texture; } { _pressed_unfocus_tx = texture; }
void setTexture(otk::BTexture *texture); void setTexture(Texture *texture);
void setUnfocusTexture(otk::BTexture *texture); void setUnfocusTexture(Texture *texture);
inline bool isPressed(void) const { return _pressed; } inline bool isPressed(void) const { return _pressed; }
void press(unsigned int mouse_button); void press(unsigned int mouse_button);
@ -32,18 +33,18 @@ public:
void buttonPressHandler(const XButtonEvent &e); void buttonPressHandler(const XButtonEvent &e);
void buttonReleaseHandler(const XButtonEvent &e); void buttonReleaseHandler(const XButtonEvent &e);
virtual void setStyle(otk::Style *style); virtual void setStyle(Style *style);
private: private:
bool _pressed; bool _pressed;
unsigned int _mouse_button; unsigned int _mouse_button;
BTexture *_pressed_focus_tx; Texture *_pressed_focus_tx;
BTexture *_pressed_unfocus_tx; Texture *_pressed_unfocus_tx;
BTexture *_unpr_focus_tx; Texture *_unpr_focus_tx;
BTexture *_unpr_unfocus_tx; Texture *_unpr_unfocus_tx;
}; };
} }

View file

@ -16,31 +16,31 @@ extern "C" {
namespace otk { namespace otk {
BColor::ColorCache BColor::colorcache; Color::ColorCache Color::colorcache;
bool BColor::cleancache = false; bool Color::cleancache = false;
BColor::BColor(unsigned int _screen) Color::Color(unsigned int _screen)
: allocated(false), r(-1), g(-1), b(-1), p(0), scrn(_screen) : allocated(false), r(-1), g(-1), b(-1), p(0), scrn(_screen)
{} {}
BColor::BColor(int _r, int _g, int _b, unsigned int _screen) Color::Color(int _r, int _g, int _b, unsigned int _screen)
: allocated(false), r(_r), g(_g), b(_b), p(0), scrn(_screen) : allocated(false), r(_r), g(_g), b(_b), p(0), scrn(_screen)
{} {}
BColor::BColor(const std::string &_name, unsigned int _screen) Color::Color(const std::string &_name, unsigned int _screen)
: allocated(false), r(-1), g(-1), b(-1), p(0), scrn(_screen), : allocated(false), r(-1), g(-1), b(-1), p(0), scrn(_screen),
colorname(_name) { colorname(_name) {
parseColorName(); parseColorName();
} }
BColor::~BColor(void) { Color::~Color(void) {
deallocate(); deallocate();
} }
void BColor::setScreen(unsigned int _screen) { void Color::setScreen(unsigned int _screen) {
if (_screen == screen()) { if (_screen == screen()) {
// nothing to do // nothing to do
return; return;
@ -56,10 +56,10 @@ void BColor::setScreen(unsigned int _screen) {
} }
unsigned long BColor::pixel(void) const { unsigned long Color::pixel(void) const {
if (! allocated) { if (! allocated) {
// mutable // mutable
BColor *that = (BColor *) this; Color *that = (Color *) this;
that->allocate(); that->allocate();
} }
@ -67,15 +67,15 @@ unsigned long BColor::pixel(void) const {
} }
void BColor::parseColorName(void) { void Color::parseColorName(void) {
if (colorname.empty()) { if (colorname.empty()) {
fprintf(stderr, "BColor: empty colorname, cannot parse (using black)\n"); fprintf(stderr, "Color: empty colorname, cannot parse (using black)\n");
setRGB(0, 0, 0); setRGB(0, 0, 0);
} }
if (scrn == ~(0u)) if (scrn == ~(0u))
scrn = DefaultScreen(OBDisplay::display); scrn = DefaultScreen(Display::display);
Colormap colormap = OBDisplay::screenInfo(scrn)->colormap(); Colormap colormap = Display::screenInfo(scrn)->colormap();
// get rgb values from colorname // get rgb values from colorname
XColor xcol; XColor xcol;
@ -84,9 +84,9 @@ void BColor::parseColorName(void) {
xcol.blue = 0; xcol.blue = 0;
xcol.pixel = 0; xcol.pixel = 0;
if (! XParseColor(OBDisplay::display, colormap, if (! XParseColor(Display::display, colormap,
colorname.c_str(), &xcol)) { colorname.c_str(), &xcol)) {
fprintf(stderr, "BColor::allocate: color parse error: \"%s\"\n", fprintf(stderr, "Color::allocate: color parse error: \"%s\"\n",
colorname.c_str()); colorname.c_str());
setRGB(0, 0, 0); setRGB(0, 0, 0);
return; return;
@ -96,13 +96,13 @@ void BColor::parseColorName(void) {
} }
void BColor::allocate(void) { void Color::allocate(void) {
if (scrn == ~(0u)) scrn = DefaultScreen(OBDisplay::display); if (scrn == ~(0u)) scrn = DefaultScreen(Display::display);
Colormap colormap = OBDisplay::screenInfo(scrn)->colormap(); Colormap colormap = Display::screenInfo(scrn)->colormap();
if (! isValid()) { if (! isValid()) {
if (colorname.empty()) { if (colorname.empty()) {
fprintf(stderr, "BColor: cannot allocate invalid color (using black)\n"); fprintf(stderr, "Color: cannot allocate invalid color (using black)\n");
setRGB(0, 0, 0); setRGB(0, 0, 0);
} else { } else {
parseColorName(); parseColorName();
@ -127,8 +127,8 @@ void BColor::allocate(void) {
xcol.blue = b | b << 8; xcol.blue = b | b << 8;
xcol.pixel = 0; xcol.pixel = 0;
if (! XAllocColor(OBDisplay::display, colormap, &xcol)) { if (! XAllocColor(Display::display, colormap, &xcol)) {
fprintf(stderr, "BColor::allocate: color alloc error: rgb:%x/%x/%x\n", fprintf(stderr, "Color::allocate: color alloc error: rgb:%x/%x/%x\n",
r, g, b); r, g, b);
xcol.pixel = 0; xcol.pixel = 0;
} }
@ -143,7 +143,7 @@ void BColor::allocate(void) {
} }
void BColor::deallocate(void) { void Color::deallocate(void) {
if (! allocated) if (! allocated)
return; return;
@ -160,7 +160,7 @@ void BColor::deallocate(void) {
} }
BColor &BColor::operator=(const BColor &c) { Color &Color::operator=(const Color &c) {
deallocate(); deallocate();
setRGB(c.r, c.g, c.b); setRGB(c.r, c.g, c.b);
@ -170,12 +170,12 @@ BColor &BColor::operator=(const BColor &c) {
} }
void BColor::cleanupColorCache(void) { void Color::cleanupColorCache(void) {
cleancache = true; cleancache = true;
} }
void BColor::doCacheCleanup(void) { void Color::doCacheCleanup(void) {
// ### TODO - support multiple displays! // ### TODO - support multiple displays!
ColorCache::iterator it = colorcache.begin(); ColorCache::iterator it = colorcache.begin();
if (it == colorcache.end()) { if (it == colorcache.end()) {
@ -187,7 +187,7 @@ void BColor::doCacheCleanup(void) {
int i; int i;
unsigned count; unsigned count;
for (i = 0; i < ScreenCount(OBDisplay::display); i++) { for (i = 0; i < ScreenCount(Display::display); i++) {
count = 0; count = 0;
it = colorcache.begin(); it = colorcache.begin();
@ -204,8 +204,8 @@ void BColor::doCacheCleanup(void) {
} }
if (count > 0) if (count > 0)
XFreeColors(OBDisplay::display, XFreeColors(Display::display,
OBDisplay::screenInfo(i)->colormap(), Display::screenInfo(i)->colormap(),
pixels, count, 0); pixels, count, 0);
} }

View file

@ -1,6 +1,6 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef COLOR_HH #ifndef __color_hh
#define COLOR_HH #define __color_hh
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -11,12 +11,12 @@ extern "C" {
namespace otk { namespace otk {
class BColor { class Color {
public: public:
BColor(unsigned int _screen = ~(0u)); Color(unsigned int _screen = ~(0u));
BColor(int _r, int _g, int _b, unsigned int _screen = ~(0u)); Color(int _r, int _g, int _b, unsigned int _screen = ~(0u));
BColor(const std::string &_name, unsigned int _screen = ~(0u)); Color(const std::string &_name, unsigned int _screen = ~(0u));
~BColor(void); ~Color(void);
inline const std::string &name(void) const { return colorname; } inline const std::string &name(void) const { return colorname; }
@ -41,11 +41,11 @@ public:
// operators // operators
#ifndef SWIG #ifndef SWIG
BColor &operator=(const BColor &c); Color &operator=(const Color &c);
#endif #endif
inline bool operator==(const BColor &c) const inline bool operator==(const Color &c) const
{ return (r == c.r && b == c.b && b == c.b); } { return (r == c.r && b == c.b && b == c.b); }
inline bool operator!=(const BColor &c) const inline bool operator!=(const Color &c) const
{ return (! operator==(c)); } { return (! operator==(c)); }
static void cleanupColorCache(void); static void cleanupColorCache(void);
@ -99,4 +99,4 @@ private:
} }
#endif // COLOR_HH #endif // __color_hh

View file

@ -48,22 +48,22 @@ extern "C" {
namespace otk { namespace otk {
Display *OBDisplay::display = (Display*) 0; ::Display *Display::display = (::Display*) 0;
bool OBDisplay::_xkb = false; bool Display::_xkb = false;
int OBDisplay::_xkb_event_basep = 0; int Display::_xkb_event_basep = 0;
bool OBDisplay::_shape = false; bool Display::_shape = false;
int OBDisplay::_shape_event_basep = 0; int Display::_shape_event_basep = 0;
bool OBDisplay::_xinerama = false; bool Display::_xinerama = false;
int OBDisplay::_xinerama_event_basep = 0; int Display::_xinerama_event_basep = 0;
unsigned int OBDisplay::_mask_list[8]; unsigned int Display::_mask_list[8];
unsigned int OBDisplay::_scrollLockMask = 0; unsigned int Display::_scrollLockMask = 0;
unsigned int OBDisplay::_numLockMask = 0; unsigned int Display::_numLockMask = 0;
OBDisplay::ScreenInfoList OBDisplay::_screenInfoList; Display::ScreenInfoList Display::_screenInfoList;
BGCCache *OBDisplay::_gccache = (BGCCache*) 0; GCCache *Display::_gccache = (GCCache*) 0;
int OBDisplay::_grab_count = 0; int Display::_grab_count = 0;
int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e) int Display::xerrorHandler(::Display *d, XErrorEvent *e)
{ {
#ifdef DEBUG #ifdef DEBUG
char errtxt[128]; char errtxt[128];
@ -84,7 +84,7 @@ int OBDisplay::xerrorHandler(Display *d, XErrorEvent *e)
} }
void OBDisplay::initialize(char *name) void Display::initialize(char *name)
{ {
int junk; int junk;
(void)junk; (void)junk;
@ -166,11 +166,11 @@ line argument.\n\n"));
for (int i = 0; i < ScreenCount(display); ++i) for (int i = 0; i < ScreenCount(display); ++i)
_screenInfoList.push_back(ScreenInfo(i)); _screenInfoList.push_back(ScreenInfo(i));
_gccache = new BGCCache(_screenInfoList.size()); _gccache = new GCCache(_screenInfoList.size());
} }
void OBDisplay::destroy() void Display::destroy()
{ {
delete _gccache; delete _gccache;
while (_grab_count > 0) while (_grab_count > 0)
@ -179,14 +179,14 @@ void OBDisplay::destroy()
} }
const ScreenInfo* OBDisplay::screenInfo(int snum) { const ScreenInfo* Display::screenInfo(int snum) {
assert(snum >= 0); assert(snum >= 0);
assert(snum < static_cast<int>(_screenInfoList.size())); assert(snum < static_cast<int>(_screenInfoList.size()));
return &_screenInfoList[snum]; return &_screenInfoList[snum];
} }
const ScreenInfo* OBDisplay::findScreen(Window root) const ScreenInfo* Display::findScreen(Window root)
{ {
ScreenInfoList::iterator it, end = _screenInfoList.end(); ScreenInfoList::iterator it, end = _screenInfoList.end();
for (it = _screenInfoList.begin(); it != end; ++it) for (it = _screenInfoList.begin(); it != end; ++it)
@ -196,7 +196,7 @@ const ScreenInfo* OBDisplay::findScreen(Window root)
} }
void OBDisplay::grab() void Display::grab()
{ {
if (_grab_count == 0) if (_grab_count == 0)
XGrabServer(display); XGrabServer(display);
@ -204,7 +204,7 @@ void OBDisplay::grab()
} }
void OBDisplay::ungrab() void Display::ungrab()
{ {
if (_grab_count == 0) return; if (_grab_count == 0) return;
_grab_count--; _grab_count--;
@ -225,7 +225,7 @@ void OBDisplay::ungrab()
* if allow_scroll_lock is true then only the top half of the lock mask * if allow_scroll_lock is true then only the top half of the lock mask
* table is used and scroll lock is ignored. This value defaults to false. * table is used and scroll lock is ignored. This value defaults to false.
*/ */
void OBDisplay::grabButton(unsigned int button, unsigned int modifiers, void Display::grabButton(unsigned int button, unsigned int modifiers,
Window grab_window, bool owner_events, Window grab_window, bool owner_events,
unsigned int event_mask, int pointer_mode, unsigned int event_mask, int pointer_mode,
int keyboard_mode, Window confine_to, int keyboard_mode, Window confine_to,
@ -233,7 +233,7 @@ void OBDisplay::grabButton(unsigned int button, unsigned int modifiers,
unsigned int length = (allow_scroll_lock) ? 8 / 2: unsigned int length = (allow_scroll_lock) ? 8 / 2:
8; 8;
for (size_t cnt = 0; cnt < length; ++cnt) for (size_t cnt = 0; cnt < length; ++cnt)
XGrabButton(otk::OBDisplay::display, button, modifiers | _mask_list[cnt], XGrabButton(Display::display, button, modifiers | _mask_list[cnt],
grab_window, owner_events, event_mask, pointer_mode, grab_window, owner_events, event_mask, pointer_mode,
keyboard_mode, confine_to, cursor); keyboard_mode, confine_to, cursor);
} }
@ -243,14 +243,14 @@ void OBDisplay::grabButton(unsigned int button, unsigned int modifiers,
* Releases the grab on a button, and ungrabs all possible combinations of the * Releases the grab on a button, and ungrabs all possible combinations of the
* keyboard lock keys. * keyboard lock keys.
*/ */
void OBDisplay::ungrabButton(unsigned int button, unsigned int modifiers, void Display::ungrabButton(unsigned int button, unsigned int modifiers,
Window grab_window) { Window grab_window) {
for (size_t cnt = 0; cnt < 8; ++cnt) for (size_t cnt = 0; cnt < 8; ++cnt)
XUngrabButton(otk::OBDisplay::display, button, modifiers | _mask_list[cnt], XUngrabButton(Display::display, button, modifiers | _mask_list[cnt],
grab_window); grab_window);
} }
void OBDisplay::grabKey(unsigned int keycode, unsigned int modifiers, void Display::grabKey(unsigned int keycode, unsigned int modifiers,
Window grab_window, bool owner_events, Window grab_window, bool owner_events,
int pointer_mode, int keyboard_mode, int pointer_mode, int keyboard_mode,
bool allow_scroll_lock) bool allow_scroll_lock)
@ -258,15 +258,15 @@ void OBDisplay::grabKey(unsigned int keycode, unsigned int modifiers,
unsigned int length = (allow_scroll_lock) ? 8 / 2: unsigned int length = (allow_scroll_lock) ? 8 / 2:
8; 8;
for (size_t cnt = 0; cnt < length; ++cnt) for (size_t cnt = 0; cnt < length; ++cnt)
XGrabKey(otk::OBDisplay::display, keycode, modifiers | _mask_list[cnt], XGrabKey(Display::display, keycode, modifiers | _mask_list[cnt],
grab_window, owner_events, pointer_mode, keyboard_mode); grab_window, owner_events, pointer_mode, keyboard_mode);
} }
void OBDisplay::ungrabKey(unsigned int keycode, unsigned int modifiers, void Display::ungrabKey(unsigned int keycode, unsigned int modifiers,
Window grab_window) Window grab_window)
{ {
for (size_t cnt = 0; cnt < 8; ++cnt) for (size_t cnt = 0; cnt < 8; ++cnt)
XUngrabKey(otk::OBDisplay::display, keycode, modifiers | _mask_list[cnt], XUngrabKey(Display::display, keycode, modifiers | _mask_list[cnt],
grab_window); grab_window);
} }

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __display_hh #ifndef __display_hh
#define __display_hh #define __display_hh
@ -11,7 +11,7 @@ extern "C" {
namespace otk { namespace otk {
class ScreenInfo; class ScreenInfo;
class BGCCache; class GCCache;
//! Manages a single X11 display. //! Manages a single X11 display.
/*! /*!
@ -19,11 +19,11 @@ class BGCCache;
Use the initialize() method to open the display and ready it for use. Use the initialize() method to open the display and ready it for use.
Use the destroy() method to close it and clean up the class' data. Use the destroy() method to close it and clean up the class' data.
*/ */
class OBDisplay class Display
{ {
public: public:
//! The X display //! The X display
static Display *display; static ::Display *display;
//! A List of ScreenInfo instances //! A List of ScreenInfo instances
typedef std::vector<ScreenInfo> ScreenInfoList; typedef std::vector<ScreenInfo> ScreenInfoList;
@ -61,27 +61,27 @@ private:
//! A cache for re-using GCs, used by the drawing objects //! A cache for re-using GCs, used by the drawing objects
/*! /*!
@see BPen @see Pen
@see BFont @see Font
@see BImage @see Image
@see BImageControl @see ImageControl
@see BTexture @see Texture
*/ */
static BGCCache *_gccache; static GCCache *_gccache;
//! Handles X errors on the display //! Handles X errors on the display
/*! /*!
Displays the error if compiled for debugging. Displays the error if compiled for debugging.
*/ */
static int xerrorHandler(Display *d, XErrorEvent *e); static int xerrorHandler(::Display *d, XErrorEvent *e);
//! Prevents instantiation of the class //! Prevents instantiation of the class
OBDisplay(); Display();
public: public:
//! Initializes the class, opens the X display //! Initializes the class, opens the X display
/*! /*!
@see OBDisplay::display @see Display::display
@param name The name of the X display to open. If it is null, the DISPLAY @param name The name of the X display to open. If it is null, the DISPLAY
environment variable is used instead. environment variable is used instead.
*/ */
@ -90,7 +90,7 @@ public:
static void destroy(); static void destroy();
//! Returns the GC cache for the application //! Returns the GC cache for the application
inline static BGCCache *gcCache() { return _gccache; } inline static GCCache *gcCache() { return _gccache; }
//! Gets information on a specific screen //! Gets information on a specific screen
/*! /*!

View file

@ -10,36 +10,36 @@
namespace otk { namespace otk {
OtkEventDispatcher::OtkEventDispatcher() EventDispatcher::EventDispatcher()
: _fallback(0), _master(0) : _fallback(0), _master(0)
{ {
} }
OtkEventDispatcher::~OtkEventDispatcher() EventDispatcher::~EventDispatcher()
{ {
} }
void OtkEventDispatcher::clearAllHandlers(void) void EventDispatcher::clearAllHandlers(void)
{ {
_map.clear(); _map.clear();
} }
void OtkEventDispatcher::registerHandler(Window id, OtkEventHandler *handler) void EventDispatcher::registerHandler(Window id, EventHandler *handler)
{ {
_map.insert(std::pair<Window, OtkEventHandler*>(id, handler)); _map.insert(std::pair<Window, EventHandler*>(id, handler));
} }
void OtkEventDispatcher::clearHandler(Window id) void EventDispatcher::clearHandler(Window id)
{ {
_map.erase(id); _map.erase(id);
} }
void OtkEventDispatcher::dispatchEvents(void) void EventDispatcher::dispatchEvents(void)
{ {
XEvent e; XEvent e;
while (XPending(OBDisplay::display)) { while (XPending(Display::display)) {
XNextEvent(OBDisplay::display, &e); XNextEvent(Display::display, &e);
#if 0//defined(DEBUG) #if 0//defined(DEBUG)
printf("Event %d window %lx\n", e.type, e.xany.window); printf("Event %d window %lx\n", e.type, e.xany.window);
@ -71,17 +71,17 @@ void OtkEventDispatcher::dispatchEvents(void)
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
_lasttime = e.xbutton.time; _lasttime = e.xbutton.time;
e.xbutton.state &= ~(LockMask | OBDisplay::numLockMask() | e.xbutton.state &= ~(LockMask | Display::numLockMask() |
OBDisplay::scrollLockMask()); Display::scrollLockMask());
break; break;
case KeyPress: case KeyPress:
e.xkey.state &= ~(LockMask | OBDisplay::numLockMask() | e.xkey.state &= ~(LockMask | Display::numLockMask() |
OBDisplay::scrollLockMask()); Display::scrollLockMask());
break; break;
case MotionNotify: case MotionNotify:
_lasttime = e.xmotion.time; _lasttime = e.xmotion.time;
e.xmotion.state &= ~(LockMask | OBDisplay::numLockMask() | e.xmotion.state &= ~(LockMask | Display::numLockMask() |
OBDisplay::scrollLockMask()); Display::scrollLockMask());
break; break;
case PropertyNotify: case PropertyNotify:
_lasttime = e.xproperty.time; _lasttime = e.xproperty.time;
@ -97,7 +97,7 @@ void OtkEventDispatcher::dispatchEvents(void)
} }
} }
void OtkEventDispatcher::dispatchFocus(const XEvent &e) void EventDispatcher::dispatchFocus(const XEvent &e)
{ {
if (e.type == FocusIn) { if (e.type == FocusIn) {
//printf("Got FocusIn!\n"); //printf("Got FocusIn!\n");
@ -116,7 +116,7 @@ void OtkEventDispatcher::dispatchFocus(const XEvent &e)
// FocusOut events just make us look for FocusIn events. They are ignored // FocusOut events just make us look for FocusIn events. They are ignored
// otherwise. // otherwise.
XEvent fi; XEvent fi;
if (XCheckTypedEvent(OBDisplay::display, FocusIn, &fi)) { if (XCheckTypedEvent(Display::display, FocusIn, &fi)) {
//printf("Found FocusIn\n"); //printf("Found FocusIn\n");
dispatchFocus(fi); dispatchFocus(fi);
// dont unfocus the window we just focused! // dont unfocus the window we just focused!
@ -129,10 +129,10 @@ void OtkEventDispatcher::dispatchFocus(const XEvent &e)
} }
} }
void OtkEventDispatcher::dispatch(Window win, const XEvent &e) void EventDispatcher::dispatch(Window win, const XEvent &e)
{ {
OtkEventHandler *handler = 0; EventHandler *handler = 0;
OtkEventMap::iterator it; EventMap::iterator it;
// master gets everything first // master gets everything first
if (_master) if (_master)
@ -157,7 +157,7 @@ void OtkEventDispatcher::dispatch(Window win, const XEvent &e)
xwc.sibling = e.xconfigurerequest.above; xwc.sibling = e.xconfigurerequest.above;
xwc.stack_mode = e.xconfigurerequest.detail; xwc.stack_mode = e.xconfigurerequest.detail;
XConfigureWindow(otk::OBDisplay::display, e.xconfigurerequest.window, XConfigureWindow(otk::Display::display, e.xconfigurerequest.window,
e.xconfigurerequest.value_mask, &xwc); e.xconfigurerequest.value_mask, &xwc);
} else { } else {
// grab a falback if it exists // grab a falback if it exists
@ -168,9 +168,9 @@ void OtkEventDispatcher::dispatch(Window win, const XEvent &e)
handler->handle(e); handler->handle(e);
} }
OtkEventHandler *OtkEventDispatcher::findHandler(Window win) EventHandler *EventDispatcher::findHandler(Window win)
{ {
OtkEventMap::iterator it = _map.find(win); EventMap::iterator it = _map.find(win);
if (it != _map.end()) if (it != _map.end())
return it->second; return it->second;
return 0; return 0;

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __eventdispatcher #ifndef __eventdispatcher
#define __eventdispatcher #define __eventdispatcher
@ -7,37 +8,37 @@
namespace otk { namespace otk {
typedef std::map<unsigned int, OtkEventHandler *> OtkEventMap; typedef std::map<unsigned int, EventHandler *> EventMap;
class OtkEventDispatcher { class EventDispatcher {
public: public:
OtkEventDispatcher(); EventDispatcher();
virtual ~OtkEventDispatcher(); virtual ~EventDispatcher();
virtual void clearAllHandlers(void); virtual void clearAllHandlers(void);
virtual void registerHandler(Window id, otk::OtkEventHandler *handler); virtual void registerHandler(Window id, EventHandler *handler);
virtual void clearHandler(Window id); virtual void clearHandler(Window id);
virtual void dispatchEvents(void); virtual void dispatchEvents(void);
inline void setFallbackHandler(otk::OtkEventHandler *fallback) inline void setFallbackHandler(EventHandler *fallback)
{ _fallback = fallback; } { _fallback = fallback; }
otk::OtkEventHandler *getFallbackHandler(void) const { return _fallback; } EventHandler *getFallbackHandler(void) const { return _fallback; }
//! Sets an event handler that gets all events for all handlers after //! Sets an event handler that gets all events for all handlers after
//! any specific handlers have received them //! any specific handlers have received them
inline void setMasterHandler(otk::OtkEventHandler *master) inline void setMasterHandler(EventHandler *master)
{ _master = master; } { _master = master; }
otk::OtkEventHandler *getMasterHandler(void) const { return _master; } EventHandler *getMasterHandler(void) const { return _master; }
otk::OtkEventHandler *findHandler(Window win); EventHandler *findHandler(Window win);
inline Time lastTime() const { return _lasttime; } inline Time lastTime() const { return _lasttime; }
private: private:
OtkEventMap _map; EventMap _map;
OtkEventHandler *_fallback; EventHandler *_fallback;
OtkEventHandler *_master; EventHandler *_master;
//! The time at which the last XEvent with a time was received //! The time at which the last XEvent with a time was received
Time _lasttime; Time _lasttime;

View file

@ -9,17 +9,17 @@
namespace otk { namespace otk {
OtkEventHandler::OtkEventHandler() EventHandler::EventHandler()
{ {
} }
OtkEventHandler::~OtkEventHandler() EventHandler::~EventHandler()
{ {
} }
void OtkEventHandler::handle(const XEvent &e) void EventHandler::handle(const XEvent &e)
{ {
switch(e.type){ switch(e.type){
case KeyPress: case KeyPress:
@ -88,11 +88,11 @@ void OtkEventHandler::handle(const XEvent &e)
return selectionRequestHandler(e.xselectionrequest); return selectionRequestHandler(e.xselectionrequest);
default: default:
#ifdef SHAPE #ifdef SHAPE
if (e.type == otk::OBDisplay::shapeEventBase()) if (e.type == Display::shapeEventBase())
return shapeHandler((*(XShapeEvent*)&e)); return shapeHandler((*(XShapeEvent*)&e));
#endif // SHAPE #endif // SHAPE
#ifdef XKB #ifdef XKB
if (e.type == otk::OBDisplay::xkbEventBase()) if (e.type == Display::xkbEventBase())
return xkbHandler((*(XkbEvent*)&e)); return xkbHandler((*(XkbEvent*)&e));
#endif // XKB #endif // XKB
; ;
@ -100,7 +100,7 @@ void OtkEventHandler::handle(const XEvent &e)
} }
void OtkEventHandler::clientMessageHandler(const XClientMessageEvent &) void EventHandler::clientMessageHandler(const XClientMessageEvent &)
{ {
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __eventhandler__hh #ifndef __eventhandler__hh
#define __eventhandler__hh #define __eventhandler__hh
@ -16,7 +17,7 @@ extern "C" {
namespace otk { namespace otk {
class OtkEventHandler { class EventHandler {
public: public:
//! Dispatches events to one of the other handlers based on their type. //! Dispatches events to one of the other handlers based on their type.
virtual void handle(const XEvent &e); virtual void handle(const XEvent &e);
@ -134,14 +135,14 @@ public:
virtual void xkbHandler(const XkbEvent &) {} virtual void xkbHandler(const XkbEvent &) {}
#endif // XKB #endif // XKB
virtual ~OtkEventHandler(); virtual ~EventHandler();
protected: protected:
/*! Constructor for the OtkEventHandler class. /*! Constructor for the EventHandler class.
This is protected so that OtkEventHandlers can't be instantiated on their This is protected so that EventHandlers can't be instantiated on their
own. own.
*/ */
OtkEventHandler(); EventHandler();
private: private:
}; };

View file

@ -10,34 +10,34 @@
namespace otk { namespace otk {
OtkFocusLabel::OtkFocusLabel(OtkWidget *parent) FocusLabel::FocusLabel(Widget *parent)
: OtkFocusWidget(parent), _text("") : FocusWidget(parent), _text("")
{ {
const ScreenInfo *info = OBDisplay::screenInfo(screen()); const ScreenInfo *info = Display::screenInfo(screen());
_xftdraw = XftDrawCreate(OBDisplay::display, window(), info->visual(), _xftdraw = XftDrawCreate(Display::display, window(), info->visual(),
info->colormap()); info->colormap());
} }
OtkFocusLabel::~OtkFocusLabel() FocusLabel::~FocusLabel()
{ {
XftDrawDestroy(_xftdraw); XftDrawDestroy(_xftdraw);
} }
void OtkFocusLabel::setStyle(Style *style) void FocusLabel::setStyle(Style *style)
{ {
OtkFocusWidget::setStyle(style); FocusWidget::setStyle(style);
setTexture(style->getLabelFocus()); setTexture(style->getLabelFocus());
setUnfocusTexture(style->getLabelUnfocus()); setUnfocusTexture(style->getLabelUnfocus());
} }
void OtkFocusLabel::update(void) void FocusLabel::update(void)
{ {
if (_dirty) { if (_dirty) {
const BFont *ft = style()->getFont(); const Font *ft = style()->getFont();
BColor *text_color = (isFocused() ? style()->getTextFocus() Color *text_color = (isFocused() ? style()->getTextFocus()
: style()->getTextUnfocus()); : style()->getTextUnfocus());
unsigned int sidemargin = style()->getBevelWidth() * 2; unsigned int sidemargin = style()->getBevelWidth() * 2;
@ -70,11 +70,11 @@ void OtkFocusLabel::update(void)
} }
} }
OtkFocusWidget::update(); FocusWidget::update();
ft->drawString(_xftdraw, x, 0, *text_color, t); ft->drawString(_xftdraw, x, 0, *text_color, t);
} else } else
OtkFocusWidget::update(); FocusWidget::update();
} }
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __label_hh #ifndef __label_hh
#define __label_hh #define __label_hh
@ -6,19 +7,19 @@
namespace otk { namespace otk {
class OtkFocusLabel : public OtkFocusWidget { class FocusLabel : public FocusWidget {
public: public:
OtkFocusLabel(OtkWidget *parent); FocusLabel(Widget *parent);
~OtkFocusLabel(); ~FocusLabel();
inline const std::string &getText(void) const { return _text; } inline const std::string &getText(void) const { return _text; }
void setText(const std::string &text) { _text = text; _dirty = true; } void setText(const std::string &text) { _text = text; _dirty = true; }
void update(void); void update(void);
virtual void setStyle(otk::Style *style); virtual void setStyle(Style *style);
private: private:
//! Object used by Xft to render to the drawable //! Object used by Xft to render to the drawable

View file

@ -8,56 +8,56 @@
namespace otk { namespace otk {
OtkFocusWidget::OtkFocusWidget(OtkWidget *parent, Direction direction) FocusWidget::FocusWidget(Widget *parent, Direction direction)
: OtkWidget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0) : Widget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0)
{ {
_focused = true; _focused = true;
_focus_texture = parent->texture(); _focus_texture = parent->texture();
_focus_bcolor = parent->borderColor(); _focus_bcolor = parent->borderColor();
} }
OtkFocusWidget::~OtkFocusWidget() FocusWidget::~FocusWidget()
{ {
} }
#include <stdio.h> #include <stdio.h>
void OtkFocusWidget::focus(void) void FocusWidget::focus(void)
{ {
if (_focused) if (_focused)
return; return;
OtkWidget::focus(); Widget::focus();
if (_focus_bcolor) if (_focus_bcolor)
OtkWidget::setBorderColor(_focus_bcolor); Widget::setBorderColor(_focus_bcolor);
OtkWidget::setTexture(_focus_texture); Widget::setTexture(_focus_texture);
update(); update();
} }
void OtkFocusWidget::unfocus(void) void FocusWidget::unfocus(void)
{ {
if (!_focused) if (!_focused)
return; return;
OtkWidget::unfocus(); Widget::unfocus();
if (_unfocus_bcolor) if (_unfocus_bcolor)
OtkWidget::setBorderColor(_unfocus_bcolor); Widget::setBorderColor(_unfocus_bcolor);
OtkWidget::setTexture(_unfocus_texture); Widget::setTexture(_unfocus_texture);
update(); update();
} }
void OtkFocusWidget::setTexture(BTexture *texture) void FocusWidget::setTexture(Texture *texture)
{ {
OtkWidget::setTexture(texture); Widget::setTexture(texture);
_focus_texture = texture; _focus_texture = texture;
} }
void OtkFocusWidget::setBorderColor(const BColor *color) void FocusWidget::setBorderColor(const Color *color)
{ {
OtkWidget::setBorderColor(color); Widget::setBorderColor(color);
_focus_bcolor = color; _focus_bcolor = color;
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __focuswidget_hh #ifndef __focuswidget_hh
#define __focuswidget_hh #define __focuswidget_hh
@ -6,27 +7,27 @@
namespace otk { namespace otk {
class OtkFocusWidget : public OtkWidget { class FocusWidget : public Widget {
public: public:
OtkFocusWidget(otk::OtkWidget *parent, Direction = Horizontal); FocusWidget(Widget *parent, Direction = Horizontal);
virtual ~OtkFocusWidget(); virtual ~FocusWidget();
virtual void focus(void); virtual void focus(void);
virtual void unfocus(void); virtual void unfocus(void);
virtual void setTexture(otk::BTexture *texture); virtual void setTexture(Texture *texture);
virtual void setBorderColor(const otk::BColor *color); virtual void setBorderColor(const Color *color);
inline void setUnfocusTexture(otk::BTexture *texture) inline void setUnfocusTexture(Texture *texture)
{ _unfocus_texture = texture; } { _unfocus_texture = texture; }
inline otk::BTexture *getUnfocusTexture(void) const inline Texture *getUnfocusTexture(void) const
{ return _unfocus_texture; } { return _unfocus_texture; }
inline void setUnfocusBorderColor(const otk::BColor *color) inline void setUnfocusBorderColor(const Color *color)
{ _unfocus_bcolor = color; } { _unfocus_bcolor = color; }
inline const otk::BColor *getUnfocusBorderColor(void) const inline const Color *getUnfocusBorderColor(void) const
{ return _unfocus_bcolor; } { return _unfocus_bcolor; }
inline bool isFocused(void) const { return _focused; } inline bool isFocused(void) const { return _focused; }
@ -34,11 +35,11 @@ public:
private: private:
BTexture *_unfocus_texture; Texture *_unfocus_texture;
BTexture *_focus_texture; Texture *_focus_texture;
const BColor *_unfocus_bcolor; const Color *_unfocus_bcolor;
const BColor *_focus_bcolor; const Color *_focus_bcolor;
}; };
} }

View file

@ -34,10 +34,10 @@ extern "C" {
namespace otk { namespace otk {
string BFont::_fallback_font = "fixed"; string Font::_fallback_font = "fixed";
bool BFont::_xft_init = false; bool Font::_xft_init = false;
BFont::BFont(int screen_num, const string &fontstring, Font::Font(int screen_num, const string &fontstring,
bool shadow, unsigned char offset, unsigned char tint) bool shadow, unsigned char offset, unsigned char tint)
: _screen_num(screen_num), : _screen_num(screen_num),
_fontstring(fontstring), _fontstring(fontstring),
@ -60,14 +60,14 @@ BFont::BFont(int screen_num, const string &fontstring,
_xft_init = true; _xft_init = true;
} }
if ((_xftfont = XftFontOpenName(OBDisplay::display, _screen_num, if ((_xftfont = XftFontOpenName(Display::display, _screen_num,
_fontstring.c_str()))) _fontstring.c_str())))
return; return;
printf(_("Unable to load font: %s\n"), _fontstring.c_str()); printf(_("Unable to load font: %s\n"), _fontstring.c_str());
printf(_("Trying fallback font: %s\n"), _fallback_font.c_str()); printf(_("Trying fallback font: %s\n"), _fallback_font.c_str());
if ((_xftfont = XftFontOpenName(OBDisplay::display, _screen_num, if ((_xftfont = XftFontOpenName(Display::display, _screen_num,
_fallback_font.c_str()))) _fallback_font.c_str())))
return; return;
@ -78,14 +78,14 @@ BFont::BFont(int screen_num, const string &fontstring,
} }
BFont::~BFont(void) Font::~Font(void)
{ {
if (_xftfont) if (_xftfont)
XftFontClose(OBDisplay::display, _xftfont); XftFontClose(Display::display, _xftfont);
} }
void BFont::drawString(XftDraw *d, int x, int y, const BColor &color, void Font::drawString(XftDraw *d, int x, int y, const Color &color,
const string &string, bool utf8) const const string &string, bool utf8) const
{ {
assert(d); assert(d);
@ -96,7 +96,7 @@ void BFont::drawString(XftDraw *d, int x, int y, const BColor &color,
c.color.green = 0; c.color.green = 0;
c.color.blue = 0; c.color.blue = 0;
c.color.alpha = _tint | _tint << 8; // transparent shadow c.color.alpha = _tint | _tint << 8; // transparent shadow
c.pixel = BlackPixel(OBDisplay::display, _screen_num); c.pixel = BlackPixel(Display::display, _screen_num);
if (utf8) if (utf8)
XftDrawStringUtf8(d, &c, _xftfont, x + _offset, XftDrawStringUtf8(d, &c, _xftfont, x + _offset,
@ -113,7 +113,7 @@ void BFont::drawString(XftDraw *d, int x, int y, const BColor &color,
c.color.green = color.green() | color.green() << 8; c.color.green = color.green() | color.green() << 8;
c.color.blue = color.blue() | color.blue() << 8; c.color.blue = color.blue() | color.blue() << 8;
c.pixel = color.pixel(); c.pixel = color.pixel();
c.color.alpha = 0xff | 0xff << 8; // no transparency in BColor yet c.color.alpha = 0xff | 0xff << 8; // no transparency in Color yet
if (utf8) if (utf8)
XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y, XftDrawStringUtf8(d, &c, _xftfont, x, _xftfont->ascent + y,
@ -126,28 +126,28 @@ void BFont::drawString(XftDraw *d, int x, int y, const BColor &color,
} }
unsigned int BFont::measureString(const string &string, bool utf8) const unsigned int Font::measureString(const string &string, bool utf8) const
{ {
XGlyphInfo info; XGlyphInfo info;
if (utf8) if (utf8)
XftTextExtentsUtf8(OBDisplay::display, _xftfont, XftTextExtentsUtf8(Display::display, _xftfont,
(FcChar8*)string.c_str(), string.size(), &info); (FcChar8*)string.c_str(), string.size(), &info);
else else
XftTextExtents8(OBDisplay::display, _xftfont, XftTextExtents8(Display::display, _xftfont,
(FcChar8*)string.c_str(), string.size(), &info); (FcChar8*)string.c_str(), string.size(), &info);
return info.xOff + (_shadow ? _offset : 0); return info.xOff + (_shadow ? _offset : 0);
} }
unsigned int BFont::height(void) const unsigned int Font::height(void) const
{ {
return _xftfont->height + (_shadow ? _offset : 0); return _xftfont->height + (_shadow ? _offset : 0);
} }
unsigned int BFont::maxCharWidth(void) const unsigned int Font::maxCharWidth(void) const
{ {
return _xftfont->max_advance_width; return _xftfont->max_advance_width;
} }

View file

@ -1,6 +1,6 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __Font_hh #ifndef __font_hh
#define __Font_hh #define __font_hh
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -13,12 +13,9 @@ extern "C" {
namespace otk { namespace otk {
class BGCCache; class Color;
class BGCCacheItem;
class BColor;
class ScreenInfo;
class BFont { class Font {
/* /*
* static members * static members
*/ */
@ -51,9 +48,9 @@ private:
public: public:
// loads an Xft font // loads an Xft font
BFont(int screen_num, const std::string &fontstring, bool shadow, Font(int screen_num, const std::string &fontstring, bool shadow,
unsigned char offset, unsigned char tint); unsigned char offset, unsigned char tint);
virtual ~BFont(); virtual ~Font();
inline const std::string &fontstring() const { return _fontstring; } inline const std::string &fontstring() const { return _fontstring; }
@ -68,10 +65,10 @@ public:
Be Warned: If you use an XftDraw object and a color, or a font from Be Warned: If you use an XftDraw object and a color, or a font from
different screens, you WILL have unpredictable results! :) different screens, you WILL have unpredictable results! :)
*/ */
void drawString(XftDraw *d, int x, int y, const BColor &color, void drawString(XftDraw *d, int x, int y, const Color &color,
const std::string &string, bool utf8 = false) const; const std::string &string, bool utf8 = false) const;
}; };
} }
#endif // __Font_hh #endif // __font_hh

View file

@ -17,16 +17,16 @@ extern "C" {
namespace otk { namespace otk {
BGCCacheContext::~BGCCacheContext(void) { GCCacheContext::~GCCacheContext(void) {
if (gc) if (gc)
XFreeGC(OBDisplay::display, gc); XFreeGC(Display::display, gc);
} }
void BGCCacheContext::set(const BColor &_color, void GCCacheContext::set(const Color &_color,
const XFontStruct * const _font, const XFontStruct * const _font,
const int _function, const int _subwindow, const int _function, const int _subwindow,
int _linewidth) { int _linewidth) {
XGCValues gcv; XGCValues gcv;
pixel = gcv.foreground = _color.pixel(); pixel = gcv.foreground = _color.pixel();
function = gcv.function = _function; function = gcv.function = _function;
@ -44,11 +44,11 @@ void BGCCacheContext::set(const BColor &_color,
fontid = 0; fontid = 0;
} }
XChangeGC(OBDisplay::display, gc, mask, &gcv); XChangeGC(Display::display, gc, mask, &gcv);
} }
void BGCCacheContext::set(const XFontStruct * const _font) { void GCCacheContext::set(const XFontStruct * const _font) {
if (! _font) { if (! _font) {
fontid = 0; fontid = 0;
return; return;
@ -56,28 +56,28 @@ void BGCCacheContext::set(const XFontStruct * const _font) {
XGCValues gcv; XGCValues gcv;
fontid = gcv.font = _font->fid; fontid = gcv.font = _font->fid;
XChangeGC(OBDisplay::display, gc, GCFont, &gcv); XChangeGC(Display::display, gc, GCFont, &gcv);
} }
BGCCache::BGCCache(unsigned int screen_count) GCCache::GCCache(unsigned int screen_count)
: context_count(128u), cache_size(16u), cache_buckets(8u * screen_count), : context_count(128u), cache_size(16u), cache_buckets(8u * screen_count),
cache_total_size(cache_size * cache_buckets) { cache_total_size(cache_size * cache_buckets) {
contexts = new BGCCacheContext*[context_count]; contexts = new GCCacheContext*[context_count];
unsigned int i; unsigned int i;
for (i = 0; i < context_count; i++) { for (i = 0; i < context_count; i++) {
contexts[i] = new BGCCacheContext(); contexts[i] = new GCCacheContext();
} }
cache = new BGCCacheItem*[cache_total_size]; cache = new GCCacheItem*[cache_total_size];
for (i = 0; i < cache_total_size; ++i) { for (i = 0; i < cache_total_size; ++i) {
cache[i] = new BGCCacheItem; cache[i] = new GCCacheItem;
} }
} }
BGCCache::~BGCCache(void) { GCCache::~GCCache(void) {
std::for_each(contexts, contexts + context_count, PointerAssassin()); std::for_each(contexts, contexts + context_count, PointerAssassin());
std::for_each(cache, cache + cache_total_size, PointerAssassin()); std::for_each(cache, cache + cache_total_size, PointerAssassin());
delete [] cache; delete [] cache;
@ -85,16 +85,16 @@ BGCCache::~BGCCache(void) {
} }
BGCCacheContext *BGCCache::nextContext(unsigned int scr) { GCCacheContext *GCCache::nextContext(unsigned int scr) {
Window hd = OBDisplay::screenInfo(scr)->rootWindow(); Window hd = Display::screenInfo(scr)->rootWindow();
BGCCacheContext *c; GCCacheContext *c;
for (unsigned int i = 0; i < context_count; ++i) { for (unsigned int i = 0; i < context_count; ++i) {
c = contexts[i]; c = contexts[i];
if (! c->gc) { if (! c->gc) {
c->gc = XCreateGC(OBDisplay::display, hd, 0, 0); c->gc = XCreateGC(Display::display, hd, 0, 0);
c->used = false; c->used = false;
c->screen = scr; c->screen = scr;
} }
@ -102,26 +102,26 @@ BGCCacheContext *BGCCache::nextContext(unsigned int scr) {
return c; return c;
} }
fprintf(stderr, "BGCCache: context fault!\n"); fprintf(stderr, "GCCache: context fault!\n");
abort(); abort();
return (BGCCacheContext*) 0; // not reached return (GCCacheContext*) 0; // not reached
} }
void BGCCache::release(BGCCacheContext *ctx) { void GCCache::release(GCCacheContext *ctx) {
ctx->used = false; ctx->used = false;
} }
BGCCacheItem *BGCCache::find(const BColor &_color, GCCacheItem *GCCache::find(const Color &_color,
const XFontStruct * const _font, const XFontStruct * const _font,
int _function, int _subwindow, int _linewidth) { int _function, int _subwindow, int _linewidth) {
const unsigned long pixel = _color.pixel(); const unsigned long pixel = _color.pixel();
const unsigned int screen = _color.screen(); const unsigned int screen = _color.screen();
const int key = _color.red() ^ _color.green() ^ _color.blue(); const int key = _color.red() ^ _color.green() ^ _color.blue();
int k = (key % cache_size) * cache_buckets; int k = (key % cache_size) * cache_buckets;
unsigned int i = 0; // loop variable unsigned int i = 0; // loop variable
BGCCacheItem *c = cache[ k ], *prev = 0; GCCacheItem *c = cache[ k ], *prev = 0;
/* /*
this will either loop cache_buckets times then return/abort or this will either loop cache_buckets times then return/abort or
@ -146,7 +146,7 @@ BGCCacheItem *BGCCache::find(const BColor &_color,
return c; return c;
} }
// cache fault! // cache fault!
fprintf(stderr, "BGCCache: cache fault, count: %d, screen: %d, item screen: %d\n", c->count, screen, c->ctx->screen); fprintf(stderr, "GCCache: cache fault, count: %d, screen: %d, item screen: %d\n", c->count, screen, c->ctx->screen);
abort(); abort();
} }
@ -172,14 +172,14 @@ BGCCacheItem *BGCCache::find(const BColor &_color,
} }
void BGCCache::release(BGCCacheItem *_item) { void GCCache::release(GCCacheItem *_item) {
_item->count--; _item->count--;
} }
void BGCCache::purge(void) { void GCCache::purge(void) {
for (unsigned int i = 0; i < cache_total_size; ++i) { for (unsigned int i = 0; i < cache_total_size; ++i) {
BGCCacheItem *d = cache[ i ]; GCCacheItem *d = cache[ i ];
if (d->ctx && d->count == 0) { if (d->ctx && d->count == 0) {
release(d->ctx); release(d->ctx);

View file

@ -1,6 +1,6 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef GCCACHE_HH #ifndef __gccache_hh
#define GCCACHE_HH #define __gccache_hh
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -11,18 +11,18 @@ extern "C" {
namespace otk { namespace otk {
class BGCCacheItem; class GCCacheItem;
class BGCCacheContext { class GCCacheContext {
public: public:
void set(const BColor &_color, const XFontStruct * const _font, void set(const Color &_color, const XFontStruct * const _font,
const int _function, const int _subwindow, const int _linewidth); const int _function, const int _subwindow, const int _linewidth);
void set(const XFontStruct * const _font); void set(const XFontStruct * const _font);
~BGCCacheContext(void); ~GCCacheContext(void);
private: private:
BGCCacheContext() GCCacheContext()
: gc(0), pixel(0ul), fontid(0ul), : gc(0), pixel(0ul), fontid(0ul),
function(0), subwindow(0), used(false), screen(~(0u)), linewidth(0) {} function(0), subwindow(0), used(false), screen(~(0u)), linewidth(0) {}
@ -35,47 +35,47 @@ private:
unsigned int screen; unsigned int screen;
int linewidth; int linewidth;
BGCCacheContext(const BGCCacheContext &_nocopy); GCCacheContext(const GCCacheContext &_nocopy);
BGCCacheContext &operator=(const BGCCacheContext &_nocopy); GCCacheContext &operator=(const GCCacheContext &_nocopy);
friend class BGCCache; friend class GCCache;
friend class BGCCacheItem; friend class GCCacheItem;
}; };
class BGCCacheItem { class GCCacheItem {
public: public:
inline const GC &gc(void) const { return ctx->gc; } inline const GC &gc(void) const { return ctx->gc; }
private: private:
BGCCacheItem(void) : ctx(0), count(0), hits(0), fault(false) { } GCCacheItem(void) : ctx(0), count(0), hits(0), fault(false) { }
BGCCacheContext *ctx; GCCacheContext *ctx;
unsigned int count; unsigned int count;
unsigned int hits; unsigned int hits;
bool fault; bool fault;
BGCCacheItem(const BGCCacheItem &_nocopy); GCCacheItem(const GCCacheItem &_nocopy);
BGCCacheItem &operator=(const BGCCacheItem &_nocopy); GCCacheItem &operator=(const GCCacheItem &_nocopy);
friend class BGCCache; friend class GCCache;
}; };
class BGCCache { class GCCache {
public: public:
BGCCache(unsigned int screen_count); GCCache(unsigned int screen_count);
~BGCCache(void); ~GCCache(void);
// cleans up the cache // cleans up the cache
void purge(void); void purge(void);
BGCCacheItem *find(const BColor &_color, const XFontStruct * const _font = 0, GCCacheItem *find(const Color &_color, const XFontStruct * const _font = 0,
int _function = GXcopy, int _subwindow = ClipByChildren, int _function = GXcopy, int _subwindow = ClipByChildren,
int _linewidth = 0); int _linewidth = 0);
void release(BGCCacheItem *_item); void release(GCCacheItem *_item);
private: private:
BGCCacheContext *nextContext(unsigned int _screen); GCCacheContext *nextContext(unsigned int _screen);
void release(BGCCacheContext *ctx); void release(GCCacheContext *ctx);
// this is closely modelled after the Qt GC cache, but with some of the // this is closely modelled after the Qt GC cache, but with some of the
// complexity stripped out // complexity stripped out
@ -83,19 +83,19 @@ private:
const unsigned int cache_size; const unsigned int cache_size;
const unsigned int cache_buckets; const unsigned int cache_buckets;
const unsigned int cache_total_size; const unsigned int cache_total_size;
BGCCacheContext **contexts; GCCacheContext **contexts;
BGCCacheItem **cache; GCCacheItem **cache;
}; };
class BPen { class Pen {
public: public:
inline BPen(const BColor &_color, const XFontStruct * const _font = 0, inline Pen(const Color &_color, const XFontStruct * const _font = 0,
int _linewidth = 0, int _function = GXcopy, int _linewidth = 0, int _function = GXcopy,
int _subwindow = ClipByChildren) int _subwindow = ClipByChildren)
: color(_color), font(_font), linewidth(_linewidth), function(_function), : color(_color), font(_font), linewidth(_linewidth), function(_function),
subwindow(_subwindow), cache(OBDisplay::gcCache()), item(0) { } subwindow(_subwindow), cache(Display::gcCache()), item(0) { }
inline ~BPen(void) { if (item) cache->release(item); } inline ~Pen(void) { if (item) cache->release(item); }
inline const GC &gc(void) const { inline const GC &gc(void) const {
if (! item) item = cache->find(color, font, function, subwindow, if (! item) item = cache->find(color, font, function, subwindow,
@ -104,16 +104,16 @@ public:
} }
private: private:
const BColor &color; const Color &color;
const XFontStruct *font; const XFontStruct *font;
int linewidth; int linewidth;
int function; int function;
int subwindow; int subwindow;
mutable BGCCache *cache; mutable GCCache *cache;
mutable BGCCacheItem *item; mutable GCCacheItem *item;
}; };
} }
#endif // GCCACHE_HH #endif // __gccache_hh

View file

@ -19,7 +19,7 @@ using std::min;
namespace otk { namespace otk {
BImage::BImage(BImageControl *c, int w, int h) { Image::Image(ImageControl *c, int w, int h) {
control = c; control = c;
width = (w > 0) ? w : 1; width = (w > 0) ? w : 1;
@ -43,95 +43,95 @@ BImage::BImage(BImageControl *c, int w, int h) {
} }
BImage::~BImage(void) { Image::~Image(void) {
delete [] red; delete [] red;
delete [] green; delete [] green;
delete [] blue; delete [] blue;
} }
Pixmap BImage::render(const BTexture &texture) { Pixmap Image::render(const Texture &texture) {
if (texture.texture() & BTexture::Parent_Relative) if (texture.texture() & Texture::Parent_Relative)
return ParentRelative; return ParentRelative;
else if (texture.texture() & BTexture::Solid) else if (texture.texture() & Texture::Solid)
return render_solid(texture); return render_solid(texture);
else if (texture.texture() & BTexture::Gradient) else if (texture.texture() & Texture::Gradient)
return render_gradient(texture); return render_gradient(texture);
return None; return None;
} }
Pixmap BImage::render_solid(const BTexture &texture) { Pixmap Image::render_solid(const Texture &texture) {
Pixmap pixmap = XCreatePixmap(OBDisplay::display, Pixmap pixmap = XCreatePixmap(Display::display,
control->getDrawable(), width, control->getDrawable(), width,
height, control->getDepth()); height, control->getDepth());
if (pixmap == None) { if (pixmap == None) {
fprintf(stderr, "BImage::render_solid: error creating pixmap\n"); fprintf(stderr, "Image::render_solid: error creating pixmap\n");
return None; return None;
} }
BPen pen(texture.color()); Pen pen(texture.color());
BPen penlight(texture.lightColor()); Pen penlight(texture.lightColor());
BPen penshadow(texture.shadowColor()); Pen penshadow(texture.shadowColor());
XFillRectangle(OBDisplay::display, pixmap, pen.gc(), 0, 0, width, height); XFillRectangle(Display::display, pixmap, pen.gc(), 0, 0, width, height);
if (texture.texture() & BTexture::Interlaced) { if (texture.texture() & Texture::Interlaced) {
BPen peninterlace(texture.colorTo()); Pen peninterlace(texture.colorTo());
for (unsigned int i = 0; i < height; i += 2) for (unsigned int i = 0; i < height; i += 2)
XDrawLine(OBDisplay::display, pixmap, peninterlace.gc(), 0, i, width, i); XDrawLine(Display::display, pixmap, peninterlace.gc(), 0, i, width, i);
} }
int left = 0, top = 0, right = width - 1, bottom = height - 1; int left = 0, top = 0, right = width - 1, bottom = height - 1;
if (texture.texture() & BTexture::Border) { if (texture.texture() & Texture::Border) {
BPen penborder(texture.borderColor()); Pen penborder(texture.borderColor());
XDrawRectangle(OBDisplay::display, pixmap, penborder.gc(), XDrawRectangle(Display::display, pixmap, penborder.gc(),
left, top, right, bottom); left, top, right, bottom);
} }
if (texture.texture() & BTexture::Bevel1) { if (texture.texture() & Texture::Bevel1) {
if (texture.texture() & BTexture::Raised) { if (texture.texture() & Texture::Raised) {
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
left, bottom, right, bottom); left, bottom, right, bottom);
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
right, bottom, right, top); right, bottom, right, top);
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
left, top, right, top); left, top, right, top);
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
left, bottom, left, top); left, bottom, left, top);
} else if (texture.texture() & BTexture::Sunken) { } else if (texture.texture() & Texture::Sunken) {
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
left, bottom, right, bottom); left, bottom, right, bottom);
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
right, bottom, right, top); right, bottom, right, top);
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
left, top, right, top); left, top, right, top);
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
left, bottom, left, top); left, bottom, left, top);
} }
} else if (texture.texture() & BTexture::Bevel2) { } else if (texture.texture() & Texture::Bevel2) {
if (texture.texture() & BTexture::Raised) { if (texture.texture() & Texture::Raised) {
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
left + 1, bottom - 2, right - 2, bottom - 2); left + 1, bottom - 2, right - 2, bottom - 2);
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
right - 2, bottom - 2, right - 2, top + 1); right - 2, bottom - 2, right - 2, top + 1);
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
left + 1, top + 1, right - 2, top + 1); left + 1, top + 1, right - 2, top + 1);
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
left + 1, bottom - 2, left + 1, top + 1); left + 1, bottom - 2, left + 1, top + 1);
} else if (texture.texture() & BTexture::Sunken) { } else if (texture.texture() & Texture::Sunken) {
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
left + 1, bottom - 2, right - 2, bottom - 2); left + 1, bottom - 2, right - 2, bottom - 2);
XDrawLine(OBDisplay::display, pixmap, penlight.gc(), XDrawLine(Display::display, pixmap, penlight.gc(),
right - 2, bottom - 2, right - 2, top + 1); right - 2, bottom - 2, right - 2, top + 1);
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
left + 1, top + 1, right - 2, top + 1); left + 1, top + 1, right - 2, top + 1);
XDrawLine(OBDisplay::display, pixmap, penshadow.gc(), XDrawLine(Display::display, pixmap, penshadow.gc(),
left + 1, bottom - 2, left + 1, top + 1); left + 1, bottom - 2, left + 1, top + 1);
} }
} }
@ -140,38 +140,38 @@ Pixmap BImage::render_solid(const BTexture &texture) {
} }
Pixmap BImage::render_gradient(const BTexture &texture) { Pixmap Image::render_gradient(const Texture &texture) {
bool inverted = False; bool inverted = False;
interlaced = texture.texture() & BTexture::Interlaced; interlaced = texture.texture() & Texture::Interlaced;
if (texture.texture() & BTexture::Sunken) { if (texture.texture() & Texture::Sunken) {
from = texture.colorTo(); from = texture.colorTo();
to = texture.color(); to = texture.color();
if (! (texture.texture() & BTexture::Invert)) inverted = True; if (! (texture.texture() & Texture::Invert)) inverted = True;
} else { } else {
from = texture.color(); from = texture.color();
to = texture.colorTo(); to = texture.colorTo();
if (texture.texture() & BTexture::Invert) inverted = True; if (texture.texture() & Texture::Invert) inverted = True;
} }
control->getGradientBuffers(width, height, &xtable, &ytable); control->getGradientBuffers(width, height, &xtable, &ytable);
if (texture.texture() & BTexture::Diagonal) dgradient(); if (texture.texture() & Texture::Diagonal) dgradient();
else if (texture.texture() & BTexture::Elliptic) egradient(); else if (texture.texture() & Texture::Elliptic) egradient();
else if (texture.texture() & BTexture::Horizontal) hgradient(); else if (texture.texture() & Texture::Horizontal) hgradient();
else if (texture.texture() & BTexture::Pyramid) pgradient(); else if (texture.texture() & Texture::Pyramid) pgradient();
else if (texture.texture() & BTexture::Rectangle) rgradient(); else if (texture.texture() & Texture::Rectangle) rgradient();
else if (texture.texture() & BTexture::Vertical) vgradient(); else if (texture.texture() & Texture::Vertical) vgradient();
else if (texture.texture() & BTexture::CrossDiagonal) cdgradient(); else if (texture.texture() & Texture::CrossDiagonal) cdgradient();
else if (texture.texture() & BTexture::PipeCross) pcgradient(); else if (texture.texture() & Texture::PipeCross) pcgradient();
if (texture.texture() & BTexture::Bevel1) bevel1(); if (texture.texture() & Texture::Bevel1) bevel1();
else if (texture.texture() & BTexture::Bevel2) bevel2(); else if (texture.texture() & Texture::Bevel2) bevel2();
if (texture.texture() & BTexture::Border) border(texture); if (texture.texture() & Texture::Border) border(texture);
if (inverted) invert(); if (inverted) invert();
@ -246,7 +246,7 @@ void assignPixelData(unsigned int bit_depth, unsigned char **data,
// algorithm: ordered dithering... many many thanks to rasterman // algorithm: ordered dithering... many many thanks to rasterman
// (raster@rasterman.com) for telling me about this... portions of this // (raster@rasterman.com) for telling me about this... portions of this
// code is based off of his code in Imlib // code is based off of his code in Imlib
void BImage::TrueColorDither(unsigned int bit_depth, int bytes_per_line, void Image::TrueColorDither(unsigned int bit_depth, int bytes_per_line,
unsigned char *pixel_data) { unsigned char *pixel_data) {
unsigned int x, y, dithx, dithy, r, g, b, er, eg, eb, offset; unsigned int x, y, dithx, dithy, r, g, b, er, eg, eb, offset;
unsigned char *ppixel_data = pixel_data; unsigned char *ppixel_data = pixel_data;
@ -293,7 +293,7 @@ const static unsigned char dither8[8][8] = {
{ 63, 31, 55, 23, 61, 29, 53, 21} { 63, 31, 55, 23, 61, 29, 53, 21}
}; };
void BImage::OrderedPseudoColorDither(int bytes_per_line, void Image::OrderedPseudoColorDither(int bytes_per_line,
unsigned char *pixel_data) { unsigned char *pixel_data) {
unsigned int x, y, dithx, dithy, r, g, b, er, eg, eb, offset; unsigned int x, y, dithx, dithy, r, g, b, er, eg, eb, offset;
unsigned long pixel; unsigned long pixel;
@ -330,7 +330,7 @@ void BImage::OrderedPseudoColorDither(int bytes_per_line,
} }
#endif #endif
void BImage::PseudoColorDither(int bytes_per_line, unsigned char *pixel_data) { void Image::PseudoColorDither(int bytes_per_line, unsigned char *pixel_data) {
short *terr, short *terr,
*rerr = new short[width + 2], *rerr = new short[width + 2],
*gerr = new short[width + 2], *gerr = new short[width + 2],
@ -423,14 +423,14 @@ void BImage::PseudoColorDither(int bytes_per_line, unsigned char *pixel_data) {
delete [] nberr; delete [] nberr;
} }
XImage *BImage::renderXImage(void) { XImage *Image::renderXImage(void) {
XImage *image = XImage *image =
XCreateImage(OBDisplay::display, XCreateImage(Display::display,
control->getVisual(), control->getDepth(), ZPixmap, 0, 0, control->getVisual(), control->getDepth(), ZPixmap, 0, 0,
width, height, 32, 0); width, height, 32, 0);
if (! image) { if (! image) {
fprintf(stderr, "BImage::renderXImage: error creating XImage\n"); fprintf(stderr, "Image::renderXImage: error creating XImage\n");
return (XImage *) 0; return (XImage *) 0;
} }
@ -525,7 +525,7 @@ XImage *BImage::renderXImage(void) {
} }
if (unsupported) { if (unsupported) {
fprintf(stderr, "BImage::renderXImage: unsupported visual\n"); fprintf(stderr, "Image::renderXImage: unsupported visual\n");
delete [] d; delete [] d;
XDestroyImage(image); XDestroyImage(image);
return (XImage *) 0; return (XImage *) 0;
@ -537,31 +537,31 @@ XImage *BImage::renderXImage(void) {
} }
Pixmap BImage::renderPixmap(void) { Pixmap Image::renderPixmap(void) {
Pixmap pixmap = Pixmap pixmap =
XCreatePixmap(OBDisplay::display, XCreatePixmap(Display::display,
control->getDrawable(), width, height, control->getDepth()); control->getDrawable(), width, height, control->getDepth());
if (pixmap == None) { if (pixmap == None) {
fprintf(stderr, "BImage::renderPixmap: error creating pixmap\n"); fprintf(stderr, "Image::renderPixmap: error creating pixmap\n");
return None; return None;
} }
XImage *image = renderXImage(); XImage *image = renderXImage();
if (! image) { if (! image) {
XFreePixmap(OBDisplay::display, pixmap); XFreePixmap(Display::display, pixmap);
return None; return None;
} }
if (! image->data) { if (! image->data) {
XDestroyImage(image); XDestroyImage(image);
XFreePixmap(OBDisplay::display, pixmap); XFreePixmap(Display::display, pixmap);
return None; return None;
} }
XPutImage(OBDisplay::display, pixmap, XPutImage(Display::display, pixmap,
DefaultGC(OBDisplay::display, DefaultGC(Display::display,
control->getScreenInfo()->screen()), control->getScreenInfo()->screen()),
image, 0, 0, 0, 0, width, height); image, 0, 0, 0, 0, width, height);
@ -576,7 +576,7 @@ Pixmap BImage::renderPixmap(void) {
} }
void BImage::bevel1(void) { void Image::bevel1(void) {
if (width > 2 && height > 2) { if (width > 2 && height > 2) {
unsigned char *pr = red, *pg = green, *pb = blue; unsigned char *pr = red, *pg = green, *pb = blue;
@ -714,7 +714,7 @@ void BImage::bevel1(void) {
} }
void BImage::bevel2(void) { void Image::bevel2(void) {
if (width > 4 && height > 4) { if (width > 4 && height > 4) {
unsigned char r, g, b, rr ,gg ,bb, *pr = red + width + 1, unsigned char r, g, b, rr ,gg ,bb, *pr = red + width + 1,
*pg = green + width + 1, *pb = blue + width + 1; *pg = green + width + 1, *pb = blue + width + 1;
@ -793,7 +793,7 @@ void BImage::bevel2(void) {
} }
void BImage::border(const BTexture &texture) { void Image::border(const Texture &texture) {
if (width < 2 || height < 2) return; if (width < 2 || height < 2) return;
register unsigned int i; register unsigned int i;
@ -837,7 +837,7 @@ void BImage::border(const BTexture &texture) {
} }
void BImage::invert(void) { void Image::invert(void) {
register unsigned int i, j, wh = (width * height) - 1; register unsigned int i, j, wh = (width * height) - 1;
unsigned char tmp; unsigned char tmp;
@ -857,7 +857,7 @@ void BImage::invert(void) {
} }
void BImage::dgradient(void) { void Image::dgradient(void) {
// diagonal gradient code was written by Mike Cole <mike@mydot.com> // diagonal gradient code was written by Mike Cole <mike@mydot.com>
// modified for interlacing by Brad Hughes // modified for interlacing by Brad Hughes
@ -958,7 +958,7 @@ void BImage::dgradient(void) {
} }
void BImage::hgradient(void) { void Image::hgradient(void) {
float drx, dgx, dbx, float drx, dgx, dbx,
xr = (float) from.red(), xr = (float) from.red(),
xg = (float) from.green(), xg = (float) from.green(),
@ -1050,7 +1050,7 @@ void BImage::hgradient(void) {
} }
void BImage::vgradient(void) { void Image::vgradient(void) {
float dry, dgy, dby, float dry, dgy, dby,
yr = (float) from.red(), yr = (float) from.red(),
yg = (float) from.green(), yg = (float) from.green(),
@ -1123,7 +1123,7 @@ void BImage::vgradient(void) {
} }
void BImage::pgradient(void) { void Image::pgradient(void) {
// pyramid gradient - based on original dgradient, written by // pyramid gradient - based on original dgradient, written by
// Mosfet (mosfet@kde.org) // Mosfet (mosfet@kde.org)
// adapted from kde sources for Blackbox by Brad Hughes // adapted from kde sources for Blackbox by Brad Hughes
@ -1233,7 +1233,7 @@ void BImage::pgradient(void) {
} }
void BImage::rgradient(void) { void Image::rgradient(void) {
// rectangle gradient - based on original dgradient, written by // rectangle gradient - based on original dgradient, written by
// Mosfet (mosfet@kde.org) // Mosfet (mosfet@kde.org)
// adapted from kde sources for Blackbox by Brad Hughes // adapted from kde sources for Blackbox by Brad Hughes
@ -1342,7 +1342,7 @@ void BImage::rgradient(void) {
} }
void BImage::egradient(void) { void Image::egradient(void) {
// elliptic gradient - based on original dgradient, written by // elliptic gradient - based on original dgradient, written by
// Mosfet (mosfet@kde.org) // Mosfet (mosfet@kde.org)
// adapted from kde sources for Blackbox by Brad Hughes // adapted from kde sources for Blackbox by Brad Hughes
@ -1462,7 +1462,7 @@ void BImage::egradient(void) {
} }
void BImage::pcgradient(void) { void Image::pcgradient(void) {
// pipe cross gradient - based on original dgradient, written by // pipe cross gradient - based on original dgradient, written by
// Mosfet (mosfet@kde.org) // Mosfet (mosfet@kde.org)
// adapted from kde sources for Blackbox by Brad Hughes // adapted from kde sources for Blackbox by Brad Hughes
@ -1573,7 +1573,7 @@ void BImage::pcgradient(void) {
} }
void BImage::cdgradient(void) { void Image::cdgradient(void) {
// cross diagonal gradient - based on original dgradient, written by // cross diagonal gradient - based on original dgradient, written by
// Mosfet (mosfet@kde.org) // Mosfet (mosfet@kde.org)
// adapted from kde sources for Blackbox by Brad Hughes // adapted from kde sources for Blackbox by Brad Hughes

View file

@ -1,6 +1,6 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __Image_hh #ifndef __image_hh
#define __Image_hh #define __image_hh
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -15,17 +15,17 @@ extern "C" {
namespace otk { namespace otk {
class BImageControl; class ImageControl;
class BTexture; class Texture;
class ScreenInfo; class ScreenInfo;
class BImage { class Image {
private: private:
BImageControl *control; ImageControl *control;
bool interlaced; bool interlaced;
XColor *colors; XColor *colors;
BColor from, to; Color from, to;
int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits, int red_offset, green_offset, blue_offset, red_bits, green_bits, blue_bits,
ncolors, cpc, cpccpc; ncolors, cpc, cpccpc;
unsigned char *red, *green, *blue, *red_table, *green_table, *blue_table; unsigned char *red, *green, *blue, *red_table, *green_table, *blue_table;
@ -39,15 +39,15 @@ private:
#endif #endif
Pixmap renderPixmap(void); Pixmap renderPixmap(void);
Pixmap render_solid(const BTexture &texture); Pixmap render_solid(const Texture &texture);
Pixmap render_gradient(const BTexture &texture); Pixmap render_gradient(const Texture &texture);
XImage *renderXImage(void); XImage *renderXImage(void);
void invert(void); void invert(void);
void bevel1(void); void bevel1(void);
void bevel2(void); void bevel2(void);
void border(const BTexture &texture); void border(const Texture &texture);
void dgradient(void); void dgradient(void);
void egradient(void); void egradient(void);
void hgradient(void); void hgradient(void);
@ -59,14 +59,14 @@ private:
public: public:
BImage(BImageControl *c, int w, int h); Image(ImageControl *c, int w, int h);
~BImage(void); ~Image(void);
Pixmap render(const BTexture &texture); Pixmap render(const Texture &texture);
}; };
class BImageControl { class ImageControl {
public: public:
#ifndef SWIG #ifndef SWIG
struct CachedImage { struct CachedImage {
@ -77,12 +77,12 @@ public:
}; };
#endif #endif
BImageControl(otk::OBTimerQueueManager *timermanager, ImageControl(otk::TimerQueueManager *timermanager,
const otk::ScreenInfo *scrn, const otk::ScreenInfo *scrn,
bool _dither= False, int _cpc = 4, bool _dither= False, int _cpc = 4,
unsigned long cache_timeout = 300000l, unsigned long cache_timeout = 300000l,
unsigned long cmax = 200l); unsigned long cmax = 200l);
virtual ~BImageControl(void); virtual ~ImageControl(void);
inline bool doDither(void) { return dither; } inline bool doDither(void) { return dither; }
@ -100,7 +100,7 @@ public:
unsigned long getSqrt(unsigned int x); unsigned long getSqrt(unsigned int x);
Pixmap renderImage(unsigned int width, unsigned int height, Pixmap renderImage(unsigned int width, unsigned int height,
const otk::BTexture &texture); const Texture &texture);
void installRootColormap(void); void installRootColormap(void);
void removeImage(Pixmap pixmap); void removeImage(Pixmap pixmap);
@ -114,12 +114,12 @@ public:
void setDither(bool d) { dither = d; } void setDither(bool d) { dither = d; }
void setColorsPerChannel(int cpc); void setColorsPerChannel(int cpc);
static void timeout(BImageControl *t); static void timeout(ImageControl *t);
private: private:
bool dither; bool dither;
const ScreenInfo *screeninfo; const ScreenInfo *screeninfo;
OBTimer *timer; Timer *timer;
Colormap colormap; Colormap colormap;
@ -139,10 +139,10 @@ private:
Pixmap searchCache(const unsigned int width, const unsigned int height, Pixmap searchCache(const unsigned int width, const unsigned int height,
const unsigned long texture, const unsigned long texture,
const BColor &c1, const BColor &c2); const Color &c1, const Color &c2);
}; };
} }
#endif // __Image_hh #endif // __image_hh

View file

@ -39,9 +39,9 @@ static unsigned long bsqrt(unsigned long x) {
} }
} }
BImageControl *ctrl = 0; ImageControl *ctrl = 0;
BImageControl::BImageControl(OBTimerQueueManager *timermanager, ImageControl::ImageControl(TimerQueueManager *timermanager,
const ScreenInfo *scrn, const ScreenInfo *scrn,
bool _dither, int _cpc, bool _dither, int _cpc,
unsigned long cache_timeout, unsigned long cache_timeout,
@ -54,11 +54,11 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
cache_max = cmax; cache_max = cmax;
if (cache_timeout) { if (cache_timeout) {
timer = new OBTimer(timermanager, (OBTimeoutHandler)timeout, this); timer = new Timer(timermanager, (TimeoutHandler)timeout, this);
timer->setTimeout(cache_timeout); timer->setTimeout(cache_timeout);
timer->start(); timer->start();
} else { } else {
timer = (OBTimer *) 0; timer = (Timer *) 0;
} }
colors = (XColor *) 0; colors = (XColor *) 0;
@ -75,7 +75,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
colormap = screeninfo->colormap(); colormap = screeninfo->colormap();
int count; int count;
XPixmapFormatValues *pmv = XListPixmapFormats(OBDisplay::display, XPixmapFormatValues *pmv = XListPixmapFormats(Display::display,
&count); &count);
if (pmv) { if (pmv) {
bits_per_pixel = 0; bits_per_pixel = 0;
@ -129,7 +129,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
fprintf(stderr, fprintf(stderr,
"BImageControl::BImageControl: invalid colormap size %d " "ImageControl::ImageControl: invalid colormap size %d "
"(%d/%d/%d) - reducing", "(%d/%d/%d) - reducing",
ncolors, colors_per_channel, colors_per_channel, ncolors, colors_per_channel, colors_per_channel,
colors_per_channel); colors_per_channel);
@ -139,7 +139,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
colors = new XColor[ncolors]; colors = new XColor[ncolors];
if (! colors) { if (! colors) {
fprintf(stderr, "BImageControl::BImageControl: error allocating " fprintf(stderr, "ImageControl::ImageControl: error allocating "
"colormap\n"); "colormap\n");
exit(1); exit(1);
} }
@ -168,7 +168,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
} }
for (i = 0; i < ncolors; i++) { for (i = 0; i < ncolors; i++) {
if (! XAllocColor(OBDisplay::display, colormap, &colors[i])) { if (! XAllocColor(Display::display, colormap, &colors[i])) {
fprintf(stderr, "couldn't alloc color %i %i %i\n", fprintf(stderr, "couldn't alloc color %i %i %i\n",
colors[i].red, colors[i].green, colors[i].blue); colors[i].red, colors[i].green, colors[i].blue);
colors[i].flags = 0; colors[i].flags = 0;
@ -183,7 +183,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
for (i = 0; i < incolors; i++) for (i = 0; i < incolors; i++)
icolors[i].pixel = i; icolors[i].pixel = i;
XQueryColors(OBDisplay::display, colormap, icolors, incolors); XQueryColors(Display::display, colormap, icolors, incolors);
for (i = 0; i < ncolors; i++) { for (i = 0; i < ncolors; i++) {
if (! colors[i].flags) { if (! colors[i].flags) {
unsigned long chk = 0xffffffff, pixel, close = 0; unsigned long chk = 0xffffffff, pixel, close = 0;
@ -205,7 +205,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
colors[i].green = icolors[close].green; colors[i].green = icolors[close].green;
colors[i].blue = icolors[close].blue; colors[i].blue = icolors[close].blue;
if (XAllocColor(OBDisplay::display, colormap, if (XAllocColor(Display::display, colormap,
&colors[i])) { &colors[i])) {
colors[i].flags = DoRed|DoGreen|DoBlue; colors[i].flags = DoRed|DoGreen|DoBlue;
break; break;
@ -234,7 +234,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) { if (colors_per_channel < 2 || ncolors > (1 << screen_depth)) {
fprintf(stderr, fprintf(stderr,
"BImageControl::BImageControl: invalid colormap size %d " "ImageControl::ImageControl: invalid colormap size %d "
"(%d/%d/%d) - reducing", "(%d/%d/%d) - reducing",
ncolors, colors_per_channel, colors_per_channel, ncolors, colors_per_channel, colors_per_channel,
colors_per_channel); colors_per_channel);
@ -245,7 +245,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
colors = new XColor[ncolors]; colors = new XColor[ncolors];
if (! colors) { if (! colors) {
fprintf(stderr, fprintf(stderr,
"BImageControl::BImageControl: error allocating colormap\n"); "ImageControl::ImageControl: error allocating colormap\n");
exit(1); exit(1);
} }
@ -262,7 +262,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);; colors[i].blue = (i * 0xffff) / (colors_per_channel - 1);;
colors[i].flags = DoRed|DoGreen|DoBlue; colors[i].flags = DoRed|DoGreen|DoBlue;
if (! XAllocColor(OBDisplay::display, colormap, if (! XAllocColor(Display::display, colormap,
&colors[i])) { &colors[i])) {
fprintf(stderr, "couldn't alloc color %i %i %i\n", fprintf(stderr, "couldn't alloc color %i %i %i\n",
colors[i].red, colors[i].green, colors[i].blue); colors[i].red, colors[i].green, colors[i].blue);
@ -279,7 +279,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
for (i = 0; i < incolors; i++) for (i = 0; i < incolors; i++)
icolors[i].pixel = i; icolors[i].pixel = i;
XQueryColors(OBDisplay::display, colormap, icolors, incolors); XQueryColors(Display::display, colormap, icolors, incolors);
for (i = 0; i < ncolors; i++) { for (i = 0; i < ncolors; i++) {
if (! colors[i].flags) { if (! colors[i].flags) {
unsigned long chk = 0xffffffff, pixel, close = 0; unsigned long chk = 0xffffffff, pixel, close = 0;
@ -301,7 +301,7 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
colors[i].green = icolors[close].green; colors[i].green = icolors[close].green;
colors[i].blue = icolors[close].blue; colors[i].blue = icolors[close].blue;
if (XAllocColor(OBDisplay::display, colormap, if (XAllocColor(Display::display, colormap,
&colors[i])) { &colors[i])) {
colors[i].flags = DoRed|DoGreen|DoBlue; colors[i].flags = DoRed|DoGreen|DoBlue;
break; break;
@ -315,14 +315,14 @@ BImageControl::BImageControl(OBTimerQueueManager *timermanager,
} }
default: default:
fprintf(stderr, "BImageControl::BImageControl: unsupported visual %d\n", fprintf(stderr, "ImageControl::ImageControl: unsupported visual %d\n",
getVisual()->c_class); getVisual()->c_class);
exit(1); exit(1);
} }
} }
BImageControl::~BImageControl(void) { ImageControl::~ImageControl(void) {
delete [] sqrt_table; delete [] sqrt_table;
delete [] grad_xbuffer; delete [] grad_xbuffer;
@ -335,20 +335,20 @@ BImageControl::~BImageControl(void) {
for (int i = 0; i < ncolors; i++) for (int i = 0; i < ncolors; i++)
*(pixels + i) = (*(colors + i)).pixel; *(pixels + i) = (*(colors + i)).pixel;
XFreeColors(OBDisplay::display, colormap, pixels, ncolors, 0); XFreeColors(Display::display, colormap, pixels, ncolors, 0);
delete [] colors; delete [] colors;
} }
if (! cache.empty()) { if (! cache.empty()) {
//#ifdef DEBUG //#ifdef DEBUG
fprintf(stderr, "BImageContol::~BImageControl: pixmap cache - " fprintf(stderr, "ImageContol::~ImageControl: pixmap cache - "
"releasing %d pixmaps\n", cache.size()); "releasing %d pixmaps\n", cache.size());
//#endif //#endif
CacheContainer::iterator it = cache.begin(); CacheContainer::iterator it = cache.begin();
const CacheContainer::iterator end = cache.end(); const CacheContainer::iterator end = cache.end();
for (; it != end; ++it) for (; it != end; ++it)
XFreePixmap(OBDisplay::display, it->pixmap); XFreePixmap(Display::display, it->pixmap);
} }
if (timer) { if (timer) {
timer->stop(); timer->stop();
@ -357,10 +357,10 @@ BImageControl::~BImageControl(void) {
} }
Pixmap BImageControl::searchCache(const unsigned int width, Pixmap ImageControl::searchCache(const unsigned int width,
const unsigned int height, const unsigned int height,
const unsigned long texture, const unsigned long texture,
const BColor &c1, const BColor &c2) { const Color &c1, const Color &c2) {
if (cache.empty()) if (cache.empty())
return None; return None;
@ -370,7 +370,7 @@ Pixmap BImageControl::searchCache(const unsigned int width,
CachedImage& tmp = *it; CachedImage& tmp = *it;
if (tmp.width == width && tmp.height == height && if (tmp.width == width && tmp.height == height &&
tmp.texture == texture && tmp.pixel1 == c1.pixel()) tmp.texture == texture && tmp.pixel1 == c1.pixel())
if (texture & BTexture::Gradient) { if (texture & Texture::Gradient) {
if (tmp.pixel2 == c2.pixel()) { if (tmp.pixel2 == c2.pixel()) {
tmp.count++; tmp.count++;
return tmp.pixmap; return tmp.pixmap;
@ -384,15 +384,15 @@ Pixmap BImageControl::searchCache(const unsigned int width,
} }
Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, Pixmap ImageControl::renderImage(unsigned int width, unsigned int height,
const BTexture &texture) { const Texture &texture) {
if (texture.texture() & BTexture::Parent_Relative) return ParentRelative; if (texture.texture() & Texture::Parent_Relative) return ParentRelative;
Pixmap pixmap = searchCache(width, height, texture.texture(), Pixmap pixmap = searchCache(width, height, texture.texture(),
texture.color(), texture.colorTo()); texture.color(), texture.colorTo());
if (pixmap) return pixmap; if (pixmap) return pixmap;
BImage image(this, width, height); Image image(this, width, height);
pixmap = image.render(texture); pixmap = image.render(texture);
if (! pixmap) if (! pixmap)
@ -407,7 +407,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
tmp.texture = texture.texture(); tmp.texture = texture.texture();
tmp.pixel1 = texture.color().pixel(); tmp.pixel1 = texture.color().pixel();
if (texture.texture() & BTexture::Gradient) if (texture.texture() & Texture::Gradient)
tmp.pixel2 = texture.colorTo().pixel(); tmp.pixel2 = texture.colorTo().pixel();
else else
tmp.pixel2 = 0l; tmp.pixel2 = 0l;
@ -416,7 +416,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
if (cache.size() > cache_max) { if (cache.size() > cache_max) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "BImageControl::renderImage: cache is large, " fprintf(stderr, "ImageControl::renderImage: cache is large, "
"forcing cleanout\n"); "forcing cleanout\n");
#endif // DEBUG #endif // DEBUG
@ -427,7 +427,7 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
} }
void BImageControl::removeImage(Pixmap pixmap) { void ImageControl::removeImage(Pixmap pixmap) {
if (! pixmap) if (! pixmap)
return; return;
@ -444,7 +444,7 @@ void BImageControl::removeImage(Pixmap pixmap) {
} }
void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt, void ImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt,
unsigned char **bmt, unsigned char **bmt,
int *roff, int *goff, int *boff, int *roff, int *goff, int *boff,
int *rbit, int *gbit, int *bbit) { int *rbit, int *gbit, int *bbit) {
@ -462,13 +462,13 @@ void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt,
} }
void BImageControl::getXColorTable(XColor **c, int *n) { void ImageControl::getXColorTable(XColor **c, int *n) {
if (c) *c = colors; if (c) *c = colors;
if (n) *n = ncolors; if (n) *n = ncolors;
} }
void BImageControl::getGradientBuffers(unsigned int w, void ImageControl::getGradientBuffers(unsigned int w,
unsigned int h, unsigned int h,
unsigned int **xbuf, unsigned int **xbuf,
unsigned int **ybuf) unsigned int **ybuf)
@ -496,10 +496,10 @@ void BImageControl::getGradientBuffers(unsigned int w,
} }
void BImageControl::installRootColormap(void) { void ImageControl::installRootColormap(void) {
int ncmap = 0; int ncmap = 0;
Colormap *cmaps = Colormap *cmaps =
XListInstalledColormaps(OBDisplay::display, window, &ncmap); XListInstalledColormaps(Display::display, window, &ncmap);
if (cmaps) { if (cmaps) {
bool install = True; bool install = True;
@ -508,14 +508,14 @@ void BImageControl::installRootColormap(void) {
install = False; install = False;
if (install) if (install)
XInstallColormap(OBDisplay::display, colormap); XInstallColormap(Display::display, colormap);
XFree(cmaps); XFree(cmaps);
} }
} }
void BImageControl::setColorsPerChannel(int cpc) { void ImageControl::setColorsPerChannel(int cpc) {
if (cpc < 2) cpc = 2; if (cpc < 2) cpc = 2;
if (cpc > 6) cpc = 6; if (cpc > 6) cpc = 6;
@ -523,7 +523,7 @@ void BImageControl::setColorsPerChannel(int cpc) {
} }
unsigned long BImageControl::getSqrt(unsigned int x) { unsigned long ImageControl::getSqrt(unsigned int x) {
if (! sqrt_table) { if (! sqrt_table) {
// build sqrt table for use with elliptic gradient // build sqrt table for use with elliptic gradient
@ -538,7 +538,7 @@ unsigned long BImageControl::getSqrt(unsigned int x) {
struct ZeroRefCheck { struct ZeroRefCheck {
inline bool operator()(const BImageControl::CachedImage &image) const { inline bool operator()(const ImageControl::CachedImage &image) const {
return (image.count == 0); return (image.count == 0);
} }
}; };
@ -546,14 +546,14 @@ struct ZeroRefCheck {
struct CacheCleaner { struct CacheCleaner {
ZeroRefCheck ref_check; ZeroRefCheck ref_check;
CacheCleaner() {} CacheCleaner() {}
inline void operator()(const BImageControl::CachedImage& image) const { inline void operator()(const ImageControl::CachedImage& image) const {
if (ref_check(image)) if (ref_check(image))
XFreePixmap(OBDisplay::display, image.pixmap); XFreePixmap(Display::display, image.pixmap);
} }
}; };
void BImageControl::timeout(BImageControl *t) { void ImageControl::timeout(ImageControl *t) {
CacheCleaner cleaner; CacheCleaner cleaner;
std::for_each(t->cache.begin(), t->cache.end(), cleaner); std::for_each(t->cache.begin(), t->cache.end(), cleaner);
t->cache.remove_if(cleaner.ref_check); t->cache.remove_if(cleaner.ref_check);

View file

@ -8,31 +8,31 @@
namespace otk { namespace otk {
OtkLabel::OtkLabel(OtkWidget *parent) Label::Label(Widget *parent)
: OtkWidget(parent), _text("") : Widget(parent), _text("")
{ {
const ScreenInfo *info = OBDisplay::screenInfo(screen()); const ScreenInfo *info = Display::screenInfo(screen());
_xftdraw = XftDrawCreate(OBDisplay::display, window(), info->visual(), _xftdraw = XftDrawCreate(Display::display, window(), info->visual(),
info->colormap()); info->colormap());
} }
OtkLabel::~OtkLabel() Label::~Label()
{ {
XftDrawDestroy(_xftdraw); XftDrawDestroy(_xftdraw);
} }
void OtkLabel::setStyle(Style *style) void Label::setStyle(Style *style)
{ {
OtkWidget::setStyle(style); Widget::setStyle(style);
setTexture(style->getLabelUnfocus()); setTexture(style->getLabelUnfocus());
} }
void OtkLabel::update(void) void Label::update(void)
{ {
if (_dirty) { if (_dirty) {
const BFont *ft = style()->getFont(); const Font *ft = style()->getFont();
unsigned int sidemargin = style()->getBevelWidth() * 2; unsigned int sidemargin = style()->getBevelWidth() * 2;
std::string t = _text; // the actual text to draw std::string t = _text; // the actual text to draw
@ -64,11 +64,11 @@ void OtkLabel::update(void)
} }
} }
OtkWidget::update(); Widget::update();
ft->drawString(_xftdraw, x, 0, *style()->getTextUnfocus(), t); ft->drawString(_xftdraw, x, 0, *style()->getTextUnfocus(), t);
} else } else
OtkWidget::update(); Widget::update();
} }
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __label_hh #ifndef __label_hh
#define __label_hh #define __label_hh
@ -6,12 +7,12 @@
namespace otk { namespace otk {
class OtkLabel : public OtkWidget { class Label : public Widget {
public: public:
OtkLabel(OtkWidget *parent); Label(Widget *parent);
~OtkLabel(); ~Label();
inline const std::string &getText(void) const { return _text; } inline const std::string &getText(void) const { return _text; }
void setText(const std::string &text) { _text = text; _dirty = true; } void setText(const std::string &text) { _text = text; _dirty = true; }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __otk_hh #ifndef __otk_hh
#define __otk_hh #define __otk_hh

1675
otk/otk.py

File diff suppressed because it is too large Load diff

View file

@ -10,38 +10,38 @@
#include "button.hh" #include "button.hh"
int main(int argc, char **argv) { int main(int argc, char **argv) {
otk::OtkApplication app(argc, argv); otk::Application app(argc, argv);
otk::OtkAppWidget foo(&app); otk::AppWidget foo(&app);
foo.resize(600, 500); foo.resize(600, 500);
foo.setTexture(app.getStyle()->getTitleFocus()); foo.setTexture(app.getStyle()->getTitleFocus());
// foo.setUnfocusTexture(app.getStyle()->getTitleUnfocus()); // foo.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
foo.setBevelWidth(2); foo.setBevelWidth(2);
foo.setDirection(otk::OtkWidget::Horizontal); foo.setDirection(otk::Widget::Horizontal);
otk::OtkFocusWidget left(&foo); otk::FocusWidget left(&foo);
otk::OtkFocusWidget right(&foo); otk::FocusWidget right(&foo);
left.setDirection(otk::OtkWidget::Horizontal); left.setDirection(otk::Widget::Horizontal);
left.setStretchableVert(true); left.setStretchableVert(true);
left.setStretchableHorz(true); left.setStretchableHorz(true);
left.setTexture(app.getStyle()->getTitleFocus()); left.setTexture(app.getStyle()->getTitleFocus());
left.setUnfocusTexture(app.getStyle()->getTitleUnfocus()); left.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
right.setDirection(otk::OtkWidget::Vertical); right.setDirection(otk::Widget::Vertical);
right.setBevelWidth(10); right.setBevelWidth(10);
right.setStretchableVert(true); right.setStretchableVert(true);
right.setWidth(300); right.setWidth(300);
right.setTexture(app.getStyle()->getTitleFocus()); right.setTexture(app.getStyle()->getTitleFocus());
right.setUnfocusTexture(app.getStyle()->getTitleUnfocus()); right.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
otk::OtkButton iconb(&left); otk::Button iconb(&left);
iconb.resize(40,20); iconb.resize(40,20);
otk::OtkFocusWidget label(&left); otk::FocusWidget label(&left);
otk::OtkButton maxb(&left); otk::Button maxb(&left);
otk::OtkButton closeb(&left); otk::Button closeb(&left);
// fixed size // fixed size
iconb.setText("foo"); iconb.setText("foo");
@ -60,9 +60,9 @@ int main(int argc, char **argv) {
// fixed size // fixed size
closeb.setText("fuubar"); closeb.setText("fuubar");
otk::OtkFocusWidget rblef(&right); otk::FocusWidget rblef(&right);
otk::OtkButton rbutt1(&right); otk::Button rbutt1(&right);
otk::OtkButton rbutt2(&right); otk::Button rbutt2(&right);
rblef.setStretchableHorz(true); rblef.setStretchableHorz(true);
rblef.setHeight(50); rblef.setHeight(50);

File diff suppressed because it is too large Load diff

View file

@ -15,9 +15,9 @@ extern "C" {
namespace otk { namespace otk {
OBProperty::OBProperty() Property::Property()
{ {
assert(OBDisplay::display); assert(Display::display);
// make sure asserts fire if there is a problem // make sure asserts fire if there is a problem
memset(_atoms, 0, sizeof(_atoms)); memset(_atoms, 0, sizeof(_atoms));
@ -153,7 +153,7 @@ OBProperty::OBProperty()
/* /*
* clean up the class' members * clean up the class' members
*/ */
OBProperty::~OBProperty() Property::~Property()
{ {
} }
@ -161,9 +161,9 @@ OBProperty::~OBProperty()
/* /*
* Returns an atom from the Xserver, creating it if necessary. * Returns an atom from the Xserver, creating it if necessary.
*/ */
Atom OBProperty::create(const char *name) const Atom Property::create(const char *name) const
{ {
Atom a = XInternAtom(OBDisplay::display, name, False); Atom a = XInternAtom(Display::display, name, False);
assert(a); assert(a);
return a; return a;
} }
@ -174,14 +174,14 @@ Atom OBProperty::create(const char *name) const
* Sets a window property on a window, optionally appending to the existing * Sets a window property on a window, optionally appending to the existing
* value. * value.
*/ */
void OBProperty::set(Window win, Atom atom, Atom type, void Property::set(Window win, Atom atom, Atom type,
unsigned char* data, int size, int nelements, unsigned char* data, int size, int nelements,
bool append) const bool append) const
{ {
assert(win != None); assert(atom != None); assert(type != None); assert(win != None); assert(atom != None); assert(type != None);
assert(nelements == 0 || (nelements > 0 && data != (unsigned char *) 0)); assert(nelements == 0 || (nelements > 0 && data != (unsigned char *) 0));
assert(size == 8 || size == 16 || size == 32); assert(size == 8 || size == 16 || size == 32);
XChangeProperty(OBDisplay::display, win, atom, type, size, XChangeProperty(Display::display, win, atom, type, size,
(append ? PropModeAppend : PropModeReplace), (append ? PropModeAppend : PropModeReplace),
data, nelements); data, nelements);
} }
@ -190,7 +190,7 @@ void OBProperty::set(Window win, Atom atom, Atom type,
/* /*
* Set a 32-bit property value on a window. * Set a 32-bit property value on a window.
*/ */
void OBProperty::set(Window win, Atoms atom, Atoms type, void Property::set(Window win, Atoms atom, Atoms type,
unsigned long value) const unsigned long value) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
@ -203,7 +203,7 @@ void OBProperty::set(Window win, Atoms atom, Atoms type,
/* /*
* Set an array of 32-bit properties value on a window. * Set an array of 32-bit properties value on a window.
*/ */
void OBProperty::set(Window win, Atoms atom, Atoms type, void Property::set(Window win, Atoms atom, Atoms type,
unsigned long value[], int elements) const unsigned long value[], int elements) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
@ -216,7 +216,7 @@ void OBProperty::set(Window win, Atoms atom, Atoms type,
/* /*
* Set an string property value on a window. * Set an string property value on a window.
*/ */
void OBProperty::set(Window win, Atoms atom, StringType type, void Property::set(Window win, Atoms atom, StringType type,
const std::string &value) const const std::string &value) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
@ -237,7 +237,7 @@ void OBProperty::set(Window win, Atoms atom, StringType type,
/* /*
* Set an array of string property values on a window. * Set an array of string property values on a window.
*/ */
void OBProperty::set(Window win, Atoms atom, StringType type, void Property::set(Window win, Atoms atom, StringType type,
const StringVect &strings) const const StringVect &strings) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
@ -270,7 +270,7 @@ void OBProperty::set(Window win, Atoms atom, StringType type,
* property did not exist on the window, or has a different type/size format * property did not exist on the window, or has a different type/size format
* than the user tried to retrieve. * than the user tried to retrieve.
*/ */
bool OBProperty::get(Window win, Atom atom, Atom type, bool Property::get(Window win, Atom atom, Atom type,
unsigned long *nelements, unsigned char **value, unsigned long *nelements, unsigned char **value,
int size) const int size) const
{ {
@ -286,7 +286,7 @@ bool OBProperty::get(Window win, Atom atom, Atom type,
bool ret = False; bool ret = False;
// try get the first element // try get the first element
result = XGetWindowProperty(OBDisplay::display, win, atom, 0l, 1l, result = XGetWindowProperty(Display::display, win, atom, 0l, 1l,
False, AnyPropertyType, &ret_type, &ret_size, False, AnyPropertyType, &ret_type, &ret_size,
nelements, &ret_bytes, &c_val); nelements, &ret_bytes, &c_val);
ret = (result == Success && ret_type == type && ret_size == size && ret = (result == Success && ret_type == type && ret_size == size &&
@ -304,7 +304,7 @@ bool OBProperty::get(Window win, Atom atom, Atom type,
int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1; int remain = (ret_bytes - 1)/sizeof(long) + 1 + 1;
if (remain > size/8 * (signed)maxread) // dont get more than the max if (remain > size/8 * (signed)maxread) // dont get more than the max
remain = size/8 * (signed)maxread; remain = size/8 * (signed)maxread;
result = XGetWindowProperty(OBDisplay::display, win, atom, 0l, result = XGetWindowProperty(Display::display, win, atom, 0l,
remain, False, type, &ret_type, &ret_size, remain, False, type, &ret_type, &ret_size,
nelements, &ret_bytes, &c_val); nelements, &ret_bytes, &c_val);
ret = (result == Success && ret_type == type && ret_size == size && ret = (result == Success && ret_type == type && ret_size == size &&
@ -329,7 +329,7 @@ bool OBProperty::get(Window win, Atom atom, Atom type,
/* /*
* Gets a 32-bit property's value from a window. * Gets a 32-bit property's value from a window.
*/ */
bool OBProperty::get(Window win, Atoms atom, Atoms type, bool Property::get(Window win, Atoms atom, Atoms type,
unsigned long *nelements, unsigned long *nelements,
unsigned long **value) const unsigned long **value) const
{ {
@ -343,7 +343,7 @@ bool OBProperty::get(Window win, Atoms atom, Atoms type,
/* /*
* Gets a single 32-bit property's value from a window. * Gets a single 32-bit property's value from a window.
*/ */
bool OBProperty::get(Window win, Atoms atom, Atoms type, bool Property::get(Window win, Atoms atom, Atoms type,
unsigned long *value) const unsigned long *value) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
@ -362,7 +362,7 @@ bool OBProperty::get(Window win, Atoms atom, Atoms type,
/* /*
* Gets an string property's value from a window. * Gets an string property's value from a window.
*/ */
bool OBProperty::get(Window win, Atoms atom, StringType type, bool Property::get(Window win, Atoms atom, StringType type,
std::string *value) const std::string *value) const
{ {
unsigned long n = 1; unsigned long n = 1;
@ -375,7 +375,7 @@ bool OBProperty::get(Window win, Atoms atom, StringType type,
} }
bool OBProperty::get(Window win, Atoms atom, StringType type, bool Property::get(Window win, Atoms atom, StringType type,
unsigned long *nelements, StringVect *strings) const unsigned long *nelements, StringVect *strings) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
@ -419,10 +419,10 @@ bool OBProperty::get(Window win, Atoms atom, StringType type,
/* /*
* Removes a property entirely from a window. * Removes a property entirely from a window.
*/ */
void OBProperty::erase(Window win, Atoms atom) const void Property::erase(Window win, Atoms atom) const
{ {
assert(atom >= 0 && atom < NUM_ATOMS); assert(atom >= 0 && atom < NUM_ATOMS);
XDeleteProperty(OBDisplay::display, win, _atoms[atom]); XDeleteProperty(Display::display, win, _atoms[atom]);
} }
} }

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __atom_hh #ifndef __atom_hh
#define __atom_hh #define __atom_hh
@ -21,7 +21,7 @@ extern "C" {
namespace otk { namespace otk {
//! Provides easy access to window properties. //! Provides easy access to window properties.
class OBProperty { class Property {
public: public:
//! The atoms on the X server which this class will cache //! The atoms on the X server which this class will cache
enum Atoms { enum Atoms {
@ -160,7 +160,7 @@ public:
private: private:
//! The value of all atoms on the X server that exist in the //! The value of all atoms on the X server that exist in the
//! OBProperty::Atoms enum //! Property::Atoms enum
Atom _atoms[NUM_ATOMS]; Atom _atoms[NUM_ATOMS];
//! Gets the value of an Atom from the X server, creating it if nessesary //! Gets the value of an Atom from the X server, creating it if nessesary
@ -178,21 +178,21 @@ public:
//! A list of strings //! A list of strings
typedef std::vector<std::string> StringVect; typedef std::vector<std::string> StringVect;
//! Constructs a new OBAtom object //! Constructs a new Atom object
/*! /*!
CAUTION: This constructor uses OBDisplay::display, so ensure that it is CAUTION: This constructor uses Display::display, so ensure that it is
initialized before initializing this class! initialized before initializing this class!
*/ */
OBProperty(); Property();
//! Destroys the OBAtom object //! Destroys the Atom object
virtual ~OBProperty(); virtual ~Property();
//! Sets a single-value property on a window to a new value //! Sets a single-value property on a window to a new value
/*! /*!
@param win The window id of the window on which to set the property's value @param win The window id of the window on which to set the property's value
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to set property to set
@param type A member of the OBProperty::Atoms enum that specifies the type @param type A member of the Property::Atoms enum that specifies the type
of the property to set of the property to set
@param value The value to set the property to @param value The value to set the property to
*/ */
@ -200,9 +200,9 @@ public:
//! Sets an multiple-value property on a window to a new value //! Sets an multiple-value property on a window to a new value
/*! /*!
@param win The window id of the window on which to set the property's value @param win The window id of the window on which to set the property's value
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to set property to set
@param type A member of the OBProperty::Atoms enum that specifies the type @param type A member of the Property::Atoms enum that specifies the type
of the property to set of the property to set
@param value Any array of values to set the property to. The array must @param value Any array of values to set the property to. The array must
contain <i>elements</i> number of elements contain <i>elements</i> number of elements
@ -213,9 +213,9 @@ public:
//! Sets a string property on a window to a new value //! Sets a string property on a window to a new value
/*! /*!
@param win The window id of the window on which to set the property's value @param win The window id of the window on which to set the property's value
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to set property to set
@param type A member of the OBProperty::StringType enum that specifies the @param type A member of the Property::StringType enum that specifies the
type of the string the property is being set to type of the string the property is being set to
@param value The string to set the property to @param value The string to set the property to
*/ */
@ -224,9 +224,9 @@ public:
//! Sets a string-array property on a window to a new value //! Sets a string-array property on a window to a new value
/*! /*!
@param win The window id of the window on which to set the property's value @param win The window id of the window on which to set the property's value
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to set property to set
@param type A member of the OBProperty::StringType enum that specifies the @param type A member of the Property::StringType enum that specifies the
type of the string the property is being set to type of the string the property is being set to
@param strings A list of strings to set the property to @param strings A list of strings to set the property to
*/ */
@ -236,9 +236,9 @@ public:
//! Gets the value of a property on a window //! Gets the value of a property on a window
/*! /*!
@param win The window id of the window to get the property value from @param win The window id of the window to get the property value from
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to retrieve property to retrieve
@param type A member of the OBProperty::Atoms enum that specifies the type @param type A member of the Property::Atoms enum that specifies the type
of the property to retrieve of the property to retrieve
@param nelements The maximum number of elements to retrieve from the @param nelements The maximum number of elements to retrieve from the
property (assuming it has more than 1 value in it). To property (assuming it has more than 1 value in it). To
@ -260,9 +260,9 @@ public:
//! Gets a single element from the value of a property on a window //! Gets a single element from the value of a property on a window
/*! /*!
@param win The window id of the window to get the property value from @param win The window id of the window to get the property value from
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to retrieve property to retrieve
@param type A member of the OBProperty::Atoms enum that specifies the type @param type A member of the Property::Atoms enum that specifies the type
of the property to retrieve of the property to retrieve
@param value If the function returns true, then this contains the first @param value If the function returns true, then this contains the first
(and possibly only) element in the value of the specified (and possibly only) element in the value of the specified
@ -274,9 +274,9 @@ public:
//! Gets a single string from the value of a property on a window //! Gets a single string from the value of a property on a window
/*! /*!
@param win The window id of the window to get the property value from @param win The window id of the window to get the property value from
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to retrieve property to retrieve
@param type A member of the OBProperty::StringType enum that specifies the @param type A member of the Property::StringType enum that specifies the
type of the string property to retrieve type of the string property to retrieve
@param value If the function returns true, then this contains the first @param value If the function returns true, then this contains the first
(and possibly only) string in the value of the specified (and possibly only) string in the value of the specified
@ -288,9 +288,9 @@ public:
//! Gets strings from the value of a property on a window //! Gets strings from the value of a property on a window
/*! /*!
@param win The window id of the window to get the property value from @param win The window id of the window to get the property value from
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to retrieve property to retrieve
@param type A member of the OBProperty::StringType enum that specifies the @param type A member of the Property::StringType enum that specifies the
type of the string property to retrieve type of the string property to retrieve
@param nelements The maximum number of strings to retrieve from the @param nelements The maximum number of strings to retrieve from the
property (assuming it has more than 1 string in it). To property (assuming it has more than 1 string in it). To
@ -308,14 +308,14 @@ public:
//! Removes a property from a window //! Removes a property from a window
/*! /*!
@param win The window id of the window to remove the property from @param win The window id of the window to remove the property from
@param atom A member of the OBProperty::Atoms enum that specifies which @param atom A member of the Property::Atoms enum that specifies which
property to remove from the window property to remove from the window
*/ */
void erase(Window win, Atoms atom) const; void erase(Window win, Atoms atom) const;
//! Gets the value of an atom on the X server //! Gets the value of an atom on the X server
/*! /*!
@param a A member of the OBProperty::Atoms enum that specifies which Atom's @param a A member of the Property::Atoms enum that specifies which Atom's
value to return value to return
@return The value of the specified Atom @return The value of the specified Atom
*/ */

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __rect_hh #ifndef __rect_hh
#define __rect_hh #define __rect_hh

View file

@ -1,4 +1,5 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "../config.h" # include "../config.h"
@ -20,11 +21,11 @@ namespace otk {
ScreenInfo::ScreenInfo(unsigned int num) { ScreenInfo::ScreenInfo(unsigned int num) {
_screen = num; _screen = num;
_root_window = RootWindow(OBDisplay::display, _screen); _root_window = RootWindow(Display::display, _screen);
_rect.setSize(WidthOfScreen(ScreenOfDisplay(OBDisplay::display, _rect.setSize(WidthOfScreen(ScreenOfDisplay(Display::display,
_screen)), _screen)),
HeightOfScreen(ScreenOfDisplay(OBDisplay::display, HeightOfScreen(ScreenOfDisplay(Display::display,
_screen))); _screen)));
/* /*
If the default depth is at least 8 we will use that, If the default depth is at least 8 we will use that,
@ -32,9 +33,9 @@ ScreenInfo::ScreenInfo(unsigned int num) {
Preference is given to 24 bit over larger depths if 24 bit is an option. Preference is given to 24 bit over larger depths if 24 bit is an option.
*/ */
_depth = DefaultDepth(OBDisplay::display, _screen); _depth = DefaultDepth(Display::display, _screen);
_visual = DefaultVisual(OBDisplay::display, _screen); _visual = DefaultVisual(Display::display, _screen);
_colormap = DefaultColormap(OBDisplay::display, _screen); _colormap = DefaultColormap(Display::display, _screen);
if (_depth < 8) { if (_depth < 8) {
// search for a TrueColor Visual... if we can't find one... // search for a TrueColor Visual... if we can't find one...
@ -46,7 +47,7 @@ ScreenInfo::ScreenInfo(unsigned int num) {
vinfo_template.screen = _screen; vinfo_template.screen = _screen;
vinfo_template.c_class = TrueColor; vinfo_template.c_class = TrueColor;
vinfo_return = XGetVisualInfo(OBDisplay::display, vinfo_return = XGetVisualInfo(Display::display,
VisualScreenMask | VisualClassMask, VisualScreenMask | VisualClassMask,
&vinfo_template, &vinfo_nitems); &vinfo_template, &vinfo_nitems);
if (vinfo_return) { if (vinfo_return) {
@ -65,7 +66,7 @@ ScreenInfo::ScreenInfo(unsigned int num) {
if (best != -1) { if (best != -1) {
_depth = vinfo_return[best].depth; _depth = vinfo_return[best].depth;
_visual = vinfo_return[best].visual; _visual = vinfo_return[best].visual;
_colormap = XCreateColormap(OBDisplay::display, _root_window, _visual, _colormap = XCreateColormap(Display::display, _root_window, _visual,
AllocNone); AllocNone);
} }
@ -73,13 +74,13 @@ ScreenInfo::ScreenInfo(unsigned int num) {
} }
// get the default display string and strip the screen number // get the default display string and strip the screen number
string default_string = DisplayString(OBDisplay::display); string default_string = DisplayString(Display::display);
const string::size_type pos = default_string.rfind("."); const string::size_type pos = default_string.rfind(".");
if (pos != string::npos) if (pos != string::npos)
default_string.resize(pos); default_string.resize(pos);
_display_string = string("DISPLAY=") + default_string + '.' + _display_string = string("DISPLAY=") + default_string + '.' +
otk::itostring(static_cast<unsigned long>(_screen)); itostring(static_cast<unsigned long>(_screen));
#if 0 //def XINERAMA #if 0 //def XINERAMA
_xinerama_active = False; _xinerama_active = False;
@ -93,7 +94,7 @@ ScreenInfo::ScreenInfo(unsigned int num) {
in future versions we should be able, so the 'activeness' is checked in future versions we should be able, so the 'activeness' is checked
on a pre-screen basis anyways. on a pre-screen basis anyways.
*/ */
if (XineramaIsActive(OBDisplay::display)) { if (XineramaIsActive(Display::display)) {
/* /*
If Xinerama is being used, there there is only going to be one screen If Xinerama is being used, there there is only going to be one screen
present. We still, of course, want to use the screen class, but that present. We still, of course, want to use the screen class, but that
@ -101,7 +102,7 @@ ScreenInfo::ScreenInfo(unsigned int num) {
never be more than one screen present with Xinerama active. never be more than one screen present with Xinerama active.
*/ */
int num; int num;
XineramaScreenInfo *info = XineramaQueryScreens(OBDisplay::display, XineramaScreenInfo *info = XineramaQueryScreens(Display::display,
&num); &num);
if (num > 0 && info) { if (num > 0 && info) {
_xinerama_areas.reserve(num); _xinerama_areas.reserve(num);

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __screeninfo_hh #ifndef __screeninfo_hh
#define __screeninfo_hh #define __screeninfo_hh

View file

@ -17,7 +17,7 @@ Style::Style() : font(NULL)
{ {
} }
Style::Style(BImageControl *ctrl) Style::Style(ImageControl *ctrl)
: image_control(ctrl), font(0), : image_control(ctrl), font(0),
screen_number(ctrl->getScreenInfo()->screen()) screen_number(ctrl->getScreenInfo()->screen())
{ {
@ -28,13 +28,13 @@ Style::~Style() {
delete font; delete font;
if (close_button.mask != None) if (close_button.mask != None)
XFreePixmap(OBDisplay::display, close_button.mask); XFreePixmap(Display::display, close_button.mask);
if (max_button.mask != None) if (max_button.mask != None)
XFreePixmap(OBDisplay::display, max_button.mask); XFreePixmap(Display::display, max_button.mask);
if (icon_button.mask != None) if (icon_button.mask != None)
XFreePixmap(OBDisplay::display, icon_button.mask); XFreePixmap(Display::display, icon_button.mask);
if (stick_button.mask != None) if (stick_button.mask != None)
XFreePixmap(OBDisplay::display, stick_button.mask); XFreePixmap(Display::display, stick_button.mask);
max_button.mask = None; max_button.mask = None;
close_button.mask = None; close_button.mask = None;
@ -70,26 +70,26 @@ void Style::load(const Configuration &style) {
//if neither of these can be found, we will use the previous resource //if neither of these can be found, we will use the previous resource
b_pressed_focus = readDatabaseTexture("window.button.pressed.focus", b_pressed_focus = readDatabaseTexture("window.button.pressed.focus",
"black", style, true); "black", style, true);
if (b_pressed_focus.texture() == BTexture::NoTexture) { if (b_pressed_focus.texture() == Texture::NoTexture) {
b_pressed_focus = readDatabaseTexture("window.button.pressed", "black", b_pressed_focus = readDatabaseTexture("window.button.pressed", "black",
style); style);
} }
b_pressed_unfocus = readDatabaseTexture("window.button.pressed.unfocus", b_pressed_unfocus = readDatabaseTexture("window.button.pressed.unfocus",
"black", style, true); "black", style, true);
if (b_pressed_unfocus.texture() == BTexture::NoTexture) { if (b_pressed_unfocus.texture() == Texture::NoTexture) {
b_pressed_unfocus = readDatabaseTexture("window.button.pressed", "black", b_pressed_unfocus = readDatabaseTexture("window.button.pressed", "black",
style); style);
} }
if (close_button.mask != None) if (close_button.mask != None)
XFreePixmap(OBDisplay::display, close_button.mask); XFreePixmap(Display::display, close_button.mask);
if (max_button.mask != None) if (max_button.mask != None)
XFreePixmap(OBDisplay::display, max_button.mask); XFreePixmap(Display::display, max_button.mask);
if (icon_button.mask != None) if (icon_button.mask != None)
XFreePixmap(OBDisplay::display, icon_button.mask); XFreePixmap(Display::display, icon_button.mask);
if (stick_button.mask != None) if (stick_button.mask != None)
XFreePixmap(OBDisplay::display, stick_button.mask); XFreePixmap(Display::display, stick_button.mask);
close_button.mask = max_button.mask = icon_button.mask close_button.mask = max_button.mask = icon_button.mask
= icon_button.mask = None; = icon_button.mask = None;
@ -101,13 +101,13 @@ void Style::load(const Configuration &style) {
// we create the window.frame texture by hand because it exists only to // we create the window.frame texture by hand because it exists only to
// make the code cleaner and is not actually used for display // make the code cleaner and is not actually used for display
BColor color = readDatabaseColor("window.frame.focusColor", "white", Color color = readDatabaseColor("window.frame.focusColor", "white",
style); style);
f_focus = BTexture("solid flat", screen_number, image_control); f_focus = Texture("solid flat", screen_number, image_control);
f_focus.setColor(color); f_focus.setColor(color);
color = readDatabaseColor("window.frame.unfocusColor", "white", style); color = readDatabaseColor("window.frame.unfocusColor", "white", style);
f_unfocus = BTexture("solid flat", screen_number, image_control); f_unfocus = Texture("solid flat", screen_number, image_control);
f_unfocus.setColor(color); f_unfocus.setColor(color);
l_text_focus = readDatabaseColor("window.label.focus.textColor", l_text_focus = readDatabaseColor("window.label.focus.textColor",
@ -130,20 +130,20 @@ void Style::load(const Configuration &style) {
} }
// sanity checks // sanity checks
if (t_focus.texture() == BTexture::Parent_Relative) if (t_focus.texture() == Texture::Parent_Relative)
t_focus = f_focus; t_focus = f_focus;
if (t_unfocus.texture() == BTexture::Parent_Relative) if (t_unfocus.texture() == Texture::Parent_Relative)
t_unfocus = f_unfocus; t_unfocus = f_unfocus;
if (h_focus.texture() == BTexture::Parent_Relative) if (h_focus.texture() == Texture::Parent_Relative)
h_focus = f_focus; h_focus = f_focus;
if (h_unfocus.texture() == BTexture::Parent_Relative) if (h_unfocus.texture() == Texture::Parent_Relative)
h_unfocus = f_unfocus; h_unfocus = f_unfocus;
border_color = readDatabaseColor("borderColor", "black", style); border_color = readDatabaseColor("borderColor", "black", style);
// load bevel, border and handle widths // load bevel, border and handle widths
const ScreenInfo *s_info = OBDisplay::screenInfo(screen_number); const ScreenInfo *s_info = Display::screenInfo(screen_number);
unsigned int width = s_info->rect().width(); unsigned int width = s_info->rect().width();
if (! style.getValue("handleWidth", handle_width) || if (! style.getValue("handleWidth", handle_width) ||
@ -168,7 +168,7 @@ void Style::load(const Configuration &style) {
void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask, void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
const Configuration &style) { const Configuration &style) {
Window root_window = OBDisplay::screenInfo(screen_number)->rootWindow(); Window root_window = Display::screenInfo(screen_number)->rootWindow();
std::string s; std::string s;
int hx, hy; //ignored int hx, hy; //ignored
int ret = BitmapOpenFailed; //default to failure. int ret = BitmapOpenFailed; //default to failure.
@ -176,17 +176,17 @@ void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
if (style.getValue(rname, s)) { if (style.getValue(rname, s)) {
if (s[0] != '/' && s[0] != '~') { if (s[0] != '/' && s[0] != '~') {
std::string xbmFile = std::string("~/.openbox/buttons/") + s; std::string xbmFile = std::string("~/.openbox/buttons/") + s;
ret = XReadBitmapFile(OBDisplay::display, root_window, ret = XReadBitmapFile(Display::display, root_window,
expandTilde(xbmFile).c_str(), &pixmapMask.w, expandTilde(xbmFile).c_str(), &pixmapMask.w,
&pixmapMask.h, &pixmapMask.mask, &hx, &hy); &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
if (ret != BitmapSuccess) { if (ret != BitmapSuccess) {
xbmFile = std::string(BUTTONSDIR) + "/" + s; xbmFile = std::string(BUTTONSDIR) + "/" + s;
ret = XReadBitmapFile(OBDisplay::display, root_window, ret = XReadBitmapFile(Display::display, root_window,
xbmFile.c_str(), &pixmapMask.w, xbmFile.c_str(), &pixmapMask.w,
&pixmapMask.h, &pixmapMask.mask, &hx, &hy); &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
} }
} else } else
ret = XReadBitmapFile(OBDisplay::display, root_window, ret = XReadBitmapFile(Display::display, root_window,
expandTilde(s).c_str(), &pixmapMask.w, expandTilde(s).c_str(), &pixmapMask.w,
&pixmapMask.h, &pixmapMask.mask, &hx, &hy); &pixmapMask.h, &pixmapMask.mask, &hx, &hy);
@ -199,26 +199,26 @@ void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
} }
BTexture Style::readDatabaseTexture(const std::string &rname, Texture Style::readDatabaseTexture(const std::string &rname,
const std::string &default_color, const std::string &default_color,
const Configuration &style, const Configuration &style,
bool allowNoTexture) bool allowNoTexture)
{ {
BTexture texture; Texture texture;
std::string s; std::string s;
if (style.getValue(rname, s)) if (style.getValue(rname, s))
texture = BTexture(s); texture = Texture(s);
else if (allowNoTexture) //no default else if (allowNoTexture) //no default
texture.setTexture(BTexture::NoTexture); texture.setTexture(Texture::NoTexture);
else else
texture.setTexture(BTexture::Solid | BTexture::Flat); texture.setTexture(Texture::Solid | Texture::Flat);
// associate this texture with this screen // associate this texture with this screen
texture.setScreen(screen_number); texture.setScreen(screen_number);
texture.setImageControl(image_control); texture.setImageControl(image_control);
if (texture.texture() != BTexture::NoTexture) { if (texture.texture() != Texture::NoTexture) {
texture.setColor(readDatabaseColor(rname + ".color", default_color, texture.setColor(readDatabaseColor(rname + ".color", default_color,
style)); style));
texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color, texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
@ -231,21 +231,21 @@ BTexture Style::readDatabaseTexture(const std::string &rname,
} }
BColor Style::readDatabaseColor(const std::string &rname, Color Style::readDatabaseColor(const std::string &rname,
const std::string &default_color, const std::string &default_color,
const Configuration &style) { const Configuration &style) {
BColor color; Color color;
std::string s; std::string s;
if (style.getValue(rname, s)) if (style.getValue(rname, s))
color = BColor(s, screen_number); color = Color(s, screen_number);
else else
color = BColor(default_color, screen_number); color = Color(default_color, screen_number);
return color; return color;
} }
BFont *Style::readDatabaseFont(const std::string &rbasename, Font *Style::readDatabaseFont(const std::string &rbasename,
const Configuration &style) { const Configuration &style) {
std::string fontstring, s; std::string fontstring, s;
// XXX: load all this font stuff from the style... // XXX: load all this font stuff from the style...
@ -267,7 +267,7 @@ BFont *Style::readDatabaseFont(const std::string &rbasename,
fontstring = "Arial,Sans-9:bold"; fontstring = "Arial,Sans-9:bold";
// if this fails, it ::exit()'s // if this fails, it ::exit()'s
return new BFont(screen_number, fontstring, dropShadow, offset, tint); return new Font(screen_number, fontstring, dropShadow, offset, tint);
} }
} }

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __style_hh #ifndef __style_hh
#define __style_hh #define __style_hh
@ -31,17 +32,17 @@ public:
// private: // private:
BImageControl *image_control; ImageControl *image_control;
BColor Color
l_text_focus, l_text_unfocus, l_text_focus, l_text_unfocus,
b_pic_focus, b_pic_unfocus; b_pic_focus, b_pic_unfocus;
BColor border_color; Color border_color;
BFont *font; Font *font;
BTexture Texture
f_focus, f_unfocus, f_focus, f_unfocus,
t_focus, t_unfocus, t_focus, t_unfocus,
l_focus, l_unfocus, l_focus, l_unfocus,
@ -63,23 +64,23 @@ public:
public: public:
Style(); Style();
Style(BImageControl *); Style(ImageControl *);
~Style(); ~Style();
void readDatabaseMask(const std::string &rname, void readDatabaseMask(const std::string &rname,
PixmapMask &pixmapMask, PixmapMask &pixmapMask,
const Configuration &style); const Configuration &style);
BTexture readDatabaseTexture(const std::string &rname, Texture readDatabaseTexture(const std::string &rname,
const std::string &default_color, const std::string &default_color,
const Configuration &style, const Configuration &style,
bool allowNoTexture = false); bool allowNoTexture = false);
BColor readDatabaseColor(const std::string &rname, Color readDatabaseColor(const std::string &rname,
const std::string &default_color, const std::string &default_color,
const Configuration &style); const Configuration &style);
BFont *readDatabaseFont(const std::string &rbasename, Font *readDatabaseFont(const std::string &rbasename,
const Configuration &style); const Configuration &style);
void load(const Configuration &style); void load(const Configuration &style);
@ -89,38 +90,38 @@ public:
inline PixmapMask *getIconifyButtonMask(void) { return &icon_button; } inline PixmapMask *getIconifyButtonMask(void) { return &icon_button; }
inline PixmapMask *getStickyButtonMask(void) { return &stick_button; } inline PixmapMask *getStickyButtonMask(void) { return &stick_button; }
inline BColor *getTextFocus(void) { return &l_text_focus; } inline Color *getTextFocus(void) { return &l_text_focus; }
inline BColor *getTextUnfocus(void) { return &l_text_unfocus; } inline Color *getTextUnfocus(void) { return &l_text_unfocus; }
inline BColor *getButtonPicFocus(void) { return &b_pic_focus; } inline Color *getButtonPicFocus(void) { return &b_pic_focus; }
inline BColor *getButtonPicUnfocus(void) { return &b_pic_unfocus; } inline Color *getButtonPicUnfocus(void) { return &b_pic_unfocus; }
inline BTexture *getTitleFocus(void) { return &t_focus; } inline Texture *getTitleFocus(void) { return &t_focus; }
inline BTexture *getTitleUnfocus(void) { return &t_unfocus; } inline Texture *getTitleUnfocus(void) { return &t_unfocus; }
inline BTexture *getLabelFocus(void) { return &l_focus; } inline Texture *getLabelFocus(void) { return &l_focus; }
inline BTexture *getLabelUnfocus(void) { return &l_unfocus; } inline Texture *getLabelUnfocus(void) { return &l_unfocus; }
inline BTexture *getHandleFocus(void) { return &h_focus; } inline Texture *getHandleFocus(void) { return &h_focus; }
inline BTexture *getHandleUnfocus(void) { return &h_unfocus; } inline Texture *getHandleUnfocus(void) { return &h_unfocus; }
inline BTexture *getButtonFocus(void) { return &b_focus; } inline Texture *getButtonFocus(void) { return &b_focus; }
inline BTexture *getButtonUnfocus(void) { return &b_unfocus; } inline Texture *getButtonUnfocus(void) { return &b_unfocus; }
inline BTexture *getButtonPressedFocus(void) inline Texture *getButtonPressedFocus(void)
{ return &b_pressed_focus; } { return &b_pressed_focus; }
inline BTexture *getButtonPressedUnfocus(void) inline Texture *getButtonPressedUnfocus(void)
{ return &b_pressed_unfocus; } { return &b_pressed_unfocus; }
inline BTexture *getGripFocus(void) { return &g_focus; } inline Texture *getGripFocus(void) { return &g_focus; }
inline BTexture *getGripUnfocus(void) { return &g_unfocus; } inline Texture *getGripUnfocus(void) { return &g_unfocus; }
inline unsigned int getHandleWidth(void) const { return handle_width; } inline unsigned int getHandleWidth(void) const { return handle_width; }
inline unsigned int getBevelWidth(void) const { return bevel_width; } inline unsigned int getBevelWidth(void) const { return bevel_width; }
inline unsigned int getFrameWidth(void) const { return frame_width; } inline unsigned int getFrameWidth(void) const { return frame_width; }
inline unsigned int getBorderWidth(void) const { return border_width; } inline unsigned int getBorderWidth(void) const { return border_width; }
inline const BFont *getFont() const { return font; } inline const Font *getFont() const { return font; }
inline void setShadowFonts(bool fonts) { shadow_fonts = fonts; } inline void setShadowFonts(bool fonts) { shadow_fonts = fonts; }
inline bool hasShadowFonts(void) const { return shadow_fonts; } inline bool hasShadowFonts(void) const { return shadow_fonts; }
@ -131,12 +132,12 @@ public:
inline TextJustify textJustify(void) { return justify; } inline TextJustify textJustify(void) { return justify; }
inline BulletType bulletType(void) { return bullet_type; } inline BulletType bulletType(void) { return bullet_type; }
inline const BColor *getBorderColor() const { return &border_color; } inline const Color *getBorderColor() const { return &border_color; }
inline const BTexture *getFrameFocus() const { return &f_focus; } inline const Texture *getFrameFocus() const { return &f_focus; }
inline const BTexture *getFrameUnfocus() const { return &f_unfocus; } inline const Texture *getFrameUnfocus() const { return &f_unfocus; }
inline void setImageControl(BImageControl *c) { inline void setImageControl(ImageControl *c) {
image_control = c; image_control = c;
screen_number = c->getScreenInfo()->screen(); screen_number = c->getScreenInfo()->screen();
} }

View file

@ -21,13 +21,13 @@ using std::string;
namespace otk { namespace otk {
BTexture::BTexture(unsigned int _screen, BImageControl* _ctrl) Texture::Texture(unsigned int _screen, ImageControl* _ctrl)
: c(_screen), ct(_screen), : c(_screen), ct(_screen),
lc(_screen), sc(_screen), bc(_screen), t(0), lc(_screen), sc(_screen), bc(_screen), t(0),
ctrl(_ctrl), scrn(_screen) { } ctrl(_ctrl), scrn(_screen) { }
BTexture::BTexture(const string &d,unsigned int _screen, BImageControl* _ctrl) Texture::Texture(const string &d,unsigned int _screen, ImageControl* _ctrl)
: c(_screen), ct(_screen), : c(_screen), ct(_screen),
lc(_screen), sc(_screen), bc(_screen), t(0), lc(_screen), sc(_screen), bc(_screen), t(0),
ctrl(_ctrl), scrn(_screen) { ctrl(_ctrl), scrn(_screen) {
@ -35,7 +35,7 @@ BTexture::BTexture(const string &d,unsigned int _screen, BImageControl* _ctrl)
} }
void BTexture::setColor(const BColor &cc) { void Texture::setColor(const Color &cc) {
c = cc; c = cc;
c.setScreen(screen()); c.setScreen(screen());
@ -51,7 +51,7 @@ void BTexture::setColor(const BColor &cc) {
if (rr < r) rr = ~0; if (rr < r) rr = ~0;
if (gg < g) gg = ~0; if (gg < g) gg = ~0;
if (bb < b) bb = ~0; if (bb < b) bb = ~0;
lc = BColor(rr, gg, bb, screen()); lc = Color(rr, gg, bb, screen());
// calculate the shadow color // calculate the shadow color
r = c.red(); r = c.red();
@ -63,11 +63,11 @@ void BTexture::setColor(const BColor &cc) {
if (rr > r) rr = 0; if (rr > r) rr = 0;
if (gg > g) gg = 0; if (gg > g) gg = 0;
if (bb > b) bb = 0; if (bb > b) bb = 0;
sc = BColor(rr, gg, bb, screen()); sc = Color(rr, gg, bb, screen());
} }
void BTexture::setDescription(const string &d) { void Texture::setDescription(const string &d) {
descr.erase(); descr.erase();
descr.reserve(d.length()); descr.reserve(d.length());
@ -76,55 +76,55 @@ void BTexture::setDescription(const string &d) {
descr += tolower(*it); descr += tolower(*it);
if (descr.find("parentrelative") != string::npos) { if (descr.find("parentrelative") != string::npos) {
setTexture(BTexture::Parent_Relative); setTexture(Texture::Parent_Relative);
} else { } else {
setTexture(0); setTexture(0);
if (descr.find("gradient") != string::npos) { if (descr.find("gradient") != string::npos) {
addTexture(BTexture::Gradient); addTexture(Texture::Gradient);
if (descr.find("crossdiagonal") != string::npos) if (descr.find("crossdiagonal") != string::npos)
addTexture(BTexture::CrossDiagonal); addTexture(Texture::CrossDiagonal);
else if (descr.find("rectangle") != string::npos) else if (descr.find("rectangle") != string::npos)
addTexture(BTexture::Rectangle); addTexture(Texture::Rectangle);
else if (descr.find("pyramid") != string::npos) else if (descr.find("pyramid") != string::npos)
addTexture(BTexture::Pyramid); addTexture(Texture::Pyramid);
else if (descr.find("pipecross") != string::npos) else if (descr.find("pipecross") != string::npos)
addTexture(BTexture::PipeCross); addTexture(Texture::PipeCross);
else if (descr.find("elliptic") != string::npos) else if (descr.find("elliptic") != string::npos)
addTexture(BTexture::Elliptic); addTexture(Texture::Elliptic);
else if (descr.find("horizontal") != string::npos) else if (descr.find("horizontal") != string::npos)
addTexture(BTexture::Horizontal); addTexture(Texture::Horizontal);
else if (descr.find("vertical") != string::npos) else if (descr.find("vertical") != string::npos)
addTexture(BTexture::Vertical); addTexture(Texture::Vertical);
else else
addTexture(BTexture::Diagonal); addTexture(Texture::Diagonal);
} else { } else {
addTexture(BTexture::Solid); addTexture(Texture::Solid);
} }
if (descr.find("sunken") != string::npos) if (descr.find("sunken") != string::npos)
addTexture(BTexture::Sunken); addTexture(Texture::Sunken);
else if (descr.find("flat") != string::npos) else if (descr.find("flat") != string::npos)
addTexture(BTexture::Flat); addTexture(Texture::Flat);
else else
addTexture(BTexture::Raised); addTexture(Texture::Raised);
if (texture() & BTexture::Flat) { if (texture() & Texture::Flat) {
if (descr.find("border") != string::npos) if (descr.find("border") != string::npos)
addTexture(BTexture::Border); addTexture(Texture::Border);
} else { } else {
if (descr.find("bevel2") != string::npos) if (descr.find("bevel2") != string::npos)
addTexture(BTexture::Bevel2); addTexture(Texture::Bevel2);
else else
addTexture(BTexture::Bevel1); addTexture(Texture::Bevel1);
} }
if (descr.find("interlaced") != string::npos) if (descr.find("interlaced") != string::npos)
addTexture(BTexture::Interlaced); addTexture(Texture::Interlaced);
} }
} }
void BTexture::setScreen(const unsigned int _screen) { void Texture::setScreen(const unsigned int _screen) {
if (_screen == screen()) { if (_screen == screen()) {
// nothing to do // nothing to do
return; return;
@ -139,7 +139,7 @@ void BTexture::setScreen(const unsigned int _screen) {
} }
BTexture& BTexture::operator=(const BTexture &tt) { Texture& Texture::operator=(const Texture &tt) {
c = tt.c; c = tt.c;
ct = tt.ct; ct = tt.ct;
lc = tt.lc; lc = tt.lc;
@ -154,17 +154,17 @@ BTexture& BTexture::operator=(const BTexture &tt) {
} }
Pixmap BTexture::render(const unsigned int width, const unsigned int height, Pixmap Texture::render(const unsigned int width, const unsigned int height,
const Pixmap old) { const Pixmap old) {
assert(texture() != BTexture::NoTexture); assert(texture() != Texture::NoTexture);
// if (texture() == (BTexture::Flat | BTexture::Solid)) // if (texture() == (Texture::Flat | Texture::Solid))
// return None; // return None;
if (texture() == BTexture::Parent_Relative) if (texture() == Texture::Parent_Relative)
return ParentRelative; return ParentRelative;
if (screen() == ~(0u)) if (screen() == ~(0u))
scrn = DefaultScreen(OBDisplay::display); scrn = DefaultScreen(Display::display);
assert(ctrl != 0); assert(ctrl != 0);
Pixmap ret = ctrl->renderImage(width, height, *this); Pixmap ret = ctrl->renderImage(width, height, *this);

View file

@ -9,9 +9,9 @@
namespace otk { namespace otk {
class BImageControl; class ImageControl;
class BTexture { class Texture {
public: public:
enum Type { enum Type {
// No texture // No texture
@ -45,36 +45,36 @@ public:
Interlaced = (1l<<18) Interlaced = (1l<<18)
}; };
BTexture(unsigned int _screen = ~(0u), BImageControl* _ctrl = 0); Texture(unsigned int _screen = ~(0u), ImageControl* _ctrl = 0);
BTexture(const std::string &_description, Texture(const std::string &_description,
unsigned int _screen = ~(0u), BImageControl* _ctrl = 0); unsigned int _screen = ~(0u), ImageControl* _ctrl = 0);
void setColor(const BColor &_color); void setColor(const Color &_color);
void setColorTo(const BColor &_colorTo) { ct = _colorTo; } void setColorTo(const Color &_colorTo) { ct = _colorTo; }
void setBorderColor(const BColor &_borderColor) { bc = _borderColor; } void setBorderColor(const Color &_borderColor) { bc = _borderColor; }
const BColor &color(void) const { return c; } const Color &color(void) const { return c; }
const BColor &colorTo(void) const { return ct; } const Color &colorTo(void) const { return ct; }
const BColor &lightColor(void) const { return lc; } const Color &lightColor(void) const { return lc; }
const BColor &shadowColor(void) const { return sc; } const Color &shadowColor(void) const { return sc; }
const BColor &borderColor(void) const { return bc; } const Color &borderColor(void) const { return bc; }
unsigned long texture(void) const { return t; } unsigned long texture(void) const { return t; }
void setTexture(const unsigned long _texture) { t = _texture; } void setTexture(const unsigned long _texture) { t = _texture; }
void addTexture(const unsigned long _texture) { t |= _texture; } void addTexture(const unsigned long _texture) { t |= _texture; }
#ifndef SWIG #ifndef SWIG
BTexture &operator=(const BTexture &tt); Texture &operator=(const Texture &tt);
#endif #endif
inline bool operator==(const BTexture &tt) inline bool operator==(const Texture &tt)
{ return (c == tt.c && ct == tt.ct && lc == tt.lc && { return (c == tt.c && ct == tt.ct && lc == tt.lc &&
sc == tt.sc && t == tt.t); } sc == tt.sc && t == tt.t); }
inline bool operator!=(const BTexture &tt) inline bool operator!=(const Texture &tt)
{ return (! operator==(tt)); } { return (! operator==(tt)); }
unsigned int screen(void) const { return scrn; } unsigned int screen(void) const { return scrn; }
void setScreen(const unsigned int _screen); void setScreen(const unsigned int _screen);
void setImageControl(BImageControl* _ctrl) { ctrl = _ctrl; } void setImageControl(ImageControl* _ctrl) { ctrl = _ctrl; }
const std::string &description(void) const { return descr; } const std::string &description(void) const { return descr; }
void setDescription(const std::string &d); void setDescription(const std::string &d);
@ -82,10 +82,10 @@ public:
const Pixmap old = 0); const Pixmap old = 0);
private: private:
BColor c, ct, lc, sc, bc; Color c, ct, lc, sc, bc;
std::string descr; std::string descr;
unsigned long t; unsigned long t;
BImageControl *ctrl; ImageControl *ctrl;
unsigned int scrn; unsigned int scrn;
}; };

View file

@ -33,7 +33,7 @@ static timeval normalizeTimeval(const timeval &tm)
} }
OBTimer::OBTimer(OBTimerQueueManager *m, OBTimeoutHandler h, OBTimeoutData d) Timer::Timer(TimerQueueManager *m, TimeoutHandler h, TimeoutData d)
{ {
_manager = m; _manager = m;
_handler = h; _handler = h;
@ -43,13 +43,13 @@ OBTimer::OBTimer(OBTimerQueueManager *m, OBTimeoutHandler h, OBTimeoutData d)
} }
OBTimer::~OBTimer(void) Timer::~Timer(void)
{ {
if (_timing) stop(); if (_timing) stop();
} }
void OBTimer::setTimeout(long t) void Timer::setTimeout(long t)
{ {
_timeout.tv_sec = t / 1000; _timeout.tv_sec = t / 1000;
_timeout.tv_usec = t % 1000; _timeout.tv_usec = t % 1000;
@ -57,14 +57,14 @@ void OBTimer::setTimeout(long t)
} }
void OBTimer::setTimeout(const timeval &t) void Timer::setTimeout(const timeval &t)
{ {
_timeout.tv_sec = t.tv_sec; _timeout.tv_sec = t.tv_sec;
_timeout.tv_usec = t.tv_usec; _timeout.tv_usec = t.tv_usec;
} }
void OBTimer::start(void) void Timer::start(void)
{ {
gettimeofday(&_start, 0); gettimeofday(&_start, 0);
@ -75,7 +75,7 @@ void OBTimer::start(void)
} }
void OBTimer::stop(void) void Timer::stop(void)
{ {
if (_timing) { if (_timing) {
_timing = false; _timing = false;
@ -85,14 +85,14 @@ void OBTimer::stop(void)
} }
void OBTimer::fire(void) void Timer::fire(void)
{ {
if (_handler) if (_handler)
_handler(_data); _handler(_data);
} }
timeval OBTimer::remainingTime(const timeval &tm) const timeval Timer::remainingTime(const timeval &tm) const
{ {
timeval ret = endTime(); timeval ret = endTime();
@ -103,7 +103,7 @@ timeval OBTimer::remainingTime(const timeval &tm) const
} }
timeval OBTimer::endTime(void) const timeval Timer::endTime(void) const
{ {
timeval ret; timeval ret;
@ -114,7 +114,7 @@ timeval OBTimer::endTime(void) const
} }
bool OBTimer::shouldFire(const timeval &tm) const bool Timer::shouldFire(const timeval &tm) const
{ {
timeval end = endTime(); timeval end = endTime();

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __timer_hh #ifndef __timer_hh
#define __timer_hh #define __timer_hh
@ -17,26 +17,26 @@ extern "C" {
namespace otk { namespace otk {
class OBTimerQueueManager; class TimerQueueManager;
//! The data passed to the OBTimeoutHandler function. //! The data passed to the TimeoutHandler function.
/*! /*!
Note: this is a very useful place to put an object instance, and set the Note: this is a very useful place to put an object instance, and set the
event handler to a static function in the same class. event handler to a static function in the same class.
*/ */
typedef void *OBTimeoutData; typedef void *TimeoutData;
//! The type of function which can be set as the callback for an OBTimer firing //! The type of function which can be set as the callback for a Timer firing
typedef void (*OBTimeoutHandler)(OBTimeoutData); typedef void (*TimeoutHandler)(TimeoutData);
//! A Timer class which will fire a function when its time elapses //! A Timer class which will fire a function when its time elapses
class OBTimer { class Timer {
private: private:
//! The manager which to add ourself to and remove ourself after we are done //! The manager which to add ourself to and remove ourself after we are done
OBTimerQueueManager *_manager; TimerQueueManager *_manager;
//! The function to call when the time elapses //! The function to call when the time elapses
OBTimeoutHandler _handler; TimeoutHandler _handler;
//! The data which gets passed along to the OBTimeoutHandler //! The data which gets passed along to the TimeoutHandler
OBTimeoutData _data; TimeoutData _data;
//! Determines if the timer is currently started //! Determines if the timer is currently started
bool _timing; bool _timing;
//! When this is true, the timer will reset itself to fire again every time //! When this is true, the timer will reset itself to fire again every time
@ -47,57 +47,57 @@ private:
//! The time at which the timer is going to fire //! The time at which the timer is going to fire
timeval _timeout; timeval _timeout;
//! Disallows copying of OBTimer objects //! Disallows copying of Timer objects
OBTimer(const OBTimer&); Timer(const Timer&);
//! Disallows copying of OBTimer objects //! Disallows copying of Timer objects
OBTimer& operator=(const OBTimer&); Timer& operator=(const Timer&);
public: public:
//! Constructs a new OBTimer object //! Constructs a new Timer object
/*! /*!
@param m The OBTimerQueueManager with which to associate. The manager @param m The TimerQueueManager with which to associate. The manager
specified will be resposible for making this timer fire. specified will be resposible for making this timer fire.
@param h The function to call when the timer fires @param h The function to call when the timer fires
@param d The data to pass along to the function call when the timer fires @param d The data to pass along to the function call when the timer fires
*/ */
OBTimer(OBTimerQueueManager *m, OBTimeoutHandler h, OBTimeoutData d); Timer(TimerQueueManager *m, TimeoutHandler h, TimeoutData d);
//! Destroys the OBTimer object //! Destroys the Timer object
virtual ~OBTimer(); virtual ~Timer();
//! Fires the timer, calling its OBTimeoutHandler //! Fires the timer, calling its TimeoutHandler
void fire(); void fire();
//! Returns if the OBTimer is started and timing //! Returns if the Timer is started and timing
inline bool timing() const { return _timing; } inline bool timing() const { return _timing; }
//! Returns if the OBTimer is going to repeat //! Returns if the Timer is going to repeat
inline bool recurring() const { return _recur; } inline bool recurring() const { return _recur; }
//! Gets the amount of time the OBTimer should last before firing //! Gets the amount of time the Timer should last before firing
inline const timeval &timeout() const { return _timeout; } inline const timeval &timeout() const { return _timeout; }
//! Gets the time at which the OBTimer started //! Gets the time at which the Timer started
inline const timeval &startTime() const { return _start; } inline const timeval &startTime() const { return _start; }
//! Gets the amount of time left before the OBTimer fires //! Gets the amount of time left before the Timer fires
timeval remainingTime(const timeval &tm) const; timeval remainingTime(const timeval &tm) const;
//! Returns if the OBTimer is past its timeout time, and should fire //! Returns if the Timer is past its timeout time, and should fire
bool shouldFire(const timeval &tm) const; bool shouldFire(const timeval &tm) const;
//! Gets the time at which the OBTimer will fire //! Gets the time at which the Timer will fire
timeval endTime() const; timeval endTime() const;
//! Sets the OBTimer to repeat or not //! Sets the Timer to repeat or not
/*! /*!
@param b If true, the timer is set to repeat; otherwise, it will fire only @param b If true, the timer is set to repeat; otherwise, it will fire only
once once
*/ */
inline void setRecurring(bool b) { _recur = b; } inline void setRecurring(bool b) { _recur = b; }
//! Sets the amount of time for the OBTimer to last in milliseconds //! Sets the amount of time for the Timer to last in milliseconds
/*! /*!
@param t The number of milliseconds the timer should last @param t The number of milliseconds the timer should last
*/ */
void setTimeout(long t); void setTimeout(long t);
//! Sets the amount of time the OBTimer should last before firing //! Sets the amount of time the Timer should last before firing
/*! /*!
@param t The amount of time the timer should last @param t The amount of time the timer should last
*/ */
@ -105,7 +105,7 @@ public:
//! Causes the timer to begin //! Causes the timer to begin
/*! /*!
The timer fires after the time in OBTimer::getTimeout has passed since this The timer fires after the time in Timer::getTimeout has passed since this
function was called. function was called.
Calling this function while the timer is already started will cause it to Calling this function while the timer is already started will cause it to
restart its countdown. restart its countdown.
@ -118,12 +118,12 @@ public:
*/ */
void stop(); // manager releases timer void stop(); // manager releases timer
//! Determines if this OBTimer will fire before a second OBTimer object //! Determines if this Timer will fire before a second Timer object
/*! /*!
@param other The second OBTimer with which to compare @param other The second Timer with which to compare
@return true if this OBTimer will fire before 'other'; otherwise, false @return true if this Timer will fire before 'other'; otherwise, false
*/ */
bool operator<(const OBTimer& other) const bool operator<(const Timer& other) const
{ return shouldFire(other.endTime()); } { return shouldFire(other.endTime()); }
}; };

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __timerqueue_hh #ifndef __timerqueue_hh
#define __timerqueue_hh #define __timerqueue_hh
@ -37,13 +37,12 @@ private:
}; };
struct TimerLessThan { struct TimerLessThan {
bool operator()(const OBTimer* const l, const OBTimer* const r) const { bool operator()(const Timer* const l, const Timer* const r) const {
return *r < *l; return *r < *l;
} }
}; };
typedef _timer_queue<OBTimer*, typedef _timer_queue<Timer*, std::vector<Timer*>, TimerLessThan> TimerQueue;
std::vector<OBTimer*>, TimerLessThan> TimerQueue;
} }

View file

@ -9,19 +9,19 @@
namespace otk { namespace otk {
void OBTimerQueueManager::fire(bool wait) void TimerQueueManager::fire(bool wait)
{ {
fd_set rfds; fd_set rfds;
timeval now, tm, *timeout = (timeval *) 0; timeval now, tm, *timeout = (timeval *) 0;
const int xfd = ConnectionNumber(otk::OBDisplay::display); const int xfd = ConnectionNumber(Display::display);
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(xfd, &rfds); // break on any x events FD_SET(xfd, &rfds); // break on any x events
if (wait) { if (wait) {
if (! timerList.empty()) { if (! timerList.empty()) {
const OBTimer* const timer = timerList.top(); const Timer* const timer = timerList.top();
gettimeofday(&now, 0); gettimeofday(&now, 0);
tm = timer->remainingTime(now); tm = timer->remainingTime(now);
@ -40,7 +40,7 @@ void OBTimerQueueManager::fire(bool wait)
// timer->start() and timer->shouldFire() is within the timer's period // timer->start() and timer->shouldFire() is within the timer's period
// then the timer will keep firing. This should be VERY near impossible. // then the timer will keep firing. This should be VERY near impossible.
while (! timerList.empty()) { while (! timerList.empty()) {
OBTimer *timer = timerList.top(); Timer *timer = timerList.top();
if (! timer->shouldFire(now)) if (! timer->shouldFire(now))
break; break;
@ -53,13 +53,13 @@ void OBTimerQueueManager::fire(bool wait)
} }
void OBTimerQueueManager::addTimer(OBTimer *timer) void TimerQueueManager::addTimer(Timer *timer)
{ {
assert(timer); assert(timer);
timerList.push(timer); timerList.push(timer);
} }
void OBTimerQueueManager::removeTimer(OBTimer* timer) void TimerQueueManager::removeTimer(Timer* timer)
{ {
assert(timer); assert(timer);
timerList.release(timer); timerList.release(timer);

View file

@ -1,4 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __timerqueuemanager_hh #ifndef __timerqueuemanager_hh
#define __timerqueuemanager_hh #define __timerqueuemanager_hh
@ -6,21 +6,21 @@
namespace otk { namespace otk {
//! Manages a queue of OBTimer objects //! Manages a queue of Timer objects
/*! /*!
All OBTimer objects add themself to an OBTimerQueueManager. The manager is All Timer objects add themself to a TimerQueueManager. The manager is
what fires the timers when their time has elapsed. This is done by having the what fires the timers when their time has elapsed. This is done by having the
application call the OBTimerQueueManager::fire class in its main event loop. application call the TimerQueueManager::fire class in its main event loop.
*/ */
class OBTimerQueueManager { class TimerQueueManager {
private: private:
//! A priority queue of all timers being managed by this class. //! A priority queue of all timers being managed by this class.
TimerQueue timerList; TimerQueue timerList;
public: public:
//! Constructs a new OBTimerQueueManager //! Constructs a new TimerQueueManager
OBTimerQueueManager() {} TimerQueueManager() {}
//! Destroys the OBTimerQueueManager //! Destroys the TimerQueueManager
virtual ~OBTimerQueueManager() {} virtual ~TimerQueueManager() {}
//! Fire the next timer in the queue. //! Fire the next timer in the queue.
/*! /*!
@ -31,14 +31,14 @@ public:
//! Adds a new timer to the queue //! Adds a new timer to the queue
/*! /*!
@param timer An OBTimer to add to the queue @param timer An Timer to add to the queue
*/ */
virtual void addTimer(OBTimer* timer); virtual void addTimer(Timer* timer);
//! Removes a timer from the queue //! Removes a timer from the queue
/*! /*!
@param timer An OBTimer already in the queue to remove @param timer An Timer already in the queue to remove
*/ */
virtual void removeTimer(OBTimer* timer); virtual void removeTimer(Timer* timer);
}; };
} }

View file

@ -1,6 +1,6 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef _BLACKBOX_UTIL_HH #ifndef __util_hh
#define _BLACKBOX_UTIL_HH #define __util_hh
extern "C" { extern "C" {
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -18,7 +18,6 @@ extern "C" {
#endif // TIME_WITH_SYS_TIME #endif // TIME_WITH_SYS_TIME
} }
#include <string> #include <string>
#include <vector> #include <vector>
@ -46,4 +45,4 @@ std::string basename(const std::string& path);
} }
#endif #endif // __util_hh

View file

@ -14,8 +14,8 @@
namespace otk { namespace otk {
OtkWidget::OtkWidget(OtkWidget *parent, Direction direction) Widget::Widget(Widget *parent, Direction direction)
: OtkEventHandler(), : EventHandler(),
_dirty(false), _focused(false), _dirty(false), _focused(false),
_parent(parent), _style(parent->style()), _direction(direction), _parent(parent), _style(parent->style()), _direction(direction),
_cursor(parent->cursor()), _bevel_width(parent->bevelWidth()), _cursor(parent->cursor()), _bevel_width(parent->bevelWidth()),
@ -33,10 +33,10 @@ OtkWidget::OtkWidget(OtkWidget *parent, Direction direction)
setStyle(_style); // let the widget initialize stuff setStyle(_style); // let the widget initialize stuff
} }
OtkWidget::OtkWidget(OtkEventDispatcher *event_dispatcher, Style *style, Widget::Widget(EventDispatcher *event_dispatcher, Style *style,
Direction direction, Cursor cursor, int bevel_width, Direction direction, Cursor cursor, int bevel_width,
bool override_redirect) bool override_redirect)
: OtkEventHandler(), : EventHandler(),
_dirty(false),_focused(false), _dirty(false),_focused(false),
_parent(0), _style(style), _direction(direction), _cursor(cursor), _parent(0), _style(style), _direction(direction), _cursor(cursor),
_bevel_width(bevel_width), _ignore_config(0), _visible(false), _bevel_width(bevel_width), _ignore_config(0), _visible(false),
@ -53,7 +53,7 @@ OtkWidget::OtkWidget(OtkEventDispatcher *event_dispatcher, Style *style,
setStyle(_style); // let the widget initialize stuff setStyle(_style); // let the widget initialize stuff
} }
OtkWidget::~OtkWidget() Widget::~Widget()
{ {
if (_visible) if (_visible)
hide(); hide();
@ -65,12 +65,12 @@ OtkWidget::~OtkWidget()
if (_parent) if (_parent)
_parent->removeChild(this); _parent->removeChild(this);
XDestroyWindow(otk::OBDisplay::display, _window); XDestroyWindow(Display::display, _window);
} }
void OtkWidget::create(bool override_redirect) void Widget::create(bool override_redirect)
{ {
const ScreenInfo *scr_info = otk::OBDisplay::screenInfo(_screen); const ScreenInfo *scr_info = Display::screenInfo(_screen);
Window p_window = _parent ? _parent->window() : scr_info->rootWindow(); Window p_window = _parent ? _parent->window() : scr_info->rootWindow();
_rect.setRect(0, 0, 1, 1); // just some initial values _rect.setRect(0, 0, 1, 1); // just some initial values
@ -93,71 +93,71 @@ void OtkWidget::create(bool override_redirect)
attrib_create.cursor = _cursor; attrib_create.cursor = _cursor;
} }
_window = XCreateWindow(otk::OBDisplay::display, p_window, _rect.x(), _window = XCreateWindow(Display::display, p_window, _rect.x(),
_rect.y(), _rect.width(), _rect.height(), 0, _rect.y(), _rect.width(), _rect.height(), 0,
scr_info->depth(), InputOutput, scr_info->depth(), InputOutput,
scr_info->visual(), create_mask, &attrib_create); scr_info->visual(), create_mask, &attrib_create);
_ignore_config++; _ignore_config++;
} }
void OtkWidget::setWidth(int w) void Widget::setWidth(int w)
{ {
assert(w > 0); assert(w > 0);
_fixed_width = true; _fixed_width = true;
setGeometry(_rect.x(), _rect.y(), w, _rect.height()); setGeometry(_rect.x(), _rect.y(), w, _rect.height());
} }
void OtkWidget::setHeight(int h) void Widget::setHeight(int h)
{ {
assert(h > 0); assert(h > 0);
_fixed_height = true; _fixed_height = true;
setGeometry(_rect.x(), _rect.y(), _rect.width(), h); setGeometry(_rect.x(), _rect.y(), _rect.width(), h);
} }
void OtkWidget::move(const Point &to) void Widget::move(const Point &to)
{ {
move(to.x(), to.y()); move(to.x(), to.y());
} }
void OtkWidget::move(int x, int y) void Widget::move(int x, int y)
{ {
_rect.setPos(x, y); _rect.setPos(x, y);
XMoveWindow(otk::OBDisplay::display, _window, x, y); XMoveWindow(Display::display, _window, x, y);
_ignore_config++; _ignore_config++;
} }
void OtkWidget::resize(const Point &to) void Widget::resize(const Point &to)
{ {
resize(to.x(), to.y()); resize(to.x(), to.y());
} }
void OtkWidget::resize(int w, int h) void Widget::resize(int w, int h)
{ {
assert(w > 0 && h > 0); assert(w > 0 && h > 0);
_fixed_width = _fixed_height = true; _fixed_width = _fixed_height = true;
setGeometry(_rect.x(), _rect.y(), w, h); setGeometry(_rect.x(), _rect.y(), w, h);
} }
void OtkWidget::setGeometry(const Rect &new_geom) void Widget::setGeometry(const Rect &new_geom)
{ {
setGeometry(new_geom.x(), new_geom.y(), new_geom.width(), new_geom.height()); setGeometry(new_geom.x(), new_geom.y(), new_geom.width(), new_geom.height());
} }
void OtkWidget::setGeometry(const Point &topleft, int width, int height) void Widget::setGeometry(const Point &topleft, int width, int height)
{ {
setGeometry(topleft.x(), topleft.y(), width, height); setGeometry(topleft.x(), topleft.y(), width, height);
} }
void OtkWidget::setGeometry(int x, int y, int width, int height) void Widget::setGeometry(int x, int y, int width, int height)
{ {
_rect = Rect(x, y, width, height); _rect = Rect(x, y, width, height);
_dirty = true; _dirty = true;
XMoveResizeWindow(otk::OBDisplay::display, _window, x, y, width, height); XMoveResizeWindow(Display::display, _window, x, y, width, height);
_ignore_config++; _ignore_config++;
} }
void OtkWidget::show(bool recursive) void Widget::show(bool recursive)
{ {
if (_visible) if (_visible)
return; return;
@ -167,53 +167,53 @@ void OtkWidget::show(bool recursive)
update(); update();
if (recursive) { if (recursive) {
OtkWidgetList::iterator it = _children.begin(), end = _children.end(); WidgetList::iterator it = _children.begin(), end = _children.end();
for (; it != end; ++it) for (; it != end; ++it)
(*it)->show(); (*it)->show();
} }
XMapWindow(otk::OBDisplay::display, _window); XMapWindow(Display::display, _window);
_visible = true; _visible = true;
} }
void OtkWidget::hide(bool recursive) void Widget::hide(bool recursive)
{ {
if (! _visible) if (! _visible)
return; return;
if (recursive) { if (recursive) {
OtkWidgetList::iterator it = _children.begin(), end = _children.end(); WidgetList::iterator it = _children.begin(), end = _children.end();
for (; it != end; ++it) for (; it != end; ++it)
(*it)->hide(); (*it)->hide();
} }
XUnmapWindow(otk::OBDisplay::display, _window); XUnmapWindow(Display::display, _window);
_visible = false; _visible = false;
} }
void OtkWidget::focus(void) void Widget::focus(void)
{ {
_focused = true; _focused = true;
OtkWidget::OtkWidgetList::iterator it = _children.begin(), Widget::WidgetList::iterator it = _children.begin(),
end = _children.end(); end = _children.end();
for (; it != end; ++it) for (; it != end; ++it)
(*it)->focus(); (*it)->focus();
} }
void OtkWidget::unfocus(void) void Widget::unfocus(void)
{ {
_focused = false; _focused = false;
OtkWidget::OtkWidgetList::iterator it = _children.begin(), Widget::WidgetList::iterator it = _children.begin(),
end = _children.end(); end = _children.end();
for (; it != end; ++it) for (; it != end; ++it)
(*it)->unfocus(); (*it)->unfocus();
} }
bool OtkWidget::grabMouse(void) bool Widget::grabMouse(void)
{ {
Status ret = XGrabPointer(otk::OBDisplay::display, _window, True, Status ret = XGrabPointer(Display::display, _window, True,
(ButtonPressMask | ButtonReleaseMask | (ButtonPressMask | ButtonReleaseMask |
ButtonMotionMask | EnterWindowMask | ButtonMotionMask | EnterWindowMask |
LeaveWindowMask | PointerMotionMask), LeaveWindowMask | PointerMotionMask),
@ -223,52 +223,52 @@ bool OtkWidget::grabMouse(void)
return _grabbed_mouse; return _grabbed_mouse;
} }
void OtkWidget::ungrabMouse(void) void Widget::ungrabMouse(void)
{ {
if (! _grabbed_mouse) if (! _grabbed_mouse)
return; return;
XUngrabPointer(otk::OBDisplay::display, CurrentTime); XUngrabPointer(Display::display, CurrentTime);
_grabbed_mouse = false; _grabbed_mouse = false;
} }
bool OtkWidget::grabKeyboard(void) bool Widget::grabKeyboard(void)
{ {
Status ret = XGrabKeyboard(otk::OBDisplay::display, _window, True, Status ret = XGrabKeyboard(Display::display, _window, True,
GrabModeSync, GrabModeAsync, CurrentTime); GrabModeSync, GrabModeAsync, CurrentTime);
_grabbed_keyboard = (ret == GrabSuccess); _grabbed_keyboard = (ret == GrabSuccess);
return _grabbed_keyboard; return _grabbed_keyboard;
} }
void OtkWidget::ungrabKeyboard(void) void Widget::ungrabKeyboard(void)
{ {
if (! _grabbed_keyboard) if (! _grabbed_keyboard)
return; return;
XUngrabKeyboard(otk::OBDisplay::display, CurrentTime); XUngrabKeyboard(Display::display, CurrentTime);
_grabbed_keyboard = false; _grabbed_keyboard = false;
} }
void OtkWidget::render(void) void Widget::render(void)
{ {
if (!_texture) return; if (!_texture) return;
_bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap); _bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap);
if (_bg_pixmap) { if (_bg_pixmap) {
XSetWindowBackgroundPixmap(otk::OBDisplay::display, _window, _bg_pixmap); XSetWindowBackgroundPixmap(Display::display, _window, _bg_pixmap);
_bg_pixel = None; _bg_pixel = None;
} else { } else {
unsigned int pix = _texture->color().pixel(); unsigned int pix = _texture->color().pixel();
if (pix != _bg_pixel) { if (pix != _bg_pixel) {
_bg_pixel = pix; _bg_pixel = pix;
XSetWindowBackground(otk::OBDisplay::display, _window, pix); XSetWindowBackground(Display::display, _window, pix);
} }
} }
} }
void OtkWidget::adjust(void) void Widget::adjust(void)
{ {
if (_direction == Horizontal) if (_direction == Horizontal)
adjustHorz(); adjustHorz();
@ -276,17 +276,17 @@ void OtkWidget::adjust(void)
adjustVert(); adjustVert();
} }
void OtkWidget::adjustHorz(void) void Widget::adjustHorz(void)
{ {
if (_children.size() == 0) if (_children.size() == 0)
return; return;
OtkWidget *tmp; Widget *tmp;
OtkWidgetList::iterator it, end = _children.end(); WidgetList::iterator it, end = _children.end();
int tallest = 0; int tallest = 0;
int width = _bevel_width; int width = _bevel_width;
OtkWidgetList stretchable; WidgetList stretchable;
for (it = _children.begin(); it != end; ++it) { for (it = _children.begin(); it != end; ++it) {
tmp = *it; tmp = *it;
@ -303,7 +303,7 @@ void OtkWidget::adjustHorz(void)
} }
if (stretchable.size() > 0) { if (stretchable.size() > 0) {
OtkWidgetList::iterator str_it = stretchable.begin(), WidgetList::iterator str_it = stretchable.begin(),
str_end = stretchable.end(); str_end = stretchable.end();
int str_width = _rect.width() - width / stretchable.size(); int str_width = _rect.width() - width / stretchable.size();
@ -313,7 +313,7 @@ void OtkWidget::adjustHorz(void)
: _bevel_width); : _bevel_width);
} }
OtkWidget *prev_widget = 0; Widget *prev_widget = 0;
for (it = _children.begin(); it != end; ++it) { for (it = _children.begin(); it != end; ++it) {
tmp = *it; tmp = *it;
@ -333,17 +333,17 @@ void OtkWidget::adjustHorz(void)
internalResize(width, tallest + _bevel_width * 2); internalResize(width, tallest + _bevel_width * 2);
} }
void OtkWidget::adjustVert(void) void Widget::adjustVert(void)
{ {
if (_children.size() == 0) if (_children.size() == 0)
return; return;
OtkWidget *tmp; Widget *tmp;
OtkWidgetList::iterator it, end = _children.end(); WidgetList::iterator it, end = _children.end();
int widest = 0; int widest = 0;
int height = _bevel_width; int height = _bevel_width;
OtkWidgetList stretchable; WidgetList stretchable;
for (it = _children.begin(); it != end; ++it) { for (it = _children.begin(); it != end; ++it) {
tmp = *it; tmp = *it;
@ -360,7 +360,7 @@ void OtkWidget::adjustVert(void)
} }
if (stretchable.size() > 0) { if (stretchable.size() > 0) {
OtkWidgetList::iterator str_it = stretchable.begin(), WidgetList::iterator str_it = stretchable.begin(),
str_end = stretchable.end(); str_end = stretchable.end();
int str_height = _rect.height() - height / stretchable.size(); int str_height = _rect.height() - height / stretchable.size();
@ -370,7 +370,7 @@ void OtkWidget::adjustVert(void)
str_height - _bevel_width : _bevel_width); str_height - _bevel_width : _bevel_width);
} }
OtkWidget *prev_widget = 0; Widget *prev_widget = 0;
for (it = _children.begin(); it != end; ++it) { for (it = _children.begin(); it != end; ++it) {
tmp = *it; tmp = *it;
@ -390,22 +390,22 @@ void OtkWidget::adjustVert(void)
internalResize(widest + _bevel_width * 2, height); internalResize(widest + _bevel_width * 2, height);
} }
void OtkWidget::update(void) void Widget::update(void)
{ {
if (_dirty) { if (_dirty) {
adjust(); adjust();
render(); render();
XClearWindow(OBDisplay::display, _window); XClearWindow(Display::display, _window);
} }
OtkWidgetList::iterator it = _children.begin(), end = _children.end(); WidgetList::iterator it = _children.begin(), end = _children.end();
for (; it != end; ++it) for (; it != end; ++it)
(*it)->update(); (*it)->update();
_dirty = false; _dirty = false;
} }
void OtkWidget::internalResize(int w, int h) void Widget::internalResize(int w, int h)
{ {
assert(w > 0 && h > 0); assert(w > 0 && h > 0);
@ -417,7 +417,7 @@ void OtkWidget::internalResize(int w, int h)
resize(_rect.width(), h); resize(_rect.width(), h);
} }
void OtkWidget::addChild(OtkWidget *child, bool front) void Widget::addChild(Widget *child, bool front)
{ {
assert(child); assert(child);
if (front) if (front)
@ -426,10 +426,10 @@ void OtkWidget::addChild(OtkWidget *child, bool front)
_children.push_back(child); _children.push_back(child);
} }
void OtkWidget::removeChild(OtkWidget *child) void Widget::removeChild(Widget *child)
{ {
assert(child); assert(child);
OtkWidgetList::iterator it, end = _children.end(); WidgetList::iterator it, end = _children.end();
for (it = _children.begin(); it != end; ++it) { for (it = _children.begin(); it != end; ++it) {
if ((*it) == child) if ((*it) == child)
break; break;
@ -439,19 +439,19 @@ void OtkWidget::removeChild(OtkWidget *child)
_children.erase(it); _children.erase(it);
} }
void OtkWidget::setStyle(Style *style) void Widget::setStyle(Style *style)
{ {
assert(style); assert(style);
_style = style; _style = style;
_dirty = true; _dirty = true;
OtkWidgetList::iterator it, end = _children.end(); WidgetList::iterator it, end = _children.end();
for (it = _children.begin(); it != end; ++it) for (it = _children.begin(); it != end; ++it)
(*it)->setStyle(style); (*it)->setStyle(style);
} }
void OtkWidget::setEventDispatcher(OtkEventDispatcher *disp) void Widget::setEventDispatcher(EventDispatcher *disp)
{ {
if (_event_dispatcher) if (_event_dispatcher)
_event_dispatcher->clearHandler(_window); _event_dispatcher->clearHandler(_window);
@ -459,16 +459,16 @@ void OtkWidget::setEventDispatcher(OtkEventDispatcher *disp)
_event_dispatcher->registerHandler(_window, this); _event_dispatcher->registerHandler(_window, this);
} }
void OtkWidget::exposeHandler(const XExposeEvent &e) void Widget::exposeHandler(const XExposeEvent &e)
{ {
OtkEventHandler::exposeHandler(e); EventHandler::exposeHandler(e);
_dirty = true; _dirty = true;
update(); update();
} }
void OtkWidget::configureHandler(const XConfigureEvent &e) void Widget::configureHandler(const XConfigureEvent &e)
{ {
OtkEventHandler::configureHandler(e); EventHandler::configureHandler(e);
if (_ignore_config) { if (_ignore_config) {
_ignore_config--; _ignore_config--;
} else { } else {

View file

@ -1,3 +1,4 @@
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
#ifndef __widget_hh #ifndef __widget_hh
#define __widget_hh #define __widget_hh
@ -17,20 +18,20 @@ extern "C" {
namespace otk { namespace otk {
class OtkWidget : public OtkEventHandler { class Widget : public EventHandler {
public: public:
enum Direction { Horizontal, Vertical }; enum Direction { Horizontal, Vertical };
typedef std::list<OtkWidget *> OtkWidgetList; typedef std::list<Widget *> WidgetList;
OtkWidget(otk::OtkWidget *parent, Direction = Horizontal); Widget(Widget *parent, Direction = Horizontal);
OtkWidget(otk::OtkEventDispatcher *event_dispatcher, otk::Style *style, Widget(EventDispatcher *event_dispatcher, Style *style,
Direction direction = Horizontal, Cursor cursor = 0, Direction direction = Horizontal, Cursor cursor = 0,
int bevel_width = 1, bool override_redirect = false); int bevel_width = 1, bool override_redirect = false);
virtual ~OtkWidget(); virtual ~Widget();
virtual void update(void); virtual void update(void);
@ -38,12 +39,12 @@ public:
void configureHandler(const XConfigureEvent &e); void configureHandler(const XConfigureEvent &e);
inline Window window(void) const { return _window; } inline Window window(void) const { return _window; }
inline const otk::OtkWidget *parent(void) const { return _parent; } inline const Widget *parent(void) const { return _parent; }
inline const OtkWidgetList &children(void) const { return _children; } inline const WidgetList &children(void) const { return _children; }
inline unsigned int screen(void) const { return _screen; } inline unsigned int screen(void) const { return _screen; }
inline const otk::Rect &rect(void) const { return _rect; } inline const Rect &rect(void) const { return _rect; }
void move(const otk::Point &to); void move(const Point &to);
void move(int x, int y); void move(int x, int y);
virtual void setWidth(int); virtual void setWidth(int);
@ -52,11 +53,11 @@ public:
virtual int width() const { return _rect.width(); } virtual int width() const { return _rect.width(); }
virtual int height() const { return _rect.height(); } virtual int height() const { return _rect.height(); }
virtual void resize(const otk::Point &to); virtual void resize(const Point &to);
virtual void resize(int x, int y); virtual void resize(int x, int y);
virtual void setGeometry(const otk::Rect &new_geom); virtual void setGeometry(const Rect &new_geom);
virtual void setGeometry(const otk::Point &topleft, int width, int height); virtual void setGeometry(const Point &topleft, int width, int height);
virtual void setGeometry(int x, int y, int width, int height); virtual void setGeometry(int x, int y, int width, int height);
inline bool isVisible(void) const { return _visible; }; inline bool isVisible(void) const { return _visible; };
@ -75,24 +76,24 @@ public:
bool grabKeyboard(void); bool grabKeyboard(void);
void ungrabKeyboard(void); void ungrabKeyboard(void);
inline otk::BTexture *texture(void) const { return _texture; } inline Texture *texture(void) const { return _texture; }
virtual void setTexture(otk::BTexture *texture) virtual void setTexture(Texture *texture)
{ _texture = texture; _dirty = true; } { _texture = texture; _dirty = true; }
inline const otk::BColor *borderColor(void) const { return _bcolor; } inline const Color *borderColor(void) const { return _bcolor; }
virtual void setBorderColor(const otk::BColor *color) { virtual void setBorderColor(const Color *color) {
assert(color); _bcolor = color; assert(color); _bcolor = color;
XSetWindowBorder(OBDisplay::display, _window, color->pixel()); XSetWindowBorder(Display::display, _window, color->pixel());
} }
inline int borderWidth(void) const { return _bwidth; } inline int borderWidth(void) const { return _bwidth; }
void setBorderWidth(int width) { void setBorderWidth(int width) {
_bwidth = width; _bwidth = width;
XSetWindowBorderWidth(otk::OBDisplay::display, _window, width); XSetWindowBorderWidth(Display::display, _window, width);
} }
virtual void addChild(OtkWidget *child, bool front = false); virtual void addChild(Widget *child, bool front = false);
virtual void removeChild(OtkWidget *child); virtual void removeChild(Widget *child);
inline bool isStretchableHorz(void) const { return _stretchable_horz; } inline bool isStretchableHorz(void) const { return _stretchable_horz; }
void setStretchableHorz(bool s_horz = true) { _stretchable_horz = s_horz; } void setStretchableHorz(bool s_horz = true) { _stretchable_horz = s_horz; }
@ -103,22 +104,22 @@ public:
inline Cursor cursor(void) const { return _cursor; } inline Cursor cursor(void) const { return _cursor; }
void setCursor(Cursor cursor) { void setCursor(Cursor cursor) {
_cursor = cursor; _cursor = cursor;
XDefineCursor(OBDisplay::display, _window, _cursor); XDefineCursor(Display::display, _window, _cursor);
} }
inline int bevelWidth(void) const { return _bevel_width; } inline int bevelWidth(void) const { return _bevel_width; }
void setBevelWidth(int bevel_width) void setBevelWidth(int bevel_width)
{ assert(bevel_width > 0); _bevel_width = bevel_width; } { assert(bevel_width > 0); _bevel_width = bevel_width; }
inline Direction direction(void) const { return _direction; } inline Direction direction(void) const { return _direction; }
void setDirection(Direction dir) { _direction = dir; } void setDirection(Direction dir) { _direction = dir; }
inline otk::Style *style(void) const { return _style; } inline Style *style(void) const { return _style; }
virtual void setStyle(otk::Style *style); virtual void setStyle(Style *style);
inline otk::OtkEventDispatcher *eventDispatcher(void) inline EventDispatcher *eventDispatcher(void)
{ return _event_dispatcher; } { return _event_dispatcher; }
void setEventDispatcher(otk::OtkEventDispatcher *disp); void setEventDispatcher(EventDispatcher *disp);
protected: protected:
@ -134,8 +135,8 @@ protected:
Window _window; Window _window;
OtkWidget *_parent; Widget *_parent;
OtkWidgetList _children; WidgetList _children;
Style *_style; Style *_style;
Direction _direction; Direction _direction;
@ -151,11 +152,11 @@ protected:
bool _stretchable_vert; bool _stretchable_vert;
bool _stretchable_horz; bool _stretchable_horz;
BTexture *_texture; Texture *_texture;
Pixmap _bg_pixmap; Pixmap _bg_pixmap;
unsigned int _bg_pixel; unsigned int _bg_pixel;
const BColor *_bcolor; const Color *_bcolor;
unsigned int _bwidth; unsigned int _bwidth;
Rect _rect; Rect _rect;
@ -164,7 +165,7 @@ protected:
bool _fixed_width; bool _fixed_width;
bool _fixed_height; bool _fixed_height;
OtkEventDispatcher *_event_dispatcher; EventDispatcher *_event_dispatcher;
}; };
} }