aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Menu.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-02-15 01:48:16 (GMT)
committerfluxgen <fluxgen>2003-02-15 01:48:16 (GMT)
commit80a8703272f3b7c872279634add72218209ac64c (patch)
tree6de5155be74213e50c905c4241028f74353ded66 /src/FbTk/Menu.cc
parent483f82fbb8be0d2d9101b71dd3f31122f1c29cb3 (diff)
downloadfluxbox_pavel-80a8703272f3b7c872279634add72218209ac64c.zip
fluxbox_pavel-80a8703272f3b7c872279634add72218209ac64c.tar.bz2
added theme observer
Diffstat (limited to 'src/FbTk/Menu.cc')
-rw-r--r--src/FbTk/Menu.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc
index b727588..d0267cb 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.8 2003/02/03 13:41:19 fluxgen Exp $ 25// $Id: Menu.cc,v 1.9 2003/02/15 01:48:16 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -60,7 +60,11 @@ Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
60 m_screen_width(DisplayWidth(m_display, screen_num)), 60 m_screen_width(DisplayWidth(m_display, screen_num)),
61 m_screen_height(DisplayHeight(m_display, screen_num)), 61 m_screen_height(DisplayHeight(m_display, screen_num)),
62 m_alignment(ALIGNDONTCARE), 62 m_alignment(ALIGNDONTCARE),
63 m_border_width(0) { 63 m_border_width(0),
64 m_themeobserver(*this) {
65
66 // make sure we get updated when the theme is reloaded
67 tm.addListener(m_themeobserver);
64 68
65 title_vis = 69 title_vis =
66 movable = 70 movable =
@@ -105,7 +109,8 @@ Menu::Menu(MenuTheme &tm, int screen_num, ImageControl &imgctrl):
105 unsigned long attrib_mask = CWOverrideRedirect | CWEventMask; 109 unsigned long attrib_mask = CWOverrideRedirect | CWEventMask;
106 XSetWindowAttributes attrib; 110 XSetWindowAttributes attrib;
107 attrib.override_redirect = True; 111 attrib.override_redirect = True;
108 attrib.event_mask = ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | KeyPressMask | ExposureMask; 112 attrib.event_mask = ButtonPressMask | ButtonReleaseMask |
113 ButtonMotionMask | KeyPressMask | ExposureMask;
109 114
110 //create menu window 115 //create menu window
111 menu.window = XCreateWindow(m_display, RootWindow(m_display, screen_num), 116 menu.window = XCreateWindow(m_display, RootWindow(m_display, screen_num),
@@ -917,10 +922,16 @@ void Menu::exposeEvent(XExposeEvent &ee) {
917 if (ee.window == menu.title) { 922 if (ee.window == menu.title) {
918 redrawTitle(); 923 redrawTitle();
919 } else if (ee.window == menu.frame) { 924 } else if (ee.window == menu.frame) {
925 if (menuitems.size() == 0)
926 return;
927
920 // this is a compilicated algorithm... lets do it step by step... 928 // this is a compilicated algorithm... lets do it step by step...
921 // first... we see in which sub level the expose starts... and how many 929 // first... we see in which sub level the expose starts... and how many
922 // items down in that sublevel 930 // items down in that sublevel
923 931 if (menu.item_w == 0)
932 menu.item_w = 1;
933 if (menu.item_h == 0)
934 menu.item_h = 1;
924 unsigned int sbl = (ee.x / menu.item_w), id = (ee.y / menu.item_h), 935 unsigned int sbl = (ee.x / menu.item_w), id = (ee.y / menu.item_h),
925 // next... figure out how many sublevels over the redraw spans 936 // next... figure out how many sublevels over the redraw spans
926 sbl_d = ((ee.x + ee.width) / menu.item_w), 937 sbl_d = ((ee.x + ee.width) / menu.item_w),