Apply the new ground_level method.
[crawl.git] / crawl-ref / source / tilereg-tab.h
blob44aa3e951a4ce442b4e2f4067e05717127147897
1 /*
2 * File: tilereg_tab.h
3 * Created by: ennewalker on Sat Jan 5 01:33:53 2008 UTC
4 */
6 #ifdef USE_TILE
7 #ifndef TILEREG_TAB_H
8 #define TILEREG_TAB_H
10 #include "tilereg-grid.h"
12 // A region that contains multiple region, selectable by tabs.
13 class TabbedRegion : public GridRegion
15 public:
16 TabbedRegion(const TileRegionInit &init);
18 virtual ~TabbedRegion();
20 enum
22 TAB_OFS_UNSELECTED,
23 TAB_OFS_MOUSEOVER,
24 TAB_OFS_SELECTED,
25 TAB_OFS_MAX
28 void set_tab_region(int idx, GridRegion *reg, tileidx_t tile_tab);
29 GridRegion *get_tab_region(int idx);
30 tileidx_t get_tab_tile(int idx);
31 void activate_tab(int idx);
32 int active_tab() const;
33 int num_tabs() const;
34 void enable_tab(int idx);
35 void disable_tab(int idx);
36 int find_tab(std::string tab_name) const;
38 virtual void update();
39 virtual void clear();
40 virtual void render();
41 virtual void on_resize();
42 virtual int handle_mouse(MouseEvent &event);
43 virtual bool update_tip_text(std::string &tip);
44 virtual bool update_tab_tip_text(std::string &tip, bool active);
45 virtual bool update_alt_text(std::string &alt);
47 virtual const std::string name() const { return ""; }
49 protected:
50 virtual void pack_buffers();
51 virtual void draw_tag();
52 virtual void activate() {}
54 bool invalid_index(int idx) const;
55 bool active_is_valid() const;
56 // Returns the tab the mouse is over, -1 if none.
57 int get_mouseover_tab(MouseEvent &event) const;
58 void set_icon_pos(int idx);
59 void reset_icons(int from_idx);
62 int m_active;
63 int m_mouse_tab;
64 TileBuffer m_buf_gui;
66 struct TabInfo
68 GridRegion *reg;
69 tileidx_t tile_tab;
70 int ofs_y;
71 int min_y;
72 int max_y;
73 int height;
74 bool enabled;
76 std::vector<TabInfo> m_tabs;
79 #endif
80 #endif