nappgui-sys 0.2.0

Rust raw bindings to NAppGUI
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
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
/*
 * NAppGUI Cross-platform C SDK
 * 2015-2025 Francisco Garcia Collado
 * MIT Licence
 * https://nappgui.com/en/legal/license.html
 *
 * File: gbind.c
 *
 */

/* Gui data binding */

#include "gbind.inl"
#include "cell.h"
#include "cell.inl"
#include "component.inl"
#include "button.inl"
#include "view.inl"
#include "edit.inl"
#include "label.inl"
#include "layout.h"
#include "layout.inl"
#include "panel.inl"
#include "popup.inl"
#include "slider.inl"
#include <core/arrpt.h>
#include <core/dbindh.h>
#include <core/event.h>
#include <core/strings.h>
#include <sewer/bmath.h>
#include <sewer/bmem.h>
#include <sewer/bstd.h>
#include <sewer/cassert.h>

ArrStFuncs(Cell);

/*---------------------------------------------------------------------------*/

static void i_set_bool(GuiComponent *component, const bool_t value)
{
    cassert_no_null(component);
    switch (component->type)
    {
    case ekGUI_TYPE_LABEL:
        _label_text(cast(component, Label), value ? "True" : "False");
        break;

    case ekGUI_TYPE_BUTTON:
        _button_bool(cast(component, Button), value);
        break;

    case ekGUI_TYPE_SLIDER:
        _slider_real32(cast(component, Slider), value ? 1.f : 0.f);
        break;

    case ekGUI_TYPE_POPUP:
    case ekGUI_TYPE_EDITBOX:
    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_CUSTOMVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }
}

/*---------------------------------------------------------------------------*/

static void i_set_integer(GuiComponent *component, const int64_t value, const int64_t min, const int64_t max)
{
    cassert_no_null(component);
    switch (component->type)
    {
    case ekGUI_TYPE_LABEL:
    {
        char_t msg[64];
        bstd_sprintf(msg, 64, "%" PRId64, value);
        _label_text(cast(component, Label), msg);
        break;
    }

    case ekGUI_TYPE_BUTTON:
        _button_uint32(cast(component, Button), value >= 0 ? (uint32_t)value : 0);
        break;

    case ekGUI_TYPE_POPUP:
        _popup_uint32(cast(component, PopUp), (uint32_t)value);
        break;

    case ekGUI_TYPE_CUSTOMVIEW:
        _view_uint32(cast(component, View), (uint32_t)value);
        break;

    case ekGUI_TYPE_SLIDER:
    {
        real64_t range = (real64_t)max - (real64_t)min;
        real32_t norm = (real32_t)(((real64_t)value - (real64_t)min) / range);
        cassert(value >= min);
        _slider_real32(cast(component, Slider), norm);
        break;
    }

    case ekGUI_TYPE_EDITBOX:
    {
        char_t msg[64];
        bstd_sprintf(msg, 64, "%" PRId64, value);
        _edit_text(cast(component, Edit), msg);
        break;
    }

    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }
}

/*---------------------------------------------------------------------------*/

static void i_set_real(GuiComponent *component, const real64_t value, const real64_t min, const real64_t max, const char_t *format)
{
    cassert_no_null(component);
    switch (component->type)
    {
    case ekGUI_TYPE_LABEL:
    {
        if (value != REAL32_MAX && value != REAL64_MAX)
        {
            char_t msg[64];
            bstd_sprintf(msg, 64, format, value);
            _label_text(cast(component, Label), msg);
        }
        else
        {
            _label_text(cast(component, Label), "");
        }
        break;
    }

    case ekGUI_TYPE_EDITBOX:
    {
        if (value != REAL32_MAX && value != REAL64_MAX)
        {
            char_t msg[64];
            bstd_sprintf(msg, 64, format, value);
            _edit_text(cast(component, Edit), msg);
        }
        else
        {
            _edit_text(cast(component, Edit), "");
        }
        break;
    }

    case ekGUI_TYPE_SLIDER:
    {
        if (value != REAL32_MAX && value != REAL64_MAX)
        {
            real64_t norm = bmath_clampd((value - min) / (max - min), 0, 1);
            _slider_real32(cast(component, Slider), (real32_t)norm);
        }
        else
        {
            _slider_real32(cast(component, Slider), .5f);
        }
        break;
    }

    case ekGUI_TYPE_BUTTON:
    case ekGUI_TYPE_POPUP:
    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_CUSTOMVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }
}

/*---------------------------------------------------------------------------*/

static void i_set_enum(GuiComponent *component, const uint32_t index, const uint32_t count, const char_t *alias)
{
    cassert_no_null(component);
    switch (component->type)
    {
    case ekGUI_TYPE_LABEL:
        _label_text(cast(component, Label), alias);
        break;

    case ekGUI_TYPE_BUTTON:
        _button_uint32(cast(component, Button), index);
        break;

    case ekGUI_TYPE_POPUP:
        _popup_uint32(cast(component, PopUp), index);
        break;

    case ekGUI_TYPE_SLIDER:
    {
        real32_t vnorm = 0;
        if (count > 1)
            vnorm = (real32_t)index / (count - 1);
        _slider_real32(cast(component, Slider), vnorm);
        break;
    }

    case ekGUI_TYPE_CUSTOMVIEW:
        _view_uint32(cast(component, View), index);
        break;

    case ekGUI_TYPE_EDITBOX:
    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }
}

/*---------------------------------------------------------------------------*/

static void i_set_string(GuiComponent *component, const char_t *str)
{
    cassert_no_null(component);
    switch (component->type)
    {
    case ekGUI_TYPE_LABEL:
        _label_text(cast(component, Label), str);
        break;

    case ekGUI_TYPE_EDITBOX:
        _edit_text(cast(component, Edit), str);
        break;

    case ekGUI_TYPE_BUTTON:
    case ekGUI_TYPE_POPUP:
    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_SLIDER:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_CUSTOMVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }
}

/*---------------------------------------------------------------------------*/

static void i_set_image(GuiComponent *component, const Image *image)
{
    cassert_no_null(component);
    switch (component->type)
    {
    case ekGUI_TYPE_CUSTOMVIEW:
        _view_image(cast(component, View), image);
        break;

    case ekGUI_TYPE_LABEL:
    case ekGUI_TYPE_BUTTON:
    case ekGUI_TYPE_POPUP:
    case ekGUI_TYPE_EDITBOX:
    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_SLIDER:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }
}

/*---------------------------------------------------------------------------*/

static void i_set_empty(Cell *cell, const DBind *stbind, const uint32_t member_id)
{
    GuiComponent *component = _cell_component(cell);
    const DBind *mbind = dbind_st_member(stbind, member_id);

    switch (component->type)
    {
    case ekGUI_TYPE_EDITBOX:
        _edit_text(cast(component, Edit), "");
        break;

    case ekGUI_TYPE_CUSTOMVIEW:
        _view_empty(cast(component, View));
        break;

    case ekGUI_TYPE_LABEL:
        _label_text(cast(component, Label), "");
        break;

    case ekGUI_TYPE_BUTTON:
    case ekGUI_TYPE_POPUP:
    case ekGUI_TYPE_COMBOBOX:
    case ekGUI_TYPE_SLIDER:
    case ekGUI_TYPE_UPDOWN:
    case ekGUI_TYPE_PROGRESS:
        break;

    case ekGUI_TYPE_TEXTVIEW:
    case ekGUI_TYPE_WEBVIEW:
    case ekGUI_TYPE_TREEVIEW:
    case ekGUI_TYPE_BOXVIEW:
    case ekGUI_TYPE_SPLITVIEW:
    case ekGUI_TYPE_PANEL:
    case ekGUI_TYPE_LINE:
    case ekGUI_TYPE_HEADER:
    case ekGUI_TYPE_WINDOW:
    case ekGUI_TYPE_TOOLBAR:
        cassert_default();
    }

    switch (dbind_type(mbind))
    {
    case ekDTYPE_BINARY:
        if (str_equ_c(dbind_typename(mbind), "Image") == TRUE)
        {
            const Image *image = cast_const(dbind_st_binary_default(stbind, member_id), Image);
            i_set_image(component, image);
        }
        break;

    case ekDTYPE_BOOL:
    case ekDTYPE_INT:
    case ekDTYPE_REAL:
    case ekDTYPE_ENUM:
    case ekDTYPE_STRING:
    case ekDTYPE_STRUCT:
    case ekDTYPE_CONTAINER:
    case ekDTYPE_UNKNOWN:
    default:
        break;
    }

    cell_enabled(cell, FALSE);
}

/*---------------------------------------------------------------------------*/

void _gbind_update_control(Cell *cell, const DBind *stbind, const uint32_t member_id, const void *obj)
{
    if (obj != NULL)
    {
        const DBind *mbind = dbind_st_member(stbind, member_id);
        dtype_t mtype = dbind_type(mbind);
        GuiComponent *component = _cell_component(cell);
        cassert(component->type != ekGUI_TYPE_PANEL);

        switch (mtype)
        {
        case ekDTYPE_BOOL:
        {
            bool_t value = dbind_st_get_bool_value(stbind, member_id, cast_const(obj, byte_t));
            i_set_bool(component, value);
            break;
        }

        case ekDTYPE_INT:
        {
            int64_t min, max, value;
            dbind_st_int_range(stbind, member_id, &min, &max);
            value = dbind_st_get_int_value(stbind, member_id, cast_const(obj, byte_t));
            i_set_integer(component, value, min, max);
            break;
        }

        case ekDTYPE_REAL:
        {
            real64_t min, max, value;
            const char_t *format = NULL;
            dbind_st_real_range(stbind, member_id, &min, &max);
            format = dbind_st_real_format(stbind, member_id);
            value = dbind_st_get_real_value(stbind, member_id, cast_const(obj, byte_t));
            i_set_real(component, value, min, max, format);
            break;
        }

        case ekDTYPE_ENUM:
        {
            enum_t value = dbind_st_get_enum_value(stbind, member_id, obj);
            uint32_t index = dbind_enum_index(mbind, value);
            uint32_t count = dbind_enum_count(mbind);
            const char_t *alias = dbind_enum_alias(mbind, index);
            i_set_enum(component, index, count, alias);
            break;
        }

        case ekDTYPE_STRING:
        {
            const char_t *str = dbind_st_get_str_value(stbind, member_id, obj);
            i_set_string(component, str != NULL ? str : "");
            break;
        }

        case ekDTYPE_BINARY:
        {
            const char_t *typename = dbind_typename(mbind);
            if (str_equ_c(typename, "Image") == TRUE)
            {
                const Image *image = cast_const(dbind_st_get_binary_value(stbind, member_id, obj), Image);
                i_set_image(component, image);
            }
            break;
        }

        case ekDTYPE_STRUCT:
        case ekDTYPE_CONTAINER:
        case ekDTYPE_UNKNOWN:
            cassert_default();
        }

        cell_enabled(cell, TRUE);
    }
    else
    {
        i_set_empty(cell, stbind, member_id);
    }
}

/*---------------------------------------------------------------------------*/

void _gbind_update_layout(Layout *layout, const DBind *stbind, const uint32_t member_id, const void *obj)
{
    if (obj != NULL)
    {
        const DBind *mbind = dbind_st_member(stbind, member_id);
        dtype_t mtype = dbind_type(mbind);

        switch (mtype)
        {
        case ekDTYPE_STRUCT:
        {
            const byte_t *sobj = dbind_st_get_struct_value(stbind, member_id, cast_const(obj, byte_t));
            const char_t *typename = dbind_typename(mbind);
            layout_dbind_obj_imp(layout, cast(sobj, void), typename);
            break;
        }

        case ekDTYPE_BOOL:
        case ekDTYPE_INT:
        case ekDTYPE_REAL:
        case ekDTYPE_ENUM:
        case ekDTYPE_STRING:
        case ekDTYPE_BINARY:
        {
            ArrPt(Cell) *cells = _layout_cells(layout);
            arrpt_foreach(cell, cells, Cell)
                _gbind_update_control(cell, stbind, member_id, obj);
            arrpt_end()
            break;
        }

        case ekDTYPE_CONTAINER:
        case ekDTYPE_UNKNOWN:
            cassert_default();
        }
    }
    else
    {
        ArrPt(Cell) *cells = _layout_cells(layout);
        arrpt_foreach(cell, cells, Cell)
            i_set_empty(cell, stbind, member_id);
        arrpt_end()
    }
}

/*---------------------------------------------------------------------------*/

static void i_on_updated(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const bindset_t updated, byte_t *store, const uint32_t sizeof_store)
{
    /* The value has changed in 'obj' */
    if (updated == ekBINDSET_OK)
    {
        bool_t allow_change = TRUE;

        if (layout_notify != NULL)
        {
            EvBind params;
            Listener *listener = NULL;
            const DBind *mbind = dbind_st_member(stbind, member_id);
            _layout_dbind_notif_obj(layout_notify, &params.obj_main, &params.objtype_main, &params.size_main, &listener);
            params.obj_edit = obj;
            params.objtype_edit = dbind_typename(stbind);
            params.offset_edit = dbind_st_offset(stbind, member_id);
            params.size_edit = dbind_size(mbind);
            listener_event_imp(listener, ekGUI_EVENT_OBJCHANGE, layout_notify, &params, &allow_change, "Layout", "EvBind", "bool_t");
        }

        /* The updated has been reverted by event processing */
        if (allow_change == FALSE)
        {
            /* Restore the previous field value from a copy */
            dbind_st_restore_field(stbind, member_id, cast(obj, byte_t), store, sizeof_store);
        }
    }

    /* The stored field can have reserved dynamic memory (string, binaries, etc) */
    dbind_st_remove_field(stbind, member_id, store, sizeof_store);

    /* Update all controls related with this member */
    if (updated == ekBINDSET_OK)
        _layout_dbind_update(layout, member_id);
}

/*---------------------------------------------------------------------------*/

static void i_store_field(const DBind *stbind, const uint32_t member_id, void *obj, byte_t *store, const uint32_t sizeof_store)
{
    bmem_set_zero(store, sizeof_store);
    dbind_st_store_field(stbind, member_id, cast(obj, byte_t), store, sizeof_store);
}

/*---------------------------------------------------------------------------*/

void _gbind_update_bool(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const bool_t value)
{
    byte_t store[16];
    bindset_t updated = ekBINDSET_NOT_ALLOWED;
    i_store_field(stbind, member_id, obj, store, sizeof(store));
    updated = dbind_st_set_value_bool(stbind, member_id, cast(obj, byte_t), value);
    i_on_updated(layout, stbind, member_id, obj, layout_notify, updated, store, sizeof(store));
}

/*---------------------------------------------------------------------------*/

void _gbind_update_u32(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const uint32_t value)
{
    byte_t store[16];
    bindset_t updated = ekBINDSET_NOT_ALLOWED;
    i_store_field(stbind, member_id, obj, store, sizeof(store));
    updated = dbind_st_set_value_int(stbind, member_id, cast(obj, byte_t), (int64_t)value);
    i_on_updated(layout, stbind, member_id, obj, layout_notify, updated, store, sizeof(store));
}

/*---------------------------------------------------------------------------*/

void _gbind_update_norm32(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const real32_t value)
{
    byte_t store[16];
    bindset_t updated = ekBINDSET_NOT_ALLOWED;
    i_store_field(stbind, member_id, obj, store, sizeof(store));
    updated = dbind_st_set_value_norm(stbind, member_id, cast(obj, byte_t), (real64_t)value);
    i_on_updated(layout, stbind, member_id, obj, layout_notify, updated, store, sizeof(store));
}

/*---------------------------------------------------------------------------*/

void _gbind_update_incr(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const bool_t positive_incr)
{
    byte_t store[16];
    bindset_t updated = ekBINDSET_NOT_ALLOWED;
    i_store_field(stbind, member_id, obj, store, sizeof(store));
    updated = dbind_st_set_value_incr(stbind, member_id, cast(obj, byte_t), positive_incr);
    i_on_updated(layout, stbind, member_id, obj, layout_notify, updated, store, sizeof(store));
}

/*---------------------------------------------------------------------------*/

void _gbind_update_str(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const char_t *str)
{
    byte_t store[16];
    bindset_t updated = ekBINDSET_NOT_ALLOWED;
    i_store_field(stbind, member_id, obj, store, sizeof(store));
    updated = dbind_st_set_value_str(stbind, member_id, cast(obj, byte_t), str);
    i_on_updated(layout, stbind, member_id, obj, layout_notify, updated, store, sizeof(store));
}

/*---------------------------------------------------------------------------*/

void _gbind_update_image(Layout *layout, const DBind *stbind, const uint32_t member_id, void *obj, Layout *layout_notify, const Image *image)
{
    byte_t store[16];
    bindset_t updated = ekBINDSET_NOT_ALLOWED;
    i_store_field(stbind, member_id, obj, store, sizeof(store));
    updated = dbind_st_set_value_binary(stbind, member_id, cast(obj, byte_t), cast(image, void));
    i_on_updated(layout, stbind, member_id, obj, layout_notify, updated, store, sizeof(store));
}

/*---------------------------------------------------------------------------*/

bool_t _gbind_field_modify(const EvBind *evbind, const char_t *type, const uint16_t size, const char_t *mname, const char_t *mtype, const uint16_t moffset, const uint16_t msize)
{
    const DBind *stbind = dbind_from_typename(type, NULL);
    uint32_t member_id = dbind_st_member_id(stbind, mname);

#if defined(__ASSERTS__)
    {
        bool_t is_ptr = FALSE;
        const DBind *mbind = dbind_st_member(stbind, member_id);
        const DBind *mbindt = dbind_from_typename(mtype, &is_ptr);
        const char_t *typename = dbind_typename(mbind);
        cassert(mbind == mbindt);
        cassert_unref(dbind_size(stbind) == size, size);
        cassert_unref(dbind_st_offset(stbind, member_id) == moffset, moffset);
        cassert_unref((is_ptr == TRUE && msize == sizeof(void *)) || dbind_size(mbind) == msize, msize);
        if (is_ptr == TRUE)
        {
            uint32_t len = str_len_c(typename);
            cassert(str_equ_cn(typename, mtype, len) == TRUE);
        }
        else
        {
            cassert_unref(str_equ_c(dbind_typename(mbind), mtype) == TRUE, mtype);
        }
        cassert_no_null(evbind);
    }
#else
    unref(size);
    unref(mtype);
    unref(msize);
    unref(moffset);
#endif

    {
        const byte_t *data = NULL;
        cassert_no_null(evbind);
        data = cast(evbind->obj_edit, byte_t) + evbind->offset_edit;
        return dbind_st_overlaps_field(stbind, member_id, evbind->obj_main, data, evbind->size_edit);
    }
}