From 0cbcb87b888d5d7ac227e74630a1734fa7c4e939 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 26 Nov 2002 16:07:29 +0000 Subject: minor cleaning --- src/Basemenu.cc | 32 ++++++++++++++++++-------------- src/Basemenu.hh | 5 ++--- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Basemenu.cc,v 1.35 2002/11/15 14:24:59 fluxgen Exp $ +// $Id: Basemenu.cc,v 1.36 2002/11/26 16:07:29 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -52,7 +52,6 @@ using namespace std; static Basemenu *shown = 0; Basemenu::Basemenu(BScreen *screen): -m_fluxbox(Fluxbox::instance()), m_screen(screen), m_display(Fluxbox::instance()->getXDisplay()), m_parent(0), @@ -116,7 +115,8 @@ m_alignment(ALIGNDONTCARE) { menu.height, m_screen->getBorderWidth(), m_screen->getDepth(), InputOutput, m_screen->getVisual(), attrib_mask, &attrib); - m_fluxbox->saveMenuSearch(menu.window, this); + Fluxbox * const fluxbox = Fluxbox::instance(); + fluxbox->saveMenuSearch(menu.window, this); //attibutes for title to menuwindow attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | CWEventMask; @@ -127,7 +127,7 @@ m_alignment(ALIGNDONTCARE) { XCreateWindow(m_display, menu.window, 0, 0, menu.width, menu.height, 0, m_screen->getDepth(), InputOutput, m_screen->getVisual(), attrib_mask, &attrib); - m_fluxbox->saveMenuSearch(menu.title, this); + fluxbox->saveMenuSearch(menu.title, this); attrib.event_mask |= PointerMotionMask; menu.frame = XCreateWindow(m_display, menu.window, 0, @@ -135,7 +135,7 @@ m_alignment(ALIGNDONTCARE) { menu.width, menu.frame_h, 0, m_screen->getDepth(), InputOutput, m_screen->getVisual(), attrib_mask, &attrib); - m_fluxbox->saveMenuSearch(menu.frame, this); + fluxbox->saveMenuSearch(menu.frame, this); } @@ -163,13 +163,15 @@ Basemenu::~Basemenu() { if (menu.sel_pixmap) m_image_ctrl->removeImage(menu.sel_pixmap); - m_fluxbox->removeMenuSearch(menu.title); + Fluxbox * fluxbox = Fluxbox::instance(); + + fluxbox->removeMenuSearch(menu.title); XDestroyWindow(m_display, menu.title); - m_fluxbox->removeMenuSearch(menu.frame); + fluxbox->removeMenuSearch(menu.frame); XDestroyWindow(m_display, menu.frame); - m_fluxbox->removeMenuSearch(menu.window); + fluxbox->removeMenuSearch(menu.window); XDestroyWindow(m_display, menu.window); } @@ -782,8 +784,9 @@ void Basemenu::setItemSelected(unsigned int index, bool sel) { bool Basemenu::isItemSelected(unsigned int index) const{ if (index >= menuitems.size()) return false; - BasemenuItem *item = find(index); - if (! item) return false; + const BasemenuItem *item = find(index); + if (!item) + return false; return item->isSelected(); } @@ -804,7 +807,8 @@ bool Basemenu::isItemEnabled(unsigned int index) const { if (index >= menuitems.size()) return false; BasemenuItem *item = find(index); - if (! item) return false; + if (!item) + return false; return item->isEnabled(); } @@ -824,7 +828,7 @@ void Basemenu::buttonPressEvent(XButtonEvent *be) { if (item->submenu()) drawSubmenu(w); else - drawItem(w, (item->isEnabled()), True); + drawItem(w, (item->isEnabled()), true); } } else { menu.x_move = be->x_root - menu.x; @@ -843,8 +847,8 @@ void Basemenu::buttonReleaseEvent(XButtonEvent *re) { } if (re->x >= 0 && re->x <= (signed) menu.width && - re->y >= 0 && re->y <= (signed) menu.title_h) - if (re->button == 3) + re->y >= 0 && re->y <= (signed) menu.title_h && + re->button == 3) hide(); } 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Basemenu.hh,v 1.18 2002/10/15 10:57:58 fluxgen Exp $ +// $Id: Basemenu.hh,v 1.19 2002/11/26 16:06:36 fluxgen Exp $ #ifndef BASEMENU_HH #define BASEMENU_HH @@ -126,12 +126,11 @@ protected: virtual void redrawTitle(); virtual void internal_hide(); inline Basemenu *parent() { return m_parent; } - inline const Basemenu *GetParent() const { return m_parent; } + inline const Basemenu *parent() const { return m_parent; } private: typedef std::vector Menuitems; - Fluxbox *m_fluxbox; //< fluxbox object, obsolete BScreen *m_screen; Display *m_display; Basemenu *m_parent; -- cgit v0.11.2