fluxbox/src/FbTk/MenuTheme.hh

147 lines
5.4 KiB
C++
Raw Normal View History

2002-12-25 11:42:05 +00:00
// MenuTheme.hh for FbTk
2003-05-04 21:01:43 +00:00
// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
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.
// $Id: MenuTheme.hh,v 1.13 2003/12/17 00:43:22 fluxgen Exp $
2002-12-25 11:42:05 +00:00
#ifndef FBTK_MENUTHEME_HH
#define FBTK_MENUTHEME_HH
#include "Theme.hh"
#include "Color.hh"
#include "Font.hh"
#include "Texture.hh"
#include "Text.hh"
2003-02-15 01:49:43 +00:00
#include "Subject.hh"
#include "PixmapWithMask.hh"
#include "GContext.hh"
2002-12-25 11:42:05 +00:00
namespace FbTk {
class MenuTheme:public FbTk::Theme {
public:
2003-12-12 18:18:49 +00:00
//!! TODO
// this isn't actually used with a theme item
// see setMenuMode() for more info
enum MenuMode {CLICK_OPEN, DELAY_OPEN};
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
bool fallback(ThemeItem_base &item);
2002-12-25 11:42:05 +00:00
/**
@name text colors
*/
///@{
const FbTk::Color &titleTextColor() const { return *t_text; }
const FbTk::Color &frameTextColor() const { return *f_text; }
const FbTk::Color &highlightTextColor() const { return *h_text; }
const FbTk::Color &disableTextColor() const { return *d_text; }
///@}
/**
@name textures
*/
///@{
const FbTk::Texture &titleTexture() const { return *title; }
const FbTk::Texture &frameTexture() const { return *frame; }
const FbTk::Texture &hiliteTexture() const { return *hilite; }
///@}
const FbTk::PixmapWithMask &bulletPixmap() const { return *m_bullet_pixmap; }
const FbTk::PixmapWithMask &selectedPixmap() const { return *m_selected_pixmap; }
const FbTk::PixmapWithMask &unselectedPixmap() const { return *m_unselected_pixmap; }
2002-12-25 11:42:05 +00:00
/**
@name fonts
*/
///@{
const FbTk::Font &titleFont() const { return *titlefont; }
2003-02-17 12:28:57 +00:00
FbTk::Font &titleFont() { return *titlefont; }
2002-12-25 11:42:05 +00:00
const FbTk::Font &frameFont() const { return *framefont; }
2003-02-17 12:28:57 +00:00
FbTk::Font &frameFont() { return *framefont; }
2002-12-25 11:42:05 +00:00
///@}
FbTk::Justify frameFontJustify() const { return *framefont_justify; }
FbTk::Justify titleFontJustify() const { return *titlefont_justify; }
/**
@name graphic contexts
*/
///@{
2003-11-28 22:53:10 +00:00
const GContext &titleTextGC() const { return t_text_gc; }
const GContext &frameTextGC() const { return f_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 &hiliteTextGC() { return h_text_gc; }
GContext &disableTextGC() { return d_text_gc; }
GContext &hiliteGC() { return hilite_gc; }
2002-12-25 11:42:05 +00:00
///@}
BulletType bullet() const { return *m_bullet; }
FbTk::Justify bulletPos() const { return *bullet_pos; }
unsigned int borderWidth() const { return *m_border_width; }
unsigned int bevelWidth() const { return *m_bevel_width; }
inline unsigned char alpha() const { return m_alpha; }
void setAlpha(unsigned char 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
void setMenuMode(MenuMode mode) { m_menumode = mode; }
MenuMode menuMode() const { return m_menumode; }
void setDelayOpen(int msec) { m_delayopen = msec; }
void setDelayClose(int msec) { m_delayclose = msec; }
2003-12-12 18:18:49 +00:00
int delayOpen() const { return m_delayopen; }
int delayClose() const { return m_delayclose; }
const FbTk::Color &borderColor() const { return *m_border_color; }
2002-12-25 11:42:05 +00:00
private:
FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text;
FbTk::ThemeItem<FbTk::Texture> title, frame, hilite;
FbTk::ThemeItem<FbTk::Font> titlefont, framefont;
FbTk::ThemeItem<FbTk::Justify> framefont_justify, titlefont_justify;
FbTk::ThemeItem<FbTk::Justify> bullet_pos;
FbTk::ThemeItem<BulletType> m_bullet;
FbTk::ThemeItem<unsigned int> m_border_width;
FbTk::ThemeItem<unsigned int> m_bevel_width;
FbTk::ThemeItem<FbTk::Color> m_border_color;
FbTk::ThemeItem<FbTk::PixmapWithMask> m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap;
2002-12-25 11:42:05 +00:00
Display *m_display;
FbTk::GContext t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
unsigned char m_alpha;
2003-12-12 18:18:49 +00:00
MenuMode m_menumode;
unsigned int m_delayopen; ///< in msec
unsigned int m_delayclose; ///< in msec
2003-12-12 18:18:49 +00:00
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