1
// MenuTheme.hh for FbTk
2
// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
4
// Permission is hereby granted, free of charge, to any person obtaining a
5
// copy of this software and associated documentation files (the "Software"),
6
// to deal in the Software without restriction, including without limitation
7
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
// and/or sell copies of the Software, and to permit persons to whom the
9
// Software is furnished to do so, subject to the following conditions:
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
// DEALINGS IN THE SOFTWARE.
22
// $Id: MenuTheme.hh 3954 2005-04-26 01:41:55Z simonb $
24
#ifndef FBTK_MENUTHEME_HH
25
#define FBTK_MENUTHEME_HH
33
#include "PixmapWithMask.hh"
34
#include "GContext.hh"
38
class MenuTheme:public FbTk::Theme {
41
// this isn't actually used with a theme item
42
// see setMenuMode() for more info
43
enum MenuMode {CLICK_OPEN, DELAY_OPEN};
45
enum BulletType { EMPTY, SQUARE, TRIANGLE, DIAMOND};
46
MenuTheme(int screen_num);
51
bool fallback(ThemeItem_base &item);
57
inline const FbTk::Color &titleTextColor() const { return *t_text; }
58
inline const FbTk::Color &frameTextColor() const { return *f_text; }
59
inline const FbTk::Color &highlightTextColor() const { return *h_text; }
60
inline const FbTk::Color &disableTextColor() const { return *d_text; }
66
inline const FbTk::Texture &titleTexture() const { return *title; }
67
inline const FbTk::Texture &frameTexture() const { return *frame; }
68
inline const FbTk::Texture &hiliteTexture() const { return *hilite; }
71
inline const FbTk::PixmapWithMask &bulletPixmap() const { return *m_bullet_pixmap; }
72
inline const FbTk::PixmapWithMask &selectedPixmap() const { return *m_selected_pixmap; }
73
inline const FbTk::PixmapWithMask &unselectedPixmap() const { return *m_unselected_pixmap; }
75
inline const FbTk::PixmapWithMask &highlightBulletPixmap() const { return *m_hl_bullet_pixmap; }
76
inline const FbTk::PixmapWithMask &highlightSelectedPixmap() const { return *m_hl_selected_pixmap; }
77
inline const FbTk::PixmapWithMask &highlightUnselectedPixmap() const { return *m_hl_unselected_pixmap; }
82
inline const FbTk::Font &titleFont() const { return *titlefont; }
83
inline FbTk::Font &titleFont() { return *titlefont; }
84
inline const FbTk::Font &frameFont() const { return *framefont; }
85
inline FbTk::Font &frameFont() { return *framefont; }
88
inline FbTk::Justify frameFontJustify() const { return *framefont_justify; }
89
inline FbTk::Justify titleFontJustify() const { return *titlefont_justify; }
92
@name graphic contexts
95
inline const GContext &titleTextGC() const { return t_text_gc; }
96
inline const GContext &frameTextGC() const { return f_text_gc; }
97
inline const GContext &hiliteTextGC() const { return h_text_gc; }
98
inline const GContext &disableTextGC() const { return d_text_gc; }
99
inline const GContext &hiliteGC() const { return hilite_gc; }
100
inline GContext &titleTextGC() { return t_text_gc; }
101
inline GContext &frameTextGC() { return f_text_gc; }
102
inline GContext &hiliteTextGC() { return h_text_gc; }
103
inline GContext &disableTextGC() { return d_text_gc; }
104
inline GContext &hiliteGC() { return hilite_gc; }
106
inline BulletType bullet() const { return *m_bullet; }
107
inline FbTk::Justify bulletPos() const { return *bullet_pos; }
109
inline unsigned int titleHeight() const { return m_real_title_height; }
110
inline unsigned int itemHeight() const { return m_real_item_height; }
111
inline unsigned int borderWidth() const { return *m_border_width; }
112
inline unsigned int bevelWidth() const { return *m_bevel_width; }
114
inline unsigned char alpha() const { return m_alpha; }
115
inline void setAlpha(unsigned char alpha) { m_alpha = alpha; }
116
// this isn't actually a theme item
117
// but we'll let it be here for now, until there's a better way to
118
// get resources into menu
119
inline void setMenuMode(MenuMode mode) { m_menumode = mode; }
120
inline MenuMode menuMode() const { return m_menumode; }
121
inline void setDelayOpen(int msec) { m_delayopen = msec; }
122
inline void setDelayClose(int msec) { m_delayclose = msec; }
123
inline int delayOpen() const { return m_delayopen; }
124
inline int delayClose() const { return m_delayclose; }
126
inline const FbTk::Color &borderColor() const { return *m_border_color; }
129
inline void setSelectedPixmap(Pixmap pm) { m_selected_pixmap->pixmap() = pm; }
130
inline void setHighlightSelectedPixmap(Pixmap pm) { m_hl_selected_pixmap->pixmap() = pm; }
133
FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text;
134
FbTk::ThemeItem<FbTk::Texture> title, frame, hilite;
135
FbTk::ThemeItem<FbTk::Font> titlefont, framefont;
136
FbTk::ThemeItem<FbTk::Justify> framefont_justify, titlefont_justify;
137
FbTk::ThemeItem<FbTk::Justify> bullet_pos;
138
FbTk::ThemeItem<BulletType> m_bullet;
139
FbTk::ThemeItem<unsigned int> m_title_height, m_item_height;
140
FbTk::ThemeItem<unsigned int> m_border_width;
141
FbTk::ThemeItem<unsigned int> m_bevel_width;
142
FbTk::ThemeItem<FbTk::Color> m_border_color;
143
FbTk::ThemeItem<FbTk::PixmapWithMask> m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap;
144
FbTk::ThemeItem<FbTk::PixmapWithMask> m_hl_bullet_pixmap, m_hl_selected_pixmap, m_hl_unselected_pixmap;
147
FbTk::GContext t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
149
unsigned char m_alpha;
151
unsigned int m_delayopen; ///< in msec
152
unsigned int m_delayclose; ///< in msec
153
int m_real_title_height; ///< the calculated item height (from font and menu.titleHeight)
154
int m_real_item_height; ///< the calculated item height (from font and menu.itemHeight)
157
} // end namespace FbTk
159
#endif // FBTK_MENUTHEME_HH