summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.h
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-19 22:30:42 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-19 22:30:42 +0000
commitd67f41ebf91d23eabe1640a2910cdae40358b77c (patch)
treeba68939920e514731ce118cf697e51357480d140 /crawl-ref/source/menu.h
parent55901dbf5e38817170440cae2f80df7b468d52f5 (diff)
downloadcrawl-ref-d67f41ebf91d23eabe1640a2910cdae40358b77c.tar.gz
crawl-ref-d67f41ebf91d23eabe1640a2910cdae40358b77c.zip
Menus are now tagged. Menu colours now only apply to a menu with a matching
tag, unless the menu colour tag is empty or "any". Menu colours are specified as tag:colour:pattern, where the "tag:" part is optional (default is empty tag, i.e., all menus.) The following menu tags exist: ability, description, equip, help, inventory, notes, resists, spell, stash. Default .crawlrc should probably be changed (and the docs, too...) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2493 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/menu.h')
-rw-r--r--crawl-ref/source/menu.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index f2fbc5b359..f7a57f0834 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -48,10 +48,12 @@ struct menu_letter
struct item_def;
int menu_colour(const std::string &itemtext,
- const std::string &prefix = "");
+ const std::string &prefix = "",
+ const std::string &tag = "");
struct MenuEntry
{
+ std::string tag;
std::string text;
int quantity, selected_qty;
int colour;
@@ -108,7 +110,7 @@ struct MenuEntry
virtual int highlight_colour() const
{
- return (menu_colour(get_text()));
+ return (menu_colour(get_text(), "", tag));
}
virtual bool selected() const
@@ -176,7 +178,7 @@ enum MenuFlag
class Menu
{
public:
- Menu( int flags = MF_MULTISELECT );
+ Menu( int flags = MF_MULTISELECT, const std::string& tagname = "" );
virtual ~Menu();
// Remove all items from the Menu, leave title intact.
@@ -187,6 +189,7 @@ public:
void set_flags(int new_flags, bool use_options = true);
int get_flags() const { return flags; }
virtual bool is_set( int flag ) const;
+ void set_tag(const std::string& t) { tag = t; }
bool draw_title_suffix( const std::string &s, bool titlefirst = true );
void update_title();
@@ -226,6 +229,7 @@ public:
protected:
MenuEntry *title;
int flags;
+ std::string tag;
int first_entry, y_offset;
int pagesize, max_pagesize;