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.
26 #@https://developer.gnome.org/gtk3/stable/GtkDialog.html
27 extern GtkDialog `{GtkDialog *`}
31 return (GtkDialog *)gtk_dialog_new
( );
34 new with_buttons( title : String, parent : GtkWindow, flags : GtkDialogFlags) is extern import String::to_cstring`{
35 return (GtkDialog *)gtk_dialog_new_with_buttons
( String_to_cstring( title
), parent
, flags
, "", NULL );
39 gtk_dialog_run
( recv
);
44 #Display information about an application
45 #@https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html
46 extern GtkAboutDialog `{GtkAboutDialog *`}
50 return (GtkAboutDialog *)gtk_about_dialog_new( );
53 fun program_name
: String is extern`{
54 return new_String_from_cstring( (char *)gtk_about_dialog_get_program_name( recv ) );
57 fun program_name
=( name
: String ) is extern import String::to_cstring
`{
58 gtk_about_dialog_set_program_name( recv, String_to_cstring( name ) );
61 fun version
: String is extern`{
62 return new_String_from_cstring( (char *)gtk_about_dialog_get_version( recv ) );
65 fun version
=( v
: String ) is extern import String::to_cstring
`{
66 gtk_about_dialog_set_version( recv, String_to_cstring( v ) );
69 fun copyright
: String is extern`{
70 return new_String_from_cstring( (char *)gtk_about_dialog_get_copyright( recv ) );
73 fun copyright
=( c
: String ) is extern import String::to_cstring
`{
74 gtk_about_dialog_set_copyright( recv, String_to_cstring( c ) );
77 fun comments
: String is extern`{
78 return new_String_from_cstring( (char *)gtk_about_dialog_get_comments( recv ) );
81 fun comments
=( com
: String ) is extern import String::to_cstring
`{
82 gtk_about_dialog_set_comments( recv, String_to_cstring( com ) );
85 fun license
: String is extern`{
86 return new_String_from_cstring( (char *)gtk_about_dialog_get_license( recv ) );
89 fun license
=( li
: String ) is extern import String::to_cstring
`{
90 gtk_about_dialog_set_license( recv, String_to_cstring( li ) );
95 fun website
: String is extern`{
96 return new_String_from_cstring( (char *)gtk_about_dialog_get_website( recv ) );
99 fun website
=( link
: String ) is extern import String::to_cstring
`{
100 gtk_about_dialog_set_website( recv, String_to_cstring( link ) );
103 fun website_label
: String is extern`{
104 return new_String_from_cstring( (char *) gtk_about_dialog_get_website_label( recv ) );
107 fun website_label
=( link_label
: String ) is extern import String::to_cstring
`{
108 gtk_about_dialog_set_website_label( recv, String_to_cstring( link_label ) );
112 #fun authors : String is extern`{
113 # return new_String_from_cstring( gtk_about_dialog_get_authors( recv ) );
117 #fun authors=( authors_list : String ) is extern import String::to_cstring`{
118 # gtk_about_dialog_set_authors( recv, String_to_cstring( authors_list ) );
121 fun show
( parent
: GtkWindow, params
: String ) is extern import String::to_cstring
`{
122 gtk_show_about_dialog( parent, String_to_cstring( params ), NULL);
126 #An application chooser dialog
127 #@https://developer.gnome.org/gtk3/stable/GtkAppChooserDialog.html
128 extern GtkAppChooserDialog `{GtkAppChooserDialog *`}
132 #new ( parent : GtkWindow, flags : GtkDialogFlags, file : GFile ) is extern `{
133 # return (GtkAppChooserDialog *)gtk_app_chooser_dialog_new( parent, flags, file );
136 new for_content_type
( parent
: GtkWindow, flags
: GtkDialogFlags, content_type
: String ) is extern import String::to_cstring
`{
137 return (GtkAppChooserDialog *)gtk_app_chooser_dialog_new_for_content_type( parent, flags, String_to_cstring( content_type ) );
140 fun widget
: GtkWidget is extern `{ return gtk_app_chooser_dialog_get_widget( recv ); `}
142 fun heading : String is extern `{
143 return new_String_from_cstring
( (char
*)gtk_app_chooser_dialog_get_heading
( recv
) );
146 fun heading=( text : String ) is extern import String::to_cstring `{
147 gtk_app_chooser_dialog_set_heading
( recv
, String_to_cstring( text
) );
152 #A dialog for choosing colors
153 #@https://developer.gnome.org/gtk3/stable/GtkColorChooserDialog.html
154 extern GtkColorChooserDialog `{GtkColorChooserDialog *`}
157 new ( title
: String, parent
: GtkWindow ) is extern import String::to_cstring
`{
158 return (GtkColorChooserDialog *)gtk_color_chooser_dialog_new( String_to_cstring( title ), parent );
162 #A file chooser dialog, suitable for "File/Open" or "File/Save" commands
163 #@https://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html
164 extern GtkFileChooserDialog `{GtkFileChooserDialog *`}
167 new ( title : String, parent : GtkWindow, action : GtkFileChooserAction ) is extern import String::to_cstring `{
168 return (GtkFileChooserDialog *)gtk_file_chooser_dialog_new
( String_to_cstring( title
), parent
, action
, "", NULL );
172 #enum GtkFileChooserAction
173 #Describes whether a GtkFileChooser is being used to open existing files or to save to a possibly new file.
174 #@https://developer.gnome.org/gtk3/stable/GtkFileChooser.html#GtkFileChooserAction
175 extern GtkFileChooserAction `{GtkFileChooserAction`}
176 #Indicates open mode. The file chooser will only let the user pick an existing file.
177 new open
`{ return GTK_FILE_CHOOSER_ACTION_OPEN; `}
179 #Indicates save mode. The file chooser will let the user pick an existing file, or type in a new filename.
180 new save `{ return GTK_FILE_CHOOSER_ACTION_SAVE; `}
182 #Indicates an Open mode for selecting folders. The file chooser will let the user pick an existing folder.
183 new select_folder
`{ return GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; `}
185 #Indicates a mode for creating a new folder. The file chooser will let the user name an existing or new folder.
186 new create_folder `{ return GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER; `}
189 #A dialog for selecting fonts
190 #@https://developer.gnome.org/gtk3/stable/GtkFontChooserDialog.html
191 extern GtkFontChooserDialog `{GtkFontChooserDialog *`}
194 new ( title : String, parent : GtkWindow ) is extern `{
195 return (GtkFontChooserDialog *)gtk_font_chooser_dialog_new
( String_to_cstring( title
), parent
);
199 #A convenient message window
200 #@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html
201 extern GtkMessageDialog `{GtkMessageDialog *`}
204 new ( parent
: GtkWindow, flags
: GtkDialogFlags, msg_type
: GtkMessageType, btn_type
: GtkButtonsType, format
: String ) is extern import String::to_cstring
`{
205 return (GtkMessageDialog *)gtk_message_dialog_new( parent, flags, msg_type, btn_type, String_to_cstring( format ), NULL );
210 #Prebuilt sets of buttons for the dialog. If none of these choices are appropriate, simply use GTK_BUTTONS_NONE then call gtk_dialog_add_buttons().
211 #@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkButtonsType
212 extern GtkButtonsType `{GtkButtonsType`}
214 new none `{ return GTK_BUTTONS_NONE; `}
217 new ok
`{ return GTK_BUTTONS_OK; `}
220 new close `{ return GTK_BUTTONS_CLOSE; `}
223 new cancel
`{ return GTK_BUTTONS_CANCEL; `}
226 new yes_no `{ return GTK_BUTTONS_YES_NO; `}
228 #OK and Cancel buttons.
229 new ok_cancel
`{ return GTK_BUTTONS_OK_CANCEL; `}
233 #The type of message being displayed in the dialog.
234 #@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkMessageType
235 extern GtkMessageType `{GtkMessageType`}
236 #Informational message
237 new info
`{ return GTK_MESSAGE_INFO; `}
239 #Non-fatal warning message.
240 new warning `{ return GTK_MESSAGE_WARNING; `}
242 #Question requiring a choice.
243 new question
`{ return GTK_MESSAGE_QUESTION; `}
245 #Fatal error message.
246 new error `{ return GTK_MESSAGE_ERROR; `}
248 #None of the above, doesn't get an icon.
249 new other
`{ return GTK_MESSAGE_OTHER; `}
253 #@https://developer.gnome.org/gtk3/stable/GtkPageSetupUnixDialog.html
254 #extern GtkPageSetupUnixDialog `{GtkPageSetupUnixDialog *`}
260 #@https://developer.gnome.org/gtk3/stable/GtkPrintUnixDialog.html
261 #extern GtkPrintUnixDialog `{GtkPrintUnixDialog *`}
266 #Displays recently used files in a dialog
267 #@https://developer.gnome.org/gtk3/stable/GtkRecentChooserDialog.html
268 extern GtkRecentChooserDialog `{GtkRecentChooserDialog *`}
275 #Flags used to influence dialog construction.
276 #@https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkDialogFlags
277 extern GtkDialogFlags `{GtkDialogFlags`}
278 #Make the constructed dialog modal.
279 new modal
`{ return GTK_DIALOG_MODAL; `}
281 #Destroy the dialog when its parent is destroyed.
282 new destroy_with_parent `{ return GTK_DIALOG_DESTROY_WITH_PARENT; `}
285 #enum GtkResponseType
286 #Predefined values for use as response ids in gtk_dialog_add_button().
287 #@https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkResponseType
288 extern GtkResponseType `{GtkResponseType`}
289 #Returned if an action widget has no response id, or if the dialog gets programmatically hidden or destroyed.
290 new none `{ return GTK_RESPONSE_NONE; `}
292 #Generic response id, not used by GTK+ dialogs.
293 new reject
`{ return GTK_RESPONSE_REJECT; `}
295 #Generic response id, not used by GTK+ dialogs
296 new accept `{ return GTK_RESPONSE_ACCEPT; `}
298 #Returned if the dialog is deleted
299 new delete_event
`{ return GTK_RESPONSE_DELETE_EVENT; `}
300 #Returned by OK buttons in GTK+ dialogs.
301 new ok `{ return GTK_RESPONSE_OK; `}
303 #Returned by Cancel buttons in GTK+ dialogs.
304 new cancel
`{ return GTK_RESPONSE_CANCEL; `}
306 #Returned by OK Close in GTK+ dialogs.
307 new close `{ return GTK_RESPONSE_CLOSE; `}
309 #Returned by OK Yes in GTK+ dialogs.
310 new yes
`{ return GTK_RESPONSE_YES; `}
312 #Returned by OK No in GTK+ dialogs.
313 new no `{ return GTK_RESPONSE_NO; `}
315 #Returned by OK Apply in GTK+ dialogs.
316 new apply
`{ return GTK_RESPONSE_APPLY; `}
318 #Returned by OK Help in GTK+ dialogs.
319 new help `{ return GTK_RESPONSE_HELP; `}