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

menuitem.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 
00010 
00011 #ifndef header_menuitem
00012 #define header_menuitem
00013 
00014 #include "../Core/System/timer.h"
00015 
00016 #include "component.h"
00017 #include "component_options.h"
00018 #include "stylemanager.h"
00019 
00020 class CL_PopupMenu;
00021 
00022 class CL_MenuItem : public CL_Component
00023 {
00024 public:
00025         static CL_MenuItem *create(
00026                 const CL_ComponentOptions &options,
00027                 CL_Component *parent,
00028                 CL_StyleManager *style);
00029 
00030         CL_MenuItem(const CL_ComponentOptions &options, CL_Component *parent);
00031         virtual ~CL_MenuItem() { return; }
00032 
00033         virtual void add_child(CL_Component *child);
00034 
00035 //      virtual void update();
00036 
00037         bool is_checkable() { return checkable; }
00038         bool is_separator() { return separator; }
00039         bool is_checked() { return checked; }
00040         bool is_highlighted() { return highlighted; }
00041 
00042         bool has_submenu() { return false; }
00043         
00044         const std::string &get_text() { return text; }
00045         //: Returns the item label.
00047 
00048         void set_text(const std::string &text) { this->text = text; }
00049         //: Sets the item label.
00051 
00052         CL_Signal_v0 sig_clicked;
00053 
00054         void set_impl(CL_ComponentStyle *impl) { this->impl = impl; }
00055         CL_ComponentStyle *get_impl() { return impl; }
00056         
00057 private:
00058         void init(int id);
00059         void close_children();
00060         
00061 protected:
00062         void on_mouse_enter();
00063         void on_mouse_leave();
00064 
00065         void on_key_down(CL_Component *comp, CL_InputDevice *device, CL_Key key);
00066         void on_timer_popup();
00067 
00068 protected:
00069         int id;
00070         
00071         std::string text;
00072         
00073         bool separator;
00074         bool checked;
00075         bool checkable;
00076         bool highlighted;
00077 
00078         CL_PopupMenu *submenu;
00079         
00080         CL_Timer timer_popup;
00081 
00082         CL_ComponentStyle *impl;
00083 };
00084 
00085 #endif

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