1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
4 # Copyright 2013 Nathan Heu <heu.nathan@courrier.uqam.ca>
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # Classes and services to use libGTK widgets
28 /* callback user data */
31 nullable_Object user_data;
34 void nit_gtk_callback_func( GtkWidget *widget,
35 gpointer callback_data ) {
37 data = (NitGtkSignal*)callback_data;
38 GtkCallable_signal( data->to_call, widget, data->user_data );
42 redef interface Object
43 protected fun init_gtk
`{ gtk_init( 0, NULL ); `}
44 protected fun run_gtk `{ gtk_main(); `}
45 protected fun quit_gtk
`{ gtk_main_quit(); `}
49 # return true to stop event processing, false to let it propagate
50 fun signal( sender : GtkWidget, user_data : nullable Object ) is abstract
53 extern GdkEvent `{GdkEvent *`}
57 #Base class for all widgets
58 #@https://developer.gnome.org/gtk3/stable/GtkWidget.html
59 extern GtkWidget `{GtkWidget *`}
60 fun show_all is extern `{ gtk_widget_show_all( recv ); `}
62 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 `{
63 NitGtkSignal *data = malloc( sizeof(NitGtkSignal) );
65 GtkCallable_incr_ref( to_call );
66 Object_incr_ref( user_data );
68 data->to_call = to_call;
69 data->user_data = user_data;
71 /*Use G_CALLBACK() to cast the callback function to a GCallback*/
72 g_signal_connect( recv,
73 String_to_cstring( signal_name ),
74 G_CALLBACK(nit_gtk_callback_func),
78 redef fun == ( o
) do return o
isa GtkWidget and equal_to_gtk_widget
( o
)
80 private fun equal_to_gtk_widget
( o
: GtkWidget ) : Bool `{
84 fun request_size
( width
, height
: Int ) `{
85 gtk_widget_set_size_request( recv, width, height );
88 fun bg_color
=( state
: GtkStateType, color
: GdkRGBA ) is extern `{
89 gtk_widget_override_background_color( recv, state, color);
92 #with gtk it's possible to set fg_color to all widget : is it correct? is fg color inherited?
94 fun fg_color
=( state
: GtkStateType, color
: GdkRGBA ) is extern `{
95 gtk_widget_override_color( recv, state, color);
99 #Base class for widgets which contain other widgets
100 #@https://developer.gnome.org/gtk3/stable/GtkContainer.html
101 extern GtkContainer `{GtkContainer *`}
104 fun add( widget : GtkWidget ) is extern `{
105 gtk_container_add
( recv
, widget
);
109 #A container with just one child
110 #@https://developer.gnome.org/gtk3/stable/GtkBin.html
111 extern GtkBin `{GtkBin *`}
114 fun child
: GtkWidget is extern `{
115 return gtk_bin_get_child( recv );
119 #Toplevel which can contain other widgets
120 #@https://developer.gnome.org/gtk3/stable/GtkWindow.html
121 extern GtkWindow `{GtkWindow *`}
124 new ( flag : Int ) is extern `{
127 win
= GTK_WINDOW(gtk_window_new
( flag
));
128 g_signal_connect
(win
, "destroy", G_CALLBACK(gtk_main_quit
), NULL);
132 fun title=( title : String ) is extern import String::to_cstring `{
133 gtk_window_set_title
( recv
, String_to_cstring( title
) );
136 #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.
137 fun on_close( to_call : GtkCallable, user_data : nullable Object )
139 signal_connect( "destroy", to_call, user_data )
142 fun resizable : Bool is extern `{
143 return gtk_window_get_resizable
( recv
);
146 fun resizable=( is_resizable : Bool) is extern `{
147 return gtk_window_set_resizable
( recv
, is_resizable
);
150 #Activates the current focused widget within the window.
151 #returns TRUE if a widget got activated.
152 fun activate_focus : Bool is extern `{
153 return gtk_window_activate_focus
( recv
);
156 #Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
157 fun modal=( is_modal : Bool ) is extern `{
158 gtk_window_set_modal
( recv
, is_modal
);
161 #Windows can't actually be 0x0 in size, they must be at least 1x1
162 #but passing 0 for width and height is OK, resulting in a 1x1 default size.
163 #params width in pixels, or -1 to unset the default width
164 #params height in pixels, or -1 to unset the default height
165 fun default_size( width : Int, height : Int ) is extern `{
166 gtk_window_set_default_size
( recv
, width
, height
);
169 #Activates the default widget for the window
170 #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.
171 fun activate_default : Bool is extern `{
172 return gtk_window_activate_default
( recv
);
175 fun gravity : GdkGravity is extern `{
176 return gtk_window_get_gravity
( recv
);
179 fun gravity=( window_grav : GdkGravity ) is extern `{
180 gtk_window_set_gravity
( recv
, window_grav
);
183 # fun position : GtkWindowPosition is extern `{
184 # return gtk_window_get_position( recv );
187 # fun position=( window_pos : GtkWindowPosition ) is extern `{
188 # gtk_window_set_position( recv, window_pos );
191 fun active
: Bool is extern `{
192 return gtk_window_is_active( recv );
195 #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.
196 fun has_toplevel_focus
: Bool is extern `{
197 return gtk_window_has_toplevel_focus( recv );
200 fun get_focus
: GtkWidget is extern `{
201 return gtk_window_get_focus( recv );
204 fun set_focus
( widget
: GtkWidget ) is extern `{
205 return gtk_window_set_focus( recv, widget );
208 fun get_default_widget
: GtkWidget is extern `{
209 return gtk_window_get_default_widget( recv );
212 fun set_default_widget
( widget
: GtkWidget ) is extern `{
213 return gtk_window_set_default( recv, widget );
216 fun maximize
is extern `{
217 return gtk_window_maximize( recv );
220 fun unmaximize
is extern `{
221 return gtk_window_unmaximize( recv );
224 fun fullscreen
is extern `{
225 return gtk_window_fullscreen( recv );
228 fun unfullscreen
is extern `{
229 return gtk_window_unfullscreen( recv );
232 fun keep_above
=( setting
: Bool ) is extern `{
233 gtk_window_set_keep_above( recv, setting );
236 fun keep_below
=( setting
: Bool ) is extern `{
237 gtk_window_set_keep_below( recv, setting );
241 #A bin with a decorative frame and optional label
242 #https://developer.gnome.org/gtk3/stable/GtkFrame.html
243 extern GtkFrame `{GtkFrame *`}
246 new ( lbl : String ) is extern import String::to_cstring`{
247 return (GtkFrame *)gtk_frame_new
( String_to_cstring( lbl
) );
250 fun frame_label : String is extern`{
251 return new_String_from_cstring
( (char
*)gtk_frame_get_label
( recv
) );
254 fun frame_label=( lbl : String ) is extern import String::to_cstring`{
255 gtk_frame_set_label
( recv
, String_to_cstring( lbl
) );
258 fun label_widget : GtkWidget is extern `{
259 return gtk_frame_get_label_widget
( recv
);
262 fun label_widget=( widget : GtkWidget ) is extern `{
263 gtk_frame_set_label_widget
( recv
, widget
);
266 fun shadow_type : GtkShadowType is extern `{
267 return gtk_frame_get_shadow_type
( recv
);
270 fun shadow_type=( stype : GtkShadowType ) is extern `{
271 gtk_frame_set_shadow_type
( recv
, stype
);
274 #fun label_align : GtkShadowType is extern `{
277 fun label_align
=( xalign
: Float, yalign
: Float ) is extern `{
278 gtk_frame_set_label_align( recv, xalign, yalign );
282 #Pack widgets in a rows and columns
283 #@https://developer.gnome.org/gtk3/3.3/GtkGrid.html
284 extern GtkGrid `{GtkGrid *`}
287 # Create a grid with a fixed number of rows and columns
288 new ( rows : Int, columns : Int, homogeneous : Bool ) `{
289 return (GtkGrid*)gtk_grid_new
(); // rows
, columns
, homogeneous
);
292 # Set a widget child inside the grid at a given position
293 fun attach( child : GtkWidget, left, top, width, height : Int ) `{
294 gtk_grid_attach
( recv
, child
, left
, top
, width
, height
);
298 #The tree interface used by GtkTreeView
299 #@https://developer.gnome.org/gtk3/stable/GtkTreeModel.html
300 extern GtkTreeModel `{GtkTreeModel *`}
303 #An abstract class for laying out GtkCellRenderers
304 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
305 extern GtkCellArea `{GtkCellArea *`}
308 #Base class for widgets with alignments and padding
309 #@https://developer.gnome.org/gtk3/3.2/GtkMisc.html
310 extern GtkMisc `{GtkMisc *`}
313 fun alignment
: GtkAlignment is abstract
315 fun alignment
=( x
: Float, y
: Float ) is extern `{
316 gtk_misc_set_alignment( recv, x, y );
319 fun padding
: GtkAlignment is abstract
321 fun padding
=( x
: Float, y
: Float ) is extern `{
322 gtk_misc_set_padding( recv, x, y );
327 #A single line text entry field
328 #@https://developer.gnome.org/gtk3/3.2/GtkEntry.html
329 extern GtkEntry `{GtkEntry *`}
333 return (GtkEntry *)gtk_entry_new
();
336 fun text : String is extern import String::to_cstring`{
337 return new_String_from_cstring
( (char
*)gtk_entry_get_text
( recv
) );
340 fun text=( value : String) is extern import String::to_cstring`{
341 gtk_entry_set_text
( recv
, String_to_cstring( value
) );
344 fun visible : Bool is extern `{
345 return gtk_entry_get_visibility
( recv
);
348 fun visible=( is_visible : Bool) is extern `{
349 gtk_entry_set_visibility
( recv
, is_visible
);
352 fun max_length : Int is extern `{
353 return gtk_entry_get_max_length
( recv
);
356 fun max_length=( max : Int) is extern `{
357 gtk_entry_set_max_length
( recv
, max
);
361 #Base class for widgets which visualize an adjustment
362 #@https://developer.gnome.org/gtk3/3.2/GtkRange.html
363 extern GtkRange `{GtkRange *`}
366 #Gets the current position of the fill level indicator.
367 fun fill_level
: Float is extern `{
368 return gtk_range_get_fill_level( recv );
371 fun fill_level
=( level
: Float ) is extern `{
372 gtk_range_set_fill_level( recv, level );
375 #Gets whether the range is restricted to the fill level.
376 fun restricted_to_fill_level
: Bool is extern `{
377 return gtk_range_get_restrict_to_fill_level( recv );
380 fun restricted_to_fill_level
=( restricted
: Bool ) is extern `{
381 gtk_range_set_restrict_to_fill_level( recv, restricted );
384 #Gets whether the range displays the fill level graphically.
385 fun show_fill_level
: Bool is extern `{
386 return gtk_range_get_show_fill_level( recv );
389 fun show_fill_level
=( is_displayed
: Bool ) is extern `{
390 gtk_range_set_show_fill_level( recv, is_displayed );
393 fun adjustment
: GtkAdjustment is extern `{
394 return gtk_range_get_adjustment( recv );
397 fun adjustment
=( value
: GtkAdjustment ) is extern `{
398 gtk_range_set_adjustment( recv, value );
401 fun inverted
: Bool is extern `{
402 return gtk_range_get_inverted( recv );
405 fun inverted
=( setting
: Bool ) is extern `{
406 gtk_range_set_inverted( recv, setting );
409 fun value
: Float is extern `{
410 return gtk_range_get_value( recv );
413 fun value
=( val
: Float ) is extern `{
414 gtk_range_set_value( recv, val );
417 fun set_increments
( step
: Float, page
: Float ) is extern `{
418 gtk_range_set_increments( recv, step, page );
421 fun set_range
( min
: Float, max
: Float ) is extern `{
422 gtk_range_set_range( recv, min, max );
425 fun round_digits
: Int is extern `{
426 return gtk_range_get_round_digits( recv );
429 fun round_digits
=( nb
: Int ) is extern `{
430 gtk_range_set_round_digits( recv, nb );
433 fun size_fixed
: Bool is extern `{
434 return gtk_range_get_slider_size_fixed( recv );
437 fun size_fixed
=( is_fixed
: Bool ) is extern `{
438 return gtk_range_set_slider_size_fixed( recv, is_fixed );
441 fun flippable
: Bool is extern `{
442 return gtk_range_get_flippable( recv );
445 fun min_size
=( is_flippable
: Bool ) is extern `{
446 return gtk_range_set_flippable( recv, is_flippable );
449 fun min_slider_size
: Int is extern `{
450 return gtk_range_get_min_slider_size( recv );
453 fun min_slider_size
=( size
: Int ) is extern `{
454 return gtk_range_set_min_slider_size( recv, size );
458 #A slider widget for selecting a value from a range
459 #@https://developer.gnome.org/gtk3/3.2/GtkScale.html
460 extern GtkScale `{GtkScale *`}
463 new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
464 return (GtkScale *)gtk_scale_new
( orientation
, adjustment
);
467 new with_range ( orientation : GtkOrientation, min : Float, max : Float, step : Float ) is extern `{
468 return (GtkScale *)gtk_scale_new_with_range
( orientation
, min
, max
, step
);
471 fun digits : Int is extern `{
472 return gtk_scale_get_digits
( recv
);
475 fun digits=( nb_digits : Int ) is extern `{
476 gtk_scale_set_digits
( recv
, nb_digits
);
479 fun draw_value : Bool is extern `{
480 return gtk_scale_get_draw_value
( recv
);
483 fun draw_value=( is_displayed : Bool ) is extern `{
484 gtk_scale_set_draw_value
( recv
, is_displayed
);
487 fun value_position : GtkPositionType is extern `{
488 return gtk_scale_get_value_pos
( recv
);
491 fun value_position=( pos : GtkPositionType ) is extern `{
492 gtk_scale_set_value_pos
( recv
, pos
);
495 fun has_origin : Bool is extern `{
496 return gtk_scale_get_has_origin
( recv
);
499 fun has_origin=( orig : Bool ) is extern `{
500 gtk_scale_set_has_origin
( recv
, orig
);
503 fun add_mark( value : Float, position : GtkPositionType, markup : String ) is extern import String::to_cstring`{
504 gtk_scale_add_mark
( recv
, value
, position
, String_to_cstring( markup
) );
507 #Removes any marks that have been added with gtk_scale_add_mark().
508 fun clear_marks is extern `{
509 gtk_scale_clear_marks
( recv
);
518 #@https://developer.gnome.org/gtk3/3.2/GtkScrollbar.html
519 extern GtkScrollbar `{GtkScrollbar *`}
522 new ( orientation
: GtkOrientation, adjustment
: GtkAdjustment ) is extern `{
523 return (GtkScrollbar *)gtk_scrollbar_new( orientation, adjustment );
527 #A widget that displays a small to medium amount of text
528 #@https://developer.gnome.org/gtk3/3.2/GtkLabel.html
529 extern GtkLabel `{GtkLabel *`}
532 # Create a GtkLabel with text
533 new ( text : String ) is extern import String::to_cstring `{
534 return (GtkLabel*)gtk_label_new
( String_to_cstring( text
) );
537 # Set the text of the label
538 fun text=( text : String ) import String::to_cstring `{
539 gtk_label_set_text
( recv
, String_to_cstring( text
) );
542 # Returns the text of the label
543 fun text : String import String::from_cstring `{
544 return new_String_from_cstring
( (char
*)gtk_label_get_text
( recv
) );
547 # Sets the angle of rotation for the label.
548 # An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom.
549 fun angle=( degre : Float ) `{
550 gtk_label_set_angle
( recv
, degre
);
553 # Returns the angle of rotation for the label.
555 return gtk_label_get_angle
( recv
);
560 #A widget displaying an image
561 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html
562 extern GtkImage `{GtkImage *`}
567 return (GtkImage*)gtk_image_new( );
570 # Create a GtkImage with text
571 new file
( filename
: String ) is extern import String::to_cstring
`{
572 return (GtkImage*)gtk_image_new_from_file( String_to_cstring( filename ) );
575 fun pixel_size
: Int is extern `{
576 return gtk_image_get_pixel_size( recv );
579 fun pixel_size
=( size
: Int) is extern `{
580 gtk_image_set_pixel_size( recv, size );
583 fun clear
is extern `{
584 gtk_image_clear( recv );
589 #Describes the image data representation used by a GtkImage.
590 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html#GtkImageType
591 extern GtkImageType `{GtkImageType`}
592 # There is no image displayed by the widget.
593 new empty `{ return GTK_IMAGE_EMPTY; `}
595 # The widget contains a GdkPixbuf.
596 new pixbuf
`{ return GTK_IMAGE_PIXBUF; `}
598 # The widget contains a stock icon name.
599 new stock `{ return GTK_IMAGE_STOCK; `}
601 # The widget contains a GtkIconSet.
602 new icon_set
`{ return GTK_IMAGE_ICON_SET; `}
604 # The widget contains a GdkPixbufAnimation.
605 new animation `{ return GTK_IMAGE_ANIMATION; `}
607 # The widget contains a named icon.
608 new icon_name
`{ return GTK_IMAGE_ICON_NAME; `}
610 # The widget contains a GIcon.
611 new gicon `{ return GTK_IMAGE_GICON; `}
615 #@https://developer.gnome.org/gtk3/3.2/GtkArrow.html
616 extern GtkArrow `{GtkArrow *`}
619 new ( arrow_type : GtkArrowType, shadow_type : GtkShadowType ) is extern `{
620 return (GtkArrow *)gtk_arrow_new
( arrow_type
, shadow_type
);
623 fun set( arrow_type : GtkArrowType, shadow_type : GtkShadowType ) is extern `{
624 gtk_arrow_set
( recv
, arrow_type
, shadow_type
);
628 #A widget that emits a signal when clicked on
629 #@https://developer.gnome.org/gtk3/stable/GtkButton.html
630 extern GtkButton `{GtkButton *`}
634 return (GtkButton *)gtk_button_new( );
637 #Create a GtkButton with text
638 new with_label
( text
: String ) is extern import String::to_cstring
`{
639 return (GtkButton *)gtk_button_new_with_label( String_to_cstring( text ) );
642 new from_stock
( stock_id
: String ) is extern import String::to_cstring
`{
643 return (GtkButton *)gtk_button_new_from_stock( String_to_cstring( stock_id ) );
646 fun text
: String is extern `{
647 return new_String_from_cstring( (char *)gtk_button_get_label( recv ) );
650 fun text
=( value
: String ) is extern import String::to_cstring
`{
651 gtk_button_set_label( recv, String_to_cstring( value ) );
654 fun on_click
( to_call
: GtkCallable, user_data
: nullable Object ) do
655 signal_connect
( "clicked", to_call
, user_data
)
660 #A button which pops up a scale
661 #@https://developer.gnome.org/gtk3/stable/GtkScaleButton.html
662 extern GtkScaleButton `{GtkScaleButton *`}
666 new( size: GtkIconSize, min: Float, max: Float, step: Float ) is extern `{
667 return (GtkScaleButton *)gtk_scale_button_new
( size
, min
, max
, step
, (const char
**)0 );
671 #Create buttons bound to a URL
672 #@https://developer.gnome.org/gtk3/stable/GtkLinkButton.html
673 extern GtkLinkButton `{GtkLinkButton *`}
676 new( uri
: String ) is extern import String::to_cstring
`{
677 return (GtkLinkButton *)gtk_link_button_new( String_to_cstring(uri) );
681 #A container which can hide its child
682 #https://developer.gnome.org/gtk3/stable/GtkExpander.html
683 extern GtkExpander `{GtkExpander *`}
686 new( lbl : String) is extern import String::to_cstring`{
687 return (GtkExpander *)gtk_expander_new
( String_to_cstring( lbl
) );
690 new with_mnemonic( lbl : String) is extern import String::to_cstring`{
691 return (GtkExpander *)gtk_expander_new_with_mnemonic
(String_to_cstring( lbl
));
694 fun expanded : Bool is extern `{
695 return gtk_expander_get_expanded
( recv
);
698 fun expanded=( is_expanded : Bool ) is extern `{
699 gtk_expander_set_expanded
( recv
, is_expanded
);
702 fun spacing : Int is extern `{
703 return gtk_expander_get_spacing
( recv
);
706 fun spacing=( pixels : Int ) is extern `{
707 gtk_expander_set_spacing
( recv
, pixels
);
710 fun label_text : String is extern `{
711 return new_String_from_cstring
( (char
*)gtk_expander_get_label
( recv
) );
714 fun label_text=( lbl : String ) is extern import String::to_cstring`{
715 gtk_expander_set_label
( recv
, String_to_cstring( lbl
) );
718 fun use_underline : Bool is extern `{
719 return gtk_expander_get_use_underline
( recv
);
722 fun use_underline=( used : Bool) is extern `{
723 gtk_expander_set_use_underline
( recv
, used
);
726 fun use_markup : Bool is extern `{
727 return gtk_expander_get_use_markup
( recv
);
730 fun use_markup=( used : Bool) is extern `{
731 gtk_expander_set_use_markup
( recv
, used
);
734 fun label_widget : GtkWidget is extern `{
735 return gtk_expander_get_label_widget
( recv
);
738 fun label_widget=( widget : GtkWidget ) is extern `{
739 gtk_expander_set_label_widget
( recv
, widget
);
742 fun label_fill : Bool is extern `{
743 return gtk_expander_get_label_fill
( recv
);
746 fun label_fill=( fill : Bool ) is extern `{
747 gtk_expander_set_label_fill
( recv
, fill
);
750 fun resize_toplevel : Bool is extern `{
751 return gtk_expander_get_resize_toplevel
( recv
);
754 fun resize_toplevel=( resize : Bool ) is extern `{
755 gtk_expander_set_resize_toplevel
( recv
, resize
);
760 #An abstract class for laying out GtkCellRenderers
761 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
762 extern GtkComboBox `{GtkComboBox *`}
766 return (GtkComboBox *)gtk_combo_box_new( );
769 new with_entry
is extern `{
770 return (GtkComboBox *)gtk_combo_box_new_with_entry( );
773 new with_model
( model
: GtkTreeModel ) is extern `{
774 return (GtkComboBox *)gtk_combo_box_new_with_model( model );
777 new with_model_and_entry
( model
: GtkTreeModel ) is extern `{
778 return (GtkComboBox *)gtk_combo_box_new_with_model_and_entry( model );
781 new with_area
( area
: GtkCellArea ) is extern `{
782 return (GtkComboBox *)gtk_combo_box_new_with_area( area );
785 new with_area_and_entry
( area
: GtkCellArea ) is extern `{
786 return (GtkComboBox *)gtk_combo_box_new_with_area_and_entry( area );
789 fun wrap_width
: Int is extern `{
790 return gtk_combo_box_get_wrap_width( recv );
793 fun wrap_width
=( width
: Int ) is extern `{
794 gtk_combo_box_set_wrap_width( recv, width );
797 fun row_span_col
: Int is extern `{
798 return gtk_combo_box_get_row_span_column( recv );
801 fun row_span_col
=( row_span
: Int ) is extern `{
802 gtk_combo_box_set_row_span_column( recv, row_span );
805 fun col_span_col
: Int is extern `{
806 return gtk_combo_box_get_column_span_column( recv );
809 fun col_span_col
=( col_span
: Int ) is extern `{
810 gtk_combo_box_set_column_span_column( recv, col_span );
813 fun active_item
: Int is extern `{
814 return gtk_combo_box_get_active( recv );
817 fun active_item
=( active
: Int ) is extern `{
818 gtk_combo_box_set_active( recv, active );
821 #fun active_iter : GtkTreeIter is extern `{
824 #fun active_iter=( active : Bool ) is extern `{
827 fun column_id
: Int is extern `{
828 return gtk_combo_box_get_id_column( recv );
831 fun column_id
=( id_column
: Int ) is extern `{
832 gtk_combo_box_set_id_column( recv, id_column );
835 fun active_id
: String is extern `{
836 return new_String_from_cstring( (char *)gtk_combo_box_get_active_id( recv ) );
839 fun active_id
=( id_active
: String ) is extern import String::to_cstring
`{
840 gtk_combo_box_set_active_id( recv, String_to_cstring( id_active ) );
843 fun model
: GtkTreeModel is extern `{
844 return gtk_combo_box_get_model( recv );
847 fun model
=( model
: GtkTreeModel ) is extern `{
848 gtk_combo_box_set_model( recv, model );
851 fun popup
is extern `{
852 gtk_combo_box_popup( recv );
855 fun popdown
is extern `{
856 gtk_combo_box_popdown( recv );
859 fun title
: String is extern`{
860 return new_String_from_cstring( (char *)gtk_combo_box_get_title( recv ) );
863 fun title
=( t
: String ) is extern import String::to_cstring
`{
864 gtk_combo_box_set_title( recv, String_to_cstring( t ) );
867 fun has_entry
: Bool is extern `{
868 return gtk_combo_box_get_has_entry( recv );
871 fun with_fixed
: Bool is extern `{
872 return gtk_combo_box_get_popup_fixed_width( recv );
875 fun with_fixed
=( fixed
: Bool ) is extern `{
876 gtk_combo_box_set_popup_fixed_width( recv, fixed );
880 #Show a spinner animation
881 #@https://developer.gnome.org/gtk3/3.2/GtkSpinner.html
882 extern GtkSpinner `{GtkSpinner *`}
886 return (GtkSpinner *)gtk_spinner_new
();
889 fun start is extern `{
890 return gtk_spinner_start
( recv
);
893 fun stop is extern `{
894 return gtk_spinner_stop
( recv
);
898 #A "light switch" style toggle
899 #@https://developer.gnome.org/gtk3/3.2/GtkSwitch.html
900 extern GtkSwitch `{GtkSwitch *`}
904 return (GtkSwitch *)gtk_switch_new();
907 fun active
: Bool is extern `{
908 return gtk_switch_get_active( recv );
911 fun active
=( is_active
: Bool ) is extern `{
912 return gtk_switch_set_active( recv, is_active );
917 #A widget which controls the alignment and size of its child
918 #https://developer.gnome.org/gtk3/stable/GtkAlignment.html
919 extern GtkAlignment `{GtkAlignment *`}
922 new ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
923 return (GtkAlignment *)gtk_alignment_new
( xalign
, yalign
, xscale
, yscale
);
926 fun set ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
927 gtk_alignment_set
( recv
, xalign
, yalign
, xscale
, yscale
);
934 #A representation of an adjustable bounded value
935 #@https://developer.gnome.org/gtk3/stable/GtkAdjustment.html#GtkAdjustment.description
936 extern GtkAdjustment `{GtkAdjustment *`}
940 extern GdkColor `{GdkColor*`}
942 GdkColor * col
= malloc
(sizeof
(GdkColor));
943 /*gdk_color_parse
( "red", recv
);*/
944 gdk_color_parse
( "red", col
);
949 extern GdkRGBA `{GdkRGBA*`}