# Base class for all widgets
# See: https://developer.gnome.org/gtk3/stable/GtkWidget.html
extern class GtkWidget `{GtkWidget *`}
# Base class for all widgets
# See: https://developer.gnome.org/gtk3/stable/GtkWidget.html
extern class GtkWidget `{GtkWidget *`}
fun signal_connect(signal_name: String, to_call: GtkCallable, user_data: nullable Object) import String.to_cstring, GtkCallable.signal, Object.as not nullable `{
NitGtkSignal *data = malloc(sizeof(NitGtkSignal));
fun signal_connect(signal_name: String, to_call: GtkCallable, user_data: nullable Object) import String.to_cstring, GtkCallable.signal, Object.as not nullable `{
NitGtkSignal *data = malloc(sizeof(NitGtkSignal));
String_to_cstring(signal_name),
G_CALLBACK(nit_gtk_callback_func),
data);
String_to_cstring(signal_name),
G_CALLBACK(nit_gtk_callback_func),
data);
redef fun ==(o) do return o isa GtkWidget and equal_to_gtk_widget(o)
private fun equal_to_gtk_widget(o: GtkWidget): Bool `{
redef fun ==(o) do return o isa GtkWidget and equal_to_gtk_widget(o)
private fun equal_to_gtk_widget(o: GtkWidget): Bool `{
`}
# with gtk it's possible to set fg_color to all widget: is it correct? is fg color inherited?
# GdkColor color;
fun fg_color=(state: GtkStateType, color: GdkRGBA) `{
`}
# with gtk it's possible to set fg_color to all widget: is it correct? is fg color inherited?
# GdkColor color;
fun fg_color=(state: GtkStateType, color: GdkRGBA) `{
`}
# Sets the sensitivity of a widget. sensitive -> the user can interact with it.
# Insensitive -> widget "grayed out" and the user can"t interact with them
fun sensitive=(sensitive: Bool) `{
`}
# Sets the sensitivity of a widget. sensitive -> the user can interact with it.
# Insensitive -> widget "grayed out" and the user can"t interact with them
fun sensitive=(sensitive: Bool) `{
- win = GTK_WINDOW(gtk_window_new(flag));
- g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);
- return win;
+ # Connect the "destroy" signal to `quit_gtk`
+ fun connect_destroy_signal_to_quit `{
+ g_signal_connect(self, "destroy", G_CALLBACK(gtk_main_quit), NULL);
`}
# The "destroy" signal is emitted when a widget is destroyed, either by explicitly calling gtk_widget_destroy() or when the widget is unparented. Top-level GtkWindows are also destroyed when the Close window control button is clicked.
`}
# The "destroy" signal is emitted when a widget is destroyed, either by explicitly calling gtk_widget_destroy() or when the widget is unparented. Top-level GtkWindows are also destroyed when the Close window control button is clicked.
`}
# Activates the current focused widget within the window.
# returns TRUE if a widget got activated.
fun activate_focus: Bool `{
`}
# Activates the current focused widget within the window.
# returns TRUE if a widget got activated.
fun activate_focus: Bool `{
`}
# Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
fun modal=(is_modal: Bool) `{
`}
# Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
fun modal=(is_modal: Bool) `{
# params width in pixels, or -1 to unset the default width
# params height in pixels, or -1 to unset the default height
fun default_size(width: Int, height: Int) `{
# params width in pixels, or -1 to unset the default width
# params height in pixels, or -1 to unset the default height
fun default_size(width: Int, height: Int) `{
`}
# Activates the default widget for the window
# unless the current focused widget has been configured to receive the default action (see gtk_widget_set_receives_default()), in which case the focused widget is activated.
fun activate_default: Bool `{
`}
# Activates the default widget for the window
# unless the current focused widget has been configured to receive the default action (see gtk_widget_set_receives_default()), in which case the focused widget is activated.
fun activate_default: Bool `{
`}
# Returns whether the input focus is within this GtkWindow. For real toplevel windows, this is identical to gtk_window_is_active(), but for embedded windows, like GtkPlug, the results will differ.
fun has_toplevel_focus: Bool `{
`}
# Returns whether the input focus is within this GtkWindow. For real toplevel windows, this is identical to gtk_window_is_active(), but for embedded windows, like GtkPlug, the results will differ.
fun has_toplevel_focus: Bool `{
# Set a widget child inside the grid at a given position
fun attach(child: GtkWidget, left, top, width, height: Int) `{
# Set a widget child inside the grid at a given position
fun attach(child: GtkWidget, left, top, width, height: Int) `{
- gtk_grid_attach(recv, child, left, top, width, height);
+ gtk_grid_attach(self, child, left, top, width, height);
`}
# Get the child of the Grid at the given position
fun get_child_at(left: Int, top: Int): GtkWidget `{
`}
# Get the child of the Grid at the given position
fun get_child_at(left: Int, top: Int): GtkWidget `{
- fun omogeneous=(omogeneous: Bool) `{
- gtk_box_set_homogeneous(recv, omogeneous);
+ fun homogeneous=(homogeneous: Bool) `{
+ gtk_box_set_homogeneous(self, homogeneous);
`}
# Add `child` and pack it at the start of the box
fun pack_start(child: GtkWidget, expand, fill: Bool, padding: Int) `{
`}
# Add `child` and pack it at the start of the box
fun pack_start(child: GtkWidget, expand, fill: Bool, padding: Int) `{
- gtk_box_pack_start(recv, child, expand, fill, padding);
+ gtk_box_pack_start(self, child, expand, fill, padding);
`}
# Add `child` and pack it at the end of the box
fun pack_end(child: GtkWidget, expand, fill: Bool, padding: Int) `{
`}
# Add `child` and pack it at the end of the box
fun pack_end(child: GtkWidget, expand, fill: Bool, padding: Int) `{
- gtk_box_pack_end(recv, child, expand, fill, padding);
+ gtk_box_pack_end(self, child, expand, fill, padding);
`}
# Set the way `child` is packed in `self`
fun set_child_packing(child: GtkWidget, expand, fill: Bool, padding: Int, packing: GtkPackType) `{
`}
# Set the way `child` is packed in `self`
fun set_child_packing(child: GtkWidget, expand, fill: Bool, padding: Int, packing: GtkPackType) `{
- gtk_box_set_child_packing(recv, child, expand, fill, padding, packing);
+ gtk_box_set_child_packing(self, child, expand, fill, padding, packing);
fun alignment: GtkAlignment is abstract
fun alignment=(x: Float, y: Float) `{
fun alignment: GtkAlignment is abstract
fun alignment=(x: Float, y: Float) `{
`}
fun padding: GtkAlignment is abstract
fun padding=(x: Float, y: Float) `{
`}
fun padding: GtkAlignment is abstract
fun padding=(x: Float, y: Float) `{
`}
# Set the text visiblility
# If false, will use the invisible char (such as '*')
fun visibility=(is_visible: Bool) `{
`}
# Set the text visiblility
# If false, will use the invisible char (such as '*')
fun visibility=(is_visible: Bool) `{
`}
fun add_mark(value: Float, position: GtkPositionType, markup: String)
import String.to_cstring `{
`}
fun add_mark(value: Float, position: GtkPositionType, markup: String)
import String.to_cstring `{
- gtk_scale_add_mark(recv, value, position, String_to_cstring(markup));
+ gtk_scale_add_mark(self, value, position, String_to_cstring(markup));
`}
# Sets the angle of rotation for the label.
# An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom.
fun angle=(degre: Float) `{
`}
# Sets the angle of rotation for the label.
# An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom.
fun angle=(degre: Float) `{
`}
fun set (xalign: Float, yalign: Float, xscale: Float, yscale: Float) `{
`}
fun set (xalign: Float, yalign: Float, xscale: Float, yscale: Float) `{
- gtk_alignment_set(recv, xalign, yalign, xscale, yscale);
+ gtk_alignment_set(self, xalign, yalign, xscale, yscale);