TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
tb_application_dialog.h
1 
9 #ifndef _TurtleBrains_ApplicationDialog_h_
10 #define _TurtleBrains_ApplicationDialog_h_
11 
12 #include "../core/tb_string.h"
13 #include "../core/tb_noncopyable.h"
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 
88  {
89  public:
95  explicit ApplicationDialog(const DialogIdentifier& dialogIdentifier);
96 
106  ~ApplicationDialog(void);
107 
112  const DialogIdentifier& GetIdentifier(void) const;
113 
136  void ResizeDialog(const DialogBucketType& bucketType, const int visibleSlots, const bool allowVerticalScrolling = false);
137 
150  void AddLabelControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlName, const DialogControlGuide& guide = 0);
151 
166  void AddButtonControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlName, const DialogControlGuide& guide = 0);
167 
184  void AddCheckboxControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlName, const bool isChecked, const DialogControlGuide& guide = 0);
185 
201  void AddTextControl(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlValue, const DialogControlGuide& guide = 0);
202 
220  void AddDropdownControl(const DialogControlIdentifier& controlIdentifier, const std::vector<tbCore::tbString>& controlValues, const DialogControlGuide& guide = 0);
221 
230  tbCore::tbString GetValueAsString(const DialogControlIdentifier& controlIdentifier) const;
231 
240  float GetValueAsFloat(const DialogControlIdentifier& controlIdentifier) const;
241 
253  int GetValueAsInteger(const DialogControlIdentifier& controlIdentifier) const;
254 
257  //void SetValueAsString(const DialogControlIdentifier& controlIdentifier, const tbCore::tbString& controlValue);
274 
290  //void SetValueAsFloat(const DialogControlIdentifier& controlIdentifier, const float controlValue);
291 
309  //void SetValueAsInteger(const DialogControlIdentifier& controlIdentifier, const int controlValue);
310 
313  void SetEnabled(const DialogControlIdentifier& controlIdentifier, const bool isEnabled);
328 
331  //void SetVisible(const DialogControlIdentifier& controlIdentifier, const bool isVisible);
350 
353  void RepositionControl(const DialogControlIdentifier& controlIdentifier, const DialogControlGuide& guide,
375  const int leftEdge = 0, const int width = 100, const DialogControlSlot& slot = kDefaultSlot);
376 
390  static void SetControlSafeForDuplication(const DialogControlIdentifier& controlIdentifier);
391 
392  private:
393  const DialogIdentifier mIdentifier;
394  };
395 
396  }; /* namespace Application */
397 }; /* namespace TurtleBrains */
398 
400 
401 #endif /* _TurtleBrains_ApplicationDialog_h_ */
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.h:22
int DialogControlSlot
Definition: tb_application_dialog.h:68
ApplicationDialog(const DialogIdentifier &dialogIdentifier)
Contains all functions, classes and helpers related to game/application development written by Tim "B...
Definition: tb_application_dialog.h: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.h: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.h:53
unsigned short DialogIdentifier
Definition: tb_application_dialog.h:44
void AddButtonControl(const DialogControlIdentifier &controlIdentifier, const tbCore::tbString &controlName, const DialogControlGuide &guide=0)
DialogBucketType
Definition: tb_application_dialog.h:31
Create a customized dialog prompt with simple controls.
Definition: tb_application_dialog.h:87
std::string tbString
Definition: tb_string.h:293
Definition: tb_application_dialog.h:19
const DialogControlSlot kDefaultSlot
int DialogControlGuide
Definition: tb_application_dialog.h:60