summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg-tab.h
diff options
context:
space:
mode:
authorEnne Walker <ennewalker@users.sourceforge.net>2010-04-19 20:00:06 -0400
committerEnne Walker <ennewalker@users.sourceforge.net>2010-04-25 19:33:13 -0400
commit8305dc11a61b732984b4bf2a2f8c8f48af84630e (patch)
tree9f605e327b60ab79111ae7c25bec938ed2261a0b /crawl-ref/source/tilereg-tab.h
parentedacdc0db313c0f5385631dfcf560f1fdf8e7c8a (diff)
downloadcrawl-ref-8305dc11a61b732984b4bf2a2f8c8f48af84630e.tar.gz
crawl-ref-8305dc11a61b732984b4bf2a2f8c8f48af84630e.zip
Split tilereg.h/cc into multiple files.
No functional changes, just rearranging and exposing functions where needed.
Diffstat (limited to 'crawl-ref/source/tilereg-tab.h')
-rw-r--r--crawl-ref/source/tilereg-tab.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/crawl-ref/source/tilereg-tab.h b/crawl-ref/source/tilereg-tab.h
new file mode 100644
index 0000000000..ebc8922bd3
--- /dev/null
+++ b/crawl-ref/source/tilereg-tab.h
@@ -0,0 +1,70 @@
+/*
+ * File: tilereg_tab.h
+ * Created by: ennewalker on Sat Jan 5 01:33:53 2008 UTC
+ */
+
+#ifdef USE_TILE
+#ifndef TILEREG_TAB_H
+#define TILEREG_TAB_H
+
+#include "tilereg-grid.h"
+
+// A region that contains multiple region, selectable by tabs.
+class TabbedRegion : public GridRegion
+{
+public:
+ TabbedRegion(const TileRegionInit &init);
+
+ virtual ~TabbedRegion();
+
+ enum
+ {
+ TAB_OFS_UNSELECTED,
+ TAB_OFS_MOUSEOVER,
+ TAB_OFS_SELECTED,
+ TAB_OFS_MAX
+ };
+
+ void set_tab_region(int idx, GridRegion *reg, int tile_tab);
+ GridRegion *get_tab_region(int idx);
+ void activate_tab(int idx);
+ int active_tab() const;
+ int num_tabs() const;
+
+ virtual void update();
+ virtual void clear();
+ virtual void render();
+ virtual void on_resize();
+ virtual int handle_mouse(MouseEvent &event);
+ virtual bool update_tip_text(std::string &tip);
+ virtual bool update_tab_tip_text(std::string &tip, bool active);
+ virtual bool update_alt_text(std::string &alt);
+
+ virtual const std::string name() const { return ""; }
+
+protected:
+ virtual void pack_buffers();
+ virtual void draw_tag();
+ virtual void activate() {}
+
+ 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
+ {
+ GridRegion *reg;
+ int tile_tab;
+ int ofs_y;
+ int min_y;
+ int max_y;
+ };
+ std::vector<TabInfo> m_tabs;
+};
+
+#endif
+#endif