Skip to content

Commit d6843b1

Browse files
committed
2 parents b8b00ca + 5e62004 commit d6843b1

98 files changed

Lines changed: 942 additions & 942 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ jobs:
117117
uses: actions/upload-artifact@v4
118118
with:
119119
name: ${{matrix.triplet}}
120+
retention-days: 90
120121
path: |
121122
Brisk-*.tar.xz
122123
@@ -151,6 +152,7 @@ jobs:
151152
uses: actions/upload-artifact@v4
152153
with:
153154
name: ${{matrix.triplet}}
155+
retention-days: 90
154156
path: |
155157
Brisk-*.tar.xz
156158
@@ -198,6 +200,7 @@ jobs:
198200
uses: actions/upload-artifact@v4
199201
with:
200202
name: ${{matrix.triplet}}
203+
retention-days: 90
201204
path: |
202205
Brisk-*.tar.xz
203206
@@ -231,6 +234,7 @@ jobs:
231234
uses: actions/upload-artifact@v4
232235
with:
233236
name: test-artifacts-${{github.job}}
237+
retention-days: 10
234238
path: |
235239
build/*.png
236240
build/*.log
@@ -264,6 +268,7 @@ jobs:
264268
uses: actions/upload-artifact@v4
265269
with:
266270
name: test-artifacts-${{github.job}}
271+
retention-days: 10
267272
path: |
268273
build/*.png
269274
build/*.log
@@ -300,6 +305,7 @@ jobs:
300305
uses: actions/upload-artifact@v4
301306
with:
302307
name: test-artifacts-${{github.job}}
308+
retention-days: 10
303309
path: |
304310
build/*.png
305311
build/*.log
@@ -331,6 +337,7 @@ jobs:
331337
uses: actions/upload-artifact@v4
332338
with:
333339
name: test-artifacts-${{github.job}}
340+
retention-days: 10
334341
path: |
335342
build/*.png
336343
build/*.log
@@ -362,6 +369,7 @@ jobs:
362369
uses: actions/upload-artifact@v4
363370
with:
364371
name: test-artifacts-${{github.job}}
372+
retention-days: 10
365373
path: |
366374
build/*.png
367375
build/*.log
@@ -399,6 +407,7 @@ jobs:
399407
uses: actions/upload-artifact@v4
400408
with:
401409
name: test-artifacts-${{github.job}}
410+
retention-days: 10
402411
path: |
403412
build/*.png
404413
build/*.log
@@ -432,6 +441,7 @@ jobs:
432441
uses: actions/upload-artifact@v4
433442
with:
434443
name: test-artifacts-${{github.job}}
444+
retention-days: 10
435445
path: |
436446
build/*.png
437447
build/*.log
@@ -482,6 +492,7 @@ jobs:
482492
uses: actions/upload-artifact@v4
483493
with:
484494
name: showcase-${{matrix.triplet}}
495+
retention-days: 30
485496
path: |
486497
build/showcase
487498
@@ -526,6 +537,7 @@ jobs:
526537
uses: actions/upload-artifact@v4
527538
with:
528539
name: showcase-${{matrix.triplet}}
540+
retention-days: 30
529541
path: |
530542
build/Release/showcase.app
531543
@@ -571,6 +583,7 @@ jobs:
571583
uses: actions/upload-artifact@v4
572584
with:
573585
name: showcase-${{matrix.triplet}}
586+
retention-days: 30
574587
path: |
575588
build/Release/showcase.exe
576589

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ if (WIN32 AND BRISK_GENERATE_MAP)
8282
add_link_options(/Map)
8383
endif ()
8484

85+
if (BRISK_SAN)
86+
add_compile_options(-fsanitize=${BRISK_SAN})
87+
add_link_options(-fsanitize=${BRISK_SAN})
88+
endif ()
89+
8590
set(DEPS_DIR
8691
"${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}"
8792
CACHE STRING "DEPS_DIR")

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,30 @@ public:
4747
// rcnew Widget{...} is equivalent to std::shared_ptr<Widget>(new Widget{...})
4848
return rcnew Widget{
4949
layout = Layout::Vertical,
50-
new Text{
50+
rcnew Text{
5151
"Switch (widgets/Switch.hpp)",
5252
classes = { "section-header" }, // Widgets can be styled using stylesheets
5353
},
5454

55-
new HLayout{
56-
new Widget{
57-
new Switch{
55+
rcnew HLayout{
56+
rcnew Widget{
57+
rcnew Switch{
5858
// Bind the switch value to the m_toggled variable (bidirectional)
5959
value = Value{ &m_toggled },
60-
new Text{ "Switch" },
60+
rcnew Text{ "Switch" },
6161
},
6262
},
6363
gapColumn = 10_apx, // CSS Flex-like properties
64-
new Text{
64+
rcnew Text{
6565
text = Value{ &m_label }, // Text may be dynamic
6666
visible =
6767
Value{ &m_toggled }, // The Switch widget controls the visibility of this text widget
6868
},
6969
},
7070

7171
// Button widget
72-
new Button{
73-
new Text{ "Click" },
72+
rcnew Button{
73+
rcnew Text{ "Click" },
7474
// Using m_lifetime ensures that callbacks will be detached once the Component is deleted
7575
onClick = m_lifetime |
7676
[this]() {
@@ -80,15 +80,15 @@ public:
8080
},
8181

8282
// ComboBox widget
83-
new ComboBox{
83+
rcnew ComboBox{
8484
Value{ &m_textAlignment }, // Bind ComboBox value to an enumeration
8585
notManaged(&textAlignList), // Pass the list of name-value pairs to populate the ComboBox
8686
},
8787

8888
// The Builder creates widgets dynamically whenever needed
8989
Builder([this](Widget* target) {
9090
for (int i = 0; i < m_number; ++i) {
91-
target->apply(new Widget{
91+
target->apply(rcnew Widget{
9292
dimensions = { 40_apx, 40_apx },
9393
});
9494
}

docs/docs/about.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ Brisk eliminates the need for markup languages in defining user interfaces. Inst
2525
For example:
2626
```c++
2727
// Label with text defined at creation
28-
Widget* makeLabel(std::string text) {
29-
return new Widget{
28+
RC<Widget> makeLabel(std::string text) {
29+
return rcnew Widget{
3030
padding = 4_apx,
3131
classes = { "label" },
32-
new Text{ std::move(text) },
32+
rcnew Text{ std::move(text) },
3333
};
3434
}
3535
```
@@ -40,9 +40,9 @@ Here’s an example of creating a `Slider` widget, accompanied by a `Text` widge
4040
4141
```c++
4242
// Slider with a dynamic value display
43-
Widget* makeSlider(float& value) {
44-
return new HLayout{
45-
new Slider{
43+
RC<Widget> makeSlider(float& value) {
44+
return rcnew HLayout{
45+
rcnew Slider{
4646
// Bind the value of the slider to the provided 'value' variable.
4747
value = Value{ &value },
4848
minimum = 0.f,
@@ -58,7 +58,7 @@ Widget* makeSlider(float& value) {
5858
gapColumn = 10_px,
5959
6060
// Create a Text widget to display the value of the slider.
61-
new Text{
61+
rcnew Text{
6262
// The text is dynamically generated based on the slider value.
6363
text = Value{ &value }.transform([](float v) {
6464
return fmt::format("Value: {:.1f}", v);
@@ -82,8 +82,8 @@ In the example below, the `Text` widget binds its `text` property to a `temperat
8282
// Temperature widget with dynamic text and color
8383
float temperature = 16.f;
8484

85-
Widget* makeTemperatureWidget() {
86-
return new Text{
85+
RC<Widget> makeTemperatureWidget() {
86+
return rcnew Text{
8787
text = Value{ &temperature }.transform([](float t){
8888
return fmt::format("{:.1f}°C", t);
8989
}),
@@ -109,18 +109,18 @@ In addition to supporting dynamic widget properties, Brisk allows the entire wid
109109
// Dynamically created widget tree
110110
static int count = 1;
111111

112-
Widget* makeTree() {
113-
return new VLayout{
114-
new Text{ "Squares:" },
112+
RC<Widget> makeTree() {
113+
return rcnew VLayout{
114+
rcnew Text{ "Squares:" },
115115
Builder{ [](Widget* target){
116116
for (int i = 1; i <= count; ++i) {
117-
target->apply(new Text{ fmt::format("{}^2 = {}", i, i * i) });
117+
target->apply(rcnew Text{ fmt::format("{}^2 = {}", i, i * i) });
118118
}
119119
}},
120120
depends = Value{ &count },
121121

122-
new Button{
123-
new Text{ "Next" },
122+
rcnew Button{
123+
rcnew Text{ "Next" },
124124
onClick = [](){
125125
bindings->assign(count, count + 1);
126126
},
@@ -170,7 +170,7 @@ For example, the `Text` widget is highly configurable with respect to font featu
170170
171171
```c++
172172
// Configuring text with OpenType features
173-
new Text{
173+
rcnew Text{
174174
text = Value{ &m_text },
175175
fontSize = 40,
176176
fontFamily = Lato,
@@ -200,30 +200,30 @@ public:
200200
// rcnew Widget{...} is equivalent to std::shared_ptr<Widget>(new Widget{...})
201201
return rcnew Widget{
202202
layout = Layout::Vertical,
203-
new Text{
203+
rcnew Text{
204204
"Switch (widgets/Switch.hpp)",
205205
classes = { "section-header" }, // Widgets can be styled using stylesheets
206206
},
207207

208-
new HLayout{
209-
new Widget{
210-
new Switch{
208+
rcnew HLayout{
209+
rcnew Widget{
210+
rcnew Switch{
211211
// Bind the switch value to the m_toggled variable (bidirectional)
212212
value = Value{ &m_toggled },
213-
new Text{ "Switch" },
213+
rcnew Text{ "Switch" },
214214
},
215215
},
216216
gapColumn = 10_apx, // CSS Flex-like properties
217-
new Text{
217+
rcnew Text{
218218
text = Value{ &m_label }, // Text may be dynamic
219219
visible =
220220
Value{ &m_toggled }, // The Switch widget controls the visibility of this text widget
221221
},
222222
},
223223

224224
// Button widget
225-
new Button{
226-
new Text{ "Click" },
225+
rcnew Button{
226+
rcnew Text{ "Click" },
227227
// Using m_lifetime ensures that callbacks will be detached once the Component is deleted
228228
onClick = m_lifetime |
229229
[this]() {
@@ -233,15 +233,15 @@ public:
233233
},
234234

235235
// ComboBox widget
236-
new ComboBox{
236+
rcnew ComboBox{
237237
Value{ &m_textAlignment }, // Bind ComboBox value to an enumeration
238238
notManaged(&textAlignList), // Pass the list of name-value pairs to populate the ComboBox
239239
},
240240

241241
// The Builder creates widgets dynamically whenever needed
242242
Builder([this](Widget* target) {
243243
for (int i = 0; i < m_number; ++i) {
244-
target->apply(new Widget{
244+
target->apply(rcnew Widget{
245245
dimensions = { 40_apx, 40_apx },
246246
});
247247
}

docs/docs/hello_world.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public:
7373
gapRow = 8_px, // Set vertical gap between elements
7474
alignItems = AlignItems::Center, // Align child widgets to the center
7575
justifyContent = Justify::Center, // Center the layout in the parent
76-
new Text{"Hello, world"}, // Display a text widget with "Hello, world"
77-
new Button{
78-
new Text{"Quit"}, // Button label
76+
rcnew Text{"Hello, world"}, // Display a text widget with "Hello, world"
77+
rcnew Button{
78+
rcnew Text{"Quit"}, // Button label
7979
onClick = m_lifetime | []() { // Quit the application on button click
8080
windowApplication->quit();
8181
},

0 commit comments

Comments
 (0)