summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg.h
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2010-02-14 19:42:22 -0500
committerEnne Walker <ennewalker@users.sourceforge.net>2010-02-14 21:39:40 -0500
commit940c3c2e79ca5b9cafed39b67eb8ec9a19f728c5 (patch)
treea7a71df5e16a4b3ed13e24b40399e19a2cb02022 /crawl-ref/source/tilereg.h
parent69ba9b76d49b2354c5e5952716de87d13a7d868b (diff)
downloadcrawl-ref-940c3c2e79ca5b9cafed39b67eb8ec9a19f728c5.tar.gz
crawl-ref-940c3c2e79ca5b9cafed39b67eb8ec9a19f728c5.zip
Cleaner implementation of tab names.
TabbedRegion is now a GridRegion, so it can draw some text more elegantly. Each GridRegion-derived class now owns its own name, so that the TabbedRegion can draw it when the mouse is over a given tab.
Diffstat (limited to 'crawl-ref/source/tilereg.h')
-rw-r--r--crawl-ref/source/tilereg.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/crawl-ref/source/tilereg.h b/crawl-ref/source/tilereg.h
index 873238cd6d..317c2f9e0f 100644
--- a/crawl-ref/source/tilereg.h
+++ b/crawl-ref/source/tilereg.h
@@ -342,6 +342,8 @@ public:
virtual void update() = 0;
void place_cursor(const coord_def &cursor);
+ virtual const std::string name() const = 0;
+
protected:
virtual void pack_buffers() = 0;
virtual void draw_tag() = 0;
@@ -375,6 +377,8 @@ public:
virtual bool update_tip_text(std::string &tip);
virtual bool update_alt_text(std::string &alt);
+ virtual const std::string name() const { return "Inventory"; }
+
protected:
virtual void pack_buffers();
virtual void draw_tag();
@@ -392,6 +396,8 @@ public:
virtual bool update_alt_text(std::string &alt);
virtual bool check_memorise();
+ virtual const std::string name() const { return "Spells"; }
+
protected:
bool memorise;
@@ -409,12 +415,14 @@ public:
virtual int handle_mouse(MouseEvent &event);
virtual bool update_tip_text(std::string &tip);
+ virtual const std::string name() const { return "Memorisation"; }
+
protected:
virtual void draw_tag();
};
// A region that contains multiple region, selectable by tabs.
-class TabbedRegion : public TileRegion
+class TabbedRegion : public GridRegion
{
public:
TabbedRegion(ImageManager *im, FTFont *tag_font,
@@ -428,8 +436,7 @@ public:
int active_tab() const;
int num_tabs() const;
- void update();
-
+ virtual void update();
virtual void clear();
virtual void render();
virtual void on_resize();
@@ -437,10 +444,18 @@ public:
virtual bool update_tip_text(std::string &tip);
virtual bool update_alt_text(std::string &alt);
+ virtual const std::string name() const { return ""; }
+
protected:
- int m_active;
+ virtual void pack_buffers();
+ virtual void draw_tag();
+
bool active_is_valid() const;
+ // Returns the tab the mouse is over, -1 if none.
+ int get_mouseover_tab(MouseEvent &event) const;
+ int m_active;
+ int m_mouse_tab;
TileBuffer m_buf_gui;
struct TabInfo