00001
00002
00003
00004
00005
00006 #ifdef USE_TILE
00007 #ifndef TILEREG_GRID_H
00008 #define TILEREG_GRID_H
00009
00010 #include "tiledgnbuf.h"
00011 #include "tilereg.h"
00012
00013 class InventoryTile
00014 {
00015 public:
00016 InventoryTile();
00017
00018
00019 tileidx_t tile;
00020
00021 int idx;
00022
00023 short quantity;
00024
00025 unsigned short flag;
00026
00027 char key;
00028
00029 int special;
00030
00031 bool empty() const;
00032 };
00033
00034 class GridRegion : public TileRegion
00035 {
00036 public:
00037 GridRegion(const TileRegionInit &init);
00038 virtual ~GridRegion();
00039
00040 virtual void clear();
00041 virtual void render();
00042 virtual void on_resize();
00043
00044 virtual void update() = 0;
00045 void place_cursor(const coord_def &cursor);
00046
00047 virtual const std::string name() const = 0;
00048 virtual bool update_tab_tip_text(std::string &tip, bool active) = 0;
00049 virtual void activate() = 0;
00050
00051 protected:
00052 virtual void pack_buffers() = 0;
00053 virtual void draw_tag() = 0;
00054
00055
00056
00057 bool place_cursor(MouseEvent &event, unsigned int &idx);
00058 unsigned int cursor_index() const;
00059 void add_quad_char(char c, int x, int y, int ox, int oy,
00060 bool outline = false);
00061 void draw_number(int x, int y, int number, bool outline = false);
00062 void draw_desc(const char *desc);
00063
00064 unsigned char *m_flavour;
00065 coord_def m_cursor;
00066 int m_last_clicked_item;
00067
00068 std::vector<InventoryTile> m_items;
00069
00070 DungeonCellBuffer m_buf;
00071 };
00072
00073 #endif
00074 #endif