aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-01-24 12:19:15 (GMT)
committerfluxgen <fluxgen>2003-01-24 12:19:15 (GMT)
commitb0d9aa11246fc23f8296d25dfc9f72310a93f614 (patch)
tree9a9e9d8bd69aa7adc6967d10a7950e6518792f98 /src
parent63d87b81a20d3513564c17c177b4b1736ecc481a (diff)
downloadfluxbox_paul-b0d9aa11246fc23f8296d25dfc9f72310a93f614.zip
fluxbox_paul-b0d9aa11246fc23f8296d25dfc9f72310a93f614.tar.bz2
fixed minor style issues
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc52
1 files changed, 38 insertions, 14 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index d6851cb..29d60d4 100644
--- a/src/FbTk/Menu.cc
+++ b/src/FbTk/Menu.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Menu.cc,v 1.6 2003/01/13 03:04:47 fluxgen Exp $ 25// $Id: Menu.cc,v 1.7 2003/01/24 12:19:15 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -248,12 +248,15 @@ void Menu::enableTitle() {
248} 248}
249 249
250void Menu::update() { 250void Menu::update() {
251 251 if (menu.bevel_w > 10) // clamp to "normal" size
252 menu.bevel_w = 10;
253 if (m_border_width > 20)
254 m_border_width = 20;
255
252 menu.item_h = m_theme.frameFont().height() + menu.bevel_w; 256 menu.item_h = m_theme.frameFont().height() + menu.bevel_w;
253 menu.title_h = m_theme.frameFont().height() + menu.bevel_w*2; 257 menu.title_h = m_theme.frameFont().height() + menu.bevel_w*2;
254
255 if (title_vis) {
256 258
259 if (title_vis) {
257 menu.item_w = m_theme.titleFont().textWidth(menu.label.c_str(), menu.label.size()); 260 menu.item_w = m_theme.titleFont().textWidth(menu.label.c_str(), menu.label.size());
258 261
259 menu.item_w += (menu.bevel_w * 2); 262 menu.item_w += (menu.bevel_w * 2);
@@ -281,8 +284,9 @@ void Menu::update() {
281 menu.sublevels = 1; 284 menu.sublevels = 1;
282 285
283 while (menu.item_h * (menuitems.size() + 1) / menu.sublevels + 286 while (menu.item_h * (menuitems.size() + 1) / menu.sublevels +
284 menu.title_h + m_border_width > m_screen_height) 287 menu.title_h + m_border_width > m_screen_height) {
285 menu.sublevels++; 288 menu.sublevels++;
289 }
286 290
287 if (menu.sublevels < menu.minsub) 291 if (menu.sublevels < menu.minsub)
288 menu.sublevels = menu.minsub; 292 menu.sublevels = menu.minsub;
@@ -298,7 +302,7 @@ void Menu::update() {
298 if (! menu.width) menu.width = menu.item_w; 302 if (! menu.width) menu.width = menu.item_w;
299 303
300 menu.frame_h = (menu.item_h * menu.persub); 304 menu.frame_h = (menu.item_h * menu.persub);
301 menu.height = ((title_vis) ? menu.title_h + m_border_width : 0) + 305 menu.height = ((title_vis) ? menu.title_h + menu.title.borderWidth() : 0) +
302 menu.frame_h; 306 menu.frame_h;
303 if (! menu.frame_h) menu.frame_h = 1; 307 if (! menu.frame_h) menu.frame_h = 1;
304 if (menu.height < 1) menu.height = 1; 308 if (menu.height < 1) menu.height = 1;
@@ -359,11 +363,13 @@ void Menu::update() {
359 363
360 menu.window.resize(menu.width, menu.height); 364 menu.window.resize(menu.width, menu.height);
361 365
362 if (title_vis) 366 if (title_vis) {
363 menu.title.resize(menu.width, menu.title_h); 367 menu.title.moveResize(-menu.title.borderWidth(), -menu.title.borderWidth(),
368 menu.width + menu.title.borderWidth(), menu.title_h);
369 }
364 370
365 menu.frame.moveResize(0, ((title_vis) ? menu.title_h + m_border_width : 0), 371 menu.frame.moveResize(0, ((title_vis) ? menu.title.y() + menu.title.height() + menu.title.borderWidth()*2 : 0),
366 menu.width, menu.frame_h); 372 menu.window.width(), menu.frame_h);
367 menu.window.clear(); 373 menu.window.clear();
368 menu.title.clear(); 374 menu.title.clear();
369 menu.frame.clear(); 375 menu.frame.clear();
@@ -497,7 +503,7 @@ void Menu::drawSubmenu(unsigned int index) {
497 503
498 if (m_alignment == ALIGNTOP) { 504 if (m_alignment == ALIGNTOP) {
499 y = (((shifted) ? menu.y_shift : menu.y) + 505 y = (((shifted) ? menu.y_shift : menu.y) +
500 ((title_vis) ? menu.title_h + m_border_width : 0) - 506 ((title_vis) ? menu.title_h + menu.title.borderWidth() : 0) -
501 ((item->submenu()->title_vis) ? 507 ((item->submenu()->title_vis) ?
502 item->submenu()->menu.title_h + menu.window.borderWidth() : 0)); 508 item->submenu()->menu.title_h + menu.window.borderWidth() : 0));
503 } else { 509 } else {
@@ -1006,11 +1012,29 @@ void Menu::leaveNotifyEvent(XCrossingEvent &ce) {
1006 1012
1007 1013
1008void Menu::reconfigure() { 1014void Menu::reconfigure() {
1015 menu.bevel_w = m_theme.bevelWidth();
1016 m_border_width = m_theme.borderWidth();
1017 if (menu.bevel_w > 10) // clamp to "normal" size
1018 menu.bevel_w = 10;
1019 if (menu.bevel_w < 0)
1020 menu.bevel_w = 1;
1021 if (m_border_width > 20) // clamp to normal size
1022 m_border_width = 20;
1023 if (m_border_width < 0)
1024 m_border_width = 0;
1025
1009 menu.window.setBackgroundColor(m_theme.borderColor()); 1026 menu.window.setBackgroundColor(m_theme.borderColor());
1027 menu.title.setBackgroundColor(m_theme.borderColor());
1028 menu.frame.setBackgroundColor(m_theme.borderColor());
1029
1010 menu.window.setBorderColor(m_theme.borderColor()); 1030 menu.window.setBorderColor(m_theme.borderColor());
1011 menu.window.setBorderWidth(m_theme.borderWidth()); 1031 menu.title.setBorderColor(m_theme.borderColor());
1012 menu.bevel_w = m_theme.bevelWidth(); 1032 menu.frame.setBorderColor(m_theme.borderColor());
1013 m_border_width = menu.window.borderWidth(); 1033
1034 menu.window.setBorderWidth(m_border_width);
1035 menu.title.setBorderWidth(m_border_width);
1036
1037
1014 update(); 1038 update();
1015} 1039}
1016 1040