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
21 cflags
"-Wno-deprecated-declarations"
32 /* callback user data */
35 nullable_Object user_data;
38 void nit_gtk_callback_func( GtkWidget *widget,
39 gpointer callback_data ) {
41 data = (NitGtkSignal*)callback_data;
42 GtkCallable_signal( data->to_call, widget, data->user_data );
46 redef interface Object
47 protected fun init_gtk
`{ gtk_init( 0, NULL ); `}
48 protected fun run_gtk `{ gtk_main(); `}
49 protected fun quit_gtk
`{ gtk_main_quit(); `}
53 # return true to stop event processing, false to let it propagate
54 fun signal( sender : GtkWidget, user_data : nullable Object ) is abstract
57 extern class GdkEvent `{GdkEvent *`}
61 #Base class for all widgets
62 #@https://developer.gnome.org/gtk3/stable/GtkWidget.html
63 extern class GtkWidget `{GtkWidget *`}
64 fun show_all is extern `{ gtk_widget_show_all( recv ); `}
66 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 `{
67 NitGtkSignal *data = malloc( sizeof(NitGtkSignal) );
69 GtkCallable_incr_ref( to_call );
70 Object_incr_ref( user_data );
72 data->to_call = to_call;
73 data->user_data = user_data;
75 /*Use G_CALLBACK() to cast the callback function to a GCallback*/
76 g_signal_connect( recv,
77 String_to_cstring( signal_name ),
78 G_CALLBACK(nit_gtk_callback_func),
82 redef fun == ( o
) do return o
isa GtkWidget and equal_to_gtk_widget
( o
)
84 private fun equal_to_gtk_widget
( o
: GtkWidget ) : Bool `{
88 fun request_size
( width
, height
: Int ) `{
89 gtk_widget_set_size_request( recv, width, height );
92 fun bg_color
=( state
: GtkStateType, color
: GdkRGBA ) is extern `{
93 gtk_widget_override_background_color( recv, state, color);
96 #with gtk it's possible to set fg_color to all widget : is it correct? is fg color inherited?
98 fun fg_color
=( state
: GtkStateType, color
: GdkRGBA ) is extern `{
99 gtk_widget_override_color( recv, state, color);
102 # Sets the sensitivity of a widget. sensitive -> the user can interact with it.
103 # Insensitive -> widget "grayed out" and the user can"t interact with them
104 fun sensitive
=(sensitive
: Bool) is extern `{
105 gtk_widget_set_sensitive(recv, sensitive);
108 # return the sensitivity of the widget
109 fun sensitive
: Bool is extern `{
110 return gtk_widget_get_sensitive(recv);
113 # Set the visibility of the widget
114 fun visible
=(visible
: Bool) is extern `{
115 gtk_widget_set_visible(recv, visible);
118 # Get the visibility of the widget only
119 fun visible_self
: Bool is extern `{
120 return gtk_widget_get_visible(recv);
124 fun destroy
`{ gtk_widget_destroy(recv); `}
126 # Show the widget on screen
128 # See: `show_all
` to recursively show this widget and contained widgets.
129 fun show `{ gtk_widget_show(recv); `}
131 # Hide the widget (reverse the effects of `show`)
132 fun hide
`{ gtk_widget_hide(recv); `}
135 #Base class for widgets which contain other widgets
136 #@https://developer.gnome.org/gtk3/stable/GtkContainer.html
137 extern class GtkContainer `{GtkContainer *`}
140 # Add a widget to the container
141 fun add
( widget
: GtkWidget ) is extern `{
142 gtk_container_add( recv, widget );
144 # Remove the widget from the container
145 fun remove_widget
( widget
: GtkWidget ) is extern `{
146 gtk_container_remove( recv, widget );
149 # Get the resize mode of the container
150 fun resize_mode
: GtkResizeMode is extern `{
151 return gtk_container_get_resize_mode( recv );
154 # Set the resize mode of the container
155 fun resize_mode
=( resize_mode
: GtkResizeMode ) is extern `{
156 gtk_container_set_resize_mode( recv, resize_mode );
161 #A container with just one child
162 #@https://developer.gnome.org/gtk3/stable/GtkBin.html
163 extern class GtkBin `{GtkBin *`}
166 fun child : GtkWidget is extern `{
167 return gtk_bin_get_child
( recv
);
171 #Toplevel which can contain other widgets
172 #@https://developer.gnome.org/gtk3/stable/GtkWindow.html
173 extern class GtkWindow `{GtkWindow *`}
176 new ( flag
: Int ) is extern `{
179 win = GTK_WINDOW(gtk_window_new( flag ));
180 g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);
184 fun title
=( title
: String ) is extern import String.to_cstring
`{
185 gtk_window_set_title( recv, String_to_cstring( title ) );
188 #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.
189 fun on_close
( to_call
: GtkCallable, user_data
: nullable Object )
191 signal_connect
( "destroy", to_call
, user_data
)
194 fun resizable
: Bool is extern `{
195 return gtk_window_get_resizable( recv );
198 fun resizable
=( is_resizable
: Bool) is extern `{
199 return gtk_window_set_resizable( recv, is_resizable );
202 #Activates the current focused widget within the window.
203 #returns TRUE if a widget got activated.
204 fun activate_focus
: Bool is extern `{
205 return gtk_window_activate_focus( recv );
208 #Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
209 fun modal
=( is_modal
: Bool ) is extern `{
210 gtk_window_set_modal( recv, is_modal );
213 #Windows can't actually be 0x0 in size, they must be at least 1x1
214 #but passing 0 for width and height is OK, resulting in a 1x1 default size.
215 #params width in pixels, or -1 to unset the default width
216 #params height in pixels, or -1 to unset the default height
217 fun default_size
( width
: Int, height
: Int ) is extern `{
218 gtk_window_set_default_size( recv, width, height );
221 #Activates the default widget for the window
222 #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.
223 fun activate_default
: Bool is extern `{
224 return gtk_window_activate_default( recv );
227 fun gravity
: GdkGravity is extern `{
228 return gtk_window_get_gravity( recv );
231 fun gravity
=( window_grav
: GdkGravity ) is extern `{
232 gtk_window_set_gravity( recv, window_grav );
235 # fun position : GtkWindowPosition is extern `{
236 # return gtk_window_get_position( recv );
239 # fun position=( window_pos : GtkWindowPosition ) is extern `{
240 # gtk_window_set_position( recv, window_pos );
243 fun active
: Bool is extern `{
244 return gtk_window_is_active( recv );
247 #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.
248 fun has_toplevel_focus
: Bool is extern `{
249 return gtk_window_has_toplevel_focus( recv );
252 fun get_focus
: GtkWidget is extern `{
253 return gtk_window_get_focus( recv );
256 fun set_focus
( widget
: GtkWidget ) is extern `{
257 return gtk_window_set_focus( recv, widget );
260 fun get_default_widget
: GtkWidget is extern `{
261 return gtk_window_get_default_widget( recv );
264 fun set_default_widget
( widget
: GtkWidget ) is extern `{
265 return gtk_window_set_default( recv, widget );
268 fun maximize
is extern `{
269 return gtk_window_maximize( recv );
272 fun unmaximize
is extern `{
273 return gtk_window_unmaximize( recv );
276 fun fullscreen
is extern `{
277 return gtk_window_fullscreen( recv );
280 fun unfullscreen
is extern `{
281 return gtk_window_unfullscreen( recv );
284 fun keep_above
=( setting
: Bool ) is extern `{
285 gtk_window_set_keep_above( recv, setting );
288 fun keep_below
=( setting
: Bool ) is extern `{
289 gtk_window_set_keep_below( recv, setting );
293 #A bin with a decorative frame and optional label
294 #https://developer.gnome.org/gtk3/stable/GtkFrame.html
295 extern class GtkFrame `{GtkFrame *`}
298 new ( lbl : String ) is extern import String.to_cstring`{
299 return (GtkFrame *)gtk_frame_new
( String_to_cstring( lbl
) );
302 fun frame_label : String is extern`{
303 return NativeString_to_s( (char
*)gtk_frame_get_label
( recv
) );
306 fun frame_label=( lbl : String ) is extern import String.to_cstring`{
307 gtk_frame_set_label
( recv
, String_to_cstring( lbl
) );
310 fun label_widget : GtkWidget is extern `{
311 return gtk_frame_get_label_widget
( recv
);
314 fun label_widget=( widget : GtkWidget ) is extern `{
315 gtk_frame_set_label_widget
( recv
, widget
);
318 fun shadow_type : GtkShadowType is extern `{
319 return gtk_frame_get_shadow_type
( recv
);
322 fun shadow_type=( stype : GtkShadowType ) is extern `{
323 gtk_frame_set_shadow_type
( recv
, stype
);
326 #fun label_align : GtkShadowType is extern `{
329 fun label_align
=( xalign
: Float, yalign
: Float ) is extern `{
330 gtk_frame_set_label_align( recv, xalign, yalign );
334 #Pack widgets in a rows and columns
335 #@https://developer.gnome.org/gtk3/3.3/GtkGrid.html
336 extern class GtkGrid `{GtkGrid *`}
341 return (GtkGrid*)gtk_grid_new
();
344 # Set a widget child inside the grid at a given position
345 fun attach( child : GtkWidget, left, top, width, height : Int ) `{
346 gtk_grid_attach
( recv
, child
, left
, top
, width
, height
);
349 # Get the child of the Grid at the given position
350 fun get_child_at( left : Int, top : Int ): GtkWidget is extern `{
351 return gtk_grid_get_child_at
( recv
, left
, top
);
354 # Insert a row at the specified position
355 fun insert_row( position :Int ) is extern `{
356 gtk_grid_insert_row
( recv
, position
);
359 # Insert a column at the specified position
360 fun insert_column( position : Int ) is extern `{
361 gtk_grid_insert_column
( recv
, position
);
367 # @https://developer.gnome.org/gtk3/3.4/GtkBox.html
368 extern class GtkBox `{ GtkBox * `}
372 #The tree interface used by GtkTreeView
373 #@https://developer.gnome.org/gtk3/stable/GtkTreeModel.html
374 extern class GtkTreeModel `{GtkTreeModel *`}
377 #An abstract class for laying out GtkCellRenderers
378 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
379 extern class GtkCellArea `{GtkCellArea *`}
382 #Base class for widgets with alignments and padding
383 #@https://developer.gnome.org/gtk3/3.2/GtkMisc.html
384 extern class GtkMisc `{GtkMisc *`}
387 fun alignment : GtkAlignment is abstract
389 fun alignment=( x : Float, y : Float ) is extern `{
390 gtk_misc_set_alignment
( recv
, x
, y
);
393 fun padding : GtkAlignment is abstract
395 fun padding=( x : Float, y : Float ) is extern `{
396 gtk_misc_set_padding
( recv
, x
, y
);
401 #A single line text entry field
402 #@https://developer.gnome.org/gtk3/3.2/GtkEntry.html
403 extern class GtkEntry `{GtkEntry *`}
407 return (GtkEntry *)gtk_entry_new();
410 fun text
: String is extern import NativeString.to_s_with_copy
`{
411 return NativeString_to_s_with_copy( (char *)gtk_entry_get_text( recv ) );
414 fun text
=( value
: String) is extern import String.to_cstring
`{
415 gtk_entry_set_text( recv, String_to_cstring( value ) );
418 # Is the text visible or is it the invisible char (such as '*')?
419 fun visiblility
: Bool is extern `{
420 return gtk_entry_get_visibility( recv );
423 # Set the text visiblility
424 # If false, will use the invisible char (such as '*')
425 fun visibility
=( is_visible
: Bool) is extern `{
426 gtk_entry_set_visibility( recv, is_visible );
429 fun max_length
: Int is extern `{
430 return gtk_entry_get_max_length( recv );
433 fun max_length
=( max
: Int) is extern `{
434 gtk_entry_set_max_length( recv, max );
438 #Base class for widgets which visualize an adjustment
439 #@https://developer.gnome.org/gtk3/3.2/GtkRange.html
440 extern class GtkRange `{GtkRange *`}
443 #Gets the current position of the fill level indicator.
444 fun fill_level : Float is extern `{
445 return gtk_range_get_fill_level
( recv
);
448 fun fill_level=( level : Float ) is extern `{
449 gtk_range_set_fill_level
( recv
, level
);
452 #Gets whether the range is restricted to the fill level.
453 fun restricted_to_fill_level : Bool is extern `{
454 return gtk_range_get_restrict_to_fill_level
( recv
);
457 fun restricted_to_fill_level=( restricted : Bool ) is extern `{
458 gtk_range_set_restrict_to_fill_level
( recv
, restricted
);
461 #Gets whether the range displays the fill level graphically.
462 fun show_fill_level : Bool is extern `{
463 return gtk_range_get_show_fill_level
( recv
);
466 fun show_fill_level=( is_displayed : Bool ) is extern `{
467 gtk_range_set_show_fill_level
( recv
, is_displayed
);
470 fun adjustment : GtkAdjustment is extern `{
471 return gtk_range_get_adjustment
( recv
);
474 fun adjustment=( value : GtkAdjustment ) is extern `{
475 gtk_range_set_adjustment
( recv
, value
);
478 fun inverted : Bool is extern `{
479 return gtk_range_get_inverted
( recv
);
482 fun inverted=( setting : Bool ) is extern `{
483 gtk_range_set_inverted
( recv
, setting
);
486 fun value : Float is extern `{
487 return gtk_range_get_value
( recv
);
490 fun value=( val : Float ) is extern `{
491 gtk_range_set_value
( recv
, val
);
494 fun set_increments( step : Float, page : Float ) is extern `{
495 gtk_range_set_increments
( recv
, step
, page
);
498 fun set_range( min : Float, max : Float ) is extern `{
499 gtk_range_set_range
( recv
, min
, max
);
502 fun round_digits : Int is extern `{
503 return gtk_range_get_round_digits
( recv
);
506 fun round_digits=( nb : Int ) is extern `{
507 gtk_range_set_round_digits
( recv
, nb
);
510 fun size_fixed : Bool is extern `{
511 return gtk_range_get_slider_size_fixed
( recv
);
514 fun size_fixed=( is_fixed : Bool ) is extern `{
515 return gtk_range_set_slider_size_fixed
( recv
, is_fixed
);
518 fun flippable : Bool is extern `{
519 return gtk_range_get_flippable
( recv
);
522 fun min_size=( is_flippable : Bool ) is extern `{
523 return gtk_range_set_flippable
( recv
, is_flippable
);
526 fun min_slider_size : Int is extern `{
527 return gtk_range_get_min_slider_size
( recv
);
530 fun min_slider_size=( size : Int ) is extern `{
531 return gtk_range_set_min_slider_size
( recv
, size
);
535 #A slider widget for selecting a value from a range
536 #@https://developer.gnome.org/gtk3/3.2/GtkScale.html
537 extern class GtkScale `{GtkScale *`}
540 new ( orientation
: GtkOrientation, adjustment
: GtkAdjustment ) is extern `{
541 return (GtkScale *)gtk_scale_new( orientation, adjustment );
544 new with_range
( orientation
: GtkOrientation, min
: Float, max
: Float, step
: Float ) is extern `{
545 return (GtkScale *)gtk_scale_new_with_range( orientation, min, max, step );
548 fun digits
: Int is extern `{
549 return gtk_scale_get_digits( recv );
552 fun digits
=( nb_digits
: Int ) is extern `{
553 gtk_scale_set_digits( recv, nb_digits );
556 fun draw_value
: Bool is extern `{
557 return gtk_scale_get_draw_value( recv );
560 fun draw_value
=( is_displayed
: Bool ) is extern `{
561 gtk_scale_set_draw_value( recv, is_displayed );
564 fun value_position
: GtkPositionType is extern `{
565 return gtk_scale_get_value_pos( recv );
568 fun value_position
=( pos
: GtkPositionType ) is extern `{
569 gtk_scale_set_value_pos( recv, pos );
572 fun has_origin
: Bool is extern `{
573 return gtk_scale_get_has_origin( recv );
576 fun has_origin
=( orig
: Bool ) is extern `{
577 gtk_scale_set_has_origin( recv, orig );
580 fun add_mark
( value
: Float, position
: GtkPositionType, markup
: String ) is extern import String.to_cstring
`{
581 gtk_scale_add_mark( recv, value, position, String_to_cstring( markup ) );
584 #Removes any marks that have been added with gtk_scale_add_mark().
585 fun clear_marks
is extern `{
586 gtk_scale_clear_marks( recv );
595 #@https://developer.gnome.org/gtk3/3.2/GtkScrollbar.html
596 extern class GtkScrollbar `{GtkScrollbar *`}
599 new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
600 return (GtkScrollbar *)gtk_scrollbar_new
( orientation
, adjustment
);
604 #A widget that displays a small to medium amount of text
605 #@https://developer.gnome.org/gtk3/3.2/GtkLabel.html
606 extern class GtkLabel `{GtkLabel *`}
609 # Create a GtkLabel with text
610 new ( text
: String ) is extern import String.to_cstring
`{
611 return (GtkLabel*)gtk_label_new( String_to_cstring( text ) );
614 # Set the text of the label
615 fun text
=( text
: String ) import String.to_cstring
`{
616 gtk_label_set_text( recv, String_to_cstring( text ) );
619 # Returns the text of the label
620 fun text
: String import NativeString.to_s
`{
621 return NativeString_to_s( (char*)gtk_label_get_text( recv ) );
624 # Sets the angle of rotation for the label.
625 # An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom.
626 fun angle
=( degre
: Float ) `{
627 gtk_label_set_angle( recv, degre );
630 # Returns the angle of rotation for the label.
632 return gtk_label_get_angle( recv );
637 #A widget displaying an image
638 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html
639 extern class GtkImage `{GtkImage *`}
644 return (GtkImage*)gtk_image_new
( );
647 # Create a GtkImage with text
648 new file( filename : String ) is extern import String.to_cstring `{
649 return (GtkImage*)gtk_image_new_from_file
( String_to_cstring( filename
) );
652 fun pixel_size : Int is extern `{
653 return gtk_image_get_pixel_size
( recv
);
656 fun pixel_size=( size : Int) is extern `{
657 gtk_image_set_pixel_size
( recv
, size
);
660 fun clear is extern `{
661 gtk_image_clear
( recv
);
666 #Describes the image data representation used by a GtkImage.
667 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html#GtkImageType
668 extern class GtkImageType `{GtkImageType`}
669 # There is no image displayed by the widget.
670 new empty
`{ return GTK_IMAGE_EMPTY; `}
672 # The widget contains a GdkPixbuf.
673 new pixbuf `{ return GTK_IMAGE_PIXBUF; `}
675 # The widget contains a stock icon name.
676 new stock
`{ return GTK_IMAGE_STOCK; `}
678 # The widget contains a GtkIconSet.
679 new icon_set `{ return GTK_IMAGE_ICON_SET; `}
681 # The widget contains a GdkPixbufAnimation.
682 new animation
`{ return GTK_IMAGE_ANIMATION; `}
684 # The widget contains a named icon.
685 new icon_name `{ return GTK_IMAGE_ICON_NAME; `}
687 # The widget contains a GIcon.
688 new gicon
`{ return GTK_IMAGE_GICON; `}
692 #@https://developer.gnome.org/gtk3/3.2/GtkArrow.html
693 extern class GtkArrow `{GtkArrow *`}
696 new ( arrow_type
: GtkArrowType, shadow_type
: GtkShadowType ) is extern `{
697 return (GtkArrow *)gtk_arrow_new( arrow_type, shadow_type );
700 fun set
( arrow_type
: GtkArrowType, shadow_type
: GtkShadowType ) is extern `{
701 gtk_arrow_set( recv, arrow_type, shadow_type );
705 #A widget that emits a signal when clicked on
706 #@https://developer.gnome.org/gtk3/stable/GtkButton.html
707 extern class GtkButton `{GtkButton *`}
711 return (GtkButton *)gtk_button_new
( );
714 #Create a GtkButton with text
715 new with_label( text : String ) is extern import String.to_cstring `{
716 return (GtkButton *)gtk_button_new_with_label
( String_to_cstring( text
) );
719 new from_stock( stock_id : String ) is extern import String.to_cstring `{
720 return (GtkButton *)gtk_button_new_from_stock
( String_to_cstring( stock_id
) );
723 fun text : String is extern `{
724 return NativeString_to_s( (char
*)gtk_button_get_label
( recv
) );
727 fun text=( value : String ) is extern import String.to_cstring`{
728 gtk_button_set_label
( recv
, String_to_cstring( value
) );
731 fun on_click( to_call : GtkCallable, user_data : nullable Object ) do
732 signal_connect( "clicked", to_call, user_data )
737 #A button which pops up a scale
738 #@https://developer.gnome.org/gtk3/stable/GtkScaleButton.html
739 extern class GtkScaleButton `{GtkScaleButton *`}
743 new( size
: GtkIconSize, min
: Float, max
: Float, step
: Float ) is extern `{
744 return (GtkScaleButton *)gtk_scale_button_new( size, min, max, step, (const char **)0 );
748 #Create buttons bound to a URL
749 #@https://developer.gnome.org/gtk3/stable/GtkLinkButton.html
750 extern class GtkLinkButton `{GtkLinkButton *`}
753 new( uri: String ) is extern import String.to_cstring `{
754 return (GtkLinkButton *)gtk_link_button_new
( String_to_cstring(uri
) );
758 #A container which can hide its child
759 #https://developer.gnome.org/gtk3/stable/GtkExpander.html
760 extern class GtkExpander `{GtkExpander *`}
763 new( lbl
: String) is extern import String.to_cstring
`{
764 return (GtkExpander *)gtk_expander_new( String_to_cstring( lbl ) );
767 new with_mnemonic
( lbl
: String) is extern import String.to_cstring
`{
768 return (GtkExpander *)gtk_expander_new_with_mnemonic(String_to_cstring( lbl ));
771 fun expanded
: Bool is extern `{
772 return gtk_expander_get_expanded( recv );
775 fun expanded
=( is_expanded
: Bool ) is extern `{
776 gtk_expander_set_expanded( recv, is_expanded );
779 fun spacing
: Int is extern `{
780 return gtk_expander_get_spacing( recv );
783 fun spacing
=( pixels
: Int ) is extern `{
784 gtk_expander_set_spacing( recv, pixels );
787 fun label_text
: String is extern `{
788 return NativeString_to_s( (char *)gtk_expander_get_label( recv ) );
791 fun label_text
=( lbl
: String ) is extern import String.to_cstring
`{
792 gtk_expander_set_label( recv, String_to_cstring( lbl ) );
795 fun use_underline
: Bool is extern `{
796 return gtk_expander_get_use_underline( recv );
799 fun use_underline
=( used
: Bool) is extern `{
800 gtk_expander_set_use_underline( recv, used );
803 fun use_markup
: Bool is extern `{
804 return gtk_expander_get_use_markup( recv );
807 fun use_markup
=( used
: Bool) is extern `{
808 gtk_expander_set_use_markup( recv, used );
811 fun label_widget
: GtkWidget is extern `{
812 return gtk_expander_get_label_widget( recv );
815 fun label_widget
=( widget
: GtkWidget ) is extern `{
816 gtk_expander_set_label_widget( recv, widget );
819 fun label_fill
: Bool is extern `{
820 return gtk_expander_get_label_fill( recv );
823 fun label_fill
=( fill
: Bool ) is extern `{
824 gtk_expander_set_label_fill( recv, fill );
827 fun resize_toplevel
: Bool is extern `{
828 return gtk_expander_get_resize_toplevel( recv );
831 fun resize_toplevel
=( resize
: Bool ) is extern `{
832 gtk_expander_set_resize_toplevel( recv, resize );
837 #An abstract class for laying out GtkCellRenderers
838 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
839 extern class GtkComboBox `{GtkComboBox *`}
843 return (GtkComboBox *)gtk_combo_box_new
( );
846 new with_entry is extern `{
847 return (GtkComboBox *)gtk_combo_box_new_with_entry
( );
850 new with_model( model : GtkTreeModel ) is extern `{
851 return (GtkComboBox *)gtk_combo_box_new_with_model
( model
);
854 new with_model_and_entry( model : GtkTreeModel ) is extern `{
855 return (GtkComboBox *)gtk_combo_box_new_with_model_and_entry
( model
);
858 new with_area( area : GtkCellArea ) is extern `{
859 return (GtkComboBox *)gtk_combo_box_new_with_area
( area
);
862 new with_area_and_entry( area : GtkCellArea ) is extern `{
863 return (GtkComboBox *)gtk_combo_box_new_with_area_and_entry
( area
);
866 fun wrap_width : Int is extern `{
867 return gtk_combo_box_get_wrap_width
( recv
);
870 fun wrap_width=( width : Int ) is extern `{
871 gtk_combo_box_set_wrap_width
( recv
, width
);
874 fun row_span_col : Int is extern `{
875 return gtk_combo_box_get_row_span_column
( recv
);
878 fun row_span_col=( row_span : Int ) is extern `{
879 gtk_combo_box_set_row_span_column
( recv
, row_span
);
882 fun col_span_col : Int is extern `{
883 return gtk_combo_box_get_column_span_column
( recv
);
886 fun col_span_col=( col_span : Int ) is extern `{
887 gtk_combo_box_set_column_span_column
( recv
, col_span
);
890 fun active_item : Int is extern `{
891 return gtk_combo_box_get_active
( recv
);
894 fun active_item=( active : Int ) is extern `{
895 gtk_combo_box_set_active
( recv
, active
);
898 #fun active_iter : GtkTreeIter is extern `{
901 #fun active_iter=( active : Bool ) is extern `{
904 fun column_id
: Int is extern `{
905 return gtk_combo_box_get_id_column( recv );
908 fun column_id
=( id_column
: Int ) is extern `{
909 gtk_combo_box_set_id_column( recv, id_column );
912 fun active_id
: String is extern `{
913 return NativeString_to_s( (char *)gtk_combo_box_get_active_id( recv ) );
916 fun active_id
=( id_active
: String ) is extern import String.to_cstring
`{
917 gtk_combo_box_set_active_id( recv, String_to_cstring( id_active ) );
920 fun model
: GtkTreeModel is extern `{
921 return gtk_combo_box_get_model( recv );
924 fun model
=( model
: GtkTreeModel ) is extern `{
925 gtk_combo_box_set_model( recv, model );
928 fun popup
is extern `{
929 gtk_combo_box_popup( recv );
932 fun popdown
is extern `{
933 gtk_combo_box_popdown( recv );
936 fun title
: String is extern`{
937 return NativeString_to_s( (char *)gtk_combo_box_get_title( recv ) );
940 fun title
=( t
: String ) is extern import String.to_cstring
`{
941 gtk_combo_box_set_title( recv, String_to_cstring( t ) );
944 fun has_entry
: Bool is extern `{
945 return gtk_combo_box_get_has_entry( recv );
948 fun with_fixed
: Bool is extern `{
949 return gtk_combo_box_get_popup_fixed_width( recv );
952 fun with_fixed
=( fixed
: Bool ) is extern `{
953 gtk_combo_box_set_popup_fixed_width( recv, fixed );
957 #Show a spinner animation
958 #@https://developer.gnome.org/gtk3/3.2/GtkSpinner.html
959 extern class GtkSpinner `{GtkSpinner *`}
963 return (GtkSpinner *)gtk_spinner_new
();
966 fun start is extern `{
967 return gtk_spinner_start
( recv
);
970 fun stop is extern `{
971 return gtk_spinner_stop
( recv
);
975 #A "light switch" style toggle
976 #@https://developer.gnome.org/gtk3/3.2/GtkSwitch.html
977 extern class GtkSwitch `{GtkSwitch *`}
981 return (GtkSwitch *)gtk_switch_new();
984 fun active
: Bool is extern `{
985 return gtk_switch_get_active( recv );
988 fun active
=( is_active
: Bool ) is extern `{
989 return gtk_switch_set_active( recv, is_active );
994 #A widget which controls the alignment and size of its child
995 #https://developer.gnome.org/gtk3/stable/GtkAlignment.html
996 extern class GtkAlignment `{GtkAlignment *`}
999 new ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
1000 return (GtkAlignment *)gtk_alignment_new
( xalign
, yalign
, xscale
, yscale
);
1003 fun set ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
1004 gtk_alignment_set
( recv
, xalign
, yalign
, xscale
, yscale
);
1011 #A representation of an adjustable bounded value
1012 #@https://developer.gnome.org/gtk3/stable/GtkAdjustment.html#GtkAdjustment.description
1013 extern class GtkAdjustment `{GtkAdjustment *`}
1017 extern class GdkColor `{GdkColor*`}
1019 GdkColor * col
= malloc
(sizeof
(GdkColor));
1020 /*gdk_color_parse
( "red", recv
);*/
1021 gdk_color_parse
( "red", col
);
1026 extern class GdkRGBA `{GdkRGBA*`}