Skip to content

Commit b3f2857

Browse files
Merge pull request #36 from Reim-developer/dev
Added & Implement LayoutManager in `SettingWindow` to application # Change Log: commit 71c12ee Author: Reim-developer <contact.kaxtr@gmail.com> Date: Tue Jul 22 14:29:14 2025 +0700 Defined function to implement layout information in `Setting_Window_LayoutManager.cc` commit c7779ba Author: Reim-developer <contact.kaxtr@gmail.com> Date: Tue Jul 22 14:28:46 2025 +0700 Added `noexcept` mark to all function in class `SettingWindowLayoutManager` Implement `inline` to template in this class Implement `WidgetProperty` to defined `LayoutProperty` and add this to window.
2 parents 2d252af + 71c12ee commit b3f2857

2 files changed

Lines changed: 146 additions & 15 deletions

File tree

Source/GUI/Toolkit/Include/SettingWindow_LayoutManager.hpp

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,49 @@ GUI_TOOLKIT_NAMESPACE
2929
PtrUnique<DataImpl> Impl;
3030

3131
public:
32-
Self *StartBuild();
32+
Self *StartBuild() noexcept;
3333

3434
CLASS_BUILD(T, V)
35-
Self *WithAndThen(T DataImpl::*member, V &&value) {
35+
inline Self *WithAndThen(T DataImpl::*member, V &&value) noexcept {
3636
Impl.get()->*member = FORWARD(V, value);
3737

3838
return this;
3939
}
4040

41-
Self *WhenDone();
41+
Self *WhenDone() noexcept;
4242

43-
Layout *GetLayout();
44-
ComponentsManager *GetComponentsManager();
43+
Layout *GetLayout() noexcept;
44+
ComponentsManager *GetComponentsManager() noexcept;
4545

46-
Widget GetSetPasswordButtonLayout();
46+
Widget GetSetPasswordButtonLayout(
47+
Layout *layout,
48+
ComponentsManager *componentsManager) const noexcept;
4749

48-
void SetupSettingWindowLayout();
50+
Widget GetHideWindowSettingCheckboxLayout(
51+
Layout *layout,
52+
ComponentsManager *componentsManager) const noexcept;
53+
54+
Widget GetNotificationCheckboxLayout(
55+
Layout *layout,
56+
ComponentsManager *componentsManager) const noexcept;
57+
58+
Widget GetLanguageListBoxLayout(
59+
Layout *layout,
60+
ComponentsManager *componentsManager) const noexcept;
61+
62+
Widget GetThemeListBoxLayout(
63+
Layout *layout,
64+
ComponentsManager *componentsManager) const noexcept;
65+
66+
Widget GetLanguageLabelLayout(
67+
Layout *layout,
68+
ComponentsManager *componentsManager) const noexcept;
69+
70+
Widget GetThemeLabelLayout(
71+
Layout *layout,
72+
ComponentsManager *componentsManager) const noexcept;
73+
74+
void SetupSettingWindowLayout() noexcept;
4975

5076
};
5177

Source/GUI/Toolkit/SettingWindow_LayoutManager.cc

Lines changed: 113 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ using ComponentsManager = SettingWindowComponentsManager;
1818
using ZClipboard::AppUtils::LogContext;
1919
#endif
2020

21-
Self *Self::StartBuild() {
21+
Self *Self::StartBuild() noexcept {
2222
if(!Impl) {
2323
Utils::MakeSmartPtr<DataImpl>(Impl);
2424
}
2525

2626
return this;
2727
}
2828

29-
Layout *Self::GetLayout() {
29+
Layout *Self::GetLayout() noexcept {
3030
auto layout = this
3131
-> Impl
3232
-> layout;
@@ -40,7 +40,7 @@ Layout *Self::GetLayout() {
4040
return layout;
4141
}
4242

43-
ComponentsManager *Self::GetComponentsManager() {
43+
ComponentsManager *Self::GetComponentsManager() noexcept {
4444
auto componentsManager = this
4545
-> Impl
4646
-> componentsManager;
@@ -54,7 +54,7 @@ ComponentsManager *Self::GetComponentsManager() {
5454
return componentsManager;
5555
}
5656

57-
Self *Self::WhenDone() {
57+
Self *Self::WhenDone() noexcept {
5858
#if defined (Z_DEBUG)
5959
AssertContext{}.RequireNonNullPtr(Impl.get());
6060
AssertContext{}.RequireNonNullPtr(Impl->componentsManager);
@@ -68,16 +68,121 @@ Self *Self::WhenDone() {
6868
return this;
6969
}
7070

71-
Widget Self::GetSetPasswordButtonLayout() {
72-
auto componentsManager = this->GetComponentsManager();
73-
auto layout = this->GetLayout();
71+
Widget Self::GetSetPasswordButtonLayout(
72+
Layout *layout,
73+
ComponentsManager *componentsManager) const noexcept {
7474

7575
auto setPasswordButton = componentsManager->GetSetPasswordButton();
7676

77-
auto widgetData = Widget {
77+
const auto widgetData = Widget {
7878
.widget = setPasswordButton,
7979
.row = 3, .column = 2
8080
};
8181

8282
return widgetData;
83+
}
84+
85+
Widget Self::GetHideWindowSettingCheckboxLayout(
86+
Layout *layout,
87+
ComponentsManager *componentsManager) const noexcept {
88+
89+
auto autoHideCheckbox = componentsManager->GetHideSettingCheckBox();
90+
91+
const auto widgetData = Widget {
92+
.widget = autoHideCheckbox,
93+
.row = 0, .column = 0
94+
};
95+
96+
return widgetData;
97+
}
98+
99+
Widget Self::GetNotificationCheckboxLayout(
100+
Layout *layout,
101+
ComponentsManager *componentsManager) const noexcept {
102+
103+
auto notificationCheckbox = componentsManager->GetNotificationCheckBox();
104+
105+
const auto widgetData = Widget {
106+
.widget = notificationCheckbox,
107+
.row = 1, .column = 0
108+
};
109+
110+
return widgetData;
111+
}
112+
113+
Widget Self::GetLanguageListBoxLayout(
114+
Layout *layout,
115+
ComponentsManager *componentsManager) const noexcept {
116+
117+
auto languageListBox = componentsManager->GetLanguageListBox();
118+
119+
const auto widgetData = Widget {
120+
.widget = languageListBox,
121+
.row = 2, .column = 0
122+
};
123+
124+
return widgetData;
125+
}
126+
127+
Widget Self::GetThemeListBoxLayout(
128+
Layout *layout,
129+
ComponentsManager *componentsManager) const noexcept {
130+
131+
auto themeListBox = componentsManager->GetThemeListBox();
132+
133+
const auto widgetData = Widget {
134+
.widget = themeListBox,
135+
.row = 3, .column = 0
136+
};
137+
138+
return widgetData;
139+
}
140+
141+
Widget Self::GetLanguageLabelLayout(
142+
Layout *layout,
143+
ComponentsManager *componentsManager) const noexcept {
144+
145+
auto languageLabel = componentsManager->GetLanguageDescription();
146+
147+
const auto widgetData = Widget {
148+
.widget = languageLabel,
149+
.row = 2, .column = 1
150+
};
151+
152+
return widgetData;
153+
}
154+
155+
Widget Self::GetThemeLabelLayout(
156+
Layout *layout,
157+
ComponentsManager *componentsManager) const noexcept {
158+
159+
auto themeLabel = componentsManager->GetThemeDescription();
160+
161+
const auto widgetData = Widget {
162+
.widget = themeLabel,
163+
.row = 3, .column = 1
164+
};
165+
166+
return widgetData;
167+
}
168+
169+
void Self::SetupSettingWindowLayout() noexcept {
170+
auto layout = this->GetLayout();
171+
auto componentsManager = this->GetComponentsManager();
172+
173+
const auto passwordButtonLayout = this->GetSetPasswordButtonLayout(layout, componentsManager);
174+
const auto hideWindowSettingCheckboxLayout = this->GetHideWindowSettingCheckboxLayout(layout, componentsManager);
175+
const auto notificationCheckboxLayout = this->GetNotificationCheckboxLayout(layout, componentsManager);
176+
const auto languageListBoxLayout = this->GetLanguageListBoxLayout(layout, componentsManager);
177+
const auto themeListBoxLayout = this->GetThemeListBoxLayout(layout, componentsManager);
178+
const auto languageLabelLayout = this->GetLanguageLabelLayout(layout, componentsManager);
179+
const auto themeLabelLayout = this->GetThemeLabelLayout(layout, componentsManager);
180+
181+
GridLayoutAdd(
182+
layout,
183+
passwordButtonLayout, hideWindowSettingCheckboxLayout,
184+
notificationCheckboxLayout, languageListBoxLayout,
185+
themeListBoxLayout, languageLabelLayout,
186+
themeLabelLayout
187+
);
83188
}

0 commit comments

Comments
 (0)