GUIFramework 1.1.0
Framework for desktop GUI applications in C++.
Loading...
Searching...
No Matches
DialogBox.h
Go to the documentation of this file.
1#pragma once
2
6
7#undef DialogBox
8
9namespace gui_framework
10{
13 public BaseDialogBox,
15 {
16 public:
19 {
20 public:
21 enum class alignment
22 {
23 left,
24 center,
25 right
26 };
27
28 private:
29 struct builderComponentData
30 {
31 std::wstring componentName;
32 RECT offsets;
33 size_t typeHash;
35 alignment type;
36 std::any additionalData;
37
38 builderComponentData(const std::wstring& componentName, const interfaces::IStyles& styles, RECT&& offsets, size_t typeHash, uint16_t width, uint16_t height, alignment type, std::any&& additionalData);
39 };
40
41 private:
43 std::wstring className;
44 std::wstring dialogBoxName;
45 std::string functionName;
46 std::vector<builderComponentData> components;
47 std::string moduleName;
48 uint16_t smallIconResource;
49 uint16_t largeIconResource;
50
51 public:
56 DialogBoxBuilder(const std::wstring& className, const std::wstring& dialogBoxName, int x, int y, const std::string& dialogBoxFunctionName, const std::string& moduleName = "", uint16_t smallIconResource = NULL, uint16_t largeIconResource = NULL);
57
58 DialogBoxBuilder& clear();
59
60 template<std::derived_from<BaseComponent> T>
61 DialogBoxBuilder& addComponent(const std::wstring& componentName, uint16_t width, uint16_t height, alignment type, const utility::AdditionalCreationData<T>& additionalData = utility::AdditionalCreationData<T>(), int leftOffset = 0, int topOffset = 0, int rightOffset = 0, int bottomOffset = 0, const interfaces::IStyles& styles = interfaces::IStyles());
62
66 DialogBox* build() const;
67
68 ~DialogBoxBuilder() = default;
69 };
70
71 public:
76 DialogBox(const std::wstring& className, const std::wstring& dialogBoxName, const utility::ComponentSettings& settings, const std::string& dialogBoxFunctionName = "", const std::string& moduleName = "", uint16_t smallIconResource = NULL, uint16_t largeIconResource = NULL);
77
78 size_t getHash() const override;
79
80 ~DialogBox() = default;
81 };
82
83 template<std::derived_from<BaseComponent> T>
84 DialogBox::DialogBoxBuilder& DialogBox::DialogBoxBuilder::addComponent(const std::wstring& componentName, uint16_t width, uint16_t height, alignment type, const utility::AdditionalCreationData<T>& additionalData, int leftOffset, int topOffset, int rightOffset, int bottomOffset, const interfaces::IStyles& styles)
85 {
86 if (settings.width < leftOffset + width + rightOffset + standard_sizes::dialogBoxBuilderMinWidth)
87 {
88 settings.width = leftOffset + width + rightOffset + standard_sizes::dialogBoxBuilderMinWidth;
89 }
90
91 settings.height += topOffset + height + bottomOffset;
92
93 components.emplace_back(componentName, styles, RECT(leftOffset, topOffset, rightOffset, bottomOffset), typeid(T).hash_code(), width, height, type, additionalData.getData());
94
95 return *this;
96 }
97}
#define GUI_FRAMEWORK_API
Base class for all dialog boxes.
DialogBoxBuilder & addComponent(const std::wstring &componentName, uint16_t width, uint16_t height, alignment type, const utility::AdditionalCreationData< T > &additionalData=utility::AdditionalCreationData< T >(), int leftOffset=0, int topOffset=0, int rightOffset=0, int bottomOffset=0, const interfaces::IStyles &styles=interfaces::IStyles())
Standard dialog box.
Definition DialogBox.h:15
Provides styles for other classes.
Definition IStyles.h:11
Base templated class for component creators.
constexpr uint16_t dialogBoxBuilderMinWidth