Hash :
d3eeeff4
Author :
Thomas de Grivel
Date :
2024-12-15T23:30:28
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
/* kc3
* Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software granted the above
* copyright notice and this permission paragraph are included in all
* copies and substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
#include <libkc3/assert.h>
#include <libkc3/s32.h>
#include <libkc3/sym.h>
#include "widget.h"
GtkWidget ** kc3_gtk4_widget_set_halign (GtkWidget **widget,
const s_sym * const *align)
{
GtkAlign a = 0;
if (*align == sym_1("fill"))
a = GTK_ALIGN_FILL;
else if (*align == sym_1("start"))
a = GTK_ALIGN_START;
else if (*align == sym_1("end"))
a = GTK_ALIGN_END;
else if (*align == sym_1("center"))
a = GTK_ALIGN_CENTER;
else if (*align == sym_1("baseline_fill"))
a = GTK_ALIGN_BASELINE_FILL;
else if (*align == sym_1("baseline"))
//a = GTK_ALIGN_BASELINE;
a = GTK_ALIGN_CENTER + 1;
else if (*align == sym_1("baseline_center"))
a = GTK_ALIGN_BASELINE_CENTER;
else {
err_puts("kc3_gtk4_widget_set_halign: invalid alignement");
assert(! "kc3_gtk4_widget_set_halign: invalid alignement");
return NULL;
}
gtk_widget_set_halign(*widget, a);
return widget;
}
void kc3_gtk4_widget_set_hexpand (GtkWidget **widget,
bool expand)
{
gtk_widget_set_hexpand(*widget, expand);
}
GtkWidget ** kc3_gtk4_widget_set_size_request (GtkWidget **widget,
const s_tag *width,
const s_tag *height)
{
s32 h;
const s_sym *sym_S32 = &g_sym_S32;
s32 w;
if (! s32_init_cast(&w, &sym_S32, width)) {
err_puts("kc3_gtk4_widget_set_size_request: invalid width");
return NULL;
}
if (! s32_init_cast(&h, &sym_S32, height)) {
err_puts("kc3_gtk4_widget_set_size_request: invalid height");
return NULL;
}
gtk_widget_set_size_request(*widget, w, h);
return widget;
}
void kc3_gtk4_widget_set_vexpand (GtkWidget **widget,
bool expand)
{
gtk_widget_set_vexpand(*widget, expand);
}