1 # This file is part of NIT ( http://www.nitlanguage.org ).
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 # GTK+ services added at version 3.10
16 module v3_10
is pkgconfig
("gtk+-3.0")
21 fun titlebar
=(widget
: GtkWidget) `{ gtk_window_set_titlebar(self, widget); `}
24 # A vertical container of `GtkListBoxRow`
25 extern class GtkListBox `{ GtkListBox * `}
28 new `{ return (GtkListBox*)gtk_list_box_new(); `}
30 fun prepend(child: GtkWidget) `{ gtk_list_box_prepend(self, child); `}
32 fun insert
(child
: GtkWidget, position
: Int) `{ gtk_list_box_insert(self, child, position); `}
34 fun selected_row: GtkListBoxRow `{ return gtk_list_box_get_selected_row(self); `}
36 fun row_at_index
(index
: Int): GtkListBoxRow`{ return gtk_list_box_get_row_at_index(self, index); `}
38 fun row_at_y(y: Int): GtkListBoxRow `{ return gtk_list_box_get_row_at_y(self, y); `}
40 fun select_row
(row
: GtkListBoxRow) `{ gtk_list_box_select_row(self, row); `}
42 fun placeholder=(placeholder: GtkWidget) `{ gtk_list_box_set_placeholder(self, placeholder); `}
44 fun adjustment
=(adjustment
: GtkAdjustment) `{ gtk_list_box_set_adjustment(self, adjustment); `}
46 fun selection_mode=(mode: GtkSelectionMode) `{ gtk_list_box_set_selection_mode(self, mode); `}
48 fun selection_mode
: GtkSelectionMode `{ return gtk_list_box_get_selection_mode (self); `}
50 fun invalidate_filter `{ gtk_list_box_invalidate_filter(self); `}
52 fun invalidate_sort
`{ gtk_list_box_invalidate_sort(self); `}
54 fun invalidate_headers `{ gtk_list_box_invalidate_headers(self); `}
56 fun activate_on_single_click
=(single
: Bool) `{ gtk_list_box_set_activate_on_single_click(self, single); `}
58 fun activate_on_single_click: Bool `{ return gtk_list_box_get_activate_on_single_click(self); `}
60 fun drag_unhighlight_row
`{ gtk_list_box_drag_unhighlight_row(self); `}
62 fun drag_highlight_row(row: GtkListBoxRow) `{ gtk_list_box_drag_highlight_row(self, row); `}
65 #fun (* GtkListBoxForeachFunc)(GtkListBoxRow *row, gpointer user_data) `{ (* GtkListBoxForeachFunc)(self, GtkListBoxRow *row, gpointer user_data); `}
66 #fun set_filter_func(GtkListBoxFilterFunc filter_func, gpointer user_data, GDestroyNotify destroy) `{ gtk_list_box_set_filter_func(self, GtkListBoxFilterFunc filter_func, gpointer user_data, GDestroyNotify destroy); `}
67 #fun set_header_func(GtkListBoxUpdateHeaderFunc update_header, gpointer user_data, GDestroyNotify destroy) `{ gtk_list_box_set_header_func(self, GtkListBoxUpdateHeaderFunc update_header, gpointer user_data, GDestroyNotify destroy); `}
68 #fun set_sort_func(GtkListBoxSortFunc sort_func, gpointer user_data, GDestroyNotify destroy) `{ gtk_list_box_set_sort_func(self, GtkListBoxSortFunc sort_func, gpointer user_data, GDestroyNotify destroy); `}
71 # A single row of a `GtkListBox`
72 extern class GtkListBoxRow `{ GtkListBoxRow* `}
75 new `{ return (GtkListBoxRow*)gtk_list_box_row_new(); `}
77 fun header
: GtkWidget `{ return gtk_list_box_row_get_header(self); `}
79 fun header=(header: GtkWidget) `{ gtk_list_box_row_set_header(self, header); `}
81 fun index
: Int `{ return gtk_list_box_row_get_index(self); `}
83 fun changed `{ gtk_list_box_row_changed(self); `}
86 # Horizontal container with a title and subtitle
87 extern class GtkHeaderBar `{ GtkHeaderBar* `}
90 new `{ return (GtkHeaderBar*)gtk_header_bar_new(); `}
92 fun title
=(title
: Text) do native_title
= title
.to_cstring
93 private fun native_title
=(title
: NativeString) `{ gtk_header_bar_set_title(self, title); `}
95 fun title: String do return native_title.to_s
96 private fun native_title: NativeString `{ return (gchar *)gtk_header_bar_get_title(self); `}
98 fun subtitle
=(subtitle
: Text) do native_subtitle
= subtitle
.to_cstring
99 fun native_subtitle
=(subtitle
: NativeString) `{ gtk_header_bar_set_subtitle(self, subtitle); `}
101 fun subtitle: String do return native_subtitle.to_s
102 fun native_subtitle: NativeString `{ return (gchar *)gtk_header_bar_get_subtitle(self); `}
104 fun custom_title
=(title_widget
: GtkWidget) `{ gtk_header_bar_set_custom_title(self, title_widget); `}
106 fun custom_title: GtkWidget `{ return gtk_header_bar_get_custom_title(self); `}
108 fun pack_start
(child
: GtkWidget) `{ gtk_header_bar_pack_start(self, child); `}
110 fun pack_end(child: GtkWidget) `{ gtk_header_bar_pack_end(self, child); `}
112 fun show_close_button
=(setting
: Bool) `{ gtk_header_bar_set_show_close_button(self, setting); `}
114 fun show_close_button: Bool `{ return gtk_header_bar_get_show_close_button(self); `}
117 # Container with a single child visible at a time
118 extern class GtkStack `{ GtkStack * `}
121 new `{ return (GtkStack*)gtk_stack_new(); `}
123 fun stack_add
(child
: GtkWidget, name
: String) do native_stack_add
(child
, name
.to_cstring
)
124 private fun native_stack_add
(child
: GtkWidget, name
: NativeString) `{ gtk_stack_add_named(self, child, name); `}
126 fun add_titled(child: GtkWidget, name, title: NativeString) `{ gtk_stack_add_titled(self, child, name, title); `}
127 fun native_add_titled
(child
: GtkWidget, name
, title
: NativeString) `{ gtk_stack_add_titled(self, child, name, title); `}
129 fun visible_child=(child: GtkWidget) `{ gtk_stack_set_visible_child(self, child); `}
131 fun visible_child
: GtkWidget `{ return gtk_stack_get_visible_child(self); `}
133 fun visible_child_name=(name: Text) do native_visible_child_name = name.to_cstring
134 fun native_visible_child_name=(name: NativeString) `{ gtk_stack_set_visible_child_name(self, name); `}
136 fun visible_child_name
: Text do return native_visible_child_name
.to_s
137 fun native_visible_child_name
: NativeString `{ return (gchar *)gtk_stack_get_visible_child_name(self); `}
139 fun set_visible_child_full(name: Text, transition: GtkStackTransitionType) do native_set_visible_child_full(name.to_cstring, transition)
140 fun native_set_visible_child_full(name: NativeString, transition: GtkStackTransitionType) `{
141 gtk_stack_set_visible_child_full
(self, name
, transition
);
144 fun homogeneous=(homogeneous: Bool) `{ gtk_stack_set_homogeneous(self, homogeneous); `}
146 fun homogeneous
: Bool `{ return gtk_stack_get_homogeneous(self); `}
148 fun transition_duration=(duration: Int) `{ gtk_stack_set_transition_duration(self, duration); `}
150 fun transition_duration
: Int `{ return gtk_stack_get_transition_duration(self); `}
152 fun transition_type=(transition: GtkStackTransitionType) `{ gtk_stack_set_transition_type(self, transition); `}
154 fun transition_type
: GtkStackTransitionType `{ return gtk_stack_get_transition_type(self); `}
157 # Type of animation used for transitions between pages in a `GtkStack`
158 extern class GtkStackTransitionType `{ GtkStackTransitionType `}
159 new none
`{ return GTK_STACK_TRANSITION_TYPE_NONE; `}
160 new crossfade `{ return GTK_STACK_TRANSITION_TYPE_CROSSFADE; `}
161 new slide_right
`{ return GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT; `}
162 new slide_left `{ return GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT; `}
163 new slide_up
`{ return GTK_STACK_TRANSITION_TYPE_SLIDE_UP; `}
164 new slide_down `{ return GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN; `}
165 new slide_left_right
`{ return GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT; `}
166 new slide_up_down `{ return GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN; `}