TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_application_dialog.hpp
1 
9 #ifndef TurtleBrains_ApplicationDialog_hpp
10 #define TurtleBrains_ApplicationDialog_hpp
11 
12 #include <turtle_brains/core/tb_string.hpp>
13 #include <turtle_brains/core/tb_noncopyable.hpp>
14 
15 #include <map>
16 #include <vector>
17 #include <set>
18 
19 namespace tbImplementation { class DialogControl; }
20 
21 namespace TurtleBrains
22 {
23  namespace Application
24  {
32  {
33  kSingleBucket, //1 guide, (left bucket)
34  kDoubleBucket, //3 guides, (left bucket, right bucket, center guide)
35  //kTripleBucket, //5 guides, (left bucket, center bucket, right bucket) ... (mid-left guide, mid-center guide) ??? uns
36  };
37 
44  typedef unsigned short DialogIdentifier;
45 
53  typedef unsigned short DialogControlIdentifier;
54 
60  typedef int DialogControlGuide;
61 
68  typedef int DialogControlSlot;
69 
75  extern const DialogControlSlot kDefaultSlot;
76 
90  {
91  public:
97  explicit ApplicationDialog(const DialogIdentifier& dialogIdentifier);
98 
108  ~ApplicationDialog(void);
109 
114  const DialogIdentifier& GetIdentifier(void) const;
115 
138  void ResizeDialog(const DialogBucketType& bucketType, const int visibleSlots, const bool allowVerticalScrolling = false);
139 
152  void AddLabelControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlName, const DialogControlGuide& guide = 0);
153 
168  void AddButtonControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlName, const DialogControlGuide& guide = 0);
169 
186  void AddCheckboxControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlName, const bool isChecked, const DialogControlGuide& guide = 0);
187 
203  void AddTextControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlValue, const DialogControlGuide& guide = 0);
204 
222  void AddDropdownControl(const DialogControlIdentifier& controlIdentifier, const std::vector<tbCore::tbString>& controlValues, const DialogControlGuide& guide = 0);
223 
232  tbCore::tbString GetValueAsString(const DialogControlIdentifier& controlIdentifier) const;
233 
242  float GetValueAsFloat(const DialogControlIdentifier& controlIdentifier) const;
243 
255  int GetValueAsInteger(const DialogControlIdentifier& controlIdentifier) const;
256 
259  void SetValueAsString(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlValue);
276 
292  void SetValueAsFloat(const DialogControlIdentifier& controlIdentifier, const float controlValue);
293 
311  void SetValueAsInteger(const DialogControlIdentifier& controlIdentifier, const int controlValue);
312 
315  void SetEnabled(const DialogControlIdentifier& controlIdentifier, const bool isEnabled);
330 
333  //void SetVisible(const DialogControlIdentifier& controlIdentifier, const bool isVisible);
352 
355  void RepositionControl(const DialogControlIdentifier& controlIdentifier, const DialogControlGuide& guide,
377  const int leftEdge = 0, const int width = 100, const DialogControlSlot& slot = kDefaultSlot);
378 
392  static void SetControlSafeForDuplication(const DialogControlIdentifier& controlIdentifier);
393 
394  private:
395  const DialogIdentifier mIdentifier;
396  };
397 
398  }; /* namespace Application */
399 }; /* namespace TurtleBrains */
400 
402 
403 #endif /* TurtleBrains_ApplicationDialog_hpp */
void AddDropdownControl(const DialogControlIdentifier &controlIdentifier, const std::vector< tbCore::tbString > &controlValues, const DialogControlGuide &guide=0)
void AddCheckboxControl(const DialogControlIdentifier &controlIdentifier, const tbCore::tbString &controlName, const bool isChecked, const DialogControlGuide &guide=0)
void AddTextControl(const DialogControlIdentifier &controlIdentifier, const tbCore::tbString &controlValue, const DialogControlGuide &guide=0)
int GetValueAsInteger(const DialogControlIdentifier &controlIdentifier) const
void RepositionControl(const DialogControlIdentifier &controlIdentifier, const DialogControlGuide &guide, const int leftEdge=0, const int width=100, const DialogControlSlot &slot=kDefaultSlot)
Definition: tb_noncopyable.hpp:22
int DialogControlSlot
Definition: tb_application_dialog.hpp:68
ApplicationDialog(const DialogIdentifier &dialogIdentifier)
Here is some information about the primary namespace.
Definition: tb_application_dialog.hpp:21
tbCore::tbString GetValueAsString(const DialogControlIdentifier &controlIdentifier) const
Contains classes, functions and constants to create Applications, Menus, Dialogs with native controls...
Definition: tb_application_dialog.hpp:23
void ResizeDialog(const DialogBucketType &bucketType, const int visibleSlots, const bool allowVerticalScrolling=false)
void SetEnabled(const DialogControlIdentifier &controlIdentifier, const bool isEnabled)
static void SetControlSafeForDuplication(const DialogControlIdentifier &controlIdentifier)
void AddLabelControl(const DialogControlIdentifier &controlIdentifier, const tbCore::tbString &controlName, const DialogControlGuide &guide=0)
float GetValueAsFloat(const DialogControlIdentifier &controlIdentifier) const
const DialogIdentifier & GetIdentifier(void) const
unsigned short DialogControlIdentifier
Definition: tb_application_dialog.hpp:53
unsigned short DialogIdentifier
Definition: tb_application_dialog.hpp:44
void AddButtonControl(const DialogControlIdentifier &controlIdentifier, const tbCore::tbString &controlName, const DialogControlGuide &guide=0)
DialogBucketType
Definition: tb_application_dialog.hpp:31
Create a customized dialog prompt with simple controls.
Definition: tb_application_dialog.hpp:89
std::string tbString
Definition: tb_string.hpp:335
Definition: tb_application_dialog.hpp:19
const DialogControlSlot kDefaultSlot
int DialogControlGuide
Definition: tb_application_dialog.hpp:60