1 // FbWinFrameTheme.hh for Fluxbox Window Manager
2 // Copyright (c) 2003 - 2006 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 #ifndef FBWINFRAMETHEME_HH
23 #define FBWINFRAMETHEME_HH
24 
25 #include "FbTk/Font.hh"
26 #include "FbTk/Texture.hh"
27 #include "FbTk/Color.hh"
28 #include "FbTk/Theme.hh"
29 #include "FbTk/BorderTheme.hh"
30 #include "FbTk/GContext.hh"
31 #include "FbTk/Shape.hh"
32 
33 #include "IconbarTheme.hh"
34 #include <string>
35 
36 class FbWinFrameTheme: public FbTk::Theme,
37                        public FbTk::ThemeProxy<FbWinFrameTheme> {
38 public:
39     explicit FbWinFrameTheme(int screen_num, const std::string &extra,
40                              const std::string &altextra);
41     ~FbWinFrameTheme();
42     /**
43        @name textures
44     */
45     //@{
titleTexture() const46     const FbTk::Texture &titleTexture() const { return *m_title; }
handleTexture() const47     const FbTk::Texture &handleTexture() const { return *m_handle; }
buttonTexture() const48     const FbTk::Texture &buttonTexture() const { return *m_button; }
buttonPressedTexture() const49     const FbTk::Texture &buttonPressedTexture() const { return *m_button_pressed; }
gripTexture() const50     const FbTk::Texture &gripTexture() const { return *m_grip; }
51     //@}
52 
buttonColor() const53     const FbTk::Color &buttonColor() const { return *m_button_color; }
font()54     FbTk::Font &font() { return *m_font; }
buttonPicGC() const55     GC buttonPicGC() const { return m_button_pic_gc.gc(); }
56 
57     bool fallback(FbTk::ThemeItem_base &item);
58     void reconfigTheme();
59 
moveCursor() const60     Cursor moveCursor() const { return m_cursor_move; }
lowerLeftAngleCursor() const61     Cursor lowerLeftAngleCursor() const { return m_cursor_lower_left_angle; }
lowerRightAngleCursor() const62     Cursor lowerRightAngleCursor() const { return m_cursor_lower_right_angle; }
upperLeftAngleCursor() const63     Cursor upperLeftAngleCursor() const { return m_cursor_upper_left_angle; }
upperRightAngleCursor() const64     Cursor upperRightAngleCursor() const { return m_cursor_upper_right_angle; }
leftSideCursor() const65     Cursor leftSideCursor() const { return m_cursor_left_side; }
rightSideCursor() const66     Cursor rightSideCursor() const { return m_cursor_right_side; }
topSideCursor() const67     Cursor topSideCursor() const { return m_cursor_top_side; }
bottomSideCursor() const68     Cursor bottomSideCursor() const { return m_cursor_bottom_side; }
69 
shapePlace() const70     FbTk::Shape::ShapePlace shapePlace() const { return *m_shape_place; }
border() const71     const FbTk::BorderTheme &border() const { return m_border; }
72 
titleHeight() const73     unsigned int titleHeight() const { return *m_title_height; }
bevelWidth() const74     unsigned int bevelWidth() const { return *m_bevel_width; }
handleWidth() const75     unsigned int handleWidth() const { return *m_handle_width; }
76 
alpha() const77     int alpha() const { return m_alpha; }
setAlpha(int alpha)78     void setAlpha(int alpha) { m_alpha = alpha; }
79 
iconbarTheme()80     IconbarTheme &iconbarTheme() { return m_iconbar_theme; }
81 
reconfigSig()82     virtual FbTk::Signal<> &reconfigSig() { return FbTk::Theme::reconfigSig(); }
83 
operator *()84     virtual FbWinFrameTheme &operator *() { return *this; }
operator *() const85     virtual const FbWinFrameTheme &operator *() const { return *this; }
86 
87 private:
88     FbTk::ThemeItem<FbTk::Texture> m_title, m_handle, m_button,
89                                    m_button_pressed, m_grip;
90 
91     FbTk::ThemeItem<FbTk::Color> m_button_color;
92     FbTk::ThemeItem<FbTk::Font> m_font;
93     FbTk::ThemeItem<FbTk::Shape::ShapePlace> m_shape_place;
94 
95     FbTk::ThemeItem<int> m_title_height, m_bevel_width, m_handle_width;
96     FbTk::BorderTheme m_border;
97 
98     FbTk::GContext m_button_pic_gc;
99 
100     Cursor m_cursor_move;
101     Cursor m_cursor_lower_left_angle;
102     Cursor m_cursor_lower_right_angle;
103     Cursor m_cursor_upper_left_angle;
104     Cursor m_cursor_upper_right_angle;
105     Cursor m_cursor_left_side;
106     Cursor m_cursor_right_side;
107     Cursor m_cursor_top_side;
108     Cursor m_cursor_bottom_side;
109     int m_alpha;
110 
111     IconbarTheme m_iconbar_theme;
112 };
113 
114 #endif // FBWINFRAMETHEME_HH
115 
116 
117