hardcode some bitmap masks
This commit is contained in:
parent
11f59d7925
commit
17d6318499
4 changed files with 104 additions and 1 deletions
|
@ -31,6 +31,8 @@ void FocusLabel::setStyle(RenderStyle *style)
|
|||
|
||||
void FocusLabel::renderForeground()
|
||||
{
|
||||
otk::Widget::renderForeground();
|
||||
|
||||
const Font *ft = style()->labelFont();
|
||||
RenderColor *text_color = (isFocused() ? style()->textFocusColor()
|
||||
: style()->textUnfocusColor());
|
||||
|
|
|
@ -27,6 +27,8 @@ void Label::setStyle(RenderStyle *style)
|
|||
|
||||
void Label::renderForeground(void)
|
||||
{
|
||||
otk::Widget::renderForeground();
|
||||
|
||||
const Font *ft = style()->labelFont();
|
||||
unsigned int sidemargin = style()->bevelWidth() * 2;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include "renderstyle.hh"
|
||||
#include "display.hh"
|
||||
#include "screeninfo.hh"
|
||||
|
||||
namespace otk {
|
||||
|
||||
|
@ -166,6 +168,82 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
|
|||
0x0);
|
||||
|
||||
_label_font = new Font(_screen, "Arial,Sans-9:bold", true, 1, 0x40);
|
||||
|
||||
XImage *image = XCreateImage(**display,
|
||||
display->screenInfo(_screen)->visual(),
|
||||
2, XYBitmap, 0, NULL, 8, 8, 0, 0);
|
||||
assert(image);
|
||||
|
||||
_max_mask = new PixmapMask();
|
||||
_max_mask->w = _max_mask->h = 8;
|
||||
{
|
||||
unsigned char data[] = {
|
||||
0,1,1,1,1,1,1,0,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,0,0,0,0,1,1,
|
||||
1,1,0,0,0,0,1,1,
|
||||
1,1,0,0,0,0,1,1,
|
||||
1,1,0,0,0,0,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
0,1,1,1,1,1,1,0 };
|
||||
image->data = (char*)data;
|
||||
XPutImage(**display, _max_mask->mask, DefaultGC(**display, _screen),
|
||||
image, 0, 0, 0, 0, 8, 8);
|
||||
}
|
||||
|
||||
_icon_mask = new PixmapMask();
|
||||
_icon_mask->w = _icon_mask->h = 8;
|
||||
{
|
||||
unsigned char data[] = {
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
1,1,0,0,0,0,1,1,
|
||||
1,1,1,0,0,1,1,1,
|
||||
0,1,1,1,1,1,1,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,0,0,1,1,0,0,0,
|
||||
0,0,0,0,0,0,0,0 };
|
||||
image->data = (char*)data;
|
||||
XPutImage(**display, _icon_mask->mask, DefaultGC(**display, _screen),
|
||||
image, 0, 0, 0, 0, 8, 8);
|
||||
}
|
||||
|
||||
_stick_mask = new PixmapMask();
|
||||
_stick_mask->w = _stick_mask->h = 8;
|
||||
{
|
||||
unsigned char data[] = {
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,1,1,0,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,0,0,1,1,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0 };
|
||||
image->data = (char*)data;
|
||||
XPutImage(**display, _stick_mask->mask, DefaultGC(**display, _screen),
|
||||
image, 0, 0, 0, 0, 8, 8);
|
||||
}
|
||||
|
||||
_close_mask = new PixmapMask();
|
||||
_close_mask->w = _close_mask->h = 8;
|
||||
{
|
||||
unsigned char data[] = {
|
||||
1,1,0,0,0,0,1,1,
|
||||
1,1,1,0,0,1,1,1,
|
||||
0,1,1,1,1,1,1,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,1,1,1,1,1,1,0,
|
||||
1,1,1,0,0,1,1,1,
|
||||
1,1,0,0,0,0,1,1 };
|
||||
image->data = (char*)data;
|
||||
XPutImage(**display, _close_mask->mask, DefaultGC(**display, _screen),
|
||||
image, 0, 0, 0, 0, 8, 8);
|
||||
}
|
||||
|
||||
image->data = NULL;
|
||||
XDestroyImage(image);
|
||||
}
|
||||
|
||||
RenderStyle::~RenderStyle()
|
||||
|
@ -199,6 +277,11 @@ RenderStyle::~RenderStyle()
|
|||
delete _grip_unfocus;
|
||||
|
||||
delete _label_font;
|
||||
|
||||
delete _max_mask;
|
||||
delete _icon_mask;
|
||||
delete _stick_mask;
|
||||
delete _close_mask;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
|
||||
namespace otk {
|
||||
|
||||
struct PixmapMask {
|
||||
Pixmap mask;
|
||||
unsigned int w, h;
|
||||
PixmapMask() { mask = None; w = h = 0; }
|
||||
};
|
||||
|
||||
class RenderStyle {
|
||||
public:
|
||||
enum TextJustify {
|
||||
|
@ -55,6 +61,11 @@ private:
|
|||
Font *_label_font;
|
||||
TextJustify _label_justify;
|
||||
|
||||
PixmapMask *_max_mask;
|
||||
PixmapMask *_icon_mask;
|
||||
PixmapMask *_stick_mask;
|
||||
PixmapMask *_close_mask;
|
||||
|
||||
int _handle_width;
|
||||
int _bevel_width;
|
||||
|
||||
|
@ -101,12 +112,17 @@ public:
|
|||
inline RenderTexture *buttonPressUnfocusBackground() const
|
||||
{ return _button_press_unfocus; }
|
||||
|
||||
inline RenderTexture *gripdFocusBackground() const { return _grip_focus; }
|
||||
inline RenderTexture *gripFocusBackground() const { return _grip_focus; }
|
||||
inline RenderTexture *gripUnfocusBackground() const { return _grip_unfocus; }
|
||||
|
||||
inline Font *labelFont() const { return _label_font; }
|
||||
inline TextJustify labelTextJustify() const { return _label_justify; }
|
||||
|
||||
inline PixmapMask *maximizeMask() const { return _max_mask; }
|
||||
inline PixmapMask *iconifyMask() const { return _icon_mask; }
|
||||
inline PixmapMask *stickyMask() const { return _stick_mask; }
|
||||
inline PixmapMask *closeMask() const { return _close_mask; }
|
||||
|
||||
inline int handleWidth() const { return _handle_width; }
|
||||
inline int bevelWidth() const { return _bevel_width; }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue