*: update all clients of the `CString::to_s` services
[nit.git] / lib / gtk / v3_4 / gtk_assistant.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Copyright 2011-2013 Alexis Laferrière <alexis.laf@xymus.net>
4 # Copyright 2013 Nathan Heu <heu.nathan@courrier.uqam.ca>
5 #
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
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17
18 module gtk_assistant is pkgconfig "gtk+-3.0"
19
20 import gtk_core
21
22 in "C Header" `{
23 #include <gtk/gtk.h>
24 `}
25
26 # A widget used to guide users through multi-step operations
27 # See: https://developer.gnome.org/gtk3/stable/GtkAssistant.html
28 extern class GtkAssistant `{GtkAssistant *`}
29 super GtkWindow
30
31 new `{
32 return (GtkAssistant *)gtk_assistant_new();
33 `}
34
35 fun current_page: Int `{
36 return gtk_assistant_get_current_page (self);
37 `}
38
39 fun current_page=(page_num: Int) `{
40 gtk_assistant_set_current_page(self, page_num);
41 `}
42
43 fun number_pages: Int `{
44 return gtk_assistant_get_n_pages(self);
45 `}
46
47 fun get_page(page_num: Int): GtkWidget `{
48 return gtk_assistant_get_nth_page(self, page_num);
49 `}
50
51 fun prepend(page: GtkWidget): Int `{
52 return gtk_assistant_prepend_page(self, page);
53 `}
54
55 fun append(page: GtkWidget): Int `{
56 return gtk_assistant_append_page(self, page);
57 `}
58
59 fun insert(page: GtkWidget, position: Int): Int `{
60 return gtk_assistant_insert_page(self, page, position);
61 `}
62
63 fun remove_page(page_num: Int) `{
64 gtk_assistant_remove_page(self, page_num);
65 `}
66
67 fun get_page_type(page: GtkWidget): GtkAssistantPageType `{
68 return gtk_assistant_get_page_type(self, page);
69 `}
70
71 fun set_page_type(page: GtkWidget, t: GtkAssistantPageType) `{
72 gtk_assistant_set_page_type(self, page, t);
73 `}
74
75 fun get_page_title(page: GtkWidget): String import CString.to_s `{
76 return CString_to_s((char *)gtk_assistant_get_page_title(self, page));
77 `}
78
79 fun set_page_title(page: GtkWidget, title: String) import String.to_cstring `{
80 gtk_assistant_set_page_title(self, page, String_to_cstring(title));
81 `}
82
83 fun set_page_complete(page: GtkWidget, is_complete: Bool) `{
84 gtk_assistant_set_page_complete(self, page, is_complete);
85 `}
86
87 fun get_page_complete(page: GtkWidget): Bool `{
88 return gtk_assistant_get_page_complete(self, page);
89 `}
90
91 fun remove_action_widget(child: GtkWidget) `{
92 gtk_assistant_remove_action_widget(self, child);
93 `}
94
95 fun add_action_widget(child: GtkWidget) `{
96 gtk_assistant_add_action_widget(self, child);
97 `}
98
99 fun update_buttons_state `{
100 gtk_assistant_update_buttons_state(self);
101 `}
102
103 fun commit `{
104 gtk_assistant_commit(self);
105 `}
106
107 fun next_page `{
108 gtk_assistant_next_page(self);
109 `}
110
111 fun previous_page `{
112 gtk_assistant_previous_page(self);
113 `}
114 end
115
116 # enum GtkAssistantPageType
117 # An enum for determining the page role inside the GtkAssistant. It's used to handle buttons sensitivity and visibility.
118 # See: https://developer.gnome.org/gtk3/stable/GtkAssistant.html#GtkAssistantPageType
119 extern class GtkAssistantPageType `{GtkAssistantPageType`}
120 # The page has regular contents. Both the Back and forward buttons will be shown.
121 new content `{ return GTK_ASSISTANT_PAGE_CONTENT; `}
122
123 # The page contains an introduction to the assistant task. Only the Forward button will be shown if there is a next page.
124 new intro `{ return GTK_ASSISTANT_PAGE_INTRO; `}
125
126 # The page lets the user confirm or deny the changes. The Back and Apply buttons will be shown.
127 new confirm `{ return GTK_ASSISTANT_PAGE_CONFIRM; `}
128
129 # The page informs the user of the changes done. Only the Close button will be shown.
130 new summary `{ return GTK_ASSISTANT_PAGE_SUMMARY; `}
131
132 # Used for tasks that take a long time to complete, blocks the assistant until the page is marked as complete. Only the back button will be shown.
133 new progress `{ return GTK_ASSISTANT_PAGE_PROGRESS; `}
134
135 # Used for when other page types are not appropriate. No buttons will be shown, and the application must add its own buttons through gtk_assistant_add_action_widget().
136 new custom `{ return GTK_ASSISTANT_PAGE_CUSTOM; `}
137 end