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

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