aboutsummaryrefslogtreecommitdiff
path: root/src/WinButtonTheme.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/WinButtonTheme.cc')
-rw-r--r--src/WinButtonTheme.cc93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/WinButtonTheme.cc b/src/WinButtonTheme.cc
new file mode 100644
index 0000000..85b273e
--- /dev/null
+++ b/src/WinButtonTheme.cc
@@ -0,0 +1,93 @@
1// WinButtonTheme.cc for Fluxbox - an X11 Window manager
2// Copyright (c) 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: WinButtonTheme.cc,v 1.7 2003/08/25 16:51:16 fluxgen Exp $
23
24#include "WinButtonTheme.hh"
25
26#include "FbTk/App.hh"
27#include "FbTk/Image.hh"
28#include "FbTk/PixmapWithMask.hh"
29
30#include "FbWinFrameTheme.hh"
31
32WinButtonTheme::WinButtonTheme(int screen_num, const FbWinFrameTheme &frame_theme):
33 FbTk::Theme(screen_num),
34 m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"),
35 m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"),
36 m_close_pressed_pm(*this, "window.close.pressed.pixmap", "Window.Close.Pressed.Pixmap"),
37 m_maximize_pm(*this, "window.maximize.pixmap", "Window.Maximize.Pixmap"),
38 m_maximize_unfocus_pm(*this, "window.maximize.unfocus.pixmap", "Window.Maximize.Unfocus.pixmap"),
39 m_maximize_pressed_pm(*this, "window.maximize.pressed.pixmap", "Window.Maximize.Pressed.Pixmap"),
40 m_iconify_pm(*this, "window.iconify.pixmap", "Window.Iconify.Pixmap"),
41 m_iconify_unfocus_pm(*this, "window.iconify.unfocus.pixmap", "Window.Iconify.Unfocus.Pixmap"),
42 m_iconify_pressed_pm(*this, "window.iconify.pressed.pixmap", "Window.Iconify.Pressed.Pixmap"),
43 m_shade_pm(*this, "window.shade.pixmap", "Window.Shade.Pixmap"),
44 m_shade_unfocus_pm(*this, "window.shade.unfocus.pixmap", "Window.Shade.Unfocus.Pixmap"),
45 m_shade_pressed_pm(*this, "window.shade.pressed.pixmap", "Window.Shade.Pressed.Pixmap"),
46 m_stick_pm(*this, "window.stick.pixmap", "Window.Stick.Pixmap"),
47 m_stick_unfocus_pm(*this, "window.stick.unfocus.pixmap", "Window.Stick.Unfocus.Pixmap"),
48 m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap"),
49 m_stuck_pm(*this, "window.stuck.pixmap", "Window.Stuck.Pixmap"),
50 m_stuck_unfocus_pm(*this, "window.stuck.unfocus.pixmap", "Window.Stuck.Unfocus.Pixmap"),
51 m_frame_theme(frame_theme) {
52
53}
54
55WinButtonTheme::~WinButtonTheme() {
56
57}
58
59void WinButtonTheme::reconfigTheme() {
60 // rescale the pixmaps to match frame theme height
61
62 unsigned int size = m_frame_theme.titleHeight();
63 if (m_frame_theme.titleHeight() == 0) {
64 // calculate height from font and border width to scale pixmaps
65 size = m_frame_theme.font().height() + 2;
66
67 } // else use specified height to scale pixmaps
68
69 // scale all pixmaps
70 m_close_pm->scale(size, size);
71 m_close_unfocus_pm->scale(size, size);
72 m_close_pressed_pm->scale(size, size);
73
74 m_maximize_pm->scale(size, size);
75 m_maximize_unfocus_pm->scale(size, size);
76 m_maximize_pressed_pm->scale(size, size);
77
78 m_iconify_pm->scale(size, size);
79 m_iconify_unfocus_pm->scale(size, size);
80 m_iconify_pressed_pm->scale(size, size);
81
82 m_shade_pm->scale(size, size);
83 m_shade_unfocus_pm->scale(size, size);
84 m_shade_pressed_pm->scale(size, size);
85
86 m_stick_pm->scale(size, size);
87 m_stick_unfocus_pm->scale(size, size);
88 m_stick_pressed_pm->scale(size, size);
89
90 m_stuck_pm->scale(size, size);
91 m_stuck_unfocus_pm->scale(size, size);
92}
93