~ubuntu-branches/ubuntu/intrepid/libgtkada2/intrepid

« back to all changes in this revision

Viewing changes to src/gdialog.adb

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-08-11 09:46:51 UTC
  • mfrom: (6.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20080811094651-9mjd6acwa98ffw5c
Tags: 2.12.0-2ubuntu1
Add lpia to supported architectures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-----------------------------------------------------------------------
2
 
-----------------------------------------------------------------------
3
 
 
4
 
--
5
 
--
6
 
 
7
 
with Gtk.Main;  use Gtk.Main;
8
 
with Gtk.Enums; use Gtk.Enums;
9
 
 
10
 
with Gtkada.Dialogs; use Gtkada.Dialogs;
11
 
 
12
 
with Ada.Text_IO; use Ada.Text_IO;
13
 
with Ada.Command_Line; use Ada.Command_Line;
14
 
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
15
 
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
16
 
 
17
 
with GNAT.OS_Lib; use GNAT.OS_Lib;
18
 
 
19
 
procedure GDialog is
20
 
   Button        : Message_Dialog_Buttons;
21
 
   pragma Warnings (Off, Button);
22
 
 
23
 
   Buffer        : String (1 .. 8192);
24
 
   Last          : Natural := 0;
25
 
   Kind          : Message_Dialog_Type := Information;
26
 
   Justification : Gtk_Justification   := Justify_Center;
27
 
 
28
 
begin
29
 
   Init;
30
 
 
31
 
   if Argument_Count > 0 then
32
 
      begin
33
 
         Kind := Message_Dialog_Type'Value (Argument (1));
34
 
      exception
35
 
         when Constraint_Error =>
36
 
            Put_Line (Standard_Error, "Wrong message dialog type: " &
37
 
              Argument (1));
38
 
            Put_Line (Standard_Error, "Possible values are:");
39
 
 
40
 
            for J in Message_Dialog_Type'Range loop
41
 
               Put_Line (Standard_Error,
42
 
                 Translate (Message_Dialog_Type'Image (J), Lower_Case_Map));
43
 
            end loop;
44
 
 
45
 
            OS_Exit (1);
46
 
      end;
47
 
   end if;
48
 
 
49
 
   if Argument_Count > 1 then
50
 
      begin
51
 
         Justification := Gtk_Justification'Value (Argument (2));
52
 
      exception
53
 
         when Constraint_Error =>
54
 
            Put_Line (Standard_Error, "Wrong justification value: " &
55
 
              Argument (2));
56
 
            Put_Line (Standard_Error, "Possible values are:");
57
 
 
58
 
            for J in Gtk_Justification'Range loop
59
 
               Put_Line (Standard_Error,
60
 
                 Translate (Gtk_Justification'Image (J), Lower_Case_Map));
61
 
            end loop;
62
 
 
63
 
            OS_Exit (2);
64
 
      end;
65
 
   end if;
66
 
 
67
 
   begin
68
 
      loop
69
 
         Get_Line (Buffer (Last + 1 .. Buffer'Last), Last);
70
 
         Last := Last + 1;
71
 
         Buffer (Last) := ASCII.LF;
72
 
      end loop;
73
 
   exception
74
 
      when End_Error =>
75
 
         null;
76
 
   end;
77
 
 
78
 
   Button := Message_Dialog
79
 
     (Buffer (1 .. Last), Kind, Button_OK,
80
 
      Justification => Justification);
81
 
end GDialog;