dont need to specify otk:: when already in the namespace
This commit is contained in:
parent
9c82f9418b
commit
196996230c
2 changed files with 54 additions and 54 deletions
78
otk/style.cc
78
otk/style.cc
|
@ -19,7 +19,7 @@ Style::Style(unsigned int screen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::Style(unsigned int screen, otk::BImageControl *ctrl)
|
Style::Style(unsigned int screen, BImageControl *ctrl)
|
||||||
: image_control(ctrl), font(NULL), screen_number(screen)
|
: image_control(ctrl), font(NULL), screen_number(screen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -29,13 +29,13 @@ Style::~Style() {
|
||||||
delete font;
|
delete font;
|
||||||
|
|
||||||
if (close_button.mask != None)
|
if (close_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, close_button.mask);
|
XFreePixmap(OBDisplay::display, close_button.mask);
|
||||||
if (max_button.mask != None)
|
if (max_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, max_button.mask);
|
XFreePixmap(OBDisplay::display, max_button.mask);
|
||||||
if (icon_button.mask != None)
|
if (icon_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, icon_button.mask);
|
XFreePixmap(OBDisplay::display, icon_button.mask);
|
||||||
if (stick_button.mask != None)
|
if (stick_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, stick_button.mask);
|
XFreePixmap(OBDisplay::display, stick_button.mask);
|
||||||
|
|
||||||
max_button.mask = None;
|
max_button.mask = None;
|
||||||
close_button.mask = None;
|
close_button.mask = None;
|
||||||
|
@ -43,7 +43,7 @@ Style::~Style() {
|
||||||
stick_button.mask = None;
|
stick_button.mask = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Style::load(otk::Configuration &style) {
|
void Style::load(Configuration &style) {
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
// load fonts/fontsets
|
// load fonts/fontsets
|
||||||
|
@ -76,13 +76,13 @@ void Style::load(otk::Configuration &style) {
|
||||||
"black", style, true);
|
"black", style, true);
|
||||||
|
|
||||||
if (close_button.mask != None)
|
if (close_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, close_button.mask);
|
XFreePixmap(OBDisplay::display, close_button.mask);
|
||||||
if (max_button.mask != None)
|
if (max_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, max_button.mask);
|
XFreePixmap(OBDisplay::display, max_button.mask);
|
||||||
if (icon_button.mask != None)
|
if (icon_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, icon_button.mask);
|
XFreePixmap(OBDisplay::display, icon_button.mask);
|
||||||
if (stick_button.mask != None)
|
if (stick_button.mask != None)
|
||||||
XFreePixmap(otk::OBDisplay::display, stick_button.mask);
|
XFreePixmap(OBDisplay::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;
|
||||||
|
@ -94,13 +94,13 @@ void Style::load(otk::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
|
||||||
otk::BColor color = readDatabaseColor("window.frame.focusColor", "white",
|
BColor color = readDatabaseColor("window.frame.focusColor", "white",
|
||||||
style);
|
style);
|
||||||
f_focus = otk::BTexture("solid flat", screen_number, image_control);
|
f_focus = BTexture("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 = otk::BTexture("solid flat", screen_number, image_control);
|
f_unfocus = BTexture("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",
|
||||||
|
@ -123,20 +123,20 @@ void Style::load(otk::Configuration &style) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity checks
|
// sanity checks
|
||||||
if (t_focus.texture() == otk::BTexture::Parent_Relative)
|
if (t_focus.texture() == BTexture::Parent_Relative)
|
||||||
t_focus = f_focus;
|
t_focus = f_focus;
|
||||||
if (t_unfocus.texture() == otk::BTexture::Parent_Relative)
|
if (t_unfocus.texture() == BTexture::Parent_Relative)
|
||||||
t_unfocus = f_unfocus;
|
t_unfocus = f_unfocus;
|
||||||
if (h_focus.texture() == otk::BTexture::Parent_Relative)
|
if (h_focus.texture() == BTexture::Parent_Relative)
|
||||||
h_focus = f_focus;
|
h_focus = f_focus;
|
||||||
if (h_unfocus.texture() == otk::BTexture::Parent_Relative)
|
if (h_unfocus.texture() == BTexture::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 otk::ScreenInfo *s_info = otk::OBDisplay::screenInfo(screen_number);
|
const ScreenInfo *s_info = OBDisplay::screenInfo(screen_number);
|
||||||
unsigned int width = s_info->getRect().width();
|
unsigned int width = s_info->getRect().width();
|
||||||
|
|
||||||
if (! style.getValue("handleWidth", handle_width) ||
|
if (! style.getValue("handleWidth", handle_width) ||
|
||||||
|
@ -186,8 +186,8 @@ void Style::doJustify(const std::string &text, int &start_pos,
|
||||||
|
|
||||||
|
|
||||||
void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
|
void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
|
||||||
const otk::Configuration &style) {
|
const Configuration &style) {
|
||||||
Window root_window = otk::OBDisplay::screenInfo(screen_number)->getRootWindow();
|
Window root_window = OBDisplay::screenInfo(screen_number)->getRootWindow();
|
||||||
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.
|
||||||
|
@ -197,11 +197,11 @@ void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
|
||||||
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(otk::OBDisplay::display, root_window,
|
ret = XReadBitmapFile(OBDisplay::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);
|
||||||
} else
|
} else
|
||||||
ret = XReadBitmapFile(otk::OBDisplay::display, root_window,
|
ret = XReadBitmapFile(OBDisplay::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);
|
||||||
|
|
||||||
|
@ -214,26 +214,26 @@ void Style::readDatabaseMask(const std::string &rname, PixmapMask &pixmapMask,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
otk::BTexture Style::readDatabaseTexture(const std::string &rname,
|
BTexture Style::readDatabaseTexture(const std::string &rname,
|
||||||
const std::string &default_color,
|
const std::string &default_color,
|
||||||
const otk::Configuration &style,
|
const Configuration &style,
|
||||||
bool allowNoTexture)
|
bool allowNoTexture)
|
||||||
{
|
{
|
||||||
otk::BTexture texture;
|
BTexture texture;
|
||||||
std::string s;
|
std::string s;
|
||||||
|
|
||||||
if (style.getValue(rname, s))
|
if (style.getValue(rname, s))
|
||||||
texture = otk::BTexture(s);
|
texture = BTexture(s);
|
||||||
else if (allowNoTexture) //no default
|
else if (allowNoTexture) //no default
|
||||||
texture.setTexture(otk::BTexture::NoTexture);
|
texture.setTexture(BTexture::NoTexture);
|
||||||
else
|
else
|
||||||
texture.setTexture(otk::BTexture::Solid | otk::BTexture::Flat);
|
texture.setTexture(BTexture::Solid | BTexture::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() != otk::BTexture::NoTexture) {
|
if (texture.texture() != BTexture::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,
|
||||||
|
@ -246,21 +246,21 @@ otk::BTexture Style::readDatabaseTexture(const std::string &rname,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
otk::BColor Style::readDatabaseColor(const std::string &rname,
|
BColor Style::readDatabaseColor(const std::string &rname,
|
||||||
const std::string &default_color,
|
const std::string &default_color,
|
||||||
const otk::Configuration &style) {
|
const Configuration &style) {
|
||||||
otk::BColor color;
|
BColor color;
|
||||||
std::string s;
|
std::string s;
|
||||||
if (style.getValue(rname, s))
|
if (style.getValue(rname, s))
|
||||||
color = otk::BColor(s, screen_number);
|
color = BColor(s, screen_number);
|
||||||
else
|
else
|
||||||
color = otk::BColor(default_color, screen_number);
|
color = BColor(default_color, screen_number);
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
otk::BFont *Style::readDatabaseFont(const std::string &rbasename,
|
BFont *Style::readDatabaseFont(const std::string &rbasename,
|
||||||
const otk::Configuration &style) {
|
const Configuration &style) {
|
||||||
std::string fontname;
|
std::string fontname;
|
||||||
|
|
||||||
std::string s;
|
std::string s;
|
||||||
|
@ -295,9 +295,9 @@ otk::BFont *Style::readDatabaseFont(const std::string &rbasename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
otk::BFont *b = new otk::BFont(screen_number, family, i, bold, italic,
|
BFont *b = new BFont(screen_number, family, i, bold, italic,
|
||||||
dropShadow && shadow_fonts,
|
dropShadow && shadow_fonts,
|
||||||
offset, tint, aa_fonts);
|
offset, tint, aa_fonts);
|
||||||
if (b->valid())
|
if (b->valid())
|
||||||
return b;
|
return b;
|
||||||
delete b;
|
delete b;
|
||||||
|
|
30
otk/style.hh
30
otk/style.hh
|
@ -26,17 +26,17 @@ public:
|
||||||
|
|
||||||
// private:
|
// private:
|
||||||
|
|
||||||
otk::BImageControl *image_control;
|
BImageControl *image_control;
|
||||||
|
|
||||||
otk::BColor
|
BColor
|
||||||
l_text_focus, l_text_unfocus,
|
l_text_focus, l_text_unfocus,
|
||||||
b_pic_focus, b_pic_unfocus;
|
b_pic_focus, b_pic_unfocus;
|
||||||
|
|
||||||
otk::BColor border_color;
|
BColor border_color;
|
||||||
|
|
||||||
otk::BFont *font;
|
BFont *font;
|
||||||
|
|
||||||
otk::BTexture
|
BTexture
|
||||||
f_focus, f_unfocus,
|
f_focus, f_unfocus,
|
||||||
t_focus, t_unfocus,
|
t_focus, t_unfocus,
|
||||||
l_focus, l_unfocus,
|
l_focus, l_unfocus,
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
Style();
|
Style();
|
||||||
Style(unsigned int);
|
Style(unsigned int);
|
||||||
Style(unsigned int, otk::BImageControl *);
|
Style(unsigned int, BImageControl *);
|
||||||
~Style();
|
~Style();
|
||||||
|
|
||||||
void doJustify(const std::string &text, int &start_pos,
|
void doJustify(const std::string &text, int &start_pos,
|
||||||
|
@ -66,28 +66,28 @@ public:
|
||||||
|
|
||||||
void readDatabaseMask(const std::string &rname,
|
void readDatabaseMask(const std::string &rname,
|
||||||
PixmapMask &pixmapMask,
|
PixmapMask &pixmapMask,
|
||||||
const otk::Configuration &style);
|
const Configuration &style);
|
||||||
|
|
||||||
otk::BTexture readDatabaseTexture(const std::string &rname,
|
BTexture readDatabaseTexture(const std::string &rname,
|
||||||
const std::string &default_color,
|
const std::string &default_color,
|
||||||
const otk::Configuration &style,
|
const Configuration &style,
|
||||||
bool allowNoTexture = false);
|
bool allowNoTexture = false);
|
||||||
|
|
||||||
otk::BColor readDatabaseColor(const std::string &rname,
|
BColor readDatabaseColor(const std::string &rname,
|
||||||
const std::string &default_color,
|
const std::string &default_color,
|
||||||
const otk::Configuration &style);
|
const Configuration &style);
|
||||||
|
|
||||||
otk::BFont *readDatabaseFont(const std::string &rbasename,
|
BFont *readDatabaseFont(const std::string &rbasename,
|
||||||
const otk::Configuration &style);
|
const Configuration &style);
|
||||||
|
|
||||||
void load(otk::Configuration &);
|
void load(Configuration &);
|
||||||
|
|
||||||
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 void setImageControl(otk::BImageControl *c) { image_control = c; }
|
inline void setImageControl(BImageControl *c) { image_control = c; }
|
||||||
inline void setScreenNumber(unsigned int scr) { screen_number = scr; }
|
inline void setScreenNumber(unsigned int scr) { screen_number = scr; }
|
||||||
|
|
||||||
// XXX add inline accessors for the rest of the bummy
|
// XXX add inline accessors for the rest of the bummy
|
||||||
|
|
Loading…
Reference in a new issue