added disable/enable title, removeAll items function and changed itemSelected to normal virtual

This commit is contained in:
fluxgen 2003-01-07 02:09:43 +00:00
parent 188ac46621
commit a7f4b6edb6

View file

@ -1,5 +1,5 @@
// Menu.hh for FbTk - Fluxbox Toolkit // Menu.hh for FbTk - Fluxbox Toolkit
// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen at users.sourceforge.net) // Copyright (c) 2001 - 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
// //
// Basemenu.hh for Blackbox - an X11 Window manager // Basemenu.hh for Blackbox - an X11 Window manager
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net) // Copyright (c) 1997 - 2000 Brad Hughes (bhughes at tcac.net)
@ -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: Menu.hh,v 1.1 2002/12/25 11:46:50 fluxgen Exp $ // $Id: Menu.hh,v 1.2 2003/01/07 02:09:43 fluxgen Exp $
#ifndef FBTK_MENU_HH #ifndef FBTK_MENU_HH
#define FBTK_MENU_HH #define FBTK_MENU_HH
@ -43,9 +43,8 @@ namespace FbTk {
class MenuItem; class MenuItem;
class MenuTheme; class MenuTheme;
/**
Base class for menus /// Base class for menus
*/
class Menu: public FbTk::EventHandler { class Menu: public FbTk::EventHandler {
public: public:
enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM }; enum Alignment{ ALIGNDONTCARE = 1, ALIGNTOP, ALIGNBOTTOM };
@ -69,8 +68,10 @@ public:
int insert(const char *label, int function= 0, const char *exec = 0, int pos = -1); int insert(const char *label, int function= 0, const char *exec = 0, int pos = -1);
/// add submenu /// add submenu
int insert(const char *label, Menu *submenu, int pos= -1); int insert(const char *label, Menu *submenu, int pos= -1);
/// remove item /// remove an item
int remove(unsigned int item); int remove(unsigned int item);
/// remove all items
void removeAll();
inline void setInternalMenu() { internal_menu = true; } inline void setInternalMenu() { internal_menu = true; }
inline void setAlignment(Alignment a) { m_alignment = a; } inline void setAlignment(Alignment a) { m_alignment = a; }
inline void setTorn() { torn = true; } inline void setTorn() { torn = true; }
@ -79,6 +80,8 @@ public:
void raise(); void raise();
/// lower this window /// lower this window
void lower(); void lower();
void disableTitle();
void enableTitle();
/** /**
@name event handlers @name event handlers
*/ */
@ -135,7 +138,7 @@ protected:
inline void setHideTree(bool h) { hide_tree = h; } inline void setHideTree(bool h) { hide_tree = h; }
inline void setMinimumSublevels(int m) { menu.minsub = m; } inline void setMinimumSublevels(int m) { menu.minsub = m; }
virtual void itemSelected(int button, unsigned int index) = 0; virtual void itemSelected(int button, unsigned int index) { }
virtual void drawItem(unsigned int index, bool highlight = false, virtual void drawItem(unsigned int index, bool highlight = false,
bool clear= false, bool clear= false,
int x= -1, int y= -1, int x= -1, int y= -1,