2002-12-25 11:42:05 +00:00
|
|
|
// MenuTheme.hh for FbTk
|
2006-02-16 06:53:05 +00:00
|
|
|
// Copyright (c) 2002 - 2006 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
2007-12-29 21:38:53 +00:00
|
|
|
//
|
2002-12-25 11:42:05 +00:00
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
#ifndef FBTK_MENUTHEME_HH
|
|
|
|
#define FBTK_MENUTHEME_HH
|
|
|
|
|
|
|
|
#include "Theme.hh"
|
|
|
|
#include "Color.hh"
|
|
|
|
#include "Font.hh"
|
2007-12-28 07:16:17 +00:00
|
|
|
#include "Shape.hh"
|
2002-12-25 11:42:05 +00:00
|
|
|
#include "Texture.hh"
|
2003-08-27 14:07:16 +00:00
|
|
|
#include "PixmapWithMask.hh"
|
|
|
|
#include "GContext.hh"
|
2002-12-25 11:42:05 +00:00
|
|
|
|
|
|
|
namespace FbTk {
|
|
|
|
|
2008-01-04 09:06:38 +00:00
|
|
|
class MenuTheme: public Theme, public ThemeProxy<MenuTheme> {
|
2002-12-25 11:42:05 +00:00
|
|
|
public:
|
2003-02-22 21:24:19 +00:00
|
|
|
enum BulletType { EMPTY, SQUARE, TRIANGLE, DIAMOND};
|
2002-12-25 11:42:05 +00:00
|
|
|
MenuTheme(int screen_num);
|
|
|
|
virtual ~MenuTheme();
|
2003-02-15 01:49:43 +00:00
|
|
|
|
2002-12-25 11:42:05 +00:00
|
|
|
void reconfigTheme();
|
2003-02-15 01:49:43 +00:00
|
|
|
|
2003-09-12 23:32:02 +00:00
|
|
|
bool fallback(ThemeItem_base &item);
|
|
|
|
|
2002-12-25 11:42:05 +00:00
|
|
|
/**
|
|
|
|
@name text colors
|
|
|
|
*/
|
|
|
|
///@{
|
2007-12-29 21:38:53 +00:00
|
|
|
const Color &titleTextColor() const { return *t_text; }
|
|
|
|
const Color &frameTextColor() const { return *f_text; }
|
|
|
|
const Color &frameUnderlineColor() const { return *u_text; }
|
|
|
|
const Color &highlightTextColor() const { return *h_text; }
|
|
|
|
const Color &disableTextColor() const { return *d_text; }
|
2002-12-25 11:42:05 +00:00
|
|
|
///@}
|
|
|
|
/**
|
|
|
|
@name textures
|
|
|
|
*/
|
|
|
|
///@{
|
2007-12-29 21:38:53 +00:00
|
|
|
const Texture &titleTexture() const { return *title; }
|
|
|
|
const Texture &frameTexture() const { return *frame; }
|
|
|
|
const Texture &hiliteTexture() const { return *hilite; }
|
2002-12-25 11:42:05 +00:00
|
|
|
///@}
|
2003-08-27 14:07:16 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
const PixmapWithMask &bulletPixmap() const { return *m_bullet_pixmap; }
|
|
|
|
const PixmapWithMask &selectedPixmap() const { return *m_selected_pixmap; }
|
|
|
|
const PixmapWithMask &unselectedPixmap() const { return *m_unselected_pixmap; }
|
2005-04-26 01:41:55 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
const PixmapWithMask &highlightBulletPixmap() const { return *m_hl_bullet_pixmap; }
|
|
|
|
const PixmapWithMask &highlightSelectedPixmap() const { return *m_hl_selected_pixmap; }
|
|
|
|
const PixmapWithMask &highlightUnselectedPixmap() const { return *m_hl_unselected_pixmap; }
|
2002-12-25 11:42:05 +00:00
|
|
|
/**
|
|
|
|
@name fonts
|
|
|
|
*/
|
|
|
|
///@{
|
2007-12-29 21:38:53 +00:00
|
|
|
const Font &titleFont() const { return *titlefont; }
|
|
|
|
Font &titleFont() { return *titlefont; }
|
|
|
|
const Font &frameFont() const { return *framefont; }
|
|
|
|
Font &frameFont() { return *framefont; }
|
2002-12-25 11:42:05 +00:00
|
|
|
///@}
|
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
Justify frameFontJustify() const { return *framefont_justify; }
|
|
|
|
Justify titleFontJustify() const { return *titlefont_justify; }
|
|
|
|
|
2002-12-25 11:42:05 +00:00
|
|
|
/**
|
|
|
|
@name graphic contexts
|
|
|
|
*/
|
|
|
|
///@{
|
2007-12-29 21:38:53 +00:00
|
|
|
const GContext &titleTextGC() const { return t_text_gc; }
|
|
|
|
const GContext &frameTextGC() const { return f_text_gc; }
|
|
|
|
const GContext &frameUnderlineGC() const { return u_text_gc; }
|
|
|
|
const GContext &hiliteTextGC() const { return h_text_gc; }
|
|
|
|
const GContext &disableTextGC() const { return d_text_gc; }
|
|
|
|
const GContext &hiliteGC() const { return hilite_gc; }
|
|
|
|
GContext &titleTextGC() { return t_text_gc; }
|
|
|
|
GContext &frameTextGC() { return f_text_gc; }
|
|
|
|
GContext &frameUnderlineGC() { return u_text_gc; }
|
|
|
|
GContext &hiliteTextGC() { return h_text_gc; }
|
|
|
|
GContext &disableTextGC() { return d_text_gc; }
|
|
|
|
GContext &hiliteGC() { return hilite_gc; }
|
2002-12-25 11:42:05 +00:00
|
|
|
///@}
|
2007-12-29 21:38:53 +00:00
|
|
|
BulletType bullet() const { return *m_bullet; }
|
|
|
|
Justify bulletPos() const { return *bullet_pos; }
|
2002-12-25 11:42:05 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
unsigned int titleHeight() const { return m_real_title_height; }
|
|
|
|
unsigned int itemHeight() const { return m_real_item_height; }
|
|
|
|
unsigned int borderWidth() const { return *m_border_width; }
|
|
|
|
unsigned int bevelWidth() const { return *m_bevel_width; }
|
2003-07-19 03:59:56 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
unsigned char alpha() const { return m_alpha; }
|
2011-02-22 21:07:39 +00:00
|
|
|
void setAlpha(int alpha) { m_alpha = alpha; }
|
2003-12-12 18:18:49 +00:00
|
|
|
// this isn't actually a theme item
|
|
|
|
// but we'll let it be here for now, until there's a better way to
|
|
|
|
// get resources into menu
|
2008-10-13 04:55:03 +00:00
|
|
|
void setDelay(int msec) { m_delay = msec; }
|
|
|
|
int getDelay() const { return m_delay; }
|
2007-12-29 21:38:53 +00:00
|
|
|
|
|
|
|
const Color &borderColor() const { return *m_border_color; }
|
|
|
|
Shape::ShapePlace shapePlaces() const { return *m_shapeplace; }
|
2003-12-17 00:43:22 +00:00
|
|
|
|
2005-04-26 01:41:55 +00:00
|
|
|
// special override
|
2007-12-29 21:38:53 +00:00
|
|
|
void setSelectedPixmap(Pixmap pm, bool is_imagecached) {
|
|
|
|
m_selected_pixmap->pixmap() = pm;
|
2006-06-24 13:11:27 +00:00
|
|
|
if (is_imagecached)
|
|
|
|
m_selected_pixmap->pixmap().dontFree();
|
|
|
|
}
|
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
void setHighlightSelectedPixmap(Pixmap pm, bool is_imagecached) {
|
|
|
|
m_hl_selected_pixmap->pixmap() = pm;
|
2006-06-24 13:11:27 +00:00
|
|
|
if (is_imagecached)
|
|
|
|
m_hl_selected_pixmap->pixmap().dontFree();
|
|
|
|
}
|
2005-04-26 01:41:55 +00:00
|
|
|
|
2008-01-04 09:06:38 +00:00
|
|
|
virtual Subject &reconfigSig() { return Theme::reconfigSig(); }
|
|
|
|
virtual const Subject &reconfigSig() const { return Theme::reconfigSig(); }
|
|
|
|
|
2008-01-05 01:39:19 +00:00
|
|
|
virtual MenuTheme &operator *() { return *this; }
|
|
|
|
virtual const MenuTheme &operator *() const { return *this; }
|
2008-01-04 09:06:38 +00:00
|
|
|
|
2002-12-25 11:42:05 +00:00
|
|
|
private:
|
2007-12-28 07:16:17 +00:00
|
|
|
ThemeItem<Color> t_text, f_text, h_text, d_text, u_text;
|
|
|
|
ThemeItem<Texture> title, frame, hilite;
|
|
|
|
ThemeItem<Font> titlefont, framefont;
|
|
|
|
ThemeItem<Justify> framefont_justify, titlefont_justify;
|
2007-12-29 21:38:53 +00:00
|
|
|
ThemeItem<Justify> bullet_pos;
|
2007-12-28 07:16:17 +00:00
|
|
|
ThemeItem<BulletType> m_bullet;
|
|
|
|
ThemeItem<Shape::ShapePlace> m_shapeplace;
|
|
|
|
ThemeItem<unsigned int> m_title_height, m_item_height;
|
|
|
|
ThemeItem<unsigned int> m_border_width;
|
|
|
|
ThemeItem<unsigned int> m_bevel_width;
|
|
|
|
ThemeItem<Color> m_border_color;
|
|
|
|
ThemeItem<PixmapWithMask> m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap;
|
|
|
|
ThemeItem<PixmapWithMask> m_hl_bullet_pixmap, m_hl_selected_pixmap, m_hl_unselected_pixmap;
|
2002-12-25 11:42:05 +00:00
|
|
|
|
|
|
|
Display *m_display;
|
2007-12-28 07:16:17 +00:00
|
|
|
GContext t_text_gc, f_text_gc, u_text_gc, h_text_gc, d_text_gc, hilite_gc;
|
2003-07-19 03:59:56 +00:00
|
|
|
|
2011-02-22 21:07:39 +00:00
|
|
|
int m_alpha;
|
2008-10-13 04:55:03 +00:00
|
|
|
unsigned int m_delay; ///< in msec
|
2006-01-16 18:46:39 +00:00
|
|
|
unsigned int m_real_title_height; ///< the calculated item height (from font and menu.titleHeight)
|
|
|
|
unsigned int m_real_item_height; ///< the calculated item height (from font and menu.itemHeight)
|
2002-12-25 11:42:05 +00:00
|
|
|
};
|
|
|
|
|
2003-12-16 17:06:52 +00:00
|
|
|
} // end namespace FbTk
|
2002-12-25 11:42:05 +00:00
|
|
|
|
|
|
|
#endif // FBTK_MENUTHEME_HH
|