00001
00002
00003
00004
00005
00006 #ifdef USE_TILE
00007 #ifndef TILEREG_MENU_H
00008 #define TILEREG_MENU_H
00009
00010 #include "format.h"
00011 #include "tilereg.h"
00012 #include "fixedvector.h"
00013 #include <vector>
00014
00015 class MenuEntry;
00016
00017 class MenuRegion : public Region
00018 {
00019 public:
00020 MenuRegion(ImageManager *im, FontWrapper *entry);
00021
00022 virtual int handle_mouse(MouseEvent &event);
00023 virtual void render();
00024 virtual void clear();
00025
00026 int maxpagesize() const;
00027 void set_entry(int index, const std::string &s, int colour, const MenuEntry *me);
00028 void set_offset(int lines);
00029 void set_more(const formatted_string &more);
00030 void set_num_columns(int columns);
00031 protected:
00032 virtual void on_resize();
00033 virtual void place_entries();
00034 int mouse_entry(int x, int y);
00035
00036 struct MenuRegionEntry
00037 {
00038 formatted_string text;
00039 int sx, ex, sy, ey;
00040 bool selected;
00041 bool heading;
00042 char key;
00043 bool valid;
00044 std::vector<tile_def> tiles;
00045 };
00046
00047 ImageManager *m_image;
00048 FontWrapper *m_font_entry;
00049 formatted_string m_more;
00050 int m_mouse_idx;
00051 int m_max_columns;
00052 bool m_dirty;
00053
00054 std::vector<MenuRegionEntry> m_entries;
00055
00056
00057 ShapeBuffer m_shape_buf;
00058 LineBuffer m_line_buf;
00059 FontBuffer m_font_buf;
00060 FixedVector<TileBuffer, TEX_MAX> m_tile_buf;
00061 };
00062
00063 #endif
00064 #endif