33
32
* Arranges clickable pictures of common size in a regular grid.
35
* Arrangement can be horizontal (pictures fill the grid from left to right, top
36
* to bottom) or vertical (pictures fill the grid from top to bottom, then left
39
* An Icon_Grid can be persistant, which means that one of the pictures can be
40
* the currently selected picture. This picture is highlighted all the time.
34
* Arrangement is horizontal (pictures fill the grid from left to right, top to
42
37
struct Icon_Grid : public Panel {
46
Grid_Orientation_Mask = 1,
53
40
int32_t x, int32_t y, int32_t cellw, int32_t cellh,
57
43
Signal1<int32_t> clicked;
58
44
Signal1<int32_t> mouseout;
59
45
Signal1<int32_t> mousein;
61
bool is_persistant() const {return m_flags & Grid_Persistant;}
62
uint32_t get_orientation() const {return m_flags & Grid_Orientation_Mask;}
48
(std::string const & name,
67
51
std::string const & descr = std::string());
68
52
void * get_data(int32_t idx);
70
void set_selection(int32_t idx);
71
int32_t get_selection() const {return m_selected;}
73
void set_selectbox_color(RGBColor clr);
76
void draw(RenderTarget &);
78
int32_t index_for_point(int32_t x, int32_t y);
79
void get_cell_position(int32_t idx, uint32_t & px, uint32_t & py);
80
void update_for_index(int32_t idx);
82
void handle_mousein(bool inside);
84
(Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
85
bool handle_mousepress (Uint8 btn, int32_t x, int32_t y);
86
bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y);
55
void clicked_button(uint32_t);
97
61
/// max # of columns (or rows, depending on orientation) in the grid
100
///currently highlight (mouseover) icon idx (-1 = no highlight)
103
int32_t m_clicked; ///< icon that was clicked (only while LMB is down)
105
///currently selected (persistant) icon idx (-1 = no selection)
108
int32_t m_cell_width; ///< size of one cell
109
int32_t m_cell_height;
110
int32_t m_font_height;
63
int32_t m_cell_width; ///< size of one cell
64
int32_t m_cell_height;
112
67
std::vector<Item> m_items;
114
RGBColor m_selectbox_color;