summaryrefslogtreecommitdiffstats
path: root/client/menu.h
diff options
context:
space:
mode:
authorArnon Gilboa <agilboa@redhat.com>2010-01-07 11:02:50 +0200
committerYaniv Kamay <ykamay@redhat.com>2010-01-07 13:53:41 +0200
commitdcf326cfd523c135bd0be8f9a4bc2da6c78b2d23 (patch)
tree8a026f5ab2cff5437b1e6817131800549c8f99af /client/menu.h
parent81945d89710d9b03d829ebd4f040b0e8f3f2b507 (diff)
downloadspice-dcf326cfd523c135bd0be8f9a4bc2da6c78b2d23.tar.gz
spice-dcf326cfd523c135bd0be8f9a4bc2da6c78b2d23.tar.xz
spice-dcf326cfd523c135bd0be8f9a4bc2da6c78b2d23.zip
spice: menu additons
-functions: set_name, remove_command, remove_sub, clear -item state & enum -add state support in RedWindow insert_command & insert_menu
Diffstat (limited to 'client/menu.h')
-rw-r--r--client/menu.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/client/menu.h b/client/menu.h
index b908e549..ee3c9ec9 100644
--- a/client/menu.h
+++ b/client/menu.h
@@ -35,37 +35,51 @@ public:
MENU_ITEM_TYPE_SEPARATOR,
};
+ enum ItemState {
+ MENU_ITEM_STATE_CHECKED = 1 << 0,
+ MENU_ITEM_STATE_DIM = 1 << 1,
+ };
+
Menu* ref() { _refs++; return this;}
void unref() { if (!--_refs) delete this;}
+ void set_name(const std::string& name) { _name = name;}
const std::string& get_name() { return _name;}
CommandTarget& get_target() { return _target;}
- void add_command(const std::string& name, int cmd_id);
+ void add_command(const std::string& name, int cmd_id, int state = 0);
void add_separator();
void add_sub(Menu* sub);
+ void remove_command(int cmd_id);
+ void remove_sub(Menu* menu);
+
ItemType item_type_at(int pos);
- void command_at(int pos, std::string& name, int& cmd_id);
+ void command_at(int pos, std::string& name, int& cmd_id, int& state);
Menu* sub_at(int pos);
+ void clear();
+
private:
virtual ~Menu();
class MenuCommand {
public:
- MenuCommand(const std::string& name, int cmd_id)
+ MenuCommand(const std::string& name, int cmd_id, int state)
: _name (name)
, _cmd_id (cmd_id)
+ , _state (state)
{
}
const std::string& get_name() { return _name;}
int get_cmd_id() { return _cmd_id;}
+ int get_state() { return _state;}
private:
std::string _name;
int _cmd_id;
+ int _state;
};
struct MenuItem {