diff options
Diffstat (limited to 'src/Theme.hh')
-rw-r--r-- | src/Theme.hh | 139 |
1 files changed, 74 insertions, 65 deletions
diff --git a/src/Theme.hh b/src/Theme.hh index c090a19..1401716 100644 --- a/src/Theme.hh +++ b/src/Theme.hh | |||
@@ -1,5 +1,5 @@ | |||
1 | // Theme.hh for fluxbox | 1 | // Theme.hh for fluxbox |
2 | // Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2001-2002 Henrik Kinnunen (fluxgen@linuxmail.org) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
@@ -42,85 +42,92 @@ | |||
42 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 42 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
43 | // DEALINGS IN THE SOFTWARE. | 43 | // DEALINGS IN THE SOFTWARE. |
44 | 44 | ||
45 | #ifndef _THEME_HH_ | 45 | // $Id: Theme.hh,v 1.9 2002/05/15 09:35:49 fluxgen Exp $ |
46 | #define _THEME_HH_ | ||
47 | 46 | ||
47 | #ifndef THEME_HH | ||
48 | #define THEME_HH | ||
48 | 49 | ||
49 | #include "Image.hh" | 50 | #include "Image.hh" |
51 | #include "DrawUtil.hh" | ||
52 | #include "Font.hh" | ||
53 | |||
50 | #include <X11/Xlib.h> | 54 | #include <X11/Xlib.h> |
51 | #include <X11/Xresource.h> | 55 | #include <X11/Xresource.h> |
52 | 56 | ||
53 | #include "Rotated.hh" // TODO: should bake this into misc.hh some day | 57 | #include <string> |
54 | 58 | ||
55 | typedef struct FFont | 59 | class Theme |
56 | { | 60 | { |
57 | enum FontJustify {Left=0, Right, Center}; | 61 | public: |
62 | |||
63 | Theme(Display *display, Window rootwindow, Colormap colormap, | ||
64 | int screennum, BImageControl *ic, const char *filename, const char *rootcommand); | ||
65 | ~Theme(); | ||
58 | 66 | ||
59 | XFontSet set; | ||
60 | XFontSetExtents *set_extents; | ||
61 | XFontStruct *fontstruct; | ||
62 | FontJustify justify; | ||
63 | } FFont; | ||
64 | |||
65 | typedef struct LabelStyle | ||
66 | { | ||
67 | BTexture l_focus, l_unfocus, | ||
68 | t_focus, t_unfocus; | ||
69 | GC l_text_focus_gc, l_text_unfocus_gc; | ||
70 | FFont font; | ||
71 | BColor l_text_focus, l_text_unfocus; | ||
72 | } LabelStyle; | ||
73 | |||
74 | typedef struct WindowStyle:public LabelStyle { | ||
75 | BColor f_focus, f_unfocus, b_pic_focus, | ||
76 | b_pic_unfocus; | ||
77 | BTexture h_focus, h_unfocus, | ||
78 | b_focus, b_unfocus, b_pressed, g_focus, g_unfocus; | ||
79 | GC b_pic_focus_gc, b_pic_unfocus_gc; | ||
80 | |||
81 | struct t_tab:public LabelStyle { | ||
82 | BColor border_color; | ||
83 | unsigned int border_width; | ||
84 | unsigned int border_width_2x; | ||
85 | XRotFontStruct *rot_font; | ||
86 | } tab; | ||
87 | 67 | ||
88 | } WindowStyle; | 68 | typedef struct MenuStyle { |
89 | 69 | MenuStyle(Display *display):titlefont(display, "fixed"), | |
90 | typedef struct ToolbarStyle { | 70 | framefont(display, "fixed") { } |
91 | BColor l_text, w_text, c_text, b_pic; | 71 | BColor t_text, f_text, h_text, d_text; |
92 | BTexture toolbar, label, window, button, pressed, clock; | 72 | BTexture title, frame, hilite; |
93 | GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; | 73 | GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; |
94 | FFont font; | 74 | FbTk::Font titlefont, framefont; |
95 | 75 | DrawUtil::Font::FontJustify framefont_justify; | |
96 | } ToolbarStyle; | 76 | DrawUtil::Font::FontJustify titlefont_justify; |
77 | int bullet, bullet_pos; | ||
78 | } MenuStyle; | ||
79 | |||
80 | typedef struct LabelStyle | ||
81 | { | ||
82 | BTexture l_focus, l_unfocus, | ||
83 | t_focus, t_unfocus; | ||
84 | GC l_text_focus_gc, l_text_unfocus_gc; | ||
85 | DrawUtil::Font font; | ||
86 | BColor l_text_focus, l_text_unfocus; | ||
87 | } LabelStyle; | ||
97 | 88 | ||
98 | typedef struct MenuStyle { | 89 | |
99 | BColor t_text, f_text, h_text, d_text; | 90 | typedef struct WindowStyle:public LabelStyle { |
100 | BTexture title, frame, hilite; | 91 | BColor f_focus, f_unfocus, b_pic_focus, |
101 | GC t_text_gc, f_text_gc, h_text_gc, d_text_gc, hilite_gc; | 92 | b_pic_unfocus; |
102 | FFont titlefont, framefont; | 93 | BTexture h_focus, h_unfocus, |
103 | int bullet, bullet_pos; | 94 | b_focus, b_unfocus, b_pressed, g_focus, g_unfocus; |
104 | } MenuStyle; | 95 | GC b_pic_focus_gc, b_pic_unfocus_gc; |
96 | |||
97 | struct t_tab:public LabelStyle { | ||
98 | BColor border_color; | ||
99 | unsigned int border_width; | ||
100 | unsigned int border_width_2x; | ||
101 | DrawUtil::XRotFontStruct *rot_font; | ||
102 | } tab; | ||
103 | |||
104 | } WindowStyle; | ||
105 | 105 | ||
106 | //singleton class | 106 | |
107 | class Theme | 107 | typedef struct ToolbarStyle { |
108 | { | 108 | BColor l_text, w_text, c_text, b_pic; |
109 | public: | 109 | BTexture toolbar, label, window, button, pressed, clock; |
110 | Theme(Display *display, Colormap colormap, int screennum, BImageControl *ic, const char *filename); | 110 | GC l_text_gc, w_text_gc, c_text_gc, b_pic_gc; |
111 | ~Theme(); | 111 | DrawUtil::Font font; |
112 | 112 | ||
113 | } ToolbarStyle; | ||
114 | |||
115 | inline WindowStyle &getWindowStyle(void) { return m_windowstyle; } | ||
116 | inline MenuStyle &getMenuStyle(void) { return m_menustyle; } | ||
117 | inline ToolbarStyle &getToolbarStyle(void) { return m_toolbarstyle; } | ||
118 | inline unsigned int getBevelWidth(void) const { return m_bevel_width; } | ||
119 | inline unsigned int getBorderWidth(void) const { return m_border_width; } | ||
120 | inline unsigned int getHandleWidth(void) const { return m_handle_width; } | ||
121 | inline unsigned int getFrameWidth(void) const { return m_frame_width; } | ||
122 | inline const GC &getOpGC(void) const { return m_opgc; } | ||
123 | inline const BColor &getBorderColor(void) const { return m_border_color; } | ||
113 | void load(const char *filename); | 124 | void load(const char *filename); |
114 | void reconfigure(); | 125 | void reconfigure(); |
115 | inline WindowStyle *getWindowStyle(void) { return &m_windowstyle; } | 126 | |
116 | inline MenuStyle *getMenuStyle(void) { return &m_menustyle; } | 127 | inline void setRootCommand(std::string command) { m_rootcommand = command; } |
117 | inline ToolbarStyle *getToolbarStyle(void) { return &m_toolbarstyle; } | 128 | |
118 | inline const unsigned int & getBevelWidth(void) const { return m_bevel_width; } | 129 | |
119 | inline const unsigned int & getBorderWidth(void) const { return m_border_width; } | 130 | |
120 | inline const unsigned int & getHandleWidth(void) const { return m_handle_width; } | ||
121 | inline const unsigned int & getFrameWidth(void) const { return m_frame_width; } | ||
122 | inline const GC &getOpGC(void) const { return m_opgc; } | ||
123 | inline const BColor & getBorderColor(void) const { return m_border_color; } | ||
124 | private: | 131 | private: |
125 | 132 | ||
126 | void loadMenuStyle(); | 133 | void loadMenuStyle(); |
@@ -156,6 +163,8 @@ private: | |||
156 | XrmDatabase m_database; | 163 | XrmDatabase m_database; |
157 | Colormap m_colormap; | 164 | Colormap m_colormap; |
158 | int m_screennum; | 165 | int m_screennum; |
166 | std::string m_rootcommand; | ||
167 | |||
159 | }; | 168 | }; |
160 | 169 | ||
161 | 170 | ||