Plutonium framework API  0.3
Simple UI framework for libnx and SDL2
ui_Dialog.hpp
Go to the documentation of this file.
1 
2 /*
3 
4  Plutonium library
5 
6  @file ui_Dialog.hpp
7  @brief A Dialog is an easy way to ask the user to choose between several options.
8  @author XorTroll
9 
10  @copyright Plutonium project - an easy-to-use UI framework for Nintendo Switch homebrew
11 
12 */
13 
14 #pragma once
15 #include <pu/pu_String.hpp>
17 #include <vector>
18 
19 namespace pu::ui
20 {
21  class Dialog
22  {
23  public:
24  Dialog(String Title, String Content);
26  ~Dialog();
27 
28  void AddOption(String Name);
29  void SetCancelOption(String Name = "Cancel");
30  void RemoveCancelOption();
31  bool HasCancelOption();
32  void SetIcon(std::string Icon);
33  bool Hasicon();
34  i32 Show(render::Renderer::Ref &Drawer, void *App);
35  bool UserCancelled();
36  bool IsOk();
37  private:
38  bool hcancel;
39  String scancel;
40  String tfont_name;
41  String cfont_name;
42  String ofont_name;
43  String stitle;
44  String scnt;
45  sdl2::Texture title;
46  sdl2::Texture cnt;
47  std::vector<String> sopts;
48  std::vector<sdl2::Texture> opts;
49  i32 osel;
50  bool cancel;
51  bool hicon;
52  sdl2::Texture icon;
53  i32 prevosel;
54  i32 pselfact;
55  i32 selfact;
56  };
57 }
i32 Show(render::Renderer::Ref &Drawer, void *App)
Definition: pu_String.hpp:21
bool HasCancelOption()
void SetCancelOption(String Name="Cancel")
SDL_Texture * Texture
Definition: sdl2_Types.hpp:11
s32 i32
Definition: pu_Macros.hpp:17
bool UserCancelled()
#define PU_SMART_CTOR(type)
Definition: pu_Macros.hpp:8
Definition: ui_Dialog.hpp:21
void AddOption(String Name)
Dialog(String Title, String Content)
void SetIcon(std::string Icon)
void RemoveCancelOption()