summaryrefslogtreecommitdiff
path: root/src/fltk-dialogs.adb
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-04-27 10:40:48 +1000
committerJed Barber <jjbarber@y7mail.com>2017-04-27 10:40:48 +1000
commit0d842f0423ba0754fb3675c7468397a8da5f6e1b (patch)
treed5da172bc7af2f7f48a3415eceac67ed67542787 /src/fltk-dialogs.adb
parent5d88963cd203f30b79433e34e5c89bfcf8abfe60 (diff)
Organising source
Diffstat (limited to 'src/fltk-dialogs.adb')
-rw-r--r--src/fltk-dialogs.adb111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/fltk-dialogs.adb b/src/fltk-dialogs.adb
new file mode 100644
index 0000000..0c9adcf
--- /dev/null
+++ b/src/fltk-dialogs.adb
@@ -0,0 +1,111 @@
+
+
+with Interfaces.C;
+with Interfaces.C.Strings;
+use type Interfaces.C.Strings.chars_ptr;
+
+
+package body FLTK.Dialogs is
+
+
+ procedure dialog_fl_alert
+ (M : in Interfaces.C.char_array);
+ pragma Import (C, dialog_fl_alert, "dialog_fl_alert");
+
+ function dialog_fl_choice
+ (M, A, B, C : in Interfaces.C.char_array)
+ return Interfaces.C.int;
+ pragma Import (C, dialog_fl_choice, "dialog_fl_choice");
+
+ function dialog_fl_file_chooser
+ (M, P, D : in Interfaces.C.char_array;
+ R : in Interfaces.C.int)
+ return Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, dialog_fl_file_chooser, "dialog_fl_file_chooser");
+
+ function dialog_fl_input
+ (M, D : in Interfaces.C.char_array)
+ return Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, dialog_fl_input, "dialog_fl_input");
+
+ procedure dialog_fl_message
+ (M : in Interfaces.C.char_array);
+ pragma Import (C, dialog_fl_message, "dialog_fl_message");
+
+
+
+
+ procedure Alert
+ (Message : String) is
+ begin
+ dialog_fl_alert (Interfaces.C.To_C (Message));
+ end Alert;
+
+
+
+
+ function Three_Way_Choice
+ (Message, Button1, Button2, Button3 : in String)
+ return Choice
+ is
+ Result : Interfaces.C.int := dialog_fl_choice
+ (Interfaces.C.To_C (Message),
+ Interfaces.C.To_C (Button1),
+ Interfaces.C.To_C (Button2),
+ Interfaces.C.To_C (Button3));
+ begin
+ return Choice'Val (Result);
+ end Three_Way_Choice;
+
+
+
+
+ function File_Chooser
+ (Message, Filter_Pattern, Default : in String;
+ Relative : in Boolean := False)
+ return String
+ is
+ Result : Interfaces.C.Strings.chars_ptr := dialog_fl_file_chooser
+ (Interfaces.C.To_C (Message),
+ Interfaces.C.To_C (Filter_Pattern),
+ Interfaces.C.To_C (Default),
+ Boolean'Pos (Relative));
+ begin
+ if Result = Interfaces.C.Strings.Null_Ptr then
+ return "";
+ else
+ return Interfaces.C.Strings.Value (Result);
+ end if;
+ end File_Chooser;
+
+
+
+
+ function Text_Input
+ (Message : in String;
+ Default : in String := "")
+ return String
+ is
+ Result : Interfaces.C.Strings.chars_ptr := dialog_fl_input
+ (Interfaces.C.To_C (Message),
+ Interfaces.C.To_C (Default));
+ begin
+ if Result = Interfaces.C.Strings.Null_Ptr then
+ return "";
+ else
+ return Interfaces.C.Strings.Value (Result);
+ end if;
+ end Text_Input;
+
+
+
+
+ procedure Message_Box
+ (Message : in String) is
+ begin
+ dialog_fl_message (Interfaces.C.To_C (Message));
+ end Message_Box;
+
+
+end FLTK.Dialogs;
+