2003-01-11 19:17:13 +00:00
|
|
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
2002-11-06 13:51:23 +00:00
|
|
|
#ifndef __style_hh
|
|
|
|
#define __style_hh
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "color.hh"
|
|
|
|
#include "font.hh"
|
|
|
|
#include "texture.hh"
|
|
|
|
#include "image.hh"
|
|
|
|
#include "configuration.hh"
|
|
|
|
|
|
|
|
// XXX: document
|
|
|
|
|
|
|
|
namespace otk {
|
|
|
|
|
2002-12-24 21:27:16 +00:00
|
|
|
struct PixmapMask {
|
|
|
|
Pixmap mask;
|
|
|
|
unsigned int w, h;
|
2002-12-25 22:02:34 +00:00
|
|
|
PixmapMask() { mask = None; w = h = 0; }
|
2002-12-24 21:27:16 +00:00
|
|
|
};
|
|
|
|
|
2002-11-06 13:51:23 +00:00
|
|
|
class Style {
|
|
|
|
public:
|
|
|
|
|
2002-11-11 03:45:46 +00:00
|
|
|
enum Type { ButtonFocus, ButtonUnfocus, TitleFocus, TitleUnfocus,
|
|
|
|
LabelFocus, LabelUnfocus, HandleFocus, HandleUnfocus,
|
|
|
|
GripFocus, GripUnfocus };
|
|
|
|
|
2002-11-06 13:51:23 +00:00
|
|
|
enum TextJustify { LeftJustify = 1, RightJustify, CenterJustify };
|
|
|
|
enum BulletType { RoundBullet = 1, TriangleBullet, SquareBullet, NoBullet };
|
|
|
|
|
|
|
|
// private:
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
ImageControl *image_control;
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Color
|
2002-11-06 13:51:23 +00:00
|
|
|
l_text_focus, l_text_unfocus,
|
|
|
|
b_pic_focus, b_pic_unfocus;
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Color border_color;
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Font *font;
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Texture
|
2002-11-06 13:51:23 +00:00
|
|
|
f_focus, f_unfocus,
|
|
|
|
t_focus, t_unfocus,
|
|
|
|
l_focus, l_unfocus,
|
|
|
|
h_focus, h_unfocus,
|
|
|
|
b_focus, b_unfocus,
|
2002-12-26 17:22:53 +00:00
|
|
|
b_pressed_focus, b_pressed_unfocus,
|
2002-11-06 13:51:23 +00:00
|
|
|
g_focus, g_unfocus;
|
|
|
|
|
|
|
|
PixmapMask close_button, max_button, icon_button, stick_button;
|
|
|
|
TextJustify justify;
|
2002-11-11 03:45:46 +00:00
|
|
|
BulletType bullet_type;
|
2002-11-06 13:51:23 +00:00
|
|
|
|
|
|
|
unsigned int handle_width, bevel_width, frame_width, border_width;
|
|
|
|
|
|
|
|
unsigned int screen_number;
|
|
|
|
|
|
|
|
bool shadow_fonts, aa_fonts;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
Style();
|
2003-01-11 19:17:13 +00:00
|
|
|
Style(ImageControl *);
|
2002-11-06 13:51:23 +00:00
|
|
|
~Style();
|
|
|
|
|
|
|
|
void readDatabaseMask(const std::string &rname,
|
|
|
|
PixmapMask &pixmapMask,
|
2002-11-06 18:25:48 +00:00
|
|
|
const Configuration &style);
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Texture readDatabaseTexture(const std::string &rname,
|
2002-11-11 03:45:46 +00:00
|
|
|
const std::string &default_color,
|
|
|
|
const Configuration &style,
|
|
|
|
bool allowNoTexture = false);
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Color readDatabaseColor(const std::string &rname,
|
2002-11-11 03:45:46 +00:00
|
|
|
const std::string &default_color,
|
|
|
|
const Configuration &style);
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
Font *readDatabaseFont(const std::string &rbasename,
|
2002-11-11 03:45:46 +00:00
|
|
|
const Configuration &style);
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2002-11-11 10:03:11 +00:00
|
|
|
void load(const Configuration &style);
|
2002-11-06 13:51:23 +00:00
|
|
|
|
2002-12-27 10:07:57 +00:00
|
|
|
inline PixmapMask *getCloseButtonMask(void) { return &close_button; }
|
|
|
|
inline PixmapMask *getMaximizeButtonMask(void) { return &max_button; }
|
|
|
|
inline PixmapMask *getIconifyButtonMask(void) { return &icon_button; }
|
|
|
|
inline PixmapMask *getStickyButtonMask(void) { return &stick_button; }
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Color *getTextFocus(void) { return &l_text_focus; }
|
|
|
|
inline Color *getTextUnfocus(void) { return &l_text_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Color *getButtonPicFocus(void) { return &b_pic_focus; }
|
|
|
|
inline Color *getButtonPicUnfocus(void) { return &b_pic_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getTitleFocus(void) { return &t_focus; }
|
|
|
|
inline Texture *getTitleUnfocus(void) { return &t_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getLabelFocus(void) { return &l_focus; }
|
|
|
|
inline Texture *getLabelUnfocus(void) { return &l_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getHandleFocus(void) { return &h_focus; }
|
|
|
|
inline Texture *getHandleUnfocus(void) { return &h_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getButtonFocus(void) { return &b_focus; }
|
|
|
|
inline Texture *getButtonUnfocus(void) { return &b_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getButtonPressedFocus(void)
|
2002-12-26 17:22:53 +00:00
|
|
|
{ return &b_pressed_focus; }
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getButtonPressedUnfocus(void)
|
2002-11-11 03:45:46 +00:00
|
|
|
{ return &b_pressed_unfocus; }
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline Texture *getGripFocus(void) { return &g_focus; }
|
|
|
|
inline Texture *getGripUnfocus(void) { return &g_unfocus; }
|
2002-11-11 03:45:46 +00:00
|
|
|
|
2002-11-06 13:51:23 +00:00
|
|
|
inline unsigned int getHandleWidth(void) const { return handle_width; }
|
|
|
|
inline unsigned int getBevelWidth(void) const { return bevel_width; }
|
|
|
|
inline unsigned int getFrameWidth(void) const { return frame_width; }
|
|
|
|
inline unsigned int getBorderWidth(void) const { return border_width; }
|
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline const Font *getFont() const { return font; }
|
2002-11-16 09:59:37 +00:00
|
|
|
|
|
|
|
inline void setShadowFonts(bool fonts) { shadow_fonts = fonts; }
|
|
|
|
inline bool hasShadowFonts(void) const { return shadow_fonts; }
|
|
|
|
|
|
|
|
inline void setAAFonts(bool fonts) { aa_fonts = fonts; }
|
2002-11-11 03:45:46 +00:00
|
|
|
inline bool hasAAFonts(void) const { return aa_fonts; }
|
|
|
|
|
|
|
|
inline TextJustify textJustify(void) { return justify; }
|
|
|
|
inline BulletType bulletType(void) { return bullet_type; }
|
2002-11-10 08:12:53 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline const Color *getBorderColor() const { return &border_color; }
|
2002-11-10 09:44:27 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline const Texture *getFrameFocus() const { return &f_focus; }
|
|
|
|
inline const Texture *getFrameUnfocus() const { return &f_unfocus; }
|
2002-11-10 10:14:20 +00:00
|
|
|
|
2003-01-11 19:17:13 +00:00
|
|
|
inline void setImageControl(ImageControl *c) {
|
2002-11-11 10:03:11 +00:00
|
|
|
image_control = c;
|
2002-12-20 15:33:58 +00:00
|
|
|
screen_number = c->getScreenInfo()->screen();
|
2002-11-11 10:03:11 +00:00
|
|
|
}
|
2002-11-11 03:45:46 +00:00
|
|
|
inline unsigned int getScreen(void) { return screen_number; }
|
2002-11-06 13:51:23 +00:00
|
|
|
|
|
|
|
// XXX add inline accessors for the rest of the bummy
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __style_hh
|