Archive / / / / gui.h
2007-09-28 01:30:14 UTC
previous next
#ifndef GUI_H_ #define GUI_H_ #include <string> #include <list> #include <boost/smart_ptr.hpp> #include <cairomm/cairomm.h> #include "gui_nativeapi.h" namespace GUI { /*class Size { public: Size(int width_, int height_) : width(width_), height(height_) {} int width; int height; }; class Rectangle { public: Rectangle(int x_, int y_, int width_, int height_ int width; int height; int x; int y; };*/ class MainMenu : public GUI::NativeAPI::EventReceiver { public: // Public classes class MenuItem { public: MenuItem( std::string label, boost::shared_ptr<NativeAPI::EventReceiver> target, bool visible = true) : _label(label), _target(target), _visible(visible) {} MenuItem( std::string label, bool visible = true) : _label(label), _visible(visible) {} void add_subitem(MenuItem item); private: std::string _label; boost::shared_ptr<NativeAPI::EventReceiver> _target; bool _visible; std::list<MenuItem> _submenu; friend class MainMenu; }; public: // Public methods MainMenu(); static void add_item(MenuItem item); public: // Events inherited from EventReceiver virtual void on_redraw_event( Cairo::RefPtr<Cairo::Context> cr, double width, double height); private: // Private methods void sort_menu(); private: // Private variables static std::list<MenuItem> _menu; }; } #endif /*GUI_H_*/