*: update all clients of the `CString::to_s` services
[nit.git] / lib / gtk / v3_4 / gtk_core.nit
index 2e8dbfa..225d4ce 100644 (file)
 # limitations under the License.
 
 # Classes and services to use libGTK widgets
-module gtk_core is pkgconfig("gtk+-3.0")
+module gtk_core is
+       pkgconfig "gtk+-3.0"
+       cflags "-Wno-deprecated-declarations"
+end
 
 import gtk_enums
 import gdk_enums
@@ -26,642 +29,725 @@ in "C Header" `{
 `}
 
 `{
-               /* callback user data */
-               typedef struct {
-                       GtkCallable to_call;
-                       nullable_Object user_data;
-               } NitGtkSignal;
-
-               void nit_gtk_callback_func( GtkWidget *widget,
-                                                       gpointer   callback_data ) {
-                       NitGtkSignal *data;
-                       data = (NitGtkSignal*)callback_data;
-                       GtkCallable_signal( data->to_call, widget, data->user_data );
-               }
+       /* callback user data */
+       typedef struct {
+               GtkCallable to_call;
+               nullable_Object user_data;
+       } NitGtkSignal;
+
+       void nit_gtk_callback_func(GtkWidget *widget, gpointer callback_data) {
+               NitGtkSignal *data;
+               data = (NitGtkSignal*)callback_data;
+               GtkCallable_signal(data->to_call, widget, data->user_data);
+       }
 `}
 
-redef interface Object
-       protected fun init_gtk `{ gtk_init( 0, NULL ); `}
-       protected fun run_gtk `{ gtk_main(); `}
-       protected fun quit_gtk `{ gtk_main_quit(); `}
-end
+# Initialize the GTK system
+fun gtk_init `{ gtk_init(0, NULL); `}
+
+# Hand over control to the GTK event loop
+fun gtk_main `{ gtk_main(); `}
+
+# Run a single iteration of the main loop, block until an event is noticed
+fun gtk_main_iteration: Bool `{ return gtk_main_iteration(); `}
+
+# Run a single iteration of the main loop, only block until an event is noticed if `blocking`
+fun gtk_main_iteration_do(blocking: Bool): Bool `{ return gtk_main_iteration_do(blocking); `}
+
+# Quit the GTK event loop and clean up the system
+fun gtk_main_quit `{ gtk_main_quit(); `}
 
 interface GtkCallable
        # return true to stop event processing, false to let it propagate
-       fun signal( sender : GtkWidget, user_data : nullable Object ) is abstract
+       fun signal(sender: GtkWidget, user_data: nullable Object) is abstract
 end
 
 extern class GdkEvent `{GdkEvent *`}
 end
 
-
-#Base class for all widgets
-#@https://developer.gnome.org/gtk3/stable/GtkWidget.html
+# Base class for all widgets
+# See: https://developer.gnome.org/gtk3/stable/GtkWidget.html
 extern class GtkWidget `{GtkWidget *`}
-       fun show_all is extern `{ gtk_widget_show_all( recv ); `}
+       fun show_all `{ gtk_widget_show_all(self); `}
 
-       fun signal_connect( signal_name : String, to_call : GtkCallable, user_data : nullable Object ) is extern 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));
 
-               GtkCallable_incr_ref( to_call );
-               Object_incr_ref( user_data );
+               GtkCallable_incr_ref(to_call);
+               Object_incr_ref(user_data);
 
                data->to_call = to_call;
                data->user_data = user_data;
 
                /*Use G_CALLBACK() to cast the callback function to a GCallback*/
-               g_signal_connect( recv,
-                                                       String_to_cstring( signal_name ),
-                                                       G_CALLBACK(nit_gtk_callback_func),
-                                                       data );
+               g_signal_connect(self,
+                                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 )
+       redef fun ==(o) do return o isa GtkWidget and equal_to_gtk_widget(o)
 
-       private fun equal_to_gtk_widget( o : GtkWidget ) : Bool `{
-               return recv == o;
+       private fun equal_to_gtk_widget(o: GtkWidget): Bool `{
+               return self == o;
        `}
 
-       fun request_size( width, height : Int ) `{
-               gtk_widget_set_size_request( recv, width, height );
+       # Set the minimum dimension of this widget
+       fun set_size_request(width, height: Int) `{
+               gtk_widget_set_size_request(self, width, height);
        `}
 
-       fun bg_color=( state : GtkStateType, color : GdkRGBA ) is extern `{
-               gtk_widget_override_background_color( recv, state, color);
+       fun bg_color=(state: GtkStateType, color: GdkRGBA) `{
+               gtk_widget_override_background_color(self, state, color);
        `}
 
-       #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 ) is extern `{
-               gtk_widget_override_color( recv, state, color);
+       # 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) `{
+               gtk_widget_override_color(self, state, color);
        `}
-       
+
        # 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) is extern `{
-               gtk_widget_set_sensitive(recv, sensitive);
+       fun sensitive=(sensitive: Bool) `{
+               gtk_widget_set_sensitive(self, sensitive);
        `}
-       
+
        # return the sensitivity of the widget
-       fun sensitive: Bool is extern `{
-               return gtk_widget_get_sensitive(recv);
+       fun sensitive: Bool `{
+               return gtk_widget_get_sensitive(self);
        `}
-       
+
        # Set the visibility of the widget
-       fun visible=(visible: Bool) is extern `{
-               gtk_widget_set_visible(recv, visible);
+       fun visible=(visible: Bool) `{
+               gtk_widget_set_visible(self, visible);
        `}
 
        # Get the visibility of the widget only
-       fun visible_self: Bool is extern `{
-               return gtk_widget_get_visible(recv);
+       fun visible_self: Bool `{
+               return gtk_widget_get_visible(self);
        `}
 
        # Destroy the widget
-       fun destroy `{ gtk_widget_destroy(recv); `}
+       fun destroy `{ gtk_widget_destroy(self); `}
 
        # Show the widget on screen
        #
        # See: `show_all` to recursively show this widget and contained widgets.
-       fun show `{ gtk_widget_show(recv); `}
+       fun show `{ gtk_widget_show(self); `}
 
        # Hide the widget (reverse the effects of `show`)
-       fun hide `{ gtk_widget_hide(recv); `}
+       fun hide `{ gtk_widget_hide(self); `}
+
+       # Vertical alignement of this widget
+       fun valign=(value: GtkAlign) `{ gtk_widget_set_valign(self, value); `}
+
+       # Horizontal alignement of this widget
+       fun halign=(value: GtkAlign) `{ gtk_widget_set_halign(self, value); `}
+end
+
+# How a widget deals with extra space
+extern class GtkAlign `{ GtkAlign `}
+       new fill `{ return GTK_ALIGN_FILL; `}
+       new start `{ return GTK_ALIGN_START; `}
+       new align_end `{ return GTK_ALIGN_END; `}
+       new center `{ return GTK_ALIGN_CENTER; `}
+       new baseline `{ return GTK_ALIGN_BASELINE; `}
 end
 
-#Base class for widgets which contain other widgets
-#@https://developer.gnome.org/gtk3/stable/GtkContainer.html
+# Base class for widgets which contain other widgets
+# See: https://developer.gnome.org/gtk3/stable/GtkContainer.html
 extern class GtkContainer `{GtkContainer *`}
        super GtkWidget
 
        # Add a widget to the container
-       fun add( widget : GtkWidget ) is extern `{
-               gtk_container_add( recv, widget );
+       fun add(widget: GtkWidget) `{
+               gtk_container_add(self, widget);
        `}
+
        # Remove the widget from the container
-       fun remove_widget( widget : GtkWidget ) is extern `{
-               gtk_container_remove( recv, widget );
+       fun remove(widget: GtkWidget) `{
+               gtk_container_remove(self, widget);
        `}
 
        # Get the resize mode of the container
-       fun resize_mode : GtkResizeMode is extern `{
-               return gtk_container_get_resize_mode( recv );
+       fun resize_mode: GtkResizeMode `{
+               return gtk_container_get_resize_mode(self);
        `}
 
        # Set the resize mode of the container
-       fun resize_mode=( resize_mode: GtkResizeMode ) is extern `{
-               gtk_container_set_resize_mode( recv, resize_mode );
+       fun resize_mode=(resize_mode: GtkResizeMode) `{
+               gtk_container_set_resize_mode(self, resize_mode);
        `}
-
 end
 
-#A container with just one child
-#@https://developer.gnome.org/gtk3/stable/GtkBin.html
+# A container with just one child
+# See: https://developer.gnome.org/gtk3/stable/GtkBin.html
 extern class GtkBin `{GtkBin *`}
        super GtkContainer
 
-       fun child : GtkWidget is extern `{
-               return gtk_bin_get_child( recv );
+       fun child: GtkWidget `{
+               return gtk_bin_get_child(self);
        `}
 end
 
-#Toplevel which can contain other widgets
-#@https://developer.gnome.org/gtk3/stable/GtkWindow.html
+# Toplevel which can contain other widgets
+# See: https://developer.gnome.org/gtk3/stable/GtkWindow.html
 extern class GtkWindow `{GtkWindow *`}
        super GtkBin
 
-       new ( flag : Int ) is extern `{
-               GtkWindow *win;
+       new (typ: GtkWindowType) `{
+               return (GtkWindow *)gtk_window_new(typ);
+       `}
 
-               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);
        `}
 
-       fun title=( title : String ) is extern import String.to_cstring `{
-               gtk_window_set_title( recv, String_to_cstring( title ) );
+       fun title=(title: String) import String.to_cstring `{
+               gtk_window_set_title(self, String_to_cstring(title));
        `}
 
-       #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.
-       fun on_close( to_call : GtkCallable, user_data : nullable Object )
+       # 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.
+       fun on_close(to_call: GtkCallable, user_data: nullable Object)
        do
-               signal_connect( "destroy", to_call, user_data )
+               signal_connect("destroy", to_call, user_data)
        end
 
-       fun resizable : Bool is extern `{
-               return gtk_window_get_resizable( recv );
+       # Resize the window as if the user had done so
+       fun resize(width, height: Int) `{
+               return gtk_window_resize(self, width, height);
        `}
 
-       fun resizable=( is_resizable : Bool) is extern `{
-               return gtk_window_set_resizable( recv, is_resizable );
+       fun resizable: Bool `{
+               return gtk_window_get_resizable(self);
        `}
 
-       #Activates the current focused widget within the window.
-       #returns TRUE if a widget got activated.
-       fun activate_focus : Bool is extern `{
-               return gtk_window_activate_focus( recv );
+       fun resizable=(is_resizable: Bool) `{
+               return gtk_window_set_resizable(self, is_resizable);
        `}
 
-       #Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
-       fun modal=( is_modal : Bool ) is extern `{
-               gtk_window_set_modal( recv, is_modal );
+       # Activates the current focused widget within the window.
+       # returns TRUE if a widget got activated.
+       fun activate_focus: Bool `{
+               return gtk_window_activate_focus(self);
        `}
 
-       #Windows can't actually be 0x0 in size, they must be at least 1x1
-       #but passing 0 for width and height is OK, resulting in a 1x1 default size.
-       #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 ) is extern `{
-               gtk_window_set_default_size( recv, width, height );
+       # Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
+       fun modal=(is_modal: Bool) `{
+               gtk_window_set_modal(self, is_modal);
        `}
 
-       #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 is extern `{
-               return gtk_window_activate_default( recv );
+       # Windows can't actually be 0x0 in size, they must be at least 1x1
+       # but passing 0 for width and height is OK, resulting in a 1x1 default size.
+       # 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) `{
+               gtk_window_set_default_size(self, width, height);
        `}
 
-       fun gravity : GdkGravity is extern `{
-               return gtk_window_get_gravity( recv );
+       # 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 `{
+               return gtk_window_activate_default(self);
        `}
 
-       fun gravity=( window_grav : GdkGravity ) is extern `{
-               gtk_window_set_gravity( recv, window_grav );
+       fun gravity: GdkGravity `{
+               return gtk_window_get_gravity(self);
        `}
 
-#      fun position : GtkWindowPosition is extern `{
-#              return gtk_window_get_position( recv );
+       fun gravity=(window_grav: GdkGravity) `{
+               gtk_window_set_gravity(self, window_grav);
+       `}
+
+#      fun position: GtkWindowPosition `{
+#              return gtk_window_get_position(self);
 #      `}
 #
-#      fun position=( window_pos : GtkWindowPosition ) is extern `{
-#              gtk_window_set_position( recv, window_pos );
+#      fun position=(window_pos: GtkWindowPosition) `{
+#              gtk_window_set_position(self, window_pos);
 #      `}
 
-       fun active : Bool is extern `{
-               return gtk_window_is_active( recv );
+       fun active: Bool `{
+               return gtk_window_is_active(self);
        `}
 
-       #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 is extern `{
-               return gtk_window_has_toplevel_focus( recv );
+       # 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 `{
+               return gtk_window_has_toplevel_focus(self);
        `}
 
-       fun get_focus : GtkWidget is extern `{
-               return gtk_window_get_focus( recv );
+       fun get_focus: GtkWidget `{
+               return gtk_window_get_focus(self);
        `}
 
-       fun set_focus( widget : GtkWidget ) is extern `{
-               return gtk_window_set_focus( recv, widget );
+       fun set_focus(widget: GtkWidget) `{
+               return gtk_window_set_focus(self, widget);
        `}
 
-       fun get_default_widget : GtkWidget is extern `{
-               return gtk_window_get_default_widget( recv );
+       fun get_default_widget: GtkWidget `{
+               return gtk_window_get_default_widget(self);
        `}
 
-       fun set_default_widget( widget : GtkWidget ) is extern `{
-               return gtk_window_set_default( recv, widget );
+       fun set_default_widget(widget: GtkWidget) `{
+               return gtk_window_set_default(self, widget);
        `}
 
-       fun maximize is extern `{
-               return gtk_window_maximize( recv );
+       fun maximize `{
+               return gtk_window_maximize(self);
        `}
 
-       fun unmaximize is extern `{
-               return gtk_window_unmaximize( recv );
+       fun unmaximize `{
+               return gtk_window_unmaximize(self);
        `}
 
-       fun fullscreen is extern `{
-               return gtk_window_fullscreen( recv );
+       fun fullscreen `{
+               return gtk_window_fullscreen(self);
        `}
 
-       fun unfullscreen is extern `{
-               return gtk_window_unfullscreen( recv );
+       fun unfullscreen `{
+               return gtk_window_unfullscreen(self);
        `}
 
-       fun keep_above=( setting : Bool ) is extern `{
-               gtk_window_set_keep_above( recv, setting );
+       fun keep_above=(setting: Bool) `{
+               gtk_window_set_keep_above(self, setting);
        `}
 
-       fun keep_below=( setting : Bool ) is extern `{
-               gtk_window_set_keep_below( recv, setting );
+       fun keep_below=(setting: Bool) `{
+               gtk_window_set_keep_below(self, setting);
        `}
+
+       # Try to convince the window manage to decorate or not this window
+       fun decorated=(setting: Bool) `{ gtk_window_set_decorated(self, setting); `}
 end
 
-#A bin with a decorative frame and optional label
-#https://developer.gnome.org/gtk3/stable/GtkFrame.html
+# A bin with a decorative frame and optional label
+# https://developer.gnome.org/gtk3/stable/GtkFrame.html
 extern class GtkFrame `{GtkFrame *`}
        super GtkBin
 
-       new ( lbl : String ) is extern import String.to_cstring`{
-               return (GtkFrame *)gtk_frame_new( String_to_cstring( lbl ) );
+       new (lbl: String) import String.to_cstring `{
+               return (GtkFrame *)gtk_frame_new(String_to_cstring(lbl));
        `}
 
-       fun frame_label : String is extern`{
-               return NativeString_to_s( (char *)gtk_frame_get_label( recv ) );
+       fun frame_label: String import CString.to_s `{
+               return CString_to_s((char *)gtk_frame_get_label(self));
        `}
 
-       fun frame_label=( lbl : String ) is extern import String.to_cstring`{
-               gtk_frame_set_label( recv, String_to_cstring( lbl ) );
+       fun frame_label=(lbl: String) import String.to_cstring `{
+               gtk_frame_set_label(self, String_to_cstring(lbl));
        `}
 
-       fun label_widget : GtkWidget is extern `{
-               return gtk_frame_get_label_widget( recv );
+       fun label_widget: GtkWidget `{
+               return gtk_frame_get_label_widget(self);
        `}
 
-       fun label_widget=( widget : GtkWidget ) is extern `{
-               gtk_frame_set_label_widget( recv, widget );
+       fun label_widget=(widget: GtkWidget) `{
+               gtk_frame_set_label_widget(self, widget);
        `}
 
-       fun shadow_type : GtkShadowType is extern `{
-               return gtk_frame_get_shadow_type( recv );
+       fun shadow_type: GtkShadowType `{
+               return gtk_frame_get_shadow_type(self);
        `}
 
-       fun shadow_type=( stype : GtkShadowType ) is extern `{
-               gtk_frame_set_shadow_type( recv, stype );
+       fun shadow_type=(stype: GtkShadowType) `{
+               gtk_frame_set_shadow_type(self, stype);
        `}
 
-       #fun label_align : GtkShadowType is extern `{
-       #`}
-
-       fun label_align=( xalign : Float, yalign : Float ) is extern `{
-               gtk_frame_set_label_align( recv, xalign, yalign );
+       fun label_align=(xalign: Float, yalign: Float) `{
+               gtk_frame_set_label_align(self, xalign, yalign);
        `}
 end
 
-#Pack widgets in a rows and columns
-#@https://developer.gnome.org/gtk3/3.3/GtkGrid.html
+# Pack widgets in a rows and columns
+# See: https://developer.gnome.org/gtk3/3.3/GtkGrid.html
 extern class GtkGrid `{GtkGrid *`}
        super GtkContainer
 
-       # Create a grid with a fixed number of rows and columns
-       new ( rows : Int, columns : Int, homogeneous : Bool ) `{
-               return (GtkGrid*)gtk_grid_new(); // rows, columns, homogeneous );
+       # Create a new grid
+       new `{
+               return (GtkGrid*)gtk_grid_new();
        `}
 
        # 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 );
+       fun attach(child: GtkWidget, left, top, width, height: Int) `{
+               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 is extern `{
-               return gtk_grid_get_child_at( recv, left, top );
+       fun get_child_at(left: Int, top: Int): GtkWidget `{
+               return gtk_grid_get_child_at(self, left, top);
        `}
 
        # Insert a row at the specified position
-       fun insert_row( position :Int ) is extern `{
-               gtk_grid_insert_row( recv, position );
+       fun insert_row(position:Int) `{
+               gtk_grid_insert_row(self, position);
        `}
 
        # Insert a column at the specified position
-       fun insert_column( position : Int ) is extern `{
-               gtk_grid_insert_column( recv, position );
+       fun insert_column(position: Int) `{
+               gtk_grid_insert_column(self, position);
+       `}
+end
+
+# A widget that can switch orientation
+extern class GtkOrientable `{GtkOrientable *`}
+       super GtkWidget
+
+       # Get the orientation of this widget
+       fun orientation: GtkOrientation `{
+               return gtk_orientable_get_orientation(self);
+       `}
+
+       # Set the orientation of this widget
+       fun orientation=(orientation: GtkOrientation) `{
+               gtk_orientable_set_orientation(self, orientation);
        `}
 end
 
 # A container box
 #
-# @https://developer.gnome.org/gtk3/3.4/GtkBox.html
+# See: https://developer.gnome.org/gtk3/3.4/GtkBox.html
 extern class GtkBox `{ GtkBox * `}
        super GtkContainer
+       super GtkOrientable
+
+       # Create a new `GtkBox` with the given `orientation` and `spacing` between its children
+       new (orientation: GtkOrientation, spacing: Int) `{
+               return (GtkBox *)gtk_box_new(orientation, spacing);
+       `}
+
+       # Give the children of `self` equal space in the box?
+       fun homogeneous: Bool `{ return gtk_box_get_homogeneous(self); `}
+
+       # Give the children of `self` equal space in the box?
+       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) `{
+               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) `{
+               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) `{
+               gtk_box_set_child_packing(self, child, expand, fill, padding, packing);
+       `}
 end
 
-#The tree interface used by GtkTreeView
-#@https://developer.gnome.org/gtk3/stable/GtkTreeModel.html
+# The tree interface used by GtkTreeView
+# See: https://developer.gnome.org/gtk3/stable/GtkTreeModel.html
 extern class GtkTreeModel `{GtkTreeModel *`}
 end
 
-#An abstract class for laying out GtkCellRenderers
-#@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
+# An abstract class for laying out GtkCellRenderers
+# See: https://developer.gnome.org/gtk3/stable/GtkCellArea.html
 extern class GtkCellArea `{GtkCellArea *`}
 end
 
-#Base class for widgets with alignments and padding
-#@https://developer.gnome.org/gtk3/3.2/GtkMisc.html
+# Base class for widgets with alignments and padding
+# See: https://developer.gnome.org/gtk3/3.2/GtkMisc.html
 extern class GtkMisc `{GtkMisc *`}
        super GtkWidget
 
-       fun alignment : GtkAlignment is abstract
-
-       fun alignment=( x : Float, y : Float ) is extern `{
-               gtk_misc_set_alignment( recv, x, y );
+       fun set_alignment(x, y: Float) `{
+               gtk_misc_set_alignment(self, x, y);
        `}
 
-       fun padding : GtkAlignment is abstract
-
-       fun padding=( x : Float, y : Float ) is extern `{
-               gtk_misc_set_padding( recv, x, y );
+       fun set_padding(x, y: Float) `{
+               gtk_misc_set_padding(self, x, y);
        `}
-
 end
 
-#A single line text entry field
-#@https://developer.gnome.org/gtk3/3.2/GtkEntry.html
+# A single line text entry field
+# See: https://developer.gnome.org/gtk3/3.2/GtkEntry.html
 extern class GtkEntry `{GtkEntry *`}
        super GtkWidget
 
-       new is extern `{
+       new `{
                 return (GtkEntry *)gtk_entry_new();
        `}
 
-       fun text : String is extern import String.to_cstring`{
-               return NativeString_to_s( (char *)gtk_entry_get_text( recv ) );
+       fun text: String import CString.to_s `{
+               return CString_to_s((char *)gtk_entry_get_text(self));
        `}
 
-       fun text=( value : String) is extern import String.to_cstring`{
-               gtk_entry_set_text( recv, String_to_cstring( value ) );
+       fun text=(value: String) import String.to_cstring `{
+               gtk_entry_set_text(self, String_to_cstring(value));
        `}
 
        # Is the text visible or is it the invisible char (such as '*')?
-       fun visiblility: Bool is extern `{
-               return gtk_entry_get_visibility( recv );
+       fun visiblility: Bool `{
+               return gtk_entry_get_visibility(self);
        `}
 
        # Set the text visiblility
        # If false, will use the invisible char (such as '*')
-       fun visibility=( is_visible : Bool) is extern `{
-               gtk_entry_set_visibility( recv, is_visible );
+       fun visibility=(is_visible: Bool) `{
+               gtk_entry_set_visibility(self, is_visible);
        `}
 
-       fun max_length : Int is extern `{
-               return gtk_entry_get_max_length( recv );
+       fun max_length: Int `{
+               return gtk_entry_get_max_length(self);
        `}
 
-       fun max_length=( max : Int) is extern `{
-               gtk_entry_set_max_length( recv, max );
+       fun max_length=(max: Int) `{
+               gtk_entry_set_max_length(self, max);
        `}
 end
 
-#Base class for widgets which visualize an adjustment
-#@https://developer.gnome.org/gtk3/3.2/GtkRange.html
+# Base class for widgets which visualize an adjustment
+# See: https://developer.gnome.org/gtk3/3.2/GtkRange.html
 extern class GtkRange `{GtkRange *`}
        super GtkWidget
 
-       #Gets the current position of the fill level indicator.
-       fun fill_level : Float is extern `{
-               return gtk_range_get_fill_level( recv );
+       # Gets the current position of the fill level indicator.
+       fun fill_level: Float `{
+               return gtk_range_get_fill_level(self);
        `}
 
-       fun fill_level=( level : Float ) is extern `{
-               gtk_range_set_fill_level( recv, level );
+       fun fill_level=(level: Float) `{
+               gtk_range_set_fill_level(self, level);
        `}
 
-       #Gets whether the range is restricted to the fill level.
-       fun restricted_to_fill_level : Bool is extern `{
-               return gtk_range_get_restrict_to_fill_level( recv );
+       # Gets whether the range is restricted to the fill level.
+       fun restricted_to_fill_level: Bool `{
+               return gtk_range_get_restrict_to_fill_level(self);
        `}
 
-       fun restricted_to_fill_level=( restricted : Bool ) is extern `{
-               gtk_range_set_restrict_to_fill_level( recv, restricted );
+       fun restricted_to_fill_level=(restricted: Bool) `{
+               gtk_range_set_restrict_to_fill_level(self, restricted);
        `}
 
-       #Gets whether the range displays the fill level graphically.
-       fun show_fill_level : Bool is extern `{
-               return gtk_range_get_show_fill_level( recv );
+       # Gets whether the range displays the fill level graphically.
+       fun show_fill_level: Bool `{
+               return gtk_range_get_show_fill_level(self);
        `}
 
-       fun show_fill_level=( is_displayed : Bool ) is extern `{
-               gtk_range_set_show_fill_level( recv, is_displayed );
+       fun show_fill_level=(is_displayed: Bool) `{
+               gtk_range_set_show_fill_level(self, is_displayed);
        `}
 
-       fun adjustment : GtkAdjustment is extern `{
-               return gtk_range_get_adjustment( recv );
+       fun adjustment: GtkAdjustment `{
+               return gtk_range_get_adjustment(self);
        `}
 
-       fun adjustment=( value : GtkAdjustment ) is extern `{
-               gtk_range_set_adjustment( recv, value );
+       fun adjustment=(value: GtkAdjustment) `{
+               gtk_range_set_adjustment(self, value);
        `}
 
-       fun inverted : Bool is extern `{
-               return gtk_range_get_inverted( recv );
+       fun inverted: Bool `{
+               return gtk_range_get_inverted(self);
        `}
 
-       fun inverted=( setting : Bool ) is extern `{
-               gtk_range_set_inverted( recv, setting );
+       fun inverted=(setting: Bool) `{
+               gtk_range_set_inverted(self, setting);
        `}
 
-       fun value : Float is extern `{
-               return gtk_range_get_value( recv );
+       fun value: Float `{
+               return gtk_range_get_value(self);
        `}
 
-       fun value=( val : Float ) is extern `{
-               gtk_range_set_value( recv, val );
+       fun value=(val: Float) `{
+               gtk_range_set_value(self, val);
        `}
 
-       fun set_increments( step : Float, page : Float ) is extern `{
-               gtk_range_set_increments( recv, step, page );
+       fun set_increments(step: Float, page: Float) `{
+               gtk_range_set_increments(self, step, page);
        `}
 
-       fun set_range( min : Float, max : Float ) is extern `{
-               gtk_range_set_range( recv, min, max );
+       fun set_range(min: Float, max: Float) `{
+               gtk_range_set_range(self, min, max);
        `}
 
-       fun round_digits : Int is extern `{
-               return gtk_range_get_round_digits( recv );
+       fun round_digits: Int `{
+               return gtk_range_get_round_digits(self);
        `}
 
-       fun round_digits=( nb : Int ) is extern `{
-               gtk_range_set_round_digits( recv, nb );
+       fun round_digits=(nb: Int) `{
+               gtk_range_set_round_digits(self, nb);
        `}
 
-       fun size_fixed : Bool is extern `{
-               return gtk_range_get_slider_size_fixed( recv );
+       fun size_fixed: Bool `{
+               return gtk_range_get_slider_size_fixed(self);
        `}
 
-       fun size_fixed=( is_fixed : Bool ) is extern `{
-               return gtk_range_set_slider_size_fixed( recv, is_fixed );
+       fun size_fixed=(is_fixed: Bool) `{
+               return gtk_range_set_slider_size_fixed(self, is_fixed);
        `}
 
-       fun flippable : Bool is extern `{
-               return gtk_range_get_flippable( recv );
+       fun flippable: Bool `{
+               return gtk_range_get_flippable(self);
        `}
 
-       fun min_size=( is_flippable : Bool ) is extern `{
-               return gtk_range_set_flippable( recv, is_flippable );
+       fun min_size=(is_flippable: Bool) `{
+               return gtk_range_set_flippable(self, is_flippable);
        `}
 
-       fun min_slider_size : Int is extern `{
-               return gtk_range_get_min_slider_size( recv );
+       fun min_slider_size: Int `{
+               return gtk_range_get_min_slider_size(self);
        `}
 
-       fun min_slider_size=( size : Int ) is extern `{
-               return gtk_range_set_min_slider_size( recv, size );
+       fun min_slider_size=(size: Int) `{
+               return gtk_range_set_min_slider_size(self, size);
        `}
 end
 
-#A slider widget for selecting a value from a range
-#@https://developer.gnome.org/gtk3/3.2/GtkScale.html
+# A slider widget for selecting a value from a range
+# See: https://developer.gnome.org/gtk3/3.2/GtkScale.html
 extern class GtkScale `{GtkScale *`}
        super GtkRange
 
-       new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
-               return (GtkScale *)gtk_scale_new( orientation, adjustment );
+       new (orientation: GtkOrientation, adjustment: GtkAdjustment) `{
+               return (GtkScale *)gtk_scale_new(orientation, adjustment);
        `}
 
-       new with_range ( orientation : GtkOrientation, min : Float, max : Float, step : Float ) is extern `{
-               return (GtkScale *)gtk_scale_new_with_range( orientation, min, max, step );
+       new with_range (orientation: GtkOrientation, min: Float, max: Float, step: Float) `{
+               return (GtkScale *)gtk_scale_new_with_range(orientation, min, max, step);
        `}
 
-       fun digits : Int is extern `{
-               return gtk_scale_get_digits( recv );
+       fun digits: Int `{
+               return gtk_scale_get_digits(self);
        `}
 
-       fun digits=( nb_digits : Int ) is extern `{
-               gtk_scale_set_digits( recv, nb_digits );
+       fun digits=(nb_digits: Int) `{
+               gtk_scale_set_digits(self, nb_digits);
        `}
 
-       fun draw_value : Bool is extern `{
-               return gtk_scale_get_draw_value( recv );
+       fun draw_value: Bool `{
+               return gtk_scale_get_draw_value(self);
        `}
 
-       fun draw_value=( is_displayed : Bool ) is extern `{
-               gtk_scale_set_draw_value( recv, is_displayed );
+       fun draw_value=(is_displayed: Bool) `{
+               gtk_scale_set_draw_value(self, is_displayed);
        `}
 
-       fun value_position : GtkPositionType is extern `{
-               return gtk_scale_get_value_pos( recv );
+       fun value_position: GtkPositionType `{
+               return gtk_scale_get_value_pos(self);
        `}
 
-       fun value_position=( pos : GtkPositionType ) is extern `{
-               gtk_scale_set_value_pos( recv, pos );
+       fun value_position=(pos: GtkPositionType) `{
+               gtk_scale_set_value_pos(self, pos);
        `}
 
-       fun has_origin : Bool is extern `{
-               return gtk_scale_get_has_origin( recv );
+       fun has_origin: Bool `{
+               return gtk_scale_get_has_origin(self);
        `}
 
-       fun has_origin=( orig : Bool ) is extern `{
-               gtk_scale_set_has_origin( recv, orig );
+       fun has_origin=(orig: Bool) `{
+               gtk_scale_set_has_origin(self, orig);
        `}
 
-       fun add_mark( value : Float, position : GtkPositionType, markup : String ) is extern import String.to_cstring`{
-               gtk_scale_add_mark( recv, value, position, String_to_cstring( markup ) );
+       fun add_mark(value: Float, position: GtkPositionType, markup: String)
+       import String.to_cstring `{
+               gtk_scale_add_mark(self, value, position, String_to_cstring(markup));
        `}
 
-       #Removes any marks that have been added with gtk_scale_add_mark().
-       fun clear_marks is extern `{
-               gtk_scale_clear_marks( recv );
+       # Removes any marks that have been added with gtk_scale_add_mark().
+       fun clear_marks `{
+               gtk_scale_clear_marks(self);
        `}
-
-       #get layout
-       #get layout offsets
-
 end
 
-#A scrollbar
-#@https://developer.gnome.org/gtk3/3.2/GtkScrollbar.html
+# A scrollbar
+# See: https://developer.gnome.org/gtk3/3.2/GtkScrollbar.html
 extern class GtkScrollbar `{GtkScrollbar *`}
        super GtkRange
 
-               new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
-               return (GtkScrollbar *)gtk_scrollbar_new( orientation, adjustment );
+               new (orientation: GtkOrientation, adjustment: GtkAdjustment) `{
+               return (GtkScrollbar *)gtk_scrollbar_new(orientation, adjustment);
        `}
 end
 
-#A widget that displays a small to medium amount of text
-#@https://developer.gnome.org/gtk3/3.2/GtkLabel.html
+# A widget that displays a small to medium amount of text
+# See: https://developer.gnome.org/gtk3/3.2/GtkLabel.html
 extern class GtkLabel `{GtkLabel *`}
        super GtkMisc
 
        # Create a GtkLabel with text
-       new ( text : String ) is extern import String.to_cstring `{
-               return (GtkLabel*)gtk_label_new( String_to_cstring( text ) );
+       new (text: String) import String.to_cstring `{
+               return (GtkLabel*)gtk_label_new(String_to_cstring(text));
        `}
 
        # Set the text of the label
-       fun text=( text : String ) import String.to_cstring `{
-               gtk_label_set_text( recv, String_to_cstring( text ) );
+       fun text=(text: String) import String.to_cstring `{
+               gtk_label_set_text(self, String_to_cstring(text));
        `}
 
        # Returns the text of the label
-       fun text : String import NativeString.to_s `{
-               return NativeString_to_s( (char*)gtk_label_get_text( recv ) );
+       fun text: String import CString.to_s `{
+               return CString_to_s((char*)gtk_label_get_text(self));
        `}
 
        # 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 ) `{
-               gtk_label_set_angle( recv, degre );
+       fun angle=(degre: Float) `{
+               gtk_label_set_angle(self, degre);
        `}
 
        # Returns the angle of rotation for the label.
-       fun angle : Float `{
-               return gtk_label_get_angle( recv );
+       fun angle: Float `{
+               return gtk_label_get_angle(self);
        `}
 
+       # Set simple formatted text content from a `format` string and the `content` which is escaped
+       #
+       # ~~~nitish
+       # GtkLabel lbl = new GtkLabel("Non-formatted text")
+       # lbl.set_markup("<span style=\"italic\">\%s</span>".to_cstring,
+       #                "Italic content")
+       # ~~~
+       fun set_markup(format, content: CString) `{
+               char *formatted = g_markup_printf_escaped(format, content);
+               gtk_label_set_markup(self, formatted);
+               g_free(formatted);
+       `}
+
+       # Set justification of the lines in the label relative to each other
+       fun justify=(value: GtkJustification) `{ gtk_label_set_justify(self, value); `}
+
+       # Get justification of the lines in the label relative to each other
+       fun justify: GtkJustification `{ return gtk_label_get_justify(self); `}
 end
 
-#A widget displaying an image
-#@https://developer.gnome.org/gtk3/3.2/GtkImage.html
+# A widget displaying an image
+# See: https://developer.gnome.org/gtk3/3.2/GtkImage.html
 extern class GtkImage `{GtkImage *`}
        super GtkMisc
 
        # Create a GtkImage
-       new is extern `{
-               return (GtkImage*)gtk_image_new( );
+       new `{
+               return (GtkImage*)gtk_image_new();
        `}
 
        # Create a GtkImage with text
-       new file( filename : String ) is extern import String.to_cstring `{
-               return (GtkImage*)gtk_image_new_from_file( String_to_cstring( filename ) );
+       new file(filename: String) import String.to_cstring `{
+               return (GtkImage*)gtk_image_new_from_file(String_to_cstring(filename));
        `}
 
-       fun pixel_size : Int is extern `{
-               return gtk_image_get_pixel_size( recv );
+       fun pixel_size: Int `{
+               return gtk_image_get_pixel_size(self);
        `}
 
-       fun pixel_size=( size : Int) is extern `{
-               gtk_image_set_pixel_size( recv, size );
+       fun pixel_size=(size: Int) `{
+               gtk_image_set_pixel_size(self, size);
        `}
 
-       fun clear is extern `{
-               gtk_image_clear( recv );
+       fun clear `{
+               gtk_image_clear(self);
        `}
 end
 
-#enum GtkImageType
-#Describes the image data representation used by a GtkImage.
-#@https://developer.gnome.org/gtk3/3.2/GtkImage.html#GtkImageType
+# enum GtkImageType
+# Describes the image data representation used by a GtkImage.
+# See: https://developer.gnome.org/gtk3/3.2/GtkImage.html#GtkImageType
 extern class GtkImageType `{GtkImageType`}
        # There is no image displayed by the widget.
        new empty `{ return GTK_IMAGE_EMPTY; `}
@@ -685,343 +771,338 @@ extern class GtkImageType `{GtkImageType`}
        new gicon `{ return GTK_IMAGE_GICON; `}
 end
 
-#Displays an arrow
-#@https://developer.gnome.org/gtk3/3.2/GtkArrow.html
+# Displays an arrow
+# See: https://developer.gnome.org/gtk3/3.2/GtkArrow.html
 extern class GtkArrow `{GtkArrow *`}
        super GtkMisc
 
-       new ( arrow_type : GtkArrowType, shadow_type : GtkShadowType ) is extern `{
-               return (GtkArrow *)gtk_arrow_new( arrow_type, shadow_type );
+       new (arrow_type: GtkArrowType, shadow_type: GtkShadowType) `{
+               return (GtkArrow *)gtk_arrow_new(arrow_type, shadow_type);
        `}
 
-       fun set( arrow_type : GtkArrowType, shadow_type : GtkShadowType ) is extern `{
-               gtk_arrow_set( recv, arrow_type, shadow_type );
+       fun set(arrow_type: GtkArrowType, shadow_type: GtkShadowType) `{
+               gtk_arrow_set(self, arrow_type, shadow_type);
        `}
 end
 
-#A widget that emits a signal when clicked on
-#@https://developer.gnome.org/gtk3/stable/GtkButton.html
+# A widget that emits a signal when clicked on
+# See: https://developer.gnome.org/gtk3/stable/GtkButton.html
 extern class GtkButton `{GtkButton *`}
        super GtkBin
 
-       new is extern `{
-               return (GtkButton *)gtk_button_new(  );
+       new `{
+               return (GtkButton *)gtk_button_new();
        `}
 
-       #Create a GtkButton with text
-       new with_label( text : String ) is extern import String.to_cstring `{
-               return (GtkButton *)gtk_button_new_with_label( String_to_cstring( text ) );
+       # Create a GtkButton with text
+       new with_label(text: String) import String.to_cstring `{
+               return (GtkButton *)gtk_button_new_with_label(String_to_cstring(text));
        `}
 
-       new from_stock( stock_id : String ) is extern import String.to_cstring `{
-               return (GtkButton *)gtk_button_new_from_stock( String_to_cstring( stock_id ) );
+       new from_stock(stock_id: String) import String.to_cstring `{
+               return (GtkButton *)gtk_button_new_from_stock(String_to_cstring(stock_id));
        `}
 
-       fun text : String is extern `{
-               return NativeString_to_s( (char *)gtk_button_get_label( recv ) );
+       fun text: String import CString.to_s `{
+               return CString_to_s((char *)gtk_button_get_label(self));
        `}
 
-       fun text=( value : String ) is extern import String.to_cstring`{
-               gtk_button_set_label( recv, String_to_cstring( value ) );
+       fun text=(value: String) import String.to_cstring `{
+               gtk_button_set_label(self, String_to_cstring(value));
        `}
 
-       fun on_click( to_call : GtkCallable, user_data : nullable Object ) do
-                       signal_connect( "clicked", to_call, user_data )
+       fun on_click(to_call: GtkCallable, user_data: nullable Object) do
+                       signal_connect("clicked", to_call, user_data)
        end
 
+       # Set the image of button to the given widget
+       fun image=(image: GtkWidget) `{
+               gtk_button_set_image(self, image);
+       `}
+
+       # Get the widget that is currenty set as the image of button
+       fun image: GtkWidget `{
+               return gtk_button_get_image(self);
+       `}
 end
 
-#A button which pops up a scale
-#@https://developer.gnome.org/gtk3/stable/GtkScaleButton.html
+# A button which pops up a scale
+# See: https://developer.gnome.org/gtk3/stable/GtkScaleButton.html
 extern class GtkScaleButton `{GtkScaleButton *`}
        super GtkButton
 
-       #const gchar **icons
-       new( size: GtkIconSize, min: Float, max: Float, step: Float ) is extern `{
-               return (GtkScaleButton *)gtk_scale_button_new( size, min, max, step, (const char **)0 );
+       # const gchar **icons
+       new(size: GtkIconSize, min: Float, max: Float, step: Float) `{
+               return (GtkScaleButton *)gtk_scale_button_new(size, min, max, step, (const char **)0);
        `}
 end
 
-#Create buttons bound to a URL
-#@https://developer.gnome.org/gtk3/stable/GtkLinkButton.html
+# Create buttons bound to a URL
+# See: https://developer.gnome.org/gtk3/stable/GtkLinkButton.html
 extern class GtkLinkButton `{GtkLinkButton *`}
        super GtkButton
 
-       new( uri: String ) is extern import String.to_cstring `{
-               return (GtkLinkButton *)gtk_link_button_new( String_to_cstring(uri) );
+       new(uri: String) import String.to_cstring `{
+               return (GtkLinkButton *)gtk_link_button_new(String_to_cstring(uri));
        `}
 end
 
-#A container which can hide its child
-#https://developer.gnome.org/gtk3/stable/GtkExpander.html
+# A container which can hide its child
+# https://developer.gnome.org/gtk3/stable/GtkExpander.html
 extern class GtkExpander `{GtkExpander *`}
        super GtkBin
 
-       new( lbl : String) is extern import String.to_cstring`{
-               return (GtkExpander *)gtk_expander_new( String_to_cstring( lbl ) );
+       new(lbl: String) import String.to_cstring `{
+               return (GtkExpander *)gtk_expander_new(String_to_cstring(lbl));
        `}
 
-       new with_mnemonic( lbl : String) is extern import String.to_cstring`{
-               return (GtkExpander *)gtk_expander_new_with_mnemonic(String_to_cstring( lbl ));
+       new with_mnemonic(lbl: String) import String.to_cstring `{
+               return (GtkExpander *)gtk_expander_new_with_mnemonic(String_to_cstring(lbl));
        `}
 
-       fun expanded : Bool is extern `{
-               return gtk_expander_get_expanded( recv );
+       fun expanded: Bool `{
+               return gtk_expander_get_expanded(self);
        `}
 
-       fun expanded=( is_expanded : Bool ) is extern `{
-               gtk_expander_set_expanded( recv, is_expanded );
+       fun expanded=(is_expanded: Bool) `{
+               gtk_expander_set_expanded(self, is_expanded);
        `}
 
-       fun spacing : Int is extern `{
-               return gtk_expander_get_spacing( recv );
+       fun spacing: Int `{
+               return gtk_expander_get_spacing(self);
        `}
 
-       fun spacing=( pixels : Int ) is extern `{
-               gtk_expander_set_spacing( recv, pixels );
+       fun spacing=(pixels: Int) `{
+               gtk_expander_set_spacing(self, pixels);
        `}
 
-       fun label_text : String is extern `{
-               return NativeString_to_s( (char *)gtk_expander_get_label( recv ) );
+       fun label_text: String import CString.to_s `{
+               return CString_to_s((char *)gtk_expander_get_label(self));
        `}
 
-       fun label_text=( lbl : String ) is extern import String.to_cstring`{
-               gtk_expander_set_label( recv, String_to_cstring( lbl ) );
+       fun label_text=(lbl: String) import String.to_cstring `{
+               gtk_expander_set_label(self, String_to_cstring(lbl));
        `}
 
-       fun use_underline : Bool is extern `{
-               return gtk_expander_get_use_underline( recv );
+       fun use_underline: Bool `{
+               return gtk_expander_get_use_underline(self);
        `}
 
-       fun use_underline=( used : Bool) is extern `{
-               gtk_expander_set_use_underline( recv, used );
+       fun use_underline=(used: Bool) `{
+               gtk_expander_set_use_underline(self, used);
        `}
 
-       fun use_markup : Bool is extern `{
-               return gtk_expander_get_use_markup( recv );
+       fun use_markup: Bool `{
+               return gtk_expander_get_use_markup(self);
        `}
 
-       fun use_markup=( used : Bool) is extern `{
-                gtk_expander_set_use_markup( recv, used );
+       fun use_markup=(used: Bool) `{
+                gtk_expander_set_use_markup(self, used);
        `}
 
-       fun label_widget : GtkWidget is extern `{
-               return gtk_expander_get_label_widget( recv );
+       fun label_widget: GtkWidget `{
+               return gtk_expander_get_label_widget(self);
        `}
 
-       fun label_widget=( widget : GtkWidget ) is extern `{
-               gtk_expander_set_label_widget( recv, widget );
+       fun label_widget=(widget: GtkWidget) `{
+               gtk_expander_set_label_widget(self, widget);
        `}
 
-       fun label_fill : Bool is extern `{
-               return gtk_expander_get_label_fill( recv );
+       fun label_fill: Bool `{
+               return gtk_expander_get_label_fill(self);
        `}
 
-       fun label_fill=( fill : Bool ) is extern `{
-               gtk_expander_set_label_fill( recv, fill );
+       fun label_fill=(fill: Bool) `{
+               gtk_expander_set_label_fill(self, fill);
        `}
 
-       fun resize_toplevel : Bool is extern `{
-               return gtk_expander_get_resize_toplevel( recv );
+       fun resize_toplevel: Bool `{
+               return gtk_expander_get_resize_toplevel(self);
        `}
 
-       fun resize_toplevel=( resize : Bool ) is extern `{
-               gtk_expander_set_resize_toplevel( recv, resize );
+       fun resize_toplevel=(resize: Bool) `{
+               gtk_expander_set_resize_toplevel(self, resize);
        `}
 
 end
 
-#An abstract class for laying out GtkCellRenderers
-#@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
+# An abstract class for laying out GtkCellRenderers
+# See: https://developer.gnome.org/gtk3/stable/GtkCellArea.html
 extern class GtkComboBox `{GtkComboBox *`}
        super GtkBin
 
-       new is extern `{
-               return (GtkComboBox *)gtk_combo_box_new( );
+       new `{
+               return (GtkComboBox *)gtk_combo_box_new();
        `}
 
-       new with_entry is extern `{
-               return (GtkComboBox *)gtk_combo_box_new_with_entry( );
+       new with_entry `{
+               return (GtkComboBox *)gtk_combo_box_new_with_entry();
        `}
 
-       new with_model( model : GtkTreeModel ) is extern `{
-               return (GtkComboBox *)gtk_combo_box_new_with_model( model );
+       new with_model(model: GtkTreeModel) `{
+               return (GtkComboBox *)gtk_combo_box_new_with_model(model);
        `}
 
-       new with_model_and_entry( model : GtkTreeModel ) is extern `{
-               return (GtkComboBox *)gtk_combo_box_new_with_model_and_entry( model );
+       new with_model_and_entry(model: GtkTreeModel) `{
+               return (GtkComboBox *)gtk_combo_box_new_with_model_and_entry(model);
        `}
 
-       new with_area( area : GtkCellArea ) is extern `{
-               return (GtkComboBox *)gtk_combo_box_new_with_area( area );
+       new with_area(area: GtkCellArea) `{
+               return (GtkComboBox *)gtk_combo_box_new_with_area(area);
        `}
 
-       new with_area_and_entry( area : GtkCellArea ) is extern `{
-               return (GtkComboBox *)gtk_combo_box_new_with_area_and_entry( area );
+       new with_area_and_entry(area: GtkCellArea) `{
+               return (GtkComboBox *)gtk_combo_box_new_with_area_and_entry(area);
        `}
 
-       fun wrap_width : Int is extern `{
-               return gtk_combo_box_get_wrap_width( recv );
+       fun wrap_width: Int `{
+               return gtk_combo_box_get_wrap_width(self);
        `}
 
-       fun wrap_width=( width : Int ) is extern `{
-               gtk_combo_box_set_wrap_width( recv, width );
+       fun wrap_width=(width: Int) `{
+               gtk_combo_box_set_wrap_width(self, width);
        `}
 
-       fun row_span_col : Int is extern `{
-               return gtk_combo_box_get_row_span_column( recv );
+       fun row_span_col: Int `{
+               return gtk_combo_box_get_row_span_column(self);
        `}
 
-       fun row_span_col=( row_span : Int ) is extern `{
-               gtk_combo_box_set_row_span_column( recv, row_span );
+       fun row_span_col=(row_span: Int) `{
+               gtk_combo_box_set_row_span_column(self, row_span);
        `}
 
-       fun col_span_col : Int is extern `{
-               return gtk_combo_box_get_column_span_column( recv );
+       fun col_span_col: Int `{
+               return gtk_combo_box_get_column_span_column(self);
        `}
 
-       fun col_span_col=( col_span : Int ) is extern `{
-               gtk_combo_box_set_column_span_column( recv, col_span );
+       fun col_span_col=(col_span: Int) `{
+               gtk_combo_box_set_column_span_column(self, col_span);
        `}
 
-       fun active_item : Int is extern `{
-               return gtk_combo_box_get_active( recv );
+       fun active_item: Int `{
+               return gtk_combo_box_get_active(self);
        `}
 
-       fun active_item=( active : Int ) is extern `{
-               gtk_combo_box_set_active( recv, active );
+       fun active_item=(active: Int) `{
+               gtk_combo_box_set_active(self, active);
        `}
 
-       #fun active_iter : GtkTreeIter is extern `{
-       #`}
-       #
-       #fun active_iter=( active : Bool ) is extern `{
-       #`}
-
-       fun column_id : Int is extern `{
-               return gtk_combo_box_get_id_column( recv );
+       fun column_id: Int `{
+               return gtk_combo_box_get_id_column(self);
        `}
 
-       fun column_id=( id_column : Int ) is extern `{
-               gtk_combo_box_set_id_column( recv, id_column );
+       fun column_id=(id_column: Int) `{
+               gtk_combo_box_set_id_column(self, id_column);
        `}
 
-       fun active_id : String is extern `{
-               return NativeString_to_s( (char *)gtk_combo_box_get_active_id( recv ) );
+       fun active_id: String import CString.to_s `{
+               return CString_to_s((char *)gtk_combo_box_get_active_id(self));
        `}
 
-       fun active_id=( id_active : String ) is extern import String.to_cstring`{
-               gtk_combo_box_set_active_id( recv, String_to_cstring( id_active ) );
+       fun active_id=(id_active: String) import String.to_cstring `{
+               gtk_combo_box_set_active_id(self, String_to_cstring(id_active));
        `}
 
-       fun model : GtkTreeModel is extern `{
-               return gtk_combo_box_get_model( recv );
+       fun model: GtkTreeModel `{
+               return gtk_combo_box_get_model(self);
        `}
 
-       fun model=( model : GtkTreeModel ) is extern `{
-               gtk_combo_box_set_model( recv, model );
+       fun model=(model: GtkTreeModel) `{
+               gtk_combo_box_set_model(self, model);
        `}
 
-       fun popup is extern `{
-               gtk_combo_box_popup( recv );
+       fun popup `{
+               gtk_combo_box_popup(self);
        `}
 
-       fun popdown is extern `{
-               gtk_combo_box_popdown( recv );
+       fun popdown `{
+               gtk_combo_box_popdown(self);
        `}
 
-       fun title : String is extern`{
-               return NativeString_to_s( (char *)gtk_combo_box_get_title( recv ) );
+       fun title: String import CString.to_s `{
+               return CString_to_s((char *)gtk_combo_box_get_title(self));
        `}
 
-       fun title=( t : String ) is extern import String.to_cstring `{
-               gtk_combo_box_set_title( recv, String_to_cstring( t ) );
+       fun title=(t: String) import String.to_cstring `{
+               gtk_combo_box_set_title(self, String_to_cstring(t));
        `}
 
-       fun has_entry : Bool is extern `{
-               return gtk_combo_box_get_has_entry( recv );
+       fun has_entry: Bool `{
+               return gtk_combo_box_get_has_entry(self);
        `}
 
-       fun with_fixed : Bool is extern `{
-               return gtk_combo_box_get_popup_fixed_width( recv );
+       fun with_fixed: Bool `{
+               return gtk_combo_box_get_popup_fixed_width(self);
        `}
 
-       fun with_fixed=( fixed : Bool ) is extern `{
-               gtk_combo_box_set_popup_fixed_width( recv, fixed );
+       fun with_fixed=(fixed: Bool) `{
+               gtk_combo_box_set_popup_fixed_width(self, fixed);
        `}
 end
 
-#Show a spinner animation
-#@https://developer.gnome.org/gtk3/3.2/GtkSpinner.html
+# Show a spinner animation
+# See: https://developer.gnome.org/gtk3/3.2/GtkSpinner.html
 extern class GtkSpinner `{GtkSpinner *`}
        super GtkWidget
 
-       new is extern `{
+       new `{
                 return (GtkSpinner *)gtk_spinner_new();
        `}
 
-       fun start is extern `{
-               return gtk_spinner_start( recv );
+       fun start `{
+               return gtk_spinner_start(self);
        `}
 
-       fun stop is extern `{
-               return gtk_spinner_stop( recv );
+       fun stop `{
+               return gtk_spinner_stop(self);
        `}
 end
 
-#A "light switch" style toggle
-#@https://developer.gnome.org/gtk3/3.2/GtkSwitch.html
+# A "light switch" style toggle
+# See: https://developer.gnome.org/gtk3/3.2/GtkSwitch.html
 extern class GtkSwitch `{GtkSwitch *`}
        super GtkWidget
 
-       new is extern `{
+       new `{
                 return (GtkSwitch *)gtk_switch_new();
        `}
 
-       fun active : Bool is extern `{
-               return gtk_switch_get_active( recv );
+       fun active: Bool `{
+               return gtk_switch_get_active(self);
        `}
 
-       fun active=( is_active : Bool ) is extern `{
-               return gtk_switch_set_active( recv, is_active );
+       fun active=(is_active: Bool) `{
+               return gtk_switch_set_active(self, is_active);
        `}
 end
 
-
-#A widget which controls the alignment and size of its child
-#https://developer.gnome.org/gtk3/stable/GtkAlignment.html
+# A widget which controls the alignment and size of its child
+# https://developer.gnome.org/gtk3/stable/GtkAlignment.html
 extern class GtkAlignment `{GtkAlignment *`}
        super GtkBin
 
-       new ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
-               return (GtkAlignment *)gtk_alignment_new( xalign, yalign, xscale, yscale );
+       new (xalign: Float, yalign: Float, xscale: Float, yscale: Float) `{
+               return (GtkAlignment *)gtk_alignment_new(xalign, yalign, xscale, yscale);
        `}
 
-       fun set ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
-               gtk_alignment_set( recv, xalign, yalign, xscale, yscale );
+       fun set (xalign: Float, yalign: Float, xscale: Float, yscale: Float) `{
+               gtk_alignment_set(self, xalign, yalign, xscale, yscale);
        `}
 
-       #get_padding
-       #set_padding
 end
 
-#A representation of an adjustable bounded value
-#@https://developer.gnome.org/gtk3/stable/GtkAdjustment.html#GtkAdjustment.description
+# A representation of an adjustable bounded value
+# See: https://developer.gnome.org/gtk3/stable/GtkAdjustment.html#GtkAdjustment.description
 extern class GtkAdjustment `{GtkAdjustment *`}
-
 end
 
 extern class GdkColor `{GdkColor*`}
-       new is extern `{
-               GdkColor * col = malloc(sizeof(GdkColor));
-               /*gdk_color_parse( "red", recv );*/
-               gdk_color_parse( "red", col);
-               return col;
+       new (color_name: String) import String.to_cstring `{
+               GdkColor *color = malloc(sizeof(GdkColor));
+               gdk_color_parse(String_to_cstring(color_name), color);
+               return color;
        `}
 end
 
 extern class GdkRGBA `{GdkRGBA*`}
-       new is extern `{
-       `}
 end
-