summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/Menu.cc39
1 files changed, 17 insertions, 22 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index 04a3433..72721a7 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.2 2003/01/07 02:10:24 fluxgen Exp $ 25// $Id: Menu.cc,v 1.3 2003/01/09 16:45:21 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -104,7 +104,7 @@ Menu::Menu(MenuTheme &tm, int screen_num, BImageControl &imgctrl):
104 unsigned long attrib_mask = CWOverrideRedirect | CWEventMask; 104 unsigned long attrib_mask = CWOverrideRedirect | CWEventMask;
105 XSetWindowAttributes attrib; 105 XSetWindowAttributes attrib;
106 attrib.override_redirect = True; 106 attrib.override_redirect = True;
107 attrib.event_mask = ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | ExposureMask; 107 attrib.event_mask = ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | KeyPressMask | ExposureMask;
108#ifdef DEBUG 108#ifdef DEBUG
109 cerr<<__FILE__<<": Creating menu("<<menu.width<<", "<<menu.height<<")"<<endl; 109 cerr<<__FILE__<<": Creating menu("<<menu.width<<", "<<menu.height<<")"<<endl;
110#endif // DEBUG 110#endif // DEBUG
@@ -177,19 +177,15 @@ int Menu::insert(const char *label, RefCount<Command> &cmd, int pos) {
177 menuitems.insert(menuitems.begin() + pos, item); 177 menuitems.insert(menuitems.begin() + pos, item);
178 } 178 }
179} 179}
180 180int Menu::insert(const char *label, int pos) {
181int Menu::insert(const char *label, int function, const char *exec, int pos) { 181 MenuItem *item = new MenuItem(label);
182 MenuItem *item = new MenuItem(label, function, exec); 182 if (pos == -1)
183 if (pos == -1) {
184 menuitems.push_back(item); 183 menuitems.push_back(item);
185 } else { 184 else
186 menuitems.insert(menuitems.begin() + pos, item); 185 menuitems.insert(menuitems.begin() + pos, item);
187 }
188
189 return menuitems.size(); 186 return menuitems.size();
190} 187}
191 188
192
193int Menu::insert(const char *label, Menu *submenu, int pos) { 189int Menu::insert(const char *label, Menu *submenu, int pos) {
194 MenuItem *item = new MenuItem(label, submenu); 190 MenuItem *item = new MenuItem(label, submenu);
195 if (pos == -1) { 191 if (pos == -1) {
@@ -507,19 +503,19 @@ void Menu::drawSubmenu(unsigned int index) {
507 503
508 int sbl = index / menu.persub, i = index - (sbl * menu.persub), 504 int sbl = index / menu.persub, i = index - (sbl * menu.persub),
509 x = menu.x + 505 x = menu.x +
510 ((menu.item_w * (sbl + 1)) + m_border_width), y; 506 ((menu.item_w * (sbl + 1)) + menu.window.borderWidth()), y;
511 507
512 if (m_alignment == ALIGNTOP) { 508 if (m_alignment == ALIGNTOP) {
513 y = (((shifted) ? menu.y_shift : menu.y) + 509 y = (((shifted) ? menu.y_shift : menu.y) +
514 ((title_vis) ? menu.title_h + m_border_width : 0) - 510 ((title_vis) ? menu.title_h + m_border_width : 0) -
515 ((item->submenu()->title_vis) ? 511 ((item->submenu()->title_vis) ?
516 item->submenu()->menu.title_h + m_border_width : 0)); 512 item->submenu()->menu.title_h + menu.window.borderWidth() : 0));
517 } else { 513 } else {
518 y = (((shifted) ? menu.y_shift : menu.y) + 514 y = (((shifted) ? menu.y_shift : menu.y) +
519 (menu.item_h * i) + 515 (menu.item_h * i) +
520 ((title_vis) ? menu.title_h + m_border_width : 0) - 516 ((title_vis) ? menu.title_h + menu.window.borderWidth() : 0) -
521 ((item->submenu()->title_vis) ? 517 ((item->submenu()->title_vis) ?
522 item->submenu()->menu.title_h + m_border_width : 0)); 518 item->submenu()->menu.title_h + menu.window.borderWidth() : 0));
523 } 519 }
524 520
525 if (m_alignment == ALIGNBOTTOM && 521 if (m_alignment == ALIGNBOTTOM &&
@@ -531,7 +527,7 @@ void Menu::drawSubmenu(unsigned int index) {
531 527
532 if ((x + item->submenu()->width()) > m_screen_width) { 528 if ((x + item->submenu()->width()) > m_screen_width) {
533 x = ((shifted) ? menu.x_shift : menu.x) - 529 x = ((shifted) ? menu.x_shift : menu.x) -
534 item->submenu()->width() - m_border_width; 530 item->submenu()->width() - menu.window.borderWidth();
535 } 531 }
536 532
537 if (x < 0) 533 if (x < 0)
@@ -539,7 +535,7 @@ void Menu::drawSubmenu(unsigned int index) {
539 535
540 if ((y + item->submenu()->height()) > m_screen_height) { 536 if ((y + item->submenu()->height()) > m_screen_height) {
541 y = m_screen_height - item->submenu()->height() - 537 y = m_screen_height - item->submenu()->height() -
542 m_border_width * 2; 538 menu.window.borderWidth() * 2;
543 } 539 }
544 540
545 if (y < 0) 541 if (y < 0)
@@ -1023,12 +1019,11 @@ void Menu::leaveNotifyEvent(XCrossingEvent &ce) {
1023 1019
1024 1020
1025void Menu::reconfigure() { 1021void Menu::reconfigure() {
1026 //!! TODO 1022 menu.window.setBackgroundColor(m_theme.borderColor());
1027 // menu.window.setBackgroundColor(*m_screen->getBorderColor()); 1023 menu.window.setBorderColor(m_theme.borderColor());
1028 // menu.window.setBorderColor(*m_screen->getBorderColor()); 1024 menu.window.setBorderWidth(m_theme.borderWidth());
1029 // menu.window.setBorderWidth(m_screen->getBorderWidth()); 1025 menu.bevel_w = m_theme.bevelWidth();
1030 1026 m_border_width = menu.window.borderWidth();
1031 // menu.bevel_w = m_screen->getBevelWidth();
1032 update(); 1027 update();
1033} 1028}
1034 1029