supertux
item_images.hpp
1 // SuperTux
2 // Copyright (C) 2022 mrkubax10 <mrkubax10@onet.pl>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_GUI_ITEM_IMAGES_HPP
18 #define HEADER_SUPERTUX_GUI_ITEM_IMAGES_HPP
19 
20 #include "gui/menu_item.hpp"
21 #include "video/surface_ptr.hpp"
22 
23 class ItemImages final : public MenuItem
24 {
25 public:
26  ItemImages(const std::string& image_path, int max_image_width = 0, int max_image_height = 0, int id = -1);
27  ItemImages(const std::vector<std::string>& image_paths, int max_image_width = 0, int max_image_height = 0, int id = -1);
28 
29  virtual void draw(DrawingContext& drawing_context, const Vector& pos, int menu_width, bool active) override;
30  virtual int get_width() const override { return m_item_width; }
31  virtual int get_height() const override { return m_item_height; }
32  virtual void process_action(const MenuAction& action) override;
33 
34 private:
35  std::vector<SurfacePtr> m_images;
36  bool m_gallery_mode;
37  int m_selected_image;
38  int m_max_image_width;
39  int m_max_image_height;
40  int m_item_width;
41  int m_item_height;
42 
43 private:
44  ItemImages(const ItemImages&) = delete;
45  ItemImages& operator=(const ItemImages&) = delete;
46 };
47 
48 #endif
49 /* EOF */
virtual int get_width() const override
Returns the minimum width of the menu item.
Definition: item_images.hpp:30
virtual int get_height() const override
Returns height of menu item.
Definition: item_images.hpp:31
Definition: menu_item.hpp:23
Definition: item_images.hpp:23
virtual void draw(DrawingContext &drawing_context, const Vector &pos, int menu_width, bool active) override
Draws the menu item.
Definition: item_images.cpp:63
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
virtual void process_action(const MenuAction &action) override
Processes the menu action.
Definition: item_images.cpp:84