aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-11-26 16:07:29 (GMT)
committerfluxgen <fluxgen>2002-11-26 16:07:29 (GMT)
commit0cbcb87b888d5d7ac227e74630a1734fa7c4e939 (patch)
tree8bf88a2d7c60dab797c24ce2f633c13e8a935de9
parent3dacf701543b52c39a39d686a97d657c47dd2e8c (diff)
downloadfluxbox_paul-0cbcb87b888d5d7ac227e74630a1734fa7c4e939.zip
fluxbox_paul-0cbcb87b888d5d7ac227e74630a1734fa7c4e939.tar.bz2
minor cleaning
-rw-r--r--src/Basemenu.cc32
-rw-r--r--src/Basemenu.hh5
2 files changed, 20 insertions, 17 deletions
diff --git a/src/Basemenu.cc b/src/Basemenu.cc
index 75c88a9..f804f3d 100644
--- a/src/Basemenu.cc
+++ b/src/Basemenu.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: Basemenu.cc,v 1.35 2002/11/15 14:24:59 fluxgen Exp $ 25// $Id: Basemenu.cc,v 1.36 2002/11/26 16:07:29 fluxgen Exp $
26 26
27//use GNU extensions 27//use GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -52,7 +52,6 @@ using namespace std;
52static Basemenu *shown = 0; 52static Basemenu *shown = 0;
53 53
54Basemenu::Basemenu(BScreen *screen): 54Basemenu::Basemenu(BScreen *screen):
55m_fluxbox(Fluxbox::instance()),
56m_screen(screen), 55m_screen(screen),
57m_display(Fluxbox::instance()->getXDisplay()), 56m_display(Fluxbox::instance()->getXDisplay()),
58m_parent(0), 57m_parent(0),
@@ -116,7 +115,8 @@ m_alignment(ALIGNDONTCARE) {
116 menu.height, m_screen->getBorderWidth(), m_screen->getDepth(), 115 menu.height, m_screen->getBorderWidth(), m_screen->getDepth(),
117 InputOutput, m_screen->getVisual(), attrib_mask, &attrib); 116 InputOutput, m_screen->getVisual(), attrib_mask, &attrib);
118 117
119 m_fluxbox->saveMenuSearch(menu.window, this); 118 Fluxbox * const fluxbox = Fluxbox::instance();
119 fluxbox->saveMenuSearch(menu.window, this);
120 120
121 //attibutes for title to menuwindow 121 //attibutes for title to menuwindow
122 attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | CWEventMask; 122 attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | CWEventMask;
@@ -127,7 +127,7 @@ m_alignment(ALIGNDONTCARE) {
127 XCreateWindow(m_display, menu.window, 0, 0, menu.width, menu.height, 0, 127 XCreateWindow(m_display, menu.window, 0, 0, menu.width, menu.height, 0,
128 m_screen->getDepth(), InputOutput, m_screen->getVisual(), 128 m_screen->getDepth(), InputOutput, m_screen->getVisual(),
129 attrib_mask, &attrib); 129 attrib_mask, &attrib);
130 m_fluxbox->saveMenuSearch(menu.title, this); 130 fluxbox->saveMenuSearch(menu.title, this);
131 131
132 attrib.event_mask |= PointerMotionMask; 132 attrib.event_mask |= PointerMotionMask;
133 menu.frame = XCreateWindow(m_display, menu.window, 0, 133 menu.frame = XCreateWindow(m_display, menu.window, 0,
@@ -135,7 +135,7 @@ m_alignment(ALIGNDONTCARE) {
135 menu.width, menu.frame_h, 0, 135 menu.width, menu.frame_h, 0,
136 m_screen->getDepth(), InputOutput, 136 m_screen->getDepth(), InputOutput,
137 m_screen->getVisual(), attrib_mask, &attrib); 137 m_screen->getVisual(), attrib_mask, &attrib);
138 m_fluxbox->saveMenuSearch(menu.frame, this); 138 fluxbox->saveMenuSearch(menu.frame, this);
139 139
140} 140}
141 141
@@ -163,13 +163,15 @@ Basemenu::~Basemenu() {
163 if (menu.sel_pixmap) 163 if (menu.sel_pixmap)
164 m_image_ctrl->removeImage(menu.sel_pixmap); 164 m_image_ctrl->removeImage(menu.sel_pixmap);
165 165
166 m_fluxbox->removeMenuSearch(menu.title); 166 Fluxbox * fluxbox = Fluxbox::instance();
167
168 fluxbox->removeMenuSearch(menu.title);
167 XDestroyWindow(m_display, menu.title); 169 XDestroyWindow(m_display, menu.title);
168 170
169 m_fluxbox->removeMenuSearch(menu.frame); 171 fluxbox->removeMenuSearch(menu.frame);
170 XDestroyWindow(m_display, menu.frame); 172 XDestroyWindow(m_display, menu.frame);
171 173
172 m_fluxbox->removeMenuSearch(menu.window); 174 fluxbox->removeMenuSearch(menu.window);
173 XDestroyWindow(m_display, menu.window); 175 XDestroyWindow(m_display, menu.window);
174} 176}
175 177
@@ -782,8 +784,9 @@ void Basemenu::setItemSelected(unsigned int index, bool sel) {
782bool Basemenu::isItemSelected(unsigned int index) const{ 784bool Basemenu::isItemSelected(unsigned int index) const{
783 if (index >= menuitems.size()) return false; 785 if (index >= menuitems.size()) return false;
784 786
785 BasemenuItem *item = find(index); 787 const BasemenuItem *item = find(index);
786 if (! item) return false; 788 if (!item)
789 return false;
787 790
788 return item->isSelected(); 791 return item->isSelected();
789} 792}
@@ -804,7 +807,8 @@ bool Basemenu::isItemEnabled(unsigned int index) const {
804 if (index >= menuitems.size()) return false; 807 if (index >= menuitems.size()) return false;
805 808
806 BasemenuItem *item = find(index); 809 BasemenuItem *item = find(index);
807 if (! item) return false; 810 if (!item)
811 return false;
808 812
809 return item->isEnabled(); 813 return item->isEnabled();
810} 814}
@@ -824,7 +828,7 @@ void Basemenu::buttonPressEvent(XButtonEvent *be) {
824 if (item->submenu()) 828 if (item->submenu())
825 drawSubmenu(w); 829 drawSubmenu(w);
826 else 830 else
827 drawItem(w, (item->isEnabled()), True); 831 drawItem(w, (item->isEnabled()), true);
828 } 832 }
829 } else { 833 } else {
830 menu.x_move = be->x_root - menu.x; 834 menu.x_move = be->x_root - menu.x;
@@ -843,8 +847,8 @@ void Basemenu::buttonReleaseEvent(XButtonEvent *re) {
843 } 847 }
844 848
845 if (re->x >= 0 && re->x <= (signed) menu.width && 849 if (re->x >= 0 && re->x <= (signed) menu.width &&
846 re->y >= 0 && re->y <= (signed) menu.title_h) 850 re->y >= 0 && re->y <= (signed) menu.title_h &&
847 if (re->button == 3) 851 re->button == 3)
848 hide(); 852 hide();
849 853
850 } else if (re->window == menu.frame && 854 } else if (re->window == menu.frame &&
diff --git a/src/Basemenu.hh b/src/Basemenu.hh
index 07d166f..7a94c72 100644
--- a/src/Basemenu.hh
+++ b/src/Basemenu.hh
@@ -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: Basemenu.hh,v 1.18 2002/10/15 10:57:58 fluxgen Exp $ 25// $Id: Basemenu.hh,v 1.19 2002/11/26 16:06:36 fluxgen Exp $
26 26
27#ifndef BASEMENU_HH 27#ifndef BASEMENU_HH
28#define BASEMENU_HH 28#define BASEMENU_HH
@@ -126,12 +126,11 @@ protected:
126 virtual void redrawTitle(); 126 virtual void redrawTitle();
127 virtual void internal_hide(); 127 virtual void internal_hide();
128 inline Basemenu *parent() { return m_parent; } 128 inline Basemenu *parent() { return m_parent; }
129 inline const Basemenu *GetParent() const { return m_parent; } 129 inline const Basemenu *parent() const { return m_parent; }
130 130
131private: 131private:
132 132
133 typedef std::vector<BasemenuItem *> Menuitems; 133 typedef std::vector<BasemenuItem *> Menuitems;
134 Fluxbox *m_fluxbox; //< fluxbox object, obsolete
135 BScreen *m_screen; 134 BScreen *m_screen;
136 Display *m_display; 135 Display *m_display;
137 Basemenu *m_parent; 136 Basemenu *m_parent;