Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

menudata_generic.h

Go to the documentation of this file.
00001 /*
00002         ClanGUI, copyrights by various people. Have a look in the CREDITS file.
00003         
00004         This sourcecode is distributed using the Library GNU Public Licence,
00005         version 2 or (at your option) any later version. Please read LICENSE
00006         for details.
00007 */
00008 
00009 #ifndef header_menudata
00010 #define header_menudata
00011 
00012 #include "component.h"
00013 
00014 #include <string>
00015 
00016 class CL_MenuItem;
00017 class CL_PopupMenu;
00018 class CL_Surface;
00019 
00020 class CL_MenuData : public CL_Component
00021 {
00022 public:
00023         CL_MenuData(CL_Component *parent);
00024         virtual ~CL_MenuData();
00025 
00026         int insert_item(const std::string &text, int id = -1, int index = -1);
00027         int insert_separator(int id = -1, int index = -1);
00028 
00029         unsigned int count() const;
00030         // Return number of items
00031 
00032         void remove_item(int id);
00033         // Remove item
00034 
00035         void remove_item_at(int index);
00036         // Remove item as position index
00037 
00038         void clear();
00039         // Remove all items
00040 
00041         const std::string &get_text(int id) const;
00042         // Return item text
00043 
00044         void change_item(const std::string &text, int id);
00045         // Change item text
00046 
00047         bool is_item_enabled(int id) const;
00048         void enable_item(int id, bool enable);
00049         bool is_item_checked(int id) const;
00050         void check_item(int id, bool check);
00051 
00052         int get_index(int id) const;
00053         // Returns item position
00054 
00055         int get_id(int index) const;
00056         // Returns item id
00057 
00058         void set_id(int index, int id);
00059         // Sets item id
00060 
00061 protected:
00062         virtual void on_item_activated(CL_MenuItem *item, CL_PopupMenu *child) {};
00063         virtual void on_item_highlighted(CL_MenuItem *item) {};
00064 
00065         CL_Component *real_parent;
00066 
00067 private:
00068         int generate_id(int id);
00069         // Returns a new available ID
00070         // Doesn't generate a new id if (id == -1)
00071 };  
00072 
00073 #endif

Generated at Wed Apr 4 19:54:01 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001