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
19 module gtk_core
is pkgconfig
("gtk+-3.0")
29 /* callback user data */
32 nullable_Object user_data;
35 void nit_gtk_callback_func( GtkWidget *widget,
36 gpointer callback_data ) {
38 data = (NitGtkSignal*)callback_data;
39 GtkCallable_signal( data->to_call, widget, data->user_data );
43 redef interface Object
44 protected fun init_gtk
`{ gtk_init( 0, NULL ); `}
45 protected fun run_gtk `{ gtk_main(); `}
46 protected fun quit_gtk
`{ gtk_main_quit(); `}
50 # return true to stop event processing, false to let it propagate
51 fun signal( sender : GtkWidget, user_data : nullable Object ) is abstract
54 extern class GdkEvent `{GdkEvent *`}
58 #Base class for all widgets
59 #@https://developer.gnome.org/gtk3/stable/GtkWidget.html
60 extern class GtkWidget `{GtkWidget *`}
61 fun show_all is extern `{ gtk_widget_show_all( recv ); `}
63 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 `{
64 NitGtkSignal *data = malloc( sizeof(NitGtkSignal) );
66 GtkCallable_incr_ref( to_call );
67 Object_incr_ref( user_data );
69 data->to_call = to_call;
70 data->user_data = user_data;
72 /*Use G_CALLBACK() to cast the callback function to a GCallback*/
73 g_signal_connect( recv,
74 String_to_cstring( signal_name ),
75 G_CALLBACK(nit_gtk_callback_func),
79 redef fun == ( o
) do return o
isa GtkWidget and equal_to_gtk_widget
( o
)
81 private fun equal_to_gtk_widget
( o
: GtkWidget ) : Bool `{
85 fun request_size
( width
, height
: Int ) `{
86 gtk_widget_set_size_request( recv, width, height );
89 fun bg_color
=( state
: GtkStateType, color
: GdkRGBA ) is extern `{
90 gtk_widget_override_background_color( recv, state, color);
93 #with gtk it's possible to set fg_color to all widget : is it correct? is fg color inherited?
95 fun fg_color
=( state
: GtkStateType, color
: GdkRGBA ) is extern `{
96 gtk_widget_override_color( recv, state, color);
99 # Sets the sensitivity of a widget. sensitive -> the user can interact with it.
100 # Insensitive -> widget "grayed out" and the user can"t interact with them
101 fun sensitive
=(sensitive
: Bool) is extern `{
102 gtk_widget_set_sensitive(recv, sensitive);
105 # return the sensitivity of the widget
106 fun sensitive
: Bool is extern `{
107 return gtk_widget_get_sensitive(recv);
110 # Set the visibility of the widget
111 fun visible
=(visible
: Bool) is extern `{
112 gtk_widget_set_visible(recv, visible);
115 # Get the visibility of the widget only
116 fun visible_self
: Bool is extern `{
117 return gtk_widget_get_visible(recv);
121 #Base class for widgets which contain other widgets
122 #@https://developer.gnome.org/gtk3/stable/GtkContainer.html
123 extern class GtkContainer `{GtkContainer *`}
126 # Add a widget to the container
127 fun add( widget : GtkWidget ) is extern `{
128 gtk_container_add
( recv
, widget
);
130 # Remove the widget from the container
131 fun remove_widget( widget : GtkWidget ) is extern `{
132 gtk_container_remove
( recv
, widget
);
135 # Get the resize mode of the container
136 fun resize_mode : GtkResizeMode is extern `{
137 return gtk_container_get_resize_mode
( recv
);
140 # Set the resize mode of the container
141 fun resize_mode=( resize_mode: GtkResizeMode ) is extern `{
142 gtk_container_set_resize_mode
( recv
, resize_mode
);
147 #A container with just one child
148 #@https://developer.gnome.org/gtk3/stable/GtkBin.html
149 extern class GtkBin `{GtkBin *`}
152 fun child
: GtkWidget is extern `{
153 return gtk_bin_get_child( recv );
157 #Toplevel which can contain other widgets
158 #@https://developer.gnome.org/gtk3/stable/GtkWindow.html
159 extern class GtkWindow `{GtkWindow *`}
162 new ( flag : Int ) is extern `{
165 win
= GTK_WINDOW(gtk_window_new
( flag
));
166 g_signal_connect
(win
, "destroy", G_CALLBACK(gtk_main_quit
), NULL);
170 fun title=( title : String ) is extern import String.to_cstring `{
171 gtk_window_set_title
( recv
, String_to_cstring( title
) );
174 #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.
175 fun on_close( to_call : GtkCallable, user_data : nullable Object )
177 signal_connect( "destroy", to_call, user_data )
180 fun resizable : Bool is extern `{
181 return gtk_window_get_resizable
( recv
);
184 fun resizable=( is_resizable : Bool) is extern `{
185 return gtk_window_set_resizable
( recv
, is_resizable
);
188 #Activates the current focused widget within the window.
189 #returns TRUE if a widget got activated.
190 fun activate_focus : Bool is extern `{
191 return gtk_window_activate_focus
( recv
);
194 #Sets a window modal or non-modal. Modal windows prevent interaction with other windows in the same application.
195 fun modal=( is_modal : Bool ) is extern `{
196 gtk_window_set_modal
( recv
, is_modal
);
199 #Windows can't actually be 0x0 in size, they must be at least 1x1
200 #but passing 0 for width and height is OK, resulting in a 1x1 default size.
201 #params width in pixels, or -1 to unset the default width
202 #params height in pixels, or -1 to unset the default height
203 fun default_size( width : Int, height : Int ) is extern `{
204 gtk_window_set_default_size
( recv
, width
, height
);
207 #Activates the default widget for the window
208 #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.
209 fun activate_default : Bool is extern `{
210 return gtk_window_activate_default
( recv
);
213 fun gravity : GdkGravity is extern `{
214 return gtk_window_get_gravity
( recv
);
217 fun gravity=( window_grav : GdkGravity ) is extern `{
218 gtk_window_set_gravity
( recv
, window_grav
);
221 # fun position : GtkWindowPosition is extern `{
222 # return gtk_window_get_position( recv );
225 # fun position=( window_pos : GtkWindowPosition ) is extern `{
226 # gtk_window_set_position( recv, window_pos );
229 fun active
: Bool is extern `{
230 return gtk_window_is_active( recv );
233 #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.
234 fun has_toplevel_focus
: Bool is extern `{
235 return gtk_window_has_toplevel_focus( recv );
238 fun get_focus
: GtkWidget is extern `{
239 return gtk_window_get_focus( recv );
242 fun set_focus
( widget
: GtkWidget ) is extern `{
243 return gtk_window_set_focus( recv, widget );
246 fun get_default_widget
: GtkWidget is extern `{
247 return gtk_window_get_default_widget( recv );
250 fun set_default_widget
( widget
: GtkWidget ) is extern `{
251 return gtk_window_set_default( recv, widget );
254 fun maximize
is extern `{
255 return gtk_window_maximize( recv );
258 fun unmaximize
is extern `{
259 return gtk_window_unmaximize( recv );
262 fun fullscreen
is extern `{
263 return gtk_window_fullscreen( recv );
266 fun unfullscreen
is extern `{
267 return gtk_window_unfullscreen( recv );
270 fun keep_above
=( setting
: Bool ) is extern `{
271 gtk_window_set_keep_above( recv, setting );
274 fun keep_below
=( setting
: Bool ) is extern `{
275 gtk_window_set_keep_below( recv, setting );
279 #A bin with a decorative frame and optional label
280 #https://developer.gnome.org/gtk3/stable/GtkFrame.html
281 extern class GtkFrame `{GtkFrame *`}
284 new ( lbl : String ) is extern import String.to_cstring`{
285 return (GtkFrame *)gtk_frame_new
( String_to_cstring( lbl
) );
288 fun frame_label : String is extern`{
289 return NativeString_to_s( (char
*)gtk_frame_get_label
( recv
) );
292 fun frame_label=( lbl : String ) is extern import String.to_cstring`{
293 gtk_frame_set_label
( recv
, String_to_cstring( lbl
) );
296 fun label_widget : GtkWidget is extern `{
297 return gtk_frame_get_label_widget
( recv
);
300 fun label_widget=( widget : GtkWidget ) is extern `{
301 gtk_frame_set_label_widget
( recv
, widget
);
304 fun shadow_type : GtkShadowType is extern `{
305 return gtk_frame_get_shadow_type
( recv
);
308 fun shadow_type=( stype : GtkShadowType ) is extern `{
309 gtk_frame_set_shadow_type
( recv
, stype
);
312 #fun label_align : GtkShadowType is extern `{
315 fun label_align
=( xalign
: Float, yalign
: Float ) is extern `{
316 gtk_frame_set_label_align( recv, xalign, yalign );
320 #Pack widgets in a rows and columns
321 #@https://developer.gnome.org/gtk3/3.3/GtkGrid.html
322 extern class GtkGrid `{GtkGrid *`}
325 # Create a grid with a fixed number of rows and columns
326 new ( rows : Int, columns : Int, homogeneous : Bool ) `{
327 return (GtkGrid*)gtk_grid_new
(); // rows
, columns
, homogeneous
);
330 # Set a widget child inside the grid at a given position
331 fun attach( child : GtkWidget, left, top, width, height : Int ) `{
332 gtk_grid_attach
( recv
, child
, left
, top
, width
, height
);
335 # Get the child of the Grid at the given position
336 fun get_child_at( left : Int, top : Int ): GtkWidget is extern `{
337 return gtk_grid_get_child_at
( recv
, left
, top
);
340 # Insert a row at the specified position
341 fun insert_row( position :Int ) is extern `{
342 gtk_grid_insert_row
( recv
, position
);
345 # Insert a column at the specified position
346 fun insert_column( position : Int ) is extern `{
347 gtk_grid_insert_column
( recv
, position
);
353 # @https://developer.gnome.org/gtk3/3.4/GtkBox.html
354 extern class GtkBox `{ GtkBox * `}
358 #The tree interface used by GtkTreeView
359 #@https://developer.gnome.org/gtk3/stable/GtkTreeModel.html
360 extern class GtkTreeModel `{GtkTreeModel *`}
363 #An abstract class for laying out GtkCellRenderers
364 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
365 extern class GtkCellArea `{GtkCellArea *`}
368 #Base class for widgets with alignments and padding
369 #@https://developer.gnome.org/gtk3/3.2/GtkMisc.html
370 extern class GtkMisc `{GtkMisc *`}
373 fun alignment : GtkAlignment is abstract
375 fun alignment=( x : Float, y : Float ) is extern `{
376 gtk_misc_set_alignment
( recv
, x
, y
);
379 fun padding : GtkAlignment is abstract
381 fun padding=( x : Float, y : Float ) is extern `{
382 gtk_misc_set_padding
( recv
, x
, y
);
387 #A single line text entry field
388 #@https://developer.gnome.org/gtk3/3.2/GtkEntry.html
389 extern class GtkEntry `{GtkEntry *`}
393 return (GtkEntry *)gtk_entry_new();
396 fun text
: String is extern import String.to_cstring
`{
397 return NativeString_to_s( (char *)gtk_entry_get_text( recv ) );
400 fun text
=( value
: String) is extern import String.to_cstring
`{
401 gtk_entry_set_text( recv, String_to_cstring( value ) );
404 # Is the text visible or is it the invisible char (such as '*')?
405 fun visiblility
: Bool is extern `{
406 return gtk_entry_get_visibility( recv );
409 # Set the text visiblility
410 # If false, will use the invisible char (such as '*')
411 fun visibility
=( is_visible
: Bool) is extern `{
412 gtk_entry_set_visibility( recv, is_visible );
415 fun max_length
: Int is extern `{
416 return gtk_entry_get_max_length( recv );
419 fun max_length
=( max
: Int) is extern `{
420 gtk_entry_set_max_length( recv, max );
424 #Base class for widgets which visualize an adjustment
425 #@https://developer.gnome.org/gtk3/3.2/GtkRange.html
426 extern class GtkRange `{GtkRange *`}
429 #Gets the current position of the fill level indicator.
430 fun fill_level : Float is extern `{
431 return gtk_range_get_fill_level
( recv
);
434 fun fill_level=( level : Float ) is extern `{
435 gtk_range_set_fill_level
( recv
, level
);
438 #Gets whether the range is restricted to the fill level.
439 fun restricted_to_fill_level : Bool is extern `{
440 return gtk_range_get_restrict_to_fill_level
( recv
);
443 fun restricted_to_fill_level=( restricted : Bool ) is extern `{
444 gtk_range_set_restrict_to_fill_level
( recv
, restricted
);
447 #Gets whether the range displays the fill level graphically.
448 fun show_fill_level : Bool is extern `{
449 return gtk_range_get_show_fill_level
( recv
);
452 fun show_fill_level=( is_displayed : Bool ) is extern `{
453 gtk_range_set_show_fill_level
( recv
, is_displayed
);
456 fun adjustment : GtkAdjustment is extern `{
457 return gtk_range_get_adjustment
( recv
);
460 fun adjustment=( value : GtkAdjustment ) is extern `{
461 gtk_range_set_adjustment
( recv
, value
);
464 fun inverted : Bool is extern `{
465 return gtk_range_get_inverted
( recv
);
468 fun inverted=( setting : Bool ) is extern `{
469 gtk_range_set_inverted
( recv
, setting
);
472 fun value : Float is extern `{
473 return gtk_range_get_value
( recv
);
476 fun value=( val : Float ) is extern `{
477 gtk_range_set_value
( recv
, val
);
480 fun set_increments( step : Float, page : Float ) is extern `{
481 gtk_range_set_increments
( recv
, step
, page
);
484 fun set_range( min : Float, max : Float ) is extern `{
485 gtk_range_set_range
( recv
, min
, max
);
488 fun round_digits : Int is extern `{
489 return gtk_range_get_round_digits
( recv
);
492 fun round_digits=( nb : Int ) is extern `{
493 gtk_range_set_round_digits
( recv
, nb
);
496 fun size_fixed : Bool is extern `{
497 return gtk_range_get_slider_size_fixed
( recv
);
500 fun size_fixed=( is_fixed : Bool ) is extern `{
501 return gtk_range_set_slider_size_fixed
( recv
, is_fixed
);
504 fun flippable : Bool is extern `{
505 return gtk_range_get_flippable
( recv
);
508 fun min_size=( is_flippable : Bool ) is extern `{
509 return gtk_range_set_flippable
( recv
, is_flippable
);
512 fun min_slider_size : Int is extern `{
513 return gtk_range_get_min_slider_size
( recv
);
516 fun min_slider_size=( size : Int ) is extern `{
517 return gtk_range_set_min_slider_size
( recv
, size
);
521 #A slider widget for selecting a value from a range
522 #@https://developer.gnome.org/gtk3/3.2/GtkScale.html
523 extern class GtkScale `{GtkScale *`}
526 new ( orientation
: GtkOrientation, adjustment
: GtkAdjustment ) is extern `{
527 return (GtkScale *)gtk_scale_new( orientation, adjustment );
530 new with_range
( orientation
: GtkOrientation, min
: Float, max
: Float, step
: Float ) is extern `{
531 return (GtkScale *)gtk_scale_new_with_range( orientation, min, max, step );
534 fun digits
: Int is extern `{
535 return gtk_scale_get_digits( recv );
538 fun digits
=( nb_digits
: Int ) is extern `{
539 gtk_scale_set_digits( recv, nb_digits );
542 fun draw_value
: Bool is extern `{
543 return gtk_scale_get_draw_value( recv );
546 fun draw_value
=( is_displayed
: Bool ) is extern `{
547 gtk_scale_set_draw_value( recv, is_displayed );
550 fun value_position
: GtkPositionType is extern `{
551 return gtk_scale_get_value_pos( recv );
554 fun value_position
=( pos
: GtkPositionType ) is extern `{
555 gtk_scale_set_value_pos( recv, pos );
558 fun has_origin
: Bool is extern `{
559 return gtk_scale_get_has_origin( recv );
562 fun has_origin
=( orig
: Bool ) is extern `{
563 gtk_scale_set_has_origin( recv, orig );
566 fun add_mark
( value
: Float, position
: GtkPositionType, markup
: String ) is extern import String.to_cstring
`{
567 gtk_scale_add_mark( recv, value, position, String_to_cstring( markup ) );
570 #Removes any marks that have been added with gtk_scale_add_mark().
571 fun clear_marks
is extern `{
572 gtk_scale_clear_marks( recv );
581 #@https://developer.gnome.org/gtk3/3.2/GtkScrollbar.html
582 extern class GtkScrollbar `{GtkScrollbar *`}
585 new ( orientation : GtkOrientation, adjustment : GtkAdjustment ) is extern `{
586 return (GtkScrollbar *)gtk_scrollbar_new
( orientation
, adjustment
);
590 #A widget that displays a small to medium amount of text
591 #@https://developer.gnome.org/gtk3/3.2/GtkLabel.html
592 extern class GtkLabel `{GtkLabel *`}
595 # Create a GtkLabel with text
596 new ( text
: String ) is extern import String.to_cstring
`{
597 return (GtkLabel*)gtk_label_new( String_to_cstring( text ) );
600 # Set the text of the label
601 fun text
=( text
: String ) import String.to_cstring
`{
602 gtk_label_set_text( recv, String_to_cstring( text ) );
605 # Returns the text of the label
606 fun text
: String import NativeString.to_s
`{
607 return NativeString_to_s( (char*)gtk_label_get_text( recv ) );
610 # Sets the angle of rotation for the label.
611 # An angle of 90 reads from from bottom to top, an angle of 270, from top to bottom.
612 fun angle
=( degre
: Float ) `{
613 gtk_label_set_angle( recv, degre );
616 # Returns the angle of rotation for the label.
618 return gtk_label_get_angle( recv );
623 #A widget displaying an image
624 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html
625 extern class GtkImage `{GtkImage *`}
630 return (GtkImage*)gtk_image_new
( );
633 # Create a GtkImage with text
634 new file( filename : String ) is extern import String.to_cstring `{
635 return (GtkImage*)gtk_image_new_from_file
( String_to_cstring( filename
) );
638 fun pixel_size : Int is extern `{
639 return gtk_image_get_pixel_size
( recv
);
642 fun pixel_size=( size : Int) is extern `{
643 gtk_image_set_pixel_size
( recv
, size
);
646 fun clear is extern `{
647 gtk_image_clear
( recv
);
652 #Describes the image data representation used by a GtkImage.
653 #@https://developer.gnome.org/gtk3/3.2/GtkImage.html#GtkImageType
654 extern class GtkImageType `{GtkImageType`}
655 # There is no image displayed by the widget.
656 new empty
`{ return GTK_IMAGE_EMPTY; `}
658 # The widget contains a GdkPixbuf.
659 new pixbuf `{ return GTK_IMAGE_PIXBUF; `}
661 # The widget contains a stock icon name.
662 new stock
`{ return GTK_IMAGE_STOCK; `}
664 # The widget contains a GtkIconSet.
665 new icon_set `{ return GTK_IMAGE_ICON_SET; `}
667 # The widget contains a GdkPixbufAnimation.
668 new animation
`{ return GTK_IMAGE_ANIMATION; `}
670 # The widget contains a named icon.
671 new icon_name `{ return GTK_IMAGE_ICON_NAME; `}
673 # The widget contains a GIcon.
674 new gicon
`{ return GTK_IMAGE_GICON; `}
678 #@https://developer.gnome.org/gtk3/3.2/GtkArrow.html
679 extern class GtkArrow `{GtkArrow *`}
682 new ( arrow_type
: GtkArrowType, shadow_type
: GtkShadowType ) is extern `{
683 return (GtkArrow *)gtk_arrow_new( arrow_type, shadow_type );
686 fun set
( arrow_type
: GtkArrowType, shadow_type
: GtkShadowType ) is extern `{
687 gtk_arrow_set( recv, arrow_type, shadow_type );
691 #A widget that emits a signal when clicked on
692 #@https://developer.gnome.org/gtk3/stable/GtkButton.html
693 extern class GtkButton `{GtkButton *`}
697 return (GtkButton *)gtk_button_new
( );
700 #Create a GtkButton with text
701 new with_label( text : String ) is extern import String.to_cstring `{
702 return (GtkButton *)gtk_button_new_with_label
( String_to_cstring( text
) );
705 new from_stock( stock_id : String ) is extern import String.to_cstring `{
706 return (GtkButton *)gtk_button_new_from_stock
( String_to_cstring( stock_id
) );
709 fun text : String is extern `{
710 return NativeString_to_s( (char
*)gtk_button_get_label
( recv
) );
713 fun text=( value : String ) is extern import String.to_cstring`{
714 gtk_button_set_label
( recv
, String_to_cstring( value
) );
717 fun on_click( to_call : GtkCallable, user_data : nullable Object ) do
718 signal_connect( "clicked", to_call, user_data )
723 #A button which pops up a scale
724 #@https://developer.gnome.org/gtk3/stable/GtkScaleButton.html
725 extern class GtkScaleButton `{GtkScaleButton *`}
729 new( size
: GtkIconSize, min
: Float, max
: Float, step
: Float ) is extern `{
730 return (GtkScaleButton *)gtk_scale_button_new( size, min, max, step, (const char **)0 );
734 #Create buttons bound to a URL
735 #@https://developer.gnome.org/gtk3/stable/GtkLinkButton.html
736 extern class GtkLinkButton `{GtkLinkButton *`}
739 new( uri: String ) is extern import String.to_cstring `{
740 return (GtkLinkButton *)gtk_link_button_new
( String_to_cstring(uri
) );
744 #A container which can hide its child
745 #https://developer.gnome.org/gtk3/stable/GtkExpander.html
746 extern class GtkExpander `{GtkExpander *`}
749 new( lbl
: String) is extern import String.to_cstring
`{
750 return (GtkExpander *)gtk_expander_new( String_to_cstring( lbl ) );
753 new with_mnemonic
( lbl
: String) is extern import String.to_cstring
`{
754 return (GtkExpander *)gtk_expander_new_with_mnemonic(String_to_cstring( lbl ));
757 fun expanded
: Bool is extern `{
758 return gtk_expander_get_expanded( recv );
761 fun expanded
=( is_expanded
: Bool ) is extern `{
762 gtk_expander_set_expanded( recv, is_expanded );
765 fun spacing
: Int is extern `{
766 return gtk_expander_get_spacing( recv );
769 fun spacing
=( pixels
: Int ) is extern `{
770 gtk_expander_set_spacing( recv, pixels );
773 fun label_text
: String is extern `{
774 return NativeString_to_s( (char *)gtk_expander_get_label( recv ) );
777 fun label_text
=( lbl
: String ) is extern import String.to_cstring
`{
778 gtk_expander_set_label( recv, String_to_cstring( lbl ) );
781 fun use_underline
: Bool is extern `{
782 return gtk_expander_get_use_underline( recv );
785 fun use_underline
=( used
: Bool) is extern `{
786 gtk_expander_set_use_underline( recv, used );
789 fun use_markup
: Bool is extern `{
790 return gtk_expander_get_use_markup( recv );
793 fun use_markup
=( used
: Bool) is extern `{
794 gtk_expander_set_use_markup( recv, used );
797 fun label_widget
: GtkWidget is extern `{
798 return gtk_expander_get_label_widget( recv );
801 fun label_widget
=( widget
: GtkWidget ) is extern `{
802 gtk_expander_set_label_widget( recv, widget );
805 fun label_fill
: Bool is extern `{
806 return gtk_expander_get_label_fill( recv );
809 fun label_fill
=( fill
: Bool ) is extern `{
810 gtk_expander_set_label_fill( recv, fill );
813 fun resize_toplevel
: Bool is extern `{
814 return gtk_expander_get_resize_toplevel( recv );
817 fun resize_toplevel
=( resize
: Bool ) is extern `{
818 gtk_expander_set_resize_toplevel( recv, resize );
823 #An abstract class for laying out GtkCellRenderers
824 #@https://developer.gnome.org/gtk3/stable/GtkCellArea.html
825 extern class GtkComboBox `{GtkComboBox *`}
829 return (GtkComboBox *)gtk_combo_box_new
( );
832 new with_entry is extern `{
833 return (GtkComboBox *)gtk_combo_box_new_with_entry
( );
836 new with_model( model : GtkTreeModel ) is extern `{
837 return (GtkComboBox *)gtk_combo_box_new_with_model
( model
);
840 new with_model_and_entry( model : GtkTreeModel ) is extern `{
841 return (GtkComboBox *)gtk_combo_box_new_with_model_and_entry
( model
);
844 new with_area( area : GtkCellArea ) is extern `{
845 return (GtkComboBox *)gtk_combo_box_new_with_area
( area
);
848 new with_area_and_entry( area : GtkCellArea ) is extern `{
849 return (GtkComboBox *)gtk_combo_box_new_with_area_and_entry
( area
);
852 fun wrap_width : Int is extern `{
853 return gtk_combo_box_get_wrap_width
( recv
);
856 fun wrap_width=( width : Int ) is extern `{
857 gtk_combo_box_set_wrap_width
( recv
, width
);
860 fun row_span_col : Int is extern `{
861 return gtk_combo_box_get_row_span_column
( recv
);
864 fun row_span_col=( row_span : Int ) is extern `{
865 gtk_combo_box_set_row_span_column
( recv
, row_span
);
868 fun col_span_col : Int is extern `{
869 return gtk_combo_box_get_column_span_column
( recv
);
872 fun col_span_col=( col_span : Int ) is extern `{
873 gtk_combo_box_set_column_span_column
( recv
, col_span
);
876 fun active_item : Int is extern `{
877 return gtk_combo_box_get_active
( recv
);
880 fun active_item=( active : Int ) is extern `{
881 gtk_combo_box_set_active
( recv
, active
);
884 #fun active_iter : GtkTreeIter is extern `{
887 #fun active_iter=( active : Bool ) is extern `{
890 fun column_id
: Int is extern `{
891 return gtk_combo_box_get_id_column( recv );
894 fun column_id
=( id_column
: Int ) is extern `{
895 gtk_combo_box_set_id_column( recv, id_column );
898 fun active_id
: String is extern `{
899 return NativeString_to_s( (char *)gtk_combo_box_get_active_id( recv ) );
902 fun active_id
=( id_active
: String ) is extern import String.to_cstring
`{
903 gtk_combo_box_set_active_id( recv, String_to_cstring( id_active ) );
906 fun model
: GtkTreeModel is extern `{
907 return gtk_combo_box_get_model( recv );
910 fun model
=( model
: GtkTreeModel ) is extern `{
911 gtk_combo_box_set_model( recv, model );
914 fun popup
is extern `{
915 gtk_combo_box_popup( recv );
918 fun popdown
is extern `{
919 gtk_combo_box_popdown( recv );
922 fun title
: String is extern`{
923 return NativeString_to_s( (char *)gtk_combo_box_get_title( recv ) );
926 fun title
=( t
: String ) is extern import String.to_cstring
`{
927 gtk_combo_box_set_title( recv, String_to_cstring( t ) );
930 fun has_entry
: Bool is extern `{
931 return gtk_combo_box_get_has_entry( recv );
934 fun with_fixed
: Bool is extern `{
935 return gtk_combo_box_get_popup_fixed_width( recv );
938 fun with_fixed
=( fixed
: Bool ) is extern `{
939 gtk_combo_box_set_popup_fixed_width( recv, fixed );
943 #Show a spinner animation
944 #@https://developer.gnome.org/gtk3/3.2/GtkSpinner.html
945 extern class GtkSpinner `{GtkSpinner *`}
949 return (GtkSpinner *)gtk_spinner_new
();
952 fun start is extern `{
953 return gtk_spinner_start
( recv
);
956 fun stop is extern `{
957 return gtk_spinner_stop
( recv
);
961 #A "light switch" style toggle
962 #@https://developer.gnome.org/gtk3/3.2/GtkSwitch.html
963 extern class GtkSwitch `{GtkSwitch *`}
967 return (GtkSwitch *)gtk_switch_new();
970 fun active
: Bool is extern `{
971 return gtk_switch_get_active( recv );
974 fun active
=( is_active
: Bool ) is extern `{
975 return gtk_switch_set_active( recv, is_active );
980 #A widget which controls the alignment and size of its child
981 #https://developer.gnome.org/gtk3/stable/GtkAlignment.html
982 extern class GtkAlignment `{GtkAlignment *`}
985 new ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
986 return (GtkAlignment *)gtk_alignment_new
( xalign
, yalign
, xscale
, yscale
);
989 fun set ( xalign : Float, yalign : Float, xscale : Float, yscale : Float ) is extern `{
990 gtk_alignment_set
( recv
, xalign
, yalign
, xscale
, yscale
);
997 #A representation of an adjustable bounded value
998 #@https://developer.gnome.org/gtk3/stable/GtkAdjustment.html#GtkAdjustment.description
999 extern class GtkAdjustment `{GtkAdjustment *`}
1003 extern class GdkColor `{GdkColor*`}
1005 GdkColor * col
= malloc
(sizeof
(GdkColor));
1006 /*gdk_color_parse
( "red", recv
);*/
1007 gdk_color_parse
( "red", col
);
1012 extern class GdkRGBA `{GdkRGBA*`}