rename `NativeString` to `CString`
[nit.git] / lib / gtk / v3_4 / gtk_dialogs.nit
index 7da083f..ade1741 100644 (file)
@@ -23,299 +23,315 @@ in "C Header" `{
        #include <gtk/gtk.h>
 `}
 
-#Create popup windows
-#@https://developer.gnome.org/gtk3/stable/GtkDialog.html
+# Create popup windows
+# See: https://developer.gnome.org/gtk3/stable/GtkDialog.html
 extern class GtkDialog `{GtkDialog *`}
        super GtkWindow
 
-       new is extern `{
-               return (GtkDialog *)gtk_dialog_new( );
+       new `{
+               return (GtkDialog *)gtk_dialog_new();
        `}
 
-       new with_buttons( title : String, parent : GtkWindow, flags : GtkDialogFlags) is extern import String.to_cstring`{
-               return (GtkDialog *)gtk_dialog_new_with_buttons( String_to_cstring( title ), parent, flags, "", NULL );
+       new with_buttons(title: String, parent: GtkWindow, flags: GtkDialogFlags)
+       import String.to_cstring `{
+               return (GtkDialog *)gtk_dialog_new_with_buttons(
+                       String_to_cstring(title), parent, flags, "", NULL);
        `}
 
-       fun run is extern `{
-               gtk_dialog_run( recv );
+       fun run `{
+               gtk_dialog_run(self);
        `}
-
 end
 
-#Display information about an application
-#@https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html
+# Display information about an application
+# See: https://developer.gnome.org/gtk3/stable/GtkAboutDialog.html
 extern class GtkAboutDialog `{GtkAboutDialog *`}
        super GtkDialog
 
-       new is extern `{
-               return (GtkAboutDialog *)gtk_about_dialog_new( );
+       new `{
+               return (GtkAboutDialog *)gtk_about_dialog_new();
        `}
 
-       fun program_name : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_about_dialog_get_program_name( recv ) );
+       fun program_name: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_about_dialog_get_program_name(self));
        `}
 
-       fun program_name=( name : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_program_name( recv, String_to_cstring( name ) );
+       fun program_name=(name: String) import String.to_cstring `{
+               gtk_about_dialog_set_program_name(self, String_to_cstring(name));
        `}
 
-       fun version : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_about_dialog_get_version( recv ) );
+       fun version: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_about_dialog_get_version(self));
        `}
 
-       fun version=( v : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_version( recv, String_to_cstring( v ) );
+       fun version=(v: String) import String.to_cstring `{
+               gtk_about_dialog_set_version(self, String_to_cstring(v));
        `}
 
-       fun copyright : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_about_dialog_get_copyright( recv ) );
+       fun copyright: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_about_dialog_get_copyright(self));
        `}
 
-       fun copyright=( c : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_copyright( recv, String_to_cstring( c ) );
+       fun copyright=(c: String) import String.to_cstring `{
+               gtk_about_dialog_set_copyright(self, String_to_cstring(c));
        `}
 
-       fun comments : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_about_dialog_get_comments( recv ) );
+       fun comments: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_about_dialog_get_comments(self));
        `}
 
-       fun comments=( com : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_comments( recv, String_to_cstring( com ) );
+       fun comments=(com: String) import String.to_cstring `{
+               gtk_about_dialog_set_comments(self, String_to_cstring(com));
        `}
 
-       fun license : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_about_dialog_get_license( recv ) );
+       fun license: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_about_dialog_get_license(self));
        `}
 
-       fun license=( li : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_license( recv, String_to_cstring( li ) );
+       fun license=(li: String) import String.to_cstring `{
+               gtk_about_dialog_set_license(self, String_to_cstring(li));
        `}
 
-       #license_type
+       # license_type
 
-       fun website : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_about_dialog_get_website( recv ) );
+       fun website: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_about_dialog_get_website(self));
        `}
 
-       fun website=( link : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_website( recv, String_to_cstring( link ) );
+       fun website=(link: String) import String.to_cstring `{
+               gtk_about_dialog_set_website(self, String_to_cstring(link));
        `}
 
-       fun website_label : String import NativeString.to_s `{
-               return NativeString_to_s( (char *) gtk_about_dialog_get_website_label( recv ) );
+       fun website_label: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *) gtk_about_dialog_get_website_label(self));
        `}
 
-       fun website_label=( link_label : String ) is extern import String.to_cstring`{
-               gtk_about_dialog_set_website_label( recv, String_to_cstring( link_label ) );
+       fun website_label=(link_label: String) import String.to_cstring `{
+               gtk_about_dialog_set_website_label(self, String_to_cstring(link_label));
        `}
 
-       #TODO
-       #fun authors : String is extern`{
-       #               return NativeString_to_s( gtk_about_dialog_get_authors( recv ) );
-       #`}
+       # TODO
+       # fun authors: String  import CString.to_s_with_copy `{
+       #               return CString_to_s_with_copy(gtk_about_dialog_get_authors(self));
+       # `}
 
-       #TODO
-       #fun authors=( authors_list : String ) is extern import String.to_cstring`{
-       #       gtk_about_dialog_set_authors( recv, String_to_cstring( authors_list ) );
-       #`}
+       # TODO
+       # fun authors=(authors_list: String) import String.to_cstring`{
+       #       gtk_about_dialog_set_authors(self, String_to_cstring(authors_list));
+       # `}
 
-       fun show ( parent : GtkWindow, params : String ) is extern import String.to_cstring`{
-               gtk_show_about_dialog( parent, String_to_cstring( params ), NULL);
+       fun show_about_dialog(parent: GtkWindow, params: String)
+       import String.to_cstring `{
+               gtk_show_about_dialog(parent, String_to_cstring(params), NULL);
        `}
 end
 
-#An application chooser dialog
-#@https://developer.gnome.org/gtk3/stable/GtkAppChooserDialog.html
+# An application chooser dialog
+# See: https://developer.gnome.org/gtk3/stable/GtkAppChooserDialog.html
 extern class GtkAppChooserDialog `{GtkAppChooserDialog *`}
        super GtkDialog
 
-       #TODO - GFile
-       #new ( parent : GtkWindow, flags : GtkDialogFlags, file : GFile ) is extern `{
-       #       return (GtkAppChooserDialog *)gtk_app_chooser_dialog_new( parent, flags, file );
-       #`}
+       # TODO - GFile
+       # new (parent: GtkWindow, flags: GtkDialogFlags, file: GFile) `{
+       #       return (GtkAppChooserDialog *)gtk_app_chooser_dialog_new(parent, flags, file);
+       # `}
 
-       new for_content_type ( parent : GtkWindow, flags : GtkDialogFlags, content_type : String ) is extern  import String.to_cstring `{
-               return (GtkAppChooserDialog *)gtk_app_chooser_dialog_new_for_content_type( parent, flags,                                                                                                                                                                                       String_to_cstring( content_type ) );
+       new for_content_type (parent: GtkWindow, flags: GtkDialogFlags, content_type: String)
+       import String.to_cstring `{
+               return (GtkAppChooserDialog *)gtk_app_chooser_dialog_new_for_content_type(
+                       parent, flags, String_to_cstring(content_type));
        `}
 
-       fun widget : GtkWidget is extern `{ return gtk_app_chooser_dialog_get_widget( recv ); `}
+       fun widget: GtkWidget `{ return gtk_app_chooser_dialog_get_widget(self); `}
 
-       fun heading : String import NativeString.to_s `{
-               return NativeString_to_s( (char *)gtk_app_chooser_dialog_get_heading( recv ) );
+       fun heading: String import CString.to_s_with_copy `{
+               return CString_to_s_with_copy((char *)gtk_app_chooser_dialog_get_heading(self));
        `}
 
-       fun heading=( text : String ) is extern import String.to_cstring `{
-               gtk_app_chooser_dialog_set_heading( recv, String_to_cstring( text ) );
+       fun heading=(text: String) import String.to_cstring `{
+               gtk_app_chooser_dialog_set_heading(self, String_to_cstring(text));
        `}
 
 end
 
-#A dialog for choosing colors
-#@https://developer.gnome.org/gtk3/stable/GtkColorChooserDialog.html
+# A dialog for choosing colors
+# See: https://developer.gnome.org/gtk3/stable/GtkColorChooserDialog.html
 extern class GtkColorChooserDialog `{GtkColorChooserDialog *`}
        super GtkDialog
 
-       new ( title : String, parent : GtkWindow ) is extern import String.to_cstring `{
-               return (GtkColorChooserDialog *)gtk_color_chooser_dialog_new( String_to_cstring( title ), parent );
+       new (title: String, parent: GtkWindow) import String.to_cstring `{
+               return (GtkColorChooserDialog *)gtk_color_chooser_dialog_new(
+                       String_to_cstring(title), parent);
        `}
 end
 
-#A file chooser dialog, suitable for "File/Open" or "File/Save" commands
-#@https://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html
+# A file chooser dialog, suitable for "File/Open" or "File/Save" commands
+# See: https://developer.gnome.org/gtk3/stable/GtkFileChooserDialog.html
 extern class GtkFileChooserDialog `{GtkFileChooserDialog *`}
        super GtkDialog
 
-       new ( title : String, parent : GtkWindow, action : GtkFileChooserAction ) is extern import String.to_cstring `{
-               return (GtkFileChooserDialog *)gtk_file_chooser_dialog_new( String_to_cstring( title ), parent, action, "", NULL );
+       new (title: String, parent: GtkWindow, action: GtkFileChooserAction)
+       import String.to_cstring `{
+               return (GtkFileChooserDialog *)gtk_file_chooser_dialog_new(
+                       String_to_cstring(title), parent, action, "", NULL);
        `}
 end
 
-#enum GtkFileChooserAction
-#Describes whether a GtkFileChooser is being used to open existing files or to save to a possibly new file.
-#@https://developer.gnome.org/gtk3/stable/GtkFileChooser.html#GtkFileChooserAction
+# enum GtkFileChooserAction
+#
+# Describes whether a GtkFileChooser is being used to open existing files or to save to a possibly new file.
+# See: https://developer.gnome.org/gtk3/stable/GtkFileChooser.html#GtkFileChooserAction
 extern class GtkFileChooserAction `{GtkFileChooserAction`}
-       #Indicates open mode. The file chooser will only let the user pick an existing file.
+       # Open file mode
+       #
+       # The file chooser will only let the user pick an existing file.
        new open `{ return GTK_FILE_CHOOSER_ACTION_OPEN; `}
 
-       #Indicates save mode. The file chooser will let the user pick an existing file, or type in a new filename.
+       # Save file mode
+       #
+       # The file chooser will let the user pick an existing file, or type in a new filename.
        new save `{ return GTK_FILE_CHOOSER_ACTION_SAVE; `}
 
-       #Indicates an Open mode for selecting folders. The file chooser will let the user pick an existing folder.
+       # Select folder mode
+       #
+       # The file chooser will let the user pick an existing folder.
        new select_folder `{ return GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; `}
 
-       #Indicates a mode for creating a new folder. The file chooser will let the user name an existing or new folder.
+       # Create a new folder mode
+       #
+       # The file chooser will let the user name an existing or new folder.
        new create_folder `{ return GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER; `}
 end
 
-#A dialog for selecting fonts
-#@https://developer.gnome.org/gtk3/stable/GtkFontChooserDialog.html
+# A dialog for selecting fonts
+# See: https://developer.gnome.org/gtk3/stable/GtkFontChooserDialog.html
 extern class GtkFontChooserDialog `{GtkFontChooserDialog *`}
        super GtkDialog
 
-       new ( title : String, parent : GtkWindow ) is extern `{
-               return (GtkFontChooserDialog *)gtk_font_chooser_dialog_new( String_to_cstring( title ), parent );
+       new (title: String, parent: GtkWindow) `{
+               return (GtkFontChooserDialog *)gtk_font_chooser_dialog_new(String_to_cstring(title), parent);
        `}
 end
 
-#A convenient message window
-#@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html
+# A convenient message window
+# See: https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html
 extern class GtkMessageDialog `{GtkMessageDialog *`}
        super GtkDialog
 
-       new ( parent : GtkWindow, flags : GtkDialogFlags, msg_type : GtkMessageType, btn_type : GtkButtonsType, format : String ) is extern import String.to_cstring `{
-               return (GtkMessageDialog *)gtk_message_dialog_new( parent, flags, msg_type, btn_type, String_to_cstring( format ), NULL );
+       new (parent: GtkWindow, flags: GtkDialogFlags, msg_type: GtkMessageType, btn_type: GtkButtonsType, format: String) import String.to_cstring `{
+               return (GtkMessageDialog *)gtk_message_dialog_new(parent, flags, msg_type, btn_type, String_to_cstring(format), NULL);
        `}
 end
 
-#enum GtkButtonsType
-#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().
-#@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkButtonsType
+# enum GtkButtonsType
+# 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().
+# See: https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkButtonsType
 extern class GtkButtonsType `{GtkButtonsType`}
-       #No buttons at all
+       # No buttons at all
        new none `{ return GTK_BUTTONS_NONE; `}
 
-       #An OK button.
+       # An OK button.
        new ok `{ return GTK_BUTTONS_OK; `}
 
-       #A Close button.
+       # A Close button.
        new close `{ return GTK_BUTTONS_CLOSE; `}
 
-       #A Cancel button.
+       # A Cancel button.
        new cancel `{ return GTK_BUTTONS_CANCEL; `}
 
-       #Yes and No buttons.
+       # Yes and No buttons.
        new yes_no `{ return GTK_BUTTONS_YES_NO; `}
 
-       #OK and Cancel buttons.
+       # OK and Cancel buttons.
        new ok_cancel `{ return GTK_BUTTONS_OK_CANCEL; `}
 end
 
-#enum GtkMessageType
-#The type of message being displayed in the dialog.
-#@https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkMessageType
+# enum GtkMessageType
+# The type of message being displayed in the dialog.
+# See: https://developer.gnome.org/gtk3/stable/GtkMessageDialog.html#GtkMessageType
 extern class GtkMessageType `{GtkMessageType`}
-       #Informational message
+       # Informational message
        new info `{ return GTK_MESSAGE_INFO; `}
 
-       #Non-fatal warning message.
+       # Non-fatal warning message.
        new warning `{ return GTK_MESSAGE_WARNING; `}
 
-       #Question requiring a choice.
+       # Question requiring a choice.
        new question `{ return GTK_MESSAGE_QUESTION; `}
 
-       #Fatal error message.
+       # Fatal error message.
        new error `{ return GTK_MESSAGE_ERROR; `}
 
-       #None of the above, doesn't get an icon.
+       # None of the above, doesn't get an icon.
        new other `{ return GTK_MESSAGE_OTHER; `}
 end
 
-#A page setup dialog
-#@https://developer.gnome.org/gtk3/stable/GtkPageSetupUnixDialog.html
-#extern class GtkPageSetupUnixDialog `{GtkPageSetupUnixDialog *`}
+# A page setup dialog
+# See: https://developer.gnome.org/gtk3/stable/GtkPageSetupUnixDialog.html
+# extern class GtkPageSetupUnixDialog `{GtkPageSetupUnixDialog *`}
 #      super GtkDialog
 #
-#end
+# end
 
-#A print dialog
-#@https://developer.gnome.org/gtk3/stable/GtkPrintUnixDialog.html
-#extern class GtkPrintUnixDialog `{GtkPrintUnixDialog *`}
+# A print dialog
+# See: https://developer.gnome.org/gtk3/stable/GtkPrintUnixDialog.html
+# extern class GtkPrintUnixDialog `{GtkPrintUnixDialog *`}
 #      super GtkDialog
 #
-#end
+# end
 
-#Displays recently used files in a dialog
-#@https://developer.gnome.org/gtk3/stable/GtkRecentChooserDialog.html
+# Displays recently used files in a dialog
+# See: https://developer.gnome.org/gtk3/stable/GtkRecentChooserDialog.html
 extern class GtkRecentChooserDialog `{GtkRecentChooserDialog *`}
        super GtkDialog
 
 end
 
 
-#enum GtkDialogFlags
-#Flags used to influence dialog construction.
-#@https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkDialogFlags
+# enum GtkDialogFlags
+# Flags used to influence dialog construction.
+# See: https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkDialogFlags
 extern class GtkDialogFlags `{GtkDialogFlags`}
-       #Make the constructed dialog modal.
+       # Make the constructed dialog modal.
        new modal `{ return GTK_DIALOG_MODAL; `}
 
-       #Destroy the dialog when its parent is destroyed.
+       # Destroy the dialog when its parent is destroyed.
        new destroy_with_parent `{ return GTK_DIALOG_DESTROY_WITH_PARENT; `}
 end
 
-#enum GtkResponseType
-#Predefined values for use as response ids in gtk_dialog_add_button().
-#@https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkResponseType
+# enum GtkResponseType
+# Predefined values for use as response ids in gtk_dialog_add_button().
+# See: https://developer.gnome.org/gtk3/stable/GtkDialog.html#GtkResponseType
 extern class GtkResponseType `{GtkResponseType`}
-       #Returned if an action widget has no response id, or if the dialog gets programmatically hidden or destroyed.
+       # Returned if an action widget has no response id, or if the dialog gets programmatically hidden or destroyed.
        new none `{ return GTK_RESPONSE_NONE; `}
 
-       #Generic response id, not used by GTK+ dialogs.
+       # Generic response id, not used by GTK+ dialogs.
        new reject `{ return GTK_RESPONSE_REJECT; `}
 
-       #Generic response id, not used by GTK+ dialogs
+       # Generic response id, not used by GTK+ dialogs
        new accept `{ return GTK_RESPONSE_ACCEPT; `}
 
-       #Returned if the dialog is deleted
+       # Returned if the dialog is deleted
        new delete_event `{ return GTK_RESPONSE_DELETE_EVENT; `}
-       #Returned by OK buttons in GTK+ dialogs.
+       # Returned by OK buttons in GTK+ dialogs.
        new ok `{ return GTK_RESPONSE_OK; `}
 
-       #Returned by Cancel buttons in GTK+ dialogs.
+       # Returned by Cancel buttons in GTK+ dialogs.
        new cancel `{ return GTK_RESPONSE_CANCEL; `}
 
-       #Returned by OK Close in GTK+ dialogs.
+       # Returned by OK Close in GTK+ dialogs.
        new close `{ return GTK_RESPONSE_CLOSE; `}
 
-       #Returned by OK Yes in GTK+ dialogs.
+       # Returned by OK Yes in GTK+ dialogs.
        new yes `{ return GTK_RESPONSE_YES; `}
 
-       #Returned by OK No in GTK+ dialogs.
+       # Returned by OK No in GTK+ dialogs.
        new no `{ return GTK_RESPONSE_NO; `}
 
-       #Returned by OK Apply in GTK+ dialogs.
+       # Returned by OK Apply in GTK+ dialogs.
        new apply `{ return GTK_RESPONSE_APPLY; `}
 
-       #Returned by OK Help in GTK+ dialogs.
+       # Returned by OK Help in GTK+ dialogs.
        new help `{ return GTK_RESPONSE_HELP; `}
 end