Stdlib: Removed all references to String constructors in nit stdlib and tests.
[nit.git] / lib / gtk3_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
19 import gtk_core
20
21 in "C Header" `{
22 #include <gtk/gtk.h>
23 `}
24
25 #A widget used to guide users through multi-step operations
26 #@https://developer.gnome.org/gtk3/stable/GtkAssistant.html
27 extern GtkAssistant `{GtkAssistant *`}
28 super GtkWindow
29
30 new is extern `{
31 return (GtkAssistant *)gtk_assistant_new( );
32 `}
33
34 fun current_page : Int is extern `{
35 return gtk_assistant_get_current_page ( recv );
36 `}
37
38 fun current_page=( page_num : Int ) is extern `{
39 gtk_assistant_set_current_page( recv, page_num);
40 `}
41
42 fun number_pages : Int is extern `{
43 return gtk_assistant_get_n_pages( recv );
44 `}
45
46 fun get_page( page_num : Int ) : GtkWidget is extern `{
47 return gtk_assistant_get_nth_page( recv, page_num );
48 `}
49
50 fun prepend( page : GtkWidget ) : Int is extern `{
51 return gtk_assistant_prepend_page( recv, page );
52 `}
53
54 fun append( page : GtkWidget ) : Int is extern `{
55 return gtk_assistant_append_page( recv, page );
56 `}
57
58 fun insert( page : GtkWidget, position : Int ) : Int is extern `{
59 return gtk_assistant_insert_page( recv, page, position );
60 `}
61
62 fun remove( page_num : Int ) is extern `{
63 gtk_assistant_remove_page( recv, page_num );
64 `}
65
66 fun get_page_type( page : GtkWidget ) : GtkAssistantPageType is extern `{
67 return gtk_assistant_get_page_type( recv, page );
68 `}
69
70 fun set_page_type( page : GtkWidget, t : GtkAssistantPageType) is extern `{
71 gtk_assistant_set_page_type( recv, page, t );
72 `}
73
74 fun get_page_title( page : GtkWidget ) : String is extern `{
75 return NativeString_to_s( (char *)gtk_assistant_get_page_title( recv, page ) );
76 `}
77
78 fun set_page_title( page : GtkWidget, title : String) is extern import String::to_cstring`{
79 gtk_assistant_set_page_title( recv, page, String_to_cstring( title ) );
80 `}
81
82 fun set_page_complete( page : GtkWidget, is_complete : Bool ) is extern `{
83 gtk_assistant_set_page_complete( recv, page, is_complete );
84 `}
85
86 fun get_page_complete( page : GtkWidget ) : Bool is extern `{
87 return gtk_assistant_get_page_complete( recv, page );
88 `}
89
90 fun remove_action_widget( child : GtkWidget ) is extern `{
91 gtk_assistant_remove_action_widget( recv, child );
92 `}
93
94 fun add_action_widget( child : GtkWidget ) is extern `{
95 gtk_assistant_add_action_widget( recv, child );
96 `}
97
98 fun update_buttons_state is extern `{
99 gtk_assistant_update_buttons_state( recv );
100 `}
101
102 fun commit is extern `{
103 gtk_assistant_commit( recv );
104 `}
105
106 fun next_page is extern `{
107 gtk_assistant_next_page( recv );
108 `}
109
110 fun previous_page is extern `{
111 gtk_assistant_previous_page( recv );
112 `}
113 end
114
115 #enum GtkAssistantPageType
116 #An enum for determining the page role inside the GtkAssistant. It's used to handle buttons sensitivity and visibility.
117 #@https://developer.gnome.org/gtk3/stable/GtkAssistant.html#GtkAssistantPageType
118 extern GtkAssistantPageType `{GtkAssistantPageType`}
119 #The page has regular contents. Both the Back and forward buttons will be shown.
120 new content `{ return GTK_ASSISTANT_PAGE_CONTENT; `}
121
122 #The page contains an introduction to the assistant task. Only the Forward button will be shown if there is a next page.
123 new intro `{ return GTK_ASSISTANT_PAGE_INTRO; `}
124
125 #The page lets the user confirm or deny the changes. The Back and Apply buttons will be shown.
126 new confirm `{ return GTK_ASSISTANT_PAGE_CONFIRM; `}
127
128 #The page informs the user of the changes done. Only the Close button will be shown.
129 new summary `{ return GTK_ASSISTANT_PAGE_SUMMARY; `}
130
131 #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.
132 new progress `{ return GTK_ASSISTANT_PAGE_PROGRESS; `}
133
134 #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().
135 new custom `{ return GTK_ASSISTANT_PAGE_CUSTOM; `}
136 end