minor cleaning
This commit is contained in:
parent
3dacf70154
commit
0cbcb87b88
2 changed files with 20 additions and 17 deletions
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
//use GNU extensions
|
||||||
#ifndef _GNU_SOURCE
|
#ifndef _GNU_SOURCE
|
||||||
|
@ -52,7 +52,6 @@ using namespace std;
|
||||||
static Basemenu *shown = 0;
|
static Basemenu *shown = 0;
|
||||||
|
|
||||||
Basemenu::Basemenu(BScreen *screen):
|
Basemenu::Basemenu(BScreen *screen):
|
||||||
m_fluxbox(Fluxbox::instance()),
|
|
||||||
m_screen(screen),
|
m_screen(screen),
|
||||||
m_display(Fluxbox::instance()->getXDisplay()),
|
m_display(Fluxbox::instance()->getXDisplay()),
|
||||||
m_parent(0),
|
m_parent(0),
|
||||||
|
@ -116,7 +115,8 @@ m_alignment(ALIGNDONTCARE) {
|
||||||
menu.height, m_screen->getBorderWidth(), m_screen->getDepth(),
|
menu.height, m_screen->getBorderWidth(), m_screen->getDepth(),
|
||||||
InputOutput, m_screen->getVisual(), attrib_mask, &attrib);
|
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
|
//attibutes for title to menuwindow
|
||||||
attrib_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | CWEventMask;
|
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,
|
XCreateWindow(m_display, menu.window, 0, 0, menu.width, menu.height, 0,
|
||||||
m_screen->getDepth(), InputOutput, m_screen->getVisual(),
|
m_screen->getDepth(), InputOutput, m_screen->getVisual(),
|
||||||
attrib_mask, &attrib);
|
attrib_mask, &attrib);
|
||||||
m_fluxbox->saveMenuSearch(menu.title, this);
|
fluxbox->saveMenuSearch(menu.title, this);
|
||||||
|
|
||||||
attrib.event_mask |= PointerMotionMask;
|
attrib.event_mask |= PointerMotionMask;
|
||||||
menu.frame = XCreateWindow(m_display, menu.window, 0,
|
menu.frame = XCreateWindow(m_display, menu.window, 0,
|
||||||
|
@ -135,7 +135,7 @@ m_alignment(ALIGNDONTCARE) {
|
||||||
menu.width, menu.frame_h, 0,
|
menu.width, menu.frame_h, 0,
|
||||||
m_screen->getDepth(), InputOutput,
|
m_screen->getDepth(), InputOutput,
|
||||||
m_screen->getVisual(), attrib_mask, &attrib);
|
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)
|
if (menu.sel_pixmap)
|
||||||
m_image_ctrl->removeImage(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);
|
XDestroyWindow(m_display, menu.title);
|
||||||
|
|
||||||
m_fluxbox->removeMenuSearch(menu.frame);
|
fluxbox->removeMenuSearch(menu.frame);
|
||||||
XDestroyWindow(m_display, menu.frame);
|
XDestroyWindow(m_display, menu.frame);
|
||||||
|
|
||||||
m_fluxbox->removeMenuSearch(menu.window);
|
fluxbox->removeMenuSearch(menu.window);
|
||||||
XDestroyWindow(m_display, 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{
|
bool Basemenu::isItemSelected(unsigned int index) const{
|
||||||
if (index >= menuitems.size()) return false;
|
if (index >= menuitems.size()) return false;
|
||||||
|
|
||||||
BasemenuItem *item = find(index);
|
const BasemenuItem *item = find(index);
|
||||||
if (! item) return false;
|
if (!item)
|
||||||
|
return false;
|
||||||
|
|
||||||
return item->isSelected();
|
return item->isSelected();
|
||||||
}
|
}
|
||||||
|
@ -804,7 +807,8 @@ bool Basemenu::isItemEnabled(unsigned int index) const {
|
||||||
if (index >= menuitems.size()) return false;
|
if (index >= menuitems.size()) return false;
|
||||||
|
|
||||||
BasemenuItem *item = find(index);
|
BasemenuItem *item = find(index);
|
||||||
if (! item) return false;
|
if (!item)
|
||||||
|
return false;
|
||||||
|
|
||||||
return item->isEnabled();
|
return item->isEnabled();
|
||||||
}
|
}
|
||||||
|
@ -824,7 +828,7 @@ void Basemenu::buttonPressEvent(XButtonEvent *be) {
|
||||||
if (item->submenu())
|
if (item->submenu())
|
||||||
drawSubmenu(w);
|
drawSubmenu(w);
|
||||||
else
|
else
|
||||||
drawItem(w, (item->isEnabled()), True);
|
drawItem(w, (item->isEnabled()), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
menu.x_move = be->x_root - menu.x;
|
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 &&
|
if (re->x >= 0 && re->x <= (signed) menu.width &&
|
||||||
re->y >= 0 && re->y <= (signed) menu.title_h)
|
re->y >= 0 && re->y <= (signed) menu.title_h &&
|
||||||
if (re->button == 3)
|
re->button == 3)
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
} else if (re->window == menu.frame &&
|
} else if (re->window == menu.frame &&
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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
|
#ifndef BASEMENU_HH
|
||||||
#define BASEMENU_HH
|
#define BASEMENU_HH
|
||||||
|
@ -126,12 +126,11 @@ protected:
|
||||||
virtual void redrawTitle();
|
virtual void redrawTitle();
|
||||||
virtual void internal_hide();
|
virtual void internal_hide();
|
||||||
inline Basemenu *parent() { return m_parent; }
|
inline Basemenu *parent() { return m_parent; }
|
||||||
inline const Basemenu *GetParent() const { return m_parent; }
|
inline const Basemenu *parent() const { return m_parent; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::vector<BasemenuItem *> Menuitems;
|
typedef std::vector<BasemenuItem *> Menuitems;
|
||||||
Fluxbox *m_fluxbox; //< fluxbox object, obsolete
|
|
||||||
BScreen *m_screen;
|
BScreen *m_screen;
|
||||||
Display *m_display;
|
Display *m_display;
|
||||||
Basemenu *m_parent;
|
Basemenu *m_parent;
|
||||||
|
|
Loading…
Reference in a new issue