diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-29 16:55:20 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-29 16:55:20 +0000 |
commit | 2b2a5958399c551e7643237bc6b519d299bad164 (patch) | |
tree | 645554f77a7f23369028f7ba46eb7c71d07a3160 /crawl-ref/source/menu.h | |
parent | cf277d8cb8c333532b3db63855ef003553e412f5 (diff) | |
download | crawl-ref-2b2a5958399c551e7643237bc6b519d299bad164.tar.gz crawl-ref-2b2a5958399c551e7643237bc6b519d299bad164.zip |
Implemented 1715578: pressing '!' in the Z? screen toggles between
showing schools/success and hunger/power.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1693 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/menu.h')
-rw-r--r-- | crawl-ref/source/menu.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h index 834946d820..2607a02702 100644 --- a/crawl-ref/source/menu.h +++ b/crawl-ref/source/menu.h @@ -117,6 +117,20 @@ struct MenuEntry } }; +struct ToggleableMenuEntry : public MenuEntry +{ +public: + std::string alt_text; + + ToggleableMenuEntry( const std::string &txt = std::string(), + const std::string &alt_txt = std::string(), + MenuEntryLevel lev = MEL_ITEM, + int qty = 0, int hotk = 0 ) : + MenuEntry(txt, lev, qty, hotk), alt_text(alt_txt) {} + + void toggle() { text.swap(alt_text); } +}; + class MenuHighlighter { public: @@ -252,6 +266,19 @@ protected: virtual bool process_key( int keyin ); }; +// Allows toggling by specific keys. +class ToggleableMenu : public Menu +{ +public: + ToggleableMenu( int _flags = MF_MULTISELECT ) : Menu(_flags) {} + void add_toggle_key(int newkey) { toggle_keys.push_back(newkey); } +protected: + virtual int pre_process(int key); + + std::vector<int> toggle_keys; +}; + + // Uses a sliding selector rather than hotkeyed selection. class slider_menu : public Menu { |