wxdragon-sys 0.9.16

Raw FFI bindings to libwxdragon (which statically links wxWidgets).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
#include <wx/wxprec.h>
#include <wx/wx.h>
#include "../include/wxdragon.h"
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/wrapsizer.h>
#include <wx/gbsizer.h>

extern "C" {

// --- Sizer Functions ---

WXD_EXPORTED wxd_Sizer_t*
wxd_BoxSizer_Create(wxd_Orientation_t orient)
{
    // Cast integer orientation to wxOrientation
    wxOrientation wx_orient = static_cast<wxOrientation>(orient);
    wxBoxSizer* sizer = new wxBoxSizer(wx_orient);
    return reinterpret_cast<wxd_Sizer_t*>(sizer);
}

WXD_EXPORTED void
wxd_Sizer_AddWindow(wxd_Sizer_t* sizer, wxd_Window_t* window, int proportion, wxd_SizerFlags_t flag,
                    int border)
{
    if (!sizer || !window)
        return;
    wxSizer* wx_sizer = reinterpret_cast<wxSizer*>(sizer);
    wxWindow* wx_window = reinterpret_cast<wxWindow*>(window);

    // Ensure flag is treated as an int for wxWidgets flags (safe due to typedef)
    wx_sizer->Add(wx_window, proportion, flag, border);
}

WXD_EXPORTED void
wxd_Sizer_AddSpacer(wxd_Sizer_t* sizer, int size)
{
    if (!sizer)
        return;
    wxSizer* wx_sizer = reinterpret_cast<wxSizer*>(sizer);
    wx_sizer->AddSpacer(size);
}

WXD_EXPORTED void
wxd_Sizer_AddSizer(wxd_Sizer_t* sizer, wxd_Sizer_t* childSizer, int proportion,
                   wxd_SizerFlags_t flag, int border)
{
    if (!sizer || !childSizer)
        return;
    wxSizer* wx_sizer = reinterpret_cast<wxSizer*>(sizer);
    wxSizer* wx_child_sizer = reinterpret_cast<wxSizer*>(childSizer);

    // The parent sizer takes ownership of the child sizer pointer
    // when added. The Rust side should `std::mem::forget` the wrapper
    // for the child sizer to prevent a double free.
    wx_sizer->Add(wx_child_sizer, proportion, flag, border);
}

WXD_EXPORTED void
wxd_Sizer_AddStretchSpacer(wxd_Sizer_t* sizer, int prop)
{
    if (!sizer)
        return;
    wxSizer* wx_sizer = reinterpret_cast<wxSizer*>(sizer);
    wx_sizer->AddStretchSpacer(prop);
}

// --- ADDED: wxStaticBoxSizer Implementation ---

WXD_EXPORTED wxd_StaticBoxSizer_t*
wxd_StaticBoxSizer_Create_WithBox(wxd_StaticBox_t* box, wxd_Orientation_t orient)
{
    if (!box)
        return nullptr;
    wxStaticBox* wx_box = reinterpret_cast<wxStaticBox*>(box);
    wxOrientation wx_orient = static_cast<wxOrientation>(orient);
    wxStaticBoxSizer* sizer = new wxStaticBoxSizer(wx_box, wx_orient);
    return reinterpret_cast<wxd_StaticBoxSizer_t*>(sizer);
}

WXD_EXPORTED wxd_StaticBoxSizer_t*
wxd_StaticBoxSizer_Create_WithLabel(wxd_Orientation_t orient, wxd_Window_t* parent,
                                    const char* label)
{
    if (!parent)
        return nullptr;
    wxWindow* wx_parent = reinterpret_cast<wxWindow*>(parent);
    wxOrientation wx_orient = static_cast<wxOrientation>(orient);
    wxStaticBoxSizer* sizer =
        new wxStaticBoxSizer(wx_orient, wx_parent, wxString::FromUTF8(label ? label : ""));
    return reinterpret_cast<wxd_StaticBoxSizer_t*>(sizer);
}

wxd_StaticBox_t*
wxd_StaticBoxSizer_GetStaticBox(wxd_StaticBoxSizer_t* self)
{
    if (!self)
        return nullptr;
    wxStaticBoxSizer* wx_sizer = reinterpret_cast<wxStaticBoxSizer*>(self);
    return reinterpret_cast<wxd_StaticBox_t*>(wx_sizer->GetStaticBox());
}

// --- wxGridSizer ---
wxd_GridSizer_t*
wxd_GridSizer_Create(int rows, int cols, int vgap, int hgap)
{
    wxGridSizer* sizer = new wxGridSizer(rows, cols, vgap, hgap);
    return reinterpret_cast<wxd_GridSizer_t*>(sizer);
}

wxd_GridSizer_t*
wxd_GridSizer_CreateWithGap(int rows, int cols, int gap_width, int gap_height)
{
    wxGridSizer* sizer = new wxGridSizer(rows, cols, wxSize(gap_width, gap_height));
    return reinterpret_cast<wxd_GridSizer_t*>(sizer);
}

void
wxd_GridSizer_SetCols(wxd_GridSizer_t* self, int cols)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        wx_sizer->SetCols(cols);
    }
}

void
wxd_GridSizer_SetRows(wxd_GridSizer_t* self, int rows)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        wx_sizer->SetRows(rows);
    }
}

void
wxd_GridSizer_SetVGap(wxd_GridSizer_t* self, int gap)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        wx_sizer->SetVGap(gap);
    }
}

void
wxd_GridSizer_SetHGap(wxd_GridSizer_t* self, int gap)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        wx_sizer->SetHGap(gap);
    }
}

int
wxd_GridSizer_GetCols(wxd_GridSizer_t* self)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        return wx_sizer->GetCols();
    }
    return 0;
}

int
wxd_GridSizer_GetRows(wxd_GridSizer_t* self)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        return wx_sizer->GetRows();
    }
    return 0;
}

int
wxd_GridSizer_GetVGap(wxd_GridSizer_t* self)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        return wx_sizer->GetVGap();
    }
    return 0;
}

int
wxd_GridSizer_GetHGap(wxd_GridSizer_t* self)
{
    if (self) {
        wxGridSizer* wx_sizer = reinterpret_cast<wxGridSizer*>(self);
        return wx_sizer->GetHGap();
    }
    return 0;
}

// --- wxFlexGridSizer ---
wxd_FlexGridSizer_t*
wxd_FlexGridSizer_Create(int rows, int cols, int vgap, int hgap)
{
    wxFlexGridSizer* sizer = new wxFlexGridSizer(rows, cols, vgap, hgap);
    return reinterpret_cast<wxd_FlexGridSizer_t*>(sizer);
}

wxd_FlexGridSizer_t*
wxd_FlexGridSizer_CreateWithGap(int rows, int cols, int gap_width, int gap_height)
{
    wxFlexGridSizer* sizer = new wxFlexGridSizer(rows, cols, wxSize(gap_width, gap_height));
    return reinterpret_cast<wxd_FlexGridSizer_t*>(sizer);
}

void
wxd_FlexGridSizer_AddGrowableCol(wxd_FlexGridSizer_t* self, size_t idx, int proportion)
{
    if (self) {
        wxFlexGridSizer* wx_sizer = reinterpret_cast<wxFlexGridSizer*>(self);
        wx_sizer->AddGrowableCol(idx, proportion);
    }
}

void
wxd_FlexGridSizer_AddGrowableRow(wxd_FlexGridSizer_t* self, size_t idx, int proportion)
{
    if (self) {
        wxFlexGridSizer* wx_sizer = reinterpret_cast<wxFlexGridSizer*>(self);
        wx_sizer->AddGrowableRow(idx, proportion);
    }
}

void
wxd_FlexGridSizer_SetFlexibleDirection(wxd_FlexGridSizer_t* self, int direction)
{
    if (self) {
        wxFlexGridSizer* wx_sizer = reinterpret_cast<wxFlexGridSizer*>(self);
        wx_sizer->SetFlexibleDirection(direction);
    }
}

void
wxd_FlexGridSizer_SetNonFlexibleGrowMode(wxd_FlexGridSizer_t* self, int mode)
{
    if (self) {
        wxFlexGridSizer* wx_sizer = reinterpret_cast<wxFlexGridSizer*>(self);
        wx_sizer->SetNonFlexibleGrowMode(static_cast<wxFlexSizerGrowMode>(mode));
    }
}

// --- WrapSizer ---
WXD_EXPORTED wxd_WrapSizer_t*
wxd_WrapSizer_Create(wxd_Orientation_t orient, int flags)
{
    wxOrientation wx_orient = static_cast<wxOrientation>(orient);
    wxWrapSizer* sizer = new wxWrapSizer(wx_orient, flags);
    return reinterpret_cast<wxd_WrapSizer_t*>(sizer);
}

// --- GridBagSizer ---
WXD_EXPORTED wxd_GridBagSizer_t*
wxd_GridBagSizer_Create(int vgap, int hgap)
{
    wxGridBagSizer* sizer = new wxGridBagSizer(vgap, hgap);
    return reinterpret_cast<wxd_GridBagSizer_t*>(sizer);
}

WXD_EXPORTED void
wxd_GridBagSizer_AddWindow(wxd_GridBagSizer_t* sizer, wxd_Window_t* window, wxd_GBPosition pos,
                           wxd_GBSpan span, int flag, int border)
{
    if (!sizer || !window)
        return;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxWindow* wx_window = reinterpret_cast<wxWindow*>(window);
    wxGBPosition wx_pos(pos.row, pos.col);
    wxGBSpan wx_span(span.rowspan, span.colspan);
    wx_sizer->Add(wx_window, wx_pos, wx_span, flag, border);
}

WXD_EXPORTED void
wxd_GridBagSizer_AddSizer(wxd_GridBagSizer_t* sizer, wxd_Sizer_t* child_sizer, wxd_GBPosition pos,
                          wxd_GBSpan span, int flag, int border)
{
    if (!sizer || !child_sizer)
        return;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSizer* wx_child_sizer = reinterpret_cast<wxSizer*>(child_sizer);
    wxGBPosition wx_pos(pos.row, pos.col);
    wxGBSpan wx_span(span.rowspan, span.colspan);
    wx_sizer->Add(wx_child_sizer, wx_pos, wx_span, flag, border);
}

WXD_EXPORTED void
wxd_GridBagSizer_AddSpacer(wxd_GridBagSizer_t* sizer, int width, int height, wxd_GBPosition pos,
                           wxd_GBSpan span, int flag, int border)
{
    if (!sizer)
        return;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxGBPosition wx_pos(pos.row, pos.col);
    wxGBSpan wx_span(span.rowspan, span.colspan);
    wx_sizer->Add(width, height, wx_pos, wx_span, flag, border);
}

WXD_EXPORTED wxd_GBPosition
wxd_GridBagSizer_GetItemPosition_Window(wxd_GridBagSizer_t* sizer, wxd_Window_t* window)
{
    wxd_GBPosition result = { 0, 0 };
    if (!sizer || !window)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxWindow* wx_window = reinterpret_cast<wxWindow*>(window);
    wxGBPosition wx_pos = wx_sizer->GetItemPosition(wx_window);
    result.row = wx_pos.GetRow();
    result.col = wx_pos.GetCol();
    return result;
}

WXD_EXPORTED wxd_GBPosition
wxd_GridBagSizer_GetItemPosition_Sizer(wxd_GridBagSizer_t* sizer, wxd_Sizer_t* child_sizer)
{
    wxd_GBPosition result = { 0, 0 };
    if (!sizer || !child_sizer)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSizer* wx_child_sizer = reinterpret_cast<wxSizer*>(child_sizer);
    wxGBPosition wx_pos = wx_sizer->GetItemPosition(wx_child_sizer);
    result.row = wx_pos.GetRow();
    result.col = wx_pos.GetCol();
    return result;
}

WXD_EXPORTED wxd_GBPosition
wxd_GridBagSizer_GetItemPosition_Index(wxd_GridBagSizer_t* sizer, size_t index)
{
    wxd_GBPosition result = { 0, 0 };
    if (!sizer)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxGBPosition wx_pos = wx_sizer->GetItemPosition(index);
    result.row = wx_pos.GetRow();
    result.col = wx_pos.GetCol();
    return result;
}

WXD_EXPORTED bool
wxd_GridBagSizer_SetItemPosition_Window(wxd_GridBagSizer_t* sizer, wxd_Window_t* window,
                                        wxd_GBPosition pos)
{
    if (!sizer || !window)
        return false;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxWindow* wx_window = reinterpret_cast<wxWindow*>(window);
    wxGBPosition wx_pos(pos.row, pos.col);
    return wx_sizer->SetItemPosition(wx_window, wx_pos);
}

WXD_EXPORTED bool
wxd_GridBagSizer_SetItemPosition_Sizer(wxd_GridBagSizer_t* sizer, wxd_Sizer_t* child_sizer,
                                       wxd_GBPosition pos)
{
    if (!sizer || !child_sizer)
        return false;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSizer* wx_child_sizer = reinterpret_cast<wxSizer*>(child_sizer);
    wxGBPosition wx_pos(pos.row, pos.col);
    return wx_sizer->SetItemPosition(wx_child_sizer, wx_pos);
}

WXD_EXPORTED bool
wxd_GridBagSizer_SetItemPosition_Index(wxd_GridBagSizer_t* sizer, size_t index, wxd_GBPosition pos)
{
    if (!sizer)
        return false;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxGBPosition wx_pos(pos.row, pos.col);
    return wx_sizer->SetItemPosition(index, wx_pos);
}

WXD_EXPORTED wxd_GBSpan
wxd_GridBagSizer_GetItemSpan_Window(wxd_GridBagSizer_t* sizer, wxd_Window_t* window)
{
    wxd_GBSpan result = { 1, 1 };
    if (!sizer || !window)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxWindow* wx_window = reinterpret_cast<wxWindow*>(window);
    wxGBSpan wx_span = wx_sizer->GetItemSpan(wx_window);
    result.rowspan = wx_span.GetRowspan();
    result.colspan = wx_span.GetColspan();
    return result;
}

WXD_EXPORTED wxd_GBSpan
wxd_GridBagSizer_GetItemSpan_Sizer(wxd_GridBagSizer_t* sizer, wxd_Sizer_t* child_sizer)
{
    wxd_GBSpan result = { 1, 1 };
    if (!sizer || !child_sizer)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSizer* wx_child_sizer = reinterpret_cast<wxSizer*>(child_sizer);
    wxGBSpan wx_span = wx_sizer->GetItemSpan(wx_child_sizer);
    result.rowspan = wx_span.GetRowspan();
    result.colspan = wx_span.GetColspan();
    return result;
}

WXD_EXPORTED wxd_GBSpan
wxd_GridBagSizer_GetItemSpan_Index(wxd_GridBagSizer_t* sizer, size_t index)
{
    wxd_GBSpan result = { 1, 1 };
    if (!sizer)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxGBSpan wx_span = wx_sizer->GetItemSpan(index);
    result.rowspan = wx_span.GetRowspan();
    result.colspan = wx_span.GetColspan();
    return result;
}

WXD_EXPORTED bool
wxd_GridBagSizer_SetItemSpan_Window(wxd_GridBagSizer_t* sizer, wxd_Window_t* window,
                                    wxd_GBSpan span)
{
    if (!sizer || !window)
        return false;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxWindow* wx_window = reinterpret_cast<wxWindow*>(window);
    wxGBSpan wx_span(span.rowspan, span.colspan);
    return wx_sizer->SetItemSpan(wx_window, wx_span);
}

WXD_EXPORTED bool
wxd_GridBagSizer_SetItemSpan_Sizer(wxd_GridBagSizer_t* sizer, wxd_Sizer_t* child_sizer,
                                   wxd_GBSpan span)
{
    if (!sizer || !child_sizer)
        return false;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSizer* wx_child_sizer = reinterpret_cast<wxSizer*>(child_sizer);
    wxGBSpan wx_span(span.rowspan, span.colspan);
    return wx_sizer->SetItemSpan(wx_child_sizer, wx_span);
}

WXD_EXPORTED bool
wxd_GridBagSizer_SetItemSpan_Index(wxd_GridBagSizer_t* sizer, size_t index, wxd_GBSpan span)
{
    if (!sizer)
        return false;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxGBSpan wx_span(span.rowspan, span.colspan);
    return wx_sizer->SetItemSpan(index, wx_span);
}

WXD_EXPORTED wxd_Size
wxd_GridBagSizer_GetEmptyCellSize(wxd_GridBagSizer_t* sizer)
{
    wxd_Size result = { 0, 0 };
    if (!sizer)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSize wx_size = wx_sizer->GetEmptyCellSize();
    result.width = wx_size.GetWidth();
    result.height = wx_size.GetHeight();
    return result;
}

WXD_EXPORTED void
wxd_GridBagSizer_SetEmptyCellSize(wxd_GridBagSizer_t* sizer, wxd_Size size)
{
    if (!sizer)
        return;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSize wx_size(size.width, size.height);
    wx_sizer->SetEmptyCellSize(wx_size);
}

WXD_EXPORTED wxd_Size
wxd_GridBagSizer_GetCellSize(wxd_GridBagSizer_t* sizer, int row, int col)
{
    wxd_Size result = { 0, 0 };
    if (!sizer)
        return result;
    wxGridBagSizer* wx_sizer = reinterpret_cast<wxGridBagSizer*>(sizer);
    wxSize wx_size = wx_sizer->GetCellSize(row, col);
    result.width = wx_size.GetWidth();
    result.height = wx_size.GetHeight();
    return result;
}

// --- StdDialogButtonSizer ---

WXD_EXPORTED wxd_StdDialogButtonSizer_t*
wxd_StdDialogButtonSizer_Create()
{
    wxStdDialogButtonSizer* sizer = new wxStdDialogButtonSizer();
    return reinterpret_cast<wxd_StdDialogButtonSizer_t*>(sizer);
}

WXD_EXPORTED void
wxd_StdDialogButtonSizer_AddButton(wxd_StdDialogButtonSizer_t* self, wxd_Button_t* button)
{
    if (!self || !button)
        return;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    wxButton* btn = reinterpret_cast<wxButton*>(button);
    sizer->AddButton(btn);
}

WXD_EXPORTED void
wxd_StdDialogButtonSizer_Realize(wxd_StdDialogButtonSizer_t* self)
{
    if (!self)
        return;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    sizer->Realize();
}

WXD_EXPORTED wxd_Button_t*
wxd_StdDialogButtonSizer_GetAffirmativeButton(wxd_StdDialogButtonSizer_t* self)
{
    if (!self)
        return nullptr;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    return reinterpret_cast<wxd_Button_t*>(sizer->GetAffirmativeButton());
}

WXD_EXPORTED wxd_Button_t*
wxd_StdDialogButtonSizer_GetApplyButton(wxd_StdDialogButtonSizer_t* self)
{
    if (!self)
        return nullptr;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    return reinterpret_cast<wxd_Button_t*>(sizer->GetApplyButton());
}

WXD_EXPORTED wxd_Button_t*
wxd_StdDialogButtonSizer_GetNegativeButton(wxd_StdDialogButtonSizer_t* self)
{
    if (!self)
        return nullptr;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    return reinterpret_cast<wxd_Button_t*>(sizer->GetNegativeButton());
}

WXD_EXPORTED wxd_Button_t*
wxd_StdDialogButtonSizer_GetCancelButton(wxd_StdDialogButtonSizer_t* self)
{
    if (!self)
        return nullptr;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    return reinterpret_cast<wxd_Button_t*>(sizer->GetCancelButton());
}

WXD_EXPORTED wxd_Button_t*
wxd_StdDialogButtonSizer_GetHelpButton(wxd_StdDialogButtonSizer_t* self)
{
    if (!self)
        return nullptr;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    return reinterpret_cast<wxd_Button_t*>(sizer->GetHelpButton());
}

WXD_EXPORTED void
wxd_StdDialogButtonSizer_SetAffirmativeButton(wxd_StdDialogButtonSizer_t* self, wxd_Button_t* button)
{
    if (!self || !button)
        return;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    wxButton* btn = reinterpret_cast<wxButton*>(button);
    sizer->SetAffirmativeButton(btn);
}

WXD_EXPORTED void
wxd_StdDialogButtonSizer_SetNegativeButton(wxd_StdDialogButtonSizer_t* self, wxd_Button_t* button)
{
    if (!self || !button)
        return;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    wxButton* btn = reinterpret_cast<wxButton*>(button);
    sizer->SetNegativeButton(btn);
}

WXD_EXPORTED void
wxd_StdDialogButtonSizer_SetCancelButton(wxd_StdDialogButtonSizer_t* self, wxd_Button_t* button)
{
    if (!self || !button)
        return;
    wxStdDialogButtonSizer* sizer = reinterpret_cast<wxStdDialogButtonSizer*>(self);
    wxButton* btn = reinterpret_cast<wxButton*>(button);
    sizer->SetCancelButton(btn);
}

// --- Treebook ---

} // extern "C"