otk using new render shit.. supposedly
This commit is contained in:
parent
75e8fc2705
commit
033e9843bc
19 changed files with 90 additions and 91 deletions
|
@ -30,22 +30,16 @@ Application::Application(int argc, char **argv)
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
|
|
||||||
const ScreenInfo *s_info = _display.screenInfo(DefaultScreen(*_display));
|
|
||||||
|
|
||||||
Timer::initialize();
|
Timer::initialize();
|
||||||
RenderColor::initialize();
|
RenderColor::initialize();
|
||||||
Property::initialize();
|
Property::initialize();
|
||||||
_img_ctrl = new ImageControl(s_info, True, 4, 5, 200);
|
_style = new RenderStyle(DefaultScreen(*_display), ""); // XXX: get a path!
|
||||||
_style_conf = new Configuration(False);
|
|
||||||
_style = new Style(_img_ctrl);
|
|
||||||
|
|
||||||
loadStyle();
|
loadStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
delete _style_conf;
|
|
||||||
delete _img_ctrl;
|
|
||||||
delete _style;
|
delete _style;
|
||||||
RenderColor::destroy();
|
RenderColor::destroy();
|
||||||
Timer::destroy();
|
Timer::destroy();
|
||||||
|
@ -53,14 +47,9 @@ Application::~Application()
|
||||||
|
|
||||||
void Application::loadStyle(void)
|
void Application::loadStyle(void)
|
||||||
{
|
{
|
||||||
// find the style name as a property
|
// XXX: 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";
|
||||||
_style_conf->setFile(style);
|
//_style->load(style);
|
||||||
if (!_style_conf->load()) {
|
|
||||||
std::cerr << "ERROR: Unable to load style \"" << style << "\".\n";
|
|
||||||
::exit(1);
|
|
||||||
}
|
|
||||||
_style->load(*_style_conf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::run(void)
|
void Application::run(void)
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
#include "eventdispatcher.hh"
|
#include "eventdispatcher.hh"
|
||||||
#include "display.hh"
|
#include "display.hh"
|
||||||
#include "configuration.hh"
|
#include "renderstyle.hh"
|
||||||
#include "image.hh"
|
|
||||||
#include "style.hh"
|
|
||||||
|
|
||||||
namespace otk {
|
namespace otk {
|
||||||
|
|
||||||
|
@ -25,16 +23,14 @@ 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 Style *getStyle(void) const { return _style; }
|
inline RenderStyle *getStyle(void) const { return _style; }
|
||||||
// more accessors
|
// more accessors
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadStyle(void);
|
void loadStyle(void);
|
||||||
|
|
||||||
Display _display;
|
Display _display;
|
||||||
ImageControl *_img_ctrl;
|
RenderStyle *_style;
|
||||||
Configuration *_style_conf;
|
|
||||||
Style *_style;
|
|
||||||
bool _dockable;
|
bool _dockable;
|
||||||
|
|
||||||
int _appwidget_count;
|
int _appwidget_count;
|
||||||
|
|
|
@ -19,15 +19,14 @@ Button::~Button()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Button::setStyle(Style *style)
|
void Button::setStyle(RenderStyle *style)
|
||||||
{
|
{
|
||||||
FocusLabel::setStyle(style);
|
FocusLabel::setStyle(style);
|
||||||
|
|
||||||
// XXX: do this again
|
setTexture(style->buttonUnpressFocusBackground());
|
||||||
//setTexture(style->getButtonFocus());
|
setUnfocusTexture(style->buttonUnpressUnfocusBackground());
|
||||||
//setUnfocusTexture(style->getButtonUnfocus());
|
_pressed_focus_tx = style->buttonPressFocusBackground();
|
||||||
//_pressed_focus_tx = style->getButtonPressedFocus();
|
_pressed_unfocus_tx = style->buttonPressUnfocusBackground();
|
||||||
//_pressed_unfocus_tx = style->getButtonPressedUnfocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
void buttonPressHandler(const XButtonEvent &e);
|
void buttonPressHandler(const XButtonEvent &e);
|
||||||
void buttonReleaseHandler(const XButtonEvent &e);
|
void buttonReleaseHandler(const XButtonEvent &e);
|
||||||
|
|
||||||
virtual void setStyle(Style *style);
|
virtual void setStyle(RenderStyle *style);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -20,22 +20,21 @@ FocusLabel::~FocusLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FocusLabel::setStyle(Style *style)
|
void FocusLabel::setStyle(RenderStyle *style)
|
||||||
{
|
{
|
||||||
FocusWidget::setStyle(style);
|
FocusWidget::setStyle(style);
|
||||||
|
|
||||||
// XXX: do this again
|
setTexture(style->labelFocusBackground());
|
||||||
//setTexture(style->getLabelFocus());
|
setUnfocusTexture(style->labelUnfocusBackground());
|
||||||
//setUnfocusTexture(style->getLabelUnfocus());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FocusLabel::renderForeground(void)
|
void FocusLabel::renderForeground(void)
|
||||||
{
|
{
|
||||||
const Font *ft = style()->getFont();
|
const Font *ft = style()->labelFont();
|
||||||
Color *text_color = (isFocused() ? style()->getTextFocus()
|
RenderColor *text_color = (isFocused() ? style()->textFocusColor()
|
||||||
: style()->getTextUnfocus());
|
: style()->textUnfocusColor());
|
||||||
unsigned int sidemargin = style()->getBevelWidth() * 2;
|
unsigned int sidemargin = style()->bevelWidth() * 2;
|
||||||
|
|
||||||
ustring t = _text; // the actual text to draw
|
ustring t = _text; // the actual text to draw
|
||||||
int x = sidemargin; // x coord for the text
|
int x = sidemargin; // x coord for the text
|
||||||
|
@ -54,14 +53,14 @@ void FocusLabel::renderForeground(void)
|
||||||
} while (length > max_length && text_len-- > 0);
|
} while (length > max_length && text_len-- > 0);
|
||||||
|
|
||||||
// justify the text
|
// justify the text
|
||||||
switch (style()->textJustify()) {
|
switch (style()->labelTextJustify()) {
|
||||||
case Style::RightJustify:
|
case RenderStyle::RightJustify:
|
||||||
x += max_length - length;
|
x += max_length - length;
|
||||||
break;
|
break;
|
||||||
case Style::CenterJustify:
|
case RenderStyle::CenterJustify:
|
||||||
x += (max_length - length) / 2;
|
x += (max_length - length) / 2;
|
||||||
break;
|
break;
|
||||||
case Style::LeftJustify:
|
case RenderStyle::LeftJustify:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
void renderForeground(void);
|
void renderForeground(void);
|
||||||
|
|
||||||
virtual void setStyle(Style *style);
|
virtual void setStyle(RenderStyle *style);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Text displayed in the label
|
//! Text displayed in the label
|
||||||
|
|
|
@ -55,7 +55,7 @@ void FocusWidget::setTexture(RenderTexture *texture)
|
||||||
_focus_texture = texture;
|
_focus_texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FocusWidget::setBorderColor(const Color *color)
|
void FocusWidget::setBorderColor(const RenderColor *color)
|
||||||
{
|
{
|
||||||
Widget::setBorderColor(color);
|
Widget::setBorderColor(color);
|
||||||
_focus_bcolor = color;
|
_focus_bcolor = color;
|
||||||
|
|
|
@ -18,16 +18,16 @@ public:
|
||||||
virtual void unfocus(void);
|
virtual void unfocus(void);
|
||||||
|
|
||||||
virtual void setTexture(RenderTexture *texture);
|
virtual void setTexture(RenderTexture *texture);
|
||||||
virtual void setBorderColor(const Color *color);
|
virtual void setBorderColor(const RenderColor *color);
|
||||||
|
|
||||||
inline void setUnfocusTexture(RenderTexture *texture)
|
inline void setUnfocusTexture(RenderTexture *texture)
|
||||||
{ _unfocus_texture = texture; }
|
{ _unfocus_texture = texture; }
|
||||||
inline RenderTexture *getUnfocusTexture(void) const
|
inline RenderTexture *getUnfocusTexture(void) const
|
||||||
{ return _unfocus_texture; }
|
{ return _unfocus_texture; }
|
||||||
|
|
||||||
inline void setUnfocusBorderColor(const Color *color)
|
inline void setUnfocusBorderColor(const RenderColor *color)
|
||||||
{ _unfocus_bcolor = color; }
|
{ _unfocus_bcolor = color; }
|
||||||
inline const Color *getUnfocusBorderColor(void) const
|
inline const RenderColor *getUnfocusBorderColor(void) const
|
||||||
{ return _unfocus_bcolor; }
|
{ return _unfocus_bcolor; }
|
||||||
|
|
||||||
inline bool isFocused(void) const { return _focused; }
|
inline bool isFocused(void) const { return _focused; }
|
||||||
|
@ -38,8 +38,8 @@ private:
|
||||||
RenderTexture *_unfocus_texture;
|
RenderTexture *_unfocus_texture;
|
||||||
RenderTexture *_focus_texture;
|
RenderTexture *_focus_texture;
|
||||||
|
|
||||||
const Color *_unfocus_bcolor;
|
const RenderColor *_unfocus_bcolor;
|
||||||
const Color *_focus_bcolor;
|
const RenderColor *_focus_bcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
19
otk/label.cc
19
otk/label.cc
|
@ -17,19 +17,18 @@ Label::~Label()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::setStyle(Style *style)
|
void Label::setStyle(RenderStyle *style)
|
||||||
{
|
{
|
||||||
Widget::setStyle(style);
|
Widget::setStyle(style);
|
||||||
|
|
||||||
// XXX: do this again
|
setTexture(style->labelUnfocusBackground());
|
||||||
//setTexture(style->getLabelUnfocus());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Label::renderForeground(void)
|
void Label::renderForeground(void)
|
||||||
{
|
{
|
||||||
const Font *ft = style()->getFont();
|
const Font *ft = style()->labelFont();
|
||||||
unsigned int sidemargin = style()->getBevelWidth() * 2;
|
unsigned int sidemargin = style()->bevelWidth() * 2;
|
||||||
|
|
||||||
ustring t = _text; // the actual text to draw
|
ustring t = _text; // the actual text to draw
|
||||||
int x = sidemargin; // x coord for the text
|
int x = sidemargin; // x coord for the text
|
||||||
|
@ -48,20 +47,20 @@ void Label::renderForeground(void)
|
||||||
} while (length > max_length && text_len-- > 0);
|
} while (length > max_length && text_len-- > 0);
|
||||||
|
|
||||||
// justify the text
|
// justify the text
|
||||||
switch (style()->textJustify()) {
|
switch (style()->labelTextJustify()) {
|
||||||
case Style::RightJustify:
|
case RenderStyle::RightJustify:
|
||||||
x += max_length - length;
|
x += max_length - length;
|
||||||
break;
|
break;
|
||||||
case Style::CenterJustify:
|
case RenderStyle::CenterJustify:
|
||||||
x += (max_length - length) / 2;
|
x += (max_length - length) / 2;
|
||||||
break;
|
break;
|
||||||
case Style::LeftJustify:
|
case RenderStyle::LeftJustify:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
display->renderControl(_screen)->
|
display->renderControl(_screen)->
|
||||||
drawString(*_surface, *ft, x, 0, *style()->getTextUnfocus(), t);
|
drawString(*_surface, *ft, x, 0, *style()->textUnfocusColor(), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
virtual void renderForeground(void);
|
virtual void renderForeground(void);
|
||||||
|
|
||||||
virtual void setStyle(Style *style);
|
virtual void setStyle(RenderStyle *style);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Text to be displayed in the label
|
//! Text to be displayed in the label
|
||||||
|
|
|
@ -15,8 +15,8 @@ int main(int argc, char **argv) {
|
||||||
otk::AppWidget foo(&app);
|
otk::AppWidget foo(&app);
|
||||||
|
|
||||||
foo.resize(600, 500);
|
foo.resize(600, 500);
|
||||||
foo.setTexture(app.getStyle()->getTitleFocus());
|
foo.setTexture(app.getStyle()->titlebarFocusBackground());
|
||||||
// foo.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
|
// foo.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
|
||||||
|
|
||||||
foo.setBevelWidth(2);
|
foo.setBevelWidth(2);
|
||||||
foo.setDirection(otk::Widget::Horizontal);
|
foo.setDirection(otk::Widget::Horizontal);
|
||||||
|
@ -27,15 +27,15 @@ int main(int argc, char **argv) {
|
||||||
left.setDirection(otk::Widget::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()->titlebarFocusBackground());
|
||||||
left.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
|
left.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
|
||||||
|
|
||||||
right.setDirection(otk::Widget::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()->titlebarFocusBackground());
|
||||||
right.setUnfocusTexture(app.getStyle()->getTitleUnfocus());
|
right.setUnfocusTexture(app.getStyle()->titlebarUnfocusBackground());
|
||||||
|
|
||||||
otk::Button iconb(&left);
|
otk::Button iconb(&left);
|
||||||
iconb.resize(40,20);
|
iconb.resize(40,20);
|
||||||
|
@ -51,8 +51,8 @@ int main(int argc, char **argv) {
|
||||||
//label.setHeight(20);
|
//label.setHeight(20);
|
||||||
label.setStretchableVert(true);
|
label.setStretchableVert(true);
|
||||||
label.setStretchableHorz(true);
|
label.setStretchableHorz(true);
|
||||||
label.setTexture(app.getStyle()->getLabelFocus());
|
label.setTexture(app.getStyle()->labelFocusBackground());
|
||||||
label.setUnfocusTexture(app.getStyle()->getLabelUnfocus());
|
label.setUnfocusTexture(app.getStyle()->labelUnfocusBackground());
|
||||||
|
|
||||||
// fixed size
|
// fixed size
|
||||||
maxb.setText("bar");
|
maxb.setText("bar");
|
||||||
|
@ -66,8 +66,8 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
rblef.setStretchableHorz(true);
|
rblef.setStretchableHorz(true);
|
||||||
rblef.setHeight(50);
|
rblef.setHeight(50);
|
||||||
rblef.setTexture(app.getStyle()->getHandleFocus());
|
rblef.setTexture(app.getStyle()->handleFocusBackground());
|
||||||
rblef.setUnfocusTexture(app.getStyle()->getHandleUnfocus());
|
rblef.setUnfocusTexture(app.getStyle()->handleUnfocusBackground());
|
||||||
|
|
||||||
rbutt1.setText("this is fucking tight");
|
rbutt1.setText("this is fucking tight");
|
||||||
rbutt2.setText("heh, WOOP");
|
rbutt2.setText("heh, WOOP");
|
||||||
|
@ -77,7 +77,7 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
foo.show();
|
foo.show();
|
||||||
|
|
||||||
app.exec();
|
app.run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,8 @@ void RenderColor::create()
|
||||||
xcol.pixel = 0;
|
xcol.pixel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gcv.foreground = xcol.pixel;
|
_pixel = xcol.pixel;
|
||||||
|
gcv.foreground = _pixel;
|
||||||
gcv.cap_style = CapProjecting;
|
gcv.cap_style = CapProjecting;
|
||||||
_gc = XCreateGC(**display, info->rootWindow(),
|
_gc = XCreateGC(**display, info->rootWindow(),
|
||||||
GCForeground | GCCapStyle, &gcv);
|
GCForeground | GCCapStyle, &gcv);
|
||||||
|
|
|
@ -36,6 +36,7 @@ private:
|
||||||
unsigned char _red;
|
unsigned char _red;
|
||||||
unsigned char _green;
|
unsigned char _green;
|
||||||
unsigned char _blue;
|
unsigned char _blue;
|
||||||
|
unsigned long _pixel;
|
||||||
|
|
||||||
GC _gc;
|
GC _gc;
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ public:
|
||||||
inline unsigned char red() const { return _red; }
|
inline unsigned char red() const { return _red; }
|
||||||
inline unsigned char green() const { return _green; }
|
inline unsigned char green() const { return _green; }
|
||||||
inline unsigned char blue() const { return _blue; }
|
inline unsigned char blue() const { return _blue; }
|
||||||
|
inline unsigned long pixel() const { return _pixel; }
|
||||||
inline GC gc() const { return _gc; }
|
inline GC gc() const { return _gc; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
#include "rendercontrol.hh"
|
#include "rendercontrol.hh"
|
||||||
#include "truerendercontrol.hh"
|
#include "truerendercontrol.hh"
|
||||||
#include "rendertexture.hh"
|
#include "rendertexture.hh"
|
||||||
|
#include "rendercolor.hh"
|
||||||
#include "display.hh"
|
#include "display.hh"
|
||||||
#include "screeninfo.hh"
|
#include "screeninfo.hh"
|
||||||
#include "surface.hh"
|
#include "surface.hh"
|
||||||
#include "color.hh"
|
|
||||||
#include "font.hh"
|
#include "font.hh"
|
||||||
#include "ustring.hh"
|
#include "ustring.hh"
|
||||||
|
|
||||||
|
@ -61,7 +61,8 @@ RenderControl::~RenderControl()
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderControl::drawString(Surface& sf, const Font &font, int x, int y,
|
void RenderControl::drawString(Surface& sf, const Font &font, int x, int y,
|
||||||
const Color &color, const ustring &string) const
|
const RenderColor &color,
|
||||||
|
const ustring &string) const
|
||||||
{
|
{
|
||||||
assert(sf._screen == _screen);
|
assert(sf._screen == _screen);
|
||||||
XftDraw *d = sf._xftdraw;
|
XftDraw *d = sf._xftdraw;
|
||||||
|
|
|
@ -13,7 +13,7 @@ class ScreenInfo;
|
||||||
class Surface;
|
class Surface;
|
||||||
class RenderTexture;
|
class RenderTexture;
|
||||||
class Font;
|
class Font;
|
||||||
class Color;
|
class RenderColor;
|
||||||
class ustring;
|
class ustring;
|
||||||
|
|
||||||
class RenderControl {
|
class RenderControl {
|
||||||
|
@ -73,7 +73,8 @@ public:
|
||||||
|
|
||||||
//! Draws a string onto a Surface
|
//! Draws a string onto a Surface
|
||||||
virtual void drawString(Surface& sf, const Font& font, int x, int y,
|
virtual void drawString(Surface& sf, const Font& font, int x, int y,
|
||||||
const Color& color, const ustring& string) const;
|
const RenderColor& color,
|
||||||
|
const ustring& string) const;
|
||||||
|
|
||||||
//! Draws a background onto a Surface, as specified by a RenderTexture
|
//! Draws a background onto a Surface, as specified by a RenderTexture
|
||||||
virtual void drawBackground(Surface& sf,
|
virtual void drawBackground(Surface& sf,
|
||||||
|
|
|
@ -62,6 +62,8 @@ public:
|
||||||
RenderStyle(int screen, const std::string &stylefile);
|
RenderStyle(int screen, const std::string &stylefile);
|
||||||
virtual ~RenderStyle();
|
virtual ~RenderStyle();
|
||||||
|
|
||||||
|
inline int screen() const { return _screen; }
|
||||||
|
|
||||||
inline RenderColor *textFocusColor() const { return _text_color_focus; }
|
inline RenderColor *textFocusColor() const { return _text_color_focus; }
|
||||||
inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; }
|
inline RenderColor *textUnfocusColor() const { return _text_color_unfocus; }
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ public:
|
||||||
{ return _button_unpress_unfocus; }
|
{ return _button_unpress_unfocus; }
|
||||||
inline RenderTexture *buttonPressFocusBackground() const
|
inline RenderTexture *buttonPressFocusBackground() const
|
||||||
{ return _button_press_focus; }
|
{ return _button_press_focus; }
|
||||||
inline RenderTexture *buttonPressUnfocusBackgrounf() const
|
inline RenderTexture *buttonPressUnfocusBackground() const
|
||||||
{ return _button_press_unfocus; }
|
{ return _button_press_unfocus; }
|
||||||
|
|
||||||
inline RenderTexture *gripdFocusBackground() const { return _grip_focus; }
|
inline RenderTexture *gripdFocusBackground() const { return _grip_focus; }
|
||||||
|
|
|
@ -35,7 +35,7 @@ Widget::Widget(Widget *parent, Direction direction)
|
||||||
setStyle(_style); // let the widget initialize stuff
|
setStyle(_style); // let the widget initialize stuff
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::Widget(EventDispatcher *event_dispatcher, Style *style,
|
Widget::Widget(EventDispatcher *event_dispatcher, RenderStyle *style,
|
||||||
Direction direction, Cursor cursor, int bevel_width,
|
Direction direction, Cursor cursor, int bevel_width,
|
||||||
bool override_redirect)
|
bool override_redirect)
|
||||||
: EventHandler(),
|
: EventHandler(),
|
||||||
|
@ -45,7 +45,7 @@ Widget::Widget(EventDispatcher *event_dispatcher, Style *style,
|
||||||
_grabbed_mouse(false), _grabbed_keyboard(false),
|
_grabbed_mouse(false), _grabbed_keyboard(false),
|
||||||
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
|
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
|
||||||
_bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1),
|
_bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1),
|
||||||
_screen(style->getScreen()), _fixed_width(false), _fixed_height(false),
|
_screen(style->screen()), _fixed_width(false), _fixed_height(false),
|
||||||
_surface(0),
|
_surface(0),
|
||||||
_event_dispatcher(event_dispatcher)
|
_event_dispatcher(event_dispatcher)
|
||||||
{
|
{
|
||||||
|
@ -444,7 +444,7 @@ void Widget::removeChild(Widget *child)
|
||||||
_children.erase(it);
|
_children.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setStyle(Style *style)
|
void Widget::setStyle(RenderStyle *style)
|
||||||
{
|
{
|
||||||
assert(style);
|
assert(style);
|
||||||
_style = style;
|
_style = style;
|
||||||
|
@ -473,12 +473,22 @@ void Widget::exposeHandler(const XExposeEvent &e)
|
||||||
void Widget::configureHandler(const XConfigureEvent &e)
|
void Widget::configureHandler(const XConfigureEvent &e)
|
||||||
{
|
{
|
||||||
EventHandler::configureHandler(e);
|
EventHandler::configureHandler(e);
|
||||||
|
|
||||||
if (_ignore_config) {
|
if (_ignore_config) {
|
||||||
_ignore_config--;
|
_ignore_config--;
|
||||||
} else {
|
} else {
|
||||||
if (!(e.width == _rect.width() && e.height == _rect.height())) {
|
int width = e.width;
|
||||||
|
int height = e.height;
|
||||||
|
|
||||||
|
XEvent ev;
|
||||||
|
while (XCheckTypedWindowEvent(**display, _window, ConfigureNotify, &ev)) {
|
||||||
|
width = ev.xconfigure.width;
|
||||||
|
height = ev.xconfigure.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(width == _rect.width() && height == _rect.height())) {
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
_rect.setSize(e.width, e.height);
|
_rect.setSize(width, height);
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include "rect.hh"
|
#include "rect.hh"
|
||||||
#include "point.hh"
|
#include "point.hh"
|
||||||
#include "rendertexture.hh"
|
#include "rendertexture.hh"
|
||||||
#include "style.hh"
|
#include "renderstyle.hh"
|
||||||
#include "eventdispatcher.hh"
|
#include "eventdispatcher.hh"
|
||||||
#include "display.hh"
|
#include "display.hh"
|
||||||
#include "surface.hh"
|
#include "surface.hh"
|
||||||
|
@ -28,7 +28,7 @@ public:
|
||||||
typedef std::list<Widget *> WidgetList;
|
typedef std::list<Widget *> WidgetList;
|
||||||
|
|
||||||
Widget(Widget *parent, Direction = Horizontal);
|
Widget(Widget *parent, Direction = Horizontal);
|
||||||
Widget(EventDispatcher *event_dispatcher, Style *style,
|
Widget(EventDispatcher *event_dispatcher, RenderStyle *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);
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public:
|
||||||
virtual void setTexture(RenderTexture *texture)
|
virtual void setTexture(RenderTexture *texture)
|
||||||
{ _texture = texture; _dirty = true; }
|
{ _texture = texture; _dirty = true; }
|
||||||
|
|
||||||
inline const Color *borderColor(void) const { return _bcolor; }
|
inline const RenderColor *borderColor(void) const { return _bcolor; }
|
||||||
virtual void setBorderColor(const Color *color) {
|
virtual void setBorderColor(const RenderColor *color) {
|
||||||
assert(color); _bcolor = color;
|
assert(color); _bcolor = color;
|
||||||
XSetWindowBorder(**display, _window, color->pixel());
|
XSetWindowBorder(**display, _window, color->pixel());
|
||||||
}
|
}
|
||||||
|
@ -115,8 +115,8 @@ public:
|
||||||
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 Style *style(void) const { return _style; }
|
inline RenderStyle *style(void) const { return _style; }
|
||||||
virtual void setStyle(Style *style);
|
virtual void setStyle(RenderStyle *style);
|
||||||
|
|
||||||
inline EventDispatcher *eventDispatcher(void)
|
inline EventDispatcher *eventDispatcher(void)
|
||||||
{ return _event_dispatcher; }
|
{ return _event_dispatcher; }
|
||||||
|
@ -140,7 +140,7 @@ protected:
|
||||||
Widget *_parent;
|
Widget *_parent;
|
||||||
WidgetList _children;
|
WidgetList _children;
|
||||||
|
|
||||||
Style *_style;
|
RenderStyle *_style;
|
||||||
Direction _direction;
|
Direction _direction;
|
||||||
Cursor _cursor;
|
Cursor _cursor;
|
||||||
int _bevel_width;
|
int _bevel_width;
|
||||||
|
@ -158,7 +158,7 @@ protected:
|
||||||
Pixmap _bg_pixmap;
|
Pixmap _bg_pixmap;
|
||||||
unsigned int _bg_pixel;
|
unsigned int _bg_pixel;
|
||||||
|
|
||||||
const Color *_bcolor;
|
const RenderColor *_bcolor;
|
||||||
unsigned int _bwidth;
|
unsigned int _bwidth;
|
||||||
|
|
||||||
Rect _rect;
|
Rect _rect;
|
||||||
|
|
Loading…
Reference in a new issue