~ubuntu-branches/ubuntu/trusty/fluxbox/trusty-proposed

« back to all changes in this revision

Viewing changes to src/FbTk/MenuTheme.hh

  • Committer: Bazaar Package Importer
  • Author(s): Dmitry E. Oboukhov
  • Date: 2008-07-01 10:38:14 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080701103814-khx2b6il152x9p93
Tags: 1.0.0+deb1-8
* x-dev has been removed from build-depends (out-of-date package).
* Standards-Version bumped to 3.8.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// MenuTheme.hh for FbTk
2
 
// Copyright (c) 2002 - 2005 Henrik Kinnunen (fluxgen at fluxbox dot org)
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 3954 2005-04-26 01:41:55Z simonb $
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
 
 
36
 
namespace FbTk {
37
 
 
38
 
class MenuTheme:public FbTk::Theme {
39
 
public:
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
 
    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; }
61
 
    ///@}
62
 
    /**
63
 
       @name textures
64
 
    */
65
 
    ///@{
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; }
69
 
    ///@}
70
 
 
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; }
74
 
 
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; }
78
 
    /**
79
 
       @name fonts
80
 
    */
81
 
    ///@{
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; }
86
 
    ///@}
87
 
 
88
 
    inline FbTk::Justify frameFontJustify() const { return *framefont_justify; }
89
 
    inline FbTk::Justify titleFontJustify() const { return *titlefont_justify; }
90
 
        
91
 
    /**
92
 
       @name graphic contexts
93
 
    */
94
 
    ///@{
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; }
105
 
    ///@}
106
 
    inline BulletType bullet() const { return *m_bullet; }
107
 
    inline FbTk::Justify bulletPos() const { return *bullet_pos; }
108
 
 
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; }
113
 
 
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; }
125
 
    
126
 
    inline const FbTk::Color &borderColor() const { return *m_border_color; }
127
 
 
128
 
    // special override
129
 
    inline void setSelectedPixmap(Pixmap pm) { m_selected_pixmap->pixmap() = pm; }
130
 
    inline void setHighlightSelectedPixmap(Pixmap pm) { m_hl_selected_pixmap->pixmap() = pm; }
131
 
 
132
 
private:
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;
145
 
 
146
 
    Display *m_display;
147
 
    FbTk::GContext t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc;
148
 
 
149
 
    unsigned char m_alpha;
150
 
    MenuMode m_menumode;
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)
155
 
};
156
 
 
157
 
} // end namespace FbTk
158
 
 
159
 
#endif // FBTK_MENUTHEME_HH