aboutsummaryrefslogtreecommitdiff
path: root/src/WinButtonTheme.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-08-22 14:48:10 (GMT)
committerfluxgen <fluxgen>2003-08-22 14:48:10 (GMT)
commitec5c2b77a11e2762921ff4736539d4f5239b5866 (patch)
tree0219fc8772b66df95b41316e1fea8479aad5a323 /src/WinButtonTheme.cc
parent697c38a6940a63137a1bd46790657662e464a468 (diff)
downloadfluxbox_pavel-ec5c2b77a11e2762921ff4736539d4f5239b5866.zip
fluxbox_pavel-ec5c2b77a11e2762921ff4736539d4f5239b5866.tar.bz2
fixed scaling for winbuttons
Diffstat (limited to 'src/WinButtonTheme.cc')
-rw-r--r--src/WinButtonTheme.cc46
1 files changed, 39 insertions, 7 deletions
diff --git a/src/WinButtonTheme.cc b/src/WinButtonTheme.cc
index d90d4c8..38d2de5 100644
--- a/src/WinButtonTheme.cc
+++ b/src/WinButtonTheme.cc
@@ -19,11 +19,12 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: WinButtonTheme.cc,v 1.3 2003/05/06 23:56:46 fluxgen Exp $ 22// $Id: WinButtonTheme.cc,v 1.4 2003/08/22 14:48:10 fluxgen Exp $
23 23
24#include "WinButtonTheme.hh" 24#include "WinButtonTheme.hh"
25 25
26#include "App.hh" 26#include "FbTk/App.hh"
27#include "FbWinFrameTheme.hh"
27 28
28#ifdef HAVE_CONFIG_H 29#ifdef HAVE_CONFIG_H
29#include "config.h" 30#include "config.h"
@@ -44,8 +45,6 @@ setDefaultValue() {
44 // create empty pixmap 45 // create empty pixmap
45 (*this)->pixmap = FbTk::FbPixmap(); // pixmap 46 (*this)->pixmap = FbTk::FbPixmap(); // pixmap
46 (*this)->mask = FbTk::FbPixmap(); // mask 47 (*this)->mask = FbTk::FbPixmap(); // mask
47 (*this)->pixmap_scaled = FbTk::FbPixmap();
48 (*this)->mask_scaled = FbTk::FbPixmap();
49} 48}
50 49
51template <> 50template <>
@@ -77,7 +76,7 @@ setFromString(const char *str) {
77 } 76 }
78} 77}
79 78
80WinButtonTheme::WinButtonTheme(int screen_num): 79WinButtonTheme::WinButtonTheme(int screen_num, const FbWinFrameTheme &frame_theme):
81 FbTk::Theme(screen_num), 80 FbTk::Theme(screen_num),
82 m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"), 81 m_close_pm(*this, "window.close.pixmap", "Window.Close.Pixmap"),
83 m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"), 82 m_close_unfocus_pm(*this, "window.close.unfocus.pixmap", "Window.Close.Unfocus.Pixmap"),
@@ -95,7 +94,8 @@ WinButtonTheme::WinButtonTheme(int screen_num):
95 m_stick_unfocus_pm(*this, "window.stick.unfocus.pixmap", "Window.Stick.Unfocus.Pixmap"), 94 m_stick_unfocus_pm(*this, "window.stick.unfocus.pixmap", "Window.Stick.Unfocus.Pixmap"),
96 m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap"), 95 m_stick_pressed_pm(*this, "window.stick.pressed.pixmap", "Window.Stick.Pressed.Pixmap"),
97 m_stuck_pm(*this, "window.stuck.pixmap", "Window.Stuck.Pixmap"), 96 m_stuck_pm(*this, "window.stuck.pixmap", "Window.Stuck.Pixmap"),
98 m_stuck_unfocus_pm(*this, "window.stuck.unfocus.pixmap", "Window.Stuck.Unfocus.Pixmap") { 97 m_stuck_unfocus_pm(*this, "window.stuck.unfocus.pixmap", "Window.Stuck.Unfocus.Pixmap"),
98 m_frame_theme(frame_theme) {
99 99
100} 100}
101 101
@@ -104,6 +104,38 @@ WinButtonTheme::~WinButtonTheme() {
104} 104}
105 105
106void WinButtonTheme::reconfigTheme() { 106void WinButtonTheme::reconfigTheme() {
107 reconfigSig().notify(); 107 // rescale the pixmaps to match frame theme height
108
109 unsigned int size = m_frame_theme.titleHeight();
110 if (m_frame_theme.titleHeight() == 0) {
111 // calculate height from font and border width to scale pixmaps
112 const int bevel = 1;
113 size = m_frame_theme.font().height() + bevel*2 + 2;
114
115 } // else use specified height to scale pixmaps
116
117 // scale all pixmaps
118 m_close_pm->scale(size, size);
119 m_close_unfocus_pm->scale(size, size);
120 m_close_pressed_pm->scale(size, size);
121
122 m_maximize_pm->scale(size, size);
123 m_maximize_unfocus_pm->scale(size, size);
124 m_maximize_pressed_pm->scale(size, size);
125
126 m_iconify_pm->scale(size, size);
127 m_iconify_unfocus_pm->scale(size, size);
128 m_iconify_pressed_pm->scale(size, size);
129
130 m_shade_pm->scale(size, size);
131 m_shade_unfocus_pm->scale(size, size);
132 m_shade_pressed_pm->scale(size, size);
133
134 m_stick_pm->scale(size, size);
135 m_stick_unfocus_pm->scale(size, size);
136 m_stick_pressed_pm->scale(size, size);
137
138 m_stuck_pm->scale(size, size);
139 m_stuck_unfocus_pm->scale(size, size);
108} 140}
109 141