1. -- 
  2. -- Copyright (c) 2013 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. with Allegro.Displays;                  use Allegro.Displays; 
  10. with Allegro.Events;                    use Allegro.Events; 
  11. with Interfaces;                        use Interfaces; 
  12.  
  13. -- Allegro 5.0.9 - Native dialogs addon 
  14. package Allegro.Native_Dialogs is 
  15.  
  16.     function Al_Init_Native_Dialog_Addon return Boolean; 
  17.  
  18.     procedure Al_Shutdown_Native_Dialog_Addon; 
  19.     pragma Import( C, Al_Shutdown_Native_Dialog_Addon, "al_shutdown_native_dialog_addon" ); 
  20.  
  21.     function Al_Get_Allegro_Native_Dialog_Version return Unsigned_32; 
  22.     pragma Import( C, Al_Get_Allegro_Native_Dialog_Version, "al_get_allegro_native_dialog_version" ); 
  23.  
  24.     -- File chooser dialog 
  25.  
  26.     type Allegro_Filechooser is limited private; 
  27.     type A_Allegro_Filechooser is access all Allegro_Filechooser; 
  28.  
  29.     type Filechooser_Flags is new Unsigned_32; 
  30.     ALLEGRO_FILECHOOSER_NONE            : constant Filechooser_Flags := 0; 
  31.     ALLEGRO_FILECHOOSER_FILE_MUST_EXIST : constant Filechooser_Flags := 1; 
  32.     ALLEGRO_FILECHOOSER_SAVE            : constant Filechooser_Flags := 2; 
  33.     ALLEGRO_FILECHOOSER_FOLDER          : constant Filechooser_Flags := 4; 
  34.     ALLEGRO_FILECHOOSER_PICTURES        : constant Filechooser_Flags := 8; 
  35.     ALLEGRO_FILECHOOSER_SHOW_HIDDEN     : constant Filechooser_Flags := 16; 
  36.     ALLEGRO_FILECHOOSER_MULTIPLE        : constant Filechooser_Flags := 32; 
  37.  
  38.     function Al_Create_Native_File_Dialog( initial_path : String; 
  39.                                            title        : String; 
  40.                                            patterns     : String; 
  41.                                            mode         : Filechooser_Flags 
  42.                                          ) return A_Allegro_Filechooser; 
  43.  
  44.     function Al_Show_Native_File_Dialog( display : A_Allegro_Display; 
  45.                                          dialog  : A_Allegro_Filechooser ) return Boolean; 
  46.  
  47.     function Al_Get_Native_File_Dialog_Count( dialog : A_Allegro_Filechooser ) return Integer; 
  48.     pragma Import( C, Al_Get_Native_File_Dialog_Count, "al_get_native_file_dialog_count" ); 
  49.  
  50.     function Al_Get_Native_File_Dialog_Path( dialog : A_Allegro_Filechooser; 
  51.                                              index  : Natural ) return String; 
  52.  
  53.     procedure Al_Destroy_Native_File_Dialog( dialog : in out A_Allegro_Filechooser ); 
  54.  
  55.     -- Message box 
  56.  
  57.     type Messagebox_Flags is new Unsigned_32; 
  58.     ALLEGRO_MESSAGEBOX_WARN      : constant Messagebox_Flags := 1; 
  59.     ALLEGRO_MESSAGEBOX_ERROR     : constant Messagebox_Flags := 2; 
  60.     ALLEGRO_MESSAGEBOX_OK_CANCEL : constant Messagebox_Flags := 4; 
  61.     ALLEGRO_MESSAGEBOX_YES_NO    : constant Messagebox_Flags := 8; 
  62.     ALLEGRO_MESSAGEBOX_QUESTION  : constant Messagebox_Flags := 16; 
  63.  
  64.     function Al_Show_Native_Message_Box( display : A_Allegro_Display; 
  65.                                          title   : String; 
  66.                                          heading : String; 
  67.                                          text    : String; 
  68.                                          buttons : String; 
  69.                                          flags   : Messagebox_Flags ) return Integer; 
  70.  
  71.     -- Text log dialog 
  72.  
  73.     type Allegro_Textlog is limited private; 
  74.     type A_Allegro_Textlog is access all Allegro_Textlog; 
  75.  
  76.     type Textlog_Flags is new Unsigned_32; 
  77.     ALLEGRO_TEXTLOG_NO_CLOSE  : constant Textlog_Flags := 1; 
  78.     ALLEGRO_TEXTLOG_MONOSPACE : constant Textlog_Flags := 2; 
  79.  
  80.     function Al_Open_Native_Text_Log( title : String; flags : Textlog_Flags ) return A_Allegro_Textlog; 
  81.  
  82.     procedure Al_Close_Native_Text_Log( textlog : in out A_Allegro_Textlog ); 
  83.  
  84.     procedure Al_Append_Native_Text_Log( textlog : A_Allegro_Textlog; str : String ); 
  85.  
  86.     function Al_Get_Native_Text_Log_Event_Source( textlog : A_Allegro_Textlog ) return A_Allegro_Event_Source; 
  87.     pragma Import( C, Al_Get_Native_Text_Log_Event_Source, "al_get_native_text_log_event_source" ); 
  88.  
  89.     -- Native dialog events 
  90.  
  91.     ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE : constant Allegro_Event_Type := 600; 
  92.  
  93. private 
  94.  
  95.     type Allegro_Filechooser is limited null record; 
  96.     pragma Convention( C, Allegro_Filechooser ); 
  97.  
  98.     type Allegro_Textlog is limited null record; 
  99.     pragma Convention( C, Allegro_Textlog ); 
  100.  
  101. end Allegro.Native_Dialogs;