00001 #ifndef MOVE_MENU_DEF 00002 #define MOVE_MENU_DEF 00003 00004 #include "std/support.H" 00005 #include "mlib/points.H" 00006 00007 class MoveMenu; 00008 class MenuItem { 00009 public : 00010 MenuItem() : _menu(0) {} 00011 MenuItem(Cstr_ptr &label) : _label(label) { } 00012 virtual ~MenuItem() {} 00013 00014 virtual void exec(mlib::CXYpt &) {} 00015 Cstr_ptr &label() const { return _label; } 00016 00017 void menu(MoveMenu *menu) {_menu = menu;} 00018 const MoveMenu *menu() const {return _menu;} 00019 00020 protected: 00021 str_ptr _label; 00022 MoveMenu *_menu; 00023 }; 00024 00025 typedef ARRAY<MenuItem *> MenuList; 00026 00027 class MoveMenu 00028 { 00029 public : 00030 MoveMenu(Cstr_ptr &name) : _is_shown(0), _name(name) {} 00031 virtual ~MoveMenu() {} 00032 00033 virtual void move(const mlib::XYpt &loc) {_loc = loc;} 00034 virtual void move_local(const mlib::XYpt &loc) = 0; 00035 virtual void hide() = 0; 00036 virtual void menu(int recreate = false) = 0; 00037 virtual void show() = 0; 00038 MenuList &items() {return _item_list;} 00039 int is_shown() {return _is_shown;} 00040 00041 protected: 00042 int _is_shown; 00043 MenuList _item_list; 00044 mlib::XYpt _loc; 00045 str_ptr _name; 00046 }; 00047 #endif