aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/MenuTheme.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/MenuTheme.hh')
-rw-r--r--src/FbTk/MenuTheme.hh146
1 files changed, 146 insertions, 0 deletions
diff --git a/src/FbTk/MenuTheme.hh b/src/FbTk/MenuTheme.hh
new file mode 100644
index 0000000..dfac7b1
--- /dev/null
+++ b/src/FbTk/MenuTheme.hh
@@ -0,0 +1,146 @@
1// MenuTheme.hh for FbTk
2// Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
3//
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:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
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.
21
22// $Id: MenuTheme.hh,v 1.13 2003/12/17 00:43:22 fluxgen Exp $
23
24#ifndef FBTK_MENUTHEME_HH
25#define FBTK_MENUTHEME_HH
26
27#include "Theme.hh"
28#include "Color.hh"
29#include "Font.hh"
30#include "Texture.hh"
31#include "Text.hh"
32#include "Subject.hh"
33#include "PixmapWithMask.hh"
34#include "GContext.hh"
35
36namespace FbTk {
37
38class MenuTheme:public FbTk::Theme {
39public:
40 //!! TODO
41 // this isn't actually used with a theme item
42 // see setMenuMode() for more info
43 enum MenuMode {CLICK_OPEN, DELAY_OPEN};
44
45 enum BulletType { EMPTY, SQUARE, TRIANGLE, DIAMOND};
46 MenuTheme(int screen_num);
47 virtual ~MenuTheme();
48
49 void reconfigTheme();
50
51 bool fallback(ThemeItem_base &item);
52
53 /**
54 @name text colors
55 */
56 ///@{
57 const FbTk::Color &titleTextColor() const { return *t_text; }
58 const FbTk::Color &frameTextColor() const { return *f_text; }
59 const FbTk::Color &highlightTextColor() const { return *h_text; }
60 const FbTk::Color &disableTextColor() const { return *d_text; }
61 ///@}
62 /**
63 @name textures
64 */
65 ///@{
66 const FbTk::Texture &titleTexture() const { return *title; }
67 const FbTk::Texture &frameTexture() const { return *frame; }
68 const FbTk::Texture &hiliteTexture() const { return *hilite; }
69 ///@}
70
71 const FbTk::PixmapWithMask &bulletPixmap() const { return *m_bullet_pixmap; }
72 const FbTk::PixmapWithMask &selectedPixmap() const { return *m_selected_pixmap; }
73 const FbTk::PixmapWithMask &unselectedPixmap() const { return *m_unselected_pixmap; }
74 /**
75 @name fonts
76 */
77 ///@{
78 const FbTk::Font &titleFont() const { return *titlefont; }
79 FbTk::Font &titleFont() { return *titlefont; }
80 const FbTk::Font &frameFont() const { return *framefont; }
81 FbTk::Font &frameFont() { return *framefont; }
82 ///@}
83
84 FbTk::Justify frameFontJustify() const { return *framefont_justify; }
85 FbTk::Justify titleFontJustify() const { return *titlefont_justify; }
86
87 /**
88 @name graphic contexts
89 */
90 ///@{
91 const GContext &titleTextGC() const { return t_text_gc; }
92 const GContext &frameTextGC() const { return f_text_gc; }
93 const GContext &hiliteTextGC() const { return h_text_gc; }
94 const GContext &disableTextGC() const { return d_text_gc; }
95 const GContext &hiliteGC() const { return hilite_gc; }
96 GContext &titleTextGC() { return t_text_gc; }
97 GContext &frameTextGC() { return f_text_gc; }
98 GContext &hiliteTextGC() { return h_text_gc; }
99 GContext &disableTextGC() { return d_text_gc; }
100 GContext &hiliteGC() { return hilite_gc; }
101 ///@}
102 BulletType bullet() const { return *m_bullet; }
103 FbTk::Justify bulletPos() const { return *bullet_pos; }
104
105 unsigned int borderWidth() const { return *m_border_width; }
106 unsigned int bevelWidth() const { return *m_bevel_width; }
107
108 inline unsigned char alpha() const { return m_alpha; }
109 void setAlpha(unsigned char alpha) { m_alpha = alpha; }
110 // this isn't actually a theme item
111 // but we'll let it be here for now, until there's a better way to
112 // get resources into menu
113 void setMenuMode(MenuMode mode) { m_menumode = mode; }
114 MenuMode menuMode() const { return m_menumode; }
115 void setDelayOpen(int msec) { m_delayopen = msec; }
116 void setDelayClose(int msec) { m_delayclose = msec; }
117 int delayOpen() const { return m_delayopen; }
118 int delayClose() const { return m_delayclose; }
119
120 const FbTk::Color &borderColor() const { return *m_border_color; }
121
122private:
123 FbTk::ThemeItem<FbTk::Color> t_text, f_text, h_text, d_text;
124 FbTk::ThemeItem<FbTk::Texture> title, frame, hilite;
125 FbTk::ThemeItem<FbTk::Font> titlefont, framefont;
126 FbTk::ThemeItem<FbTk::Justify> framefont_justify, titlefont_justify;
127 FbTk::ThemeItem<FbTk::Justify> bullet_pos;
128 FbTk::ThemeItem<BulletType> m_bullet;
129 FbTk::ThemeItem<unsigned int> m_border_width;
130 FbTk::ThemeItem<unsigned int> m_bevel_width;
131 FbTk::ThemeItem<FbTk::Color> m_border_color;
132 FbTk::ThemeItem<FbTk::PixmapWithMask> m_bullet_pixmap, m_selected_pixmap, m_unselected_pixmap;
133
134 Display *m_display;
135 FbTk::GContext t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
136
137 unsigned char m_alpha;
138 MenuMode m_menumode;
139 unsigned int m_delayopen; ///< in msec
140 unsigned int m_delayclose; ///< in msec
141
142};
143
144} // end namespace FbTk
145
146#endif // FBTK_MENUTHEME_HH