-- Auto generated by RAPID
-- By: Martin C. Carlisle and W. Blair Watkinson II

with Subwindow_Actions;
with Subwindow_Actions;
with Subwindow_Actions;
with fred;
with fred;


with Mcc.Gui.Fonts;

package body test_dialog_window is

   procedure Generate_Window is
   begin

      if Mcc.Gui.Container.Window.Is_Open(Mcc.Gui.Container.Window.Window(test_dialog_window)) then
         raise Already_Open;
      end if;

      Mcc.Gui.Container.Window.Create(
         Obj    => test_dialog_window,
         X      => 0,
         Y      => 0,
         Width  => 440,
         Height => 238);

      Mcc.Gui.Container.Window.Set_Title(
         Obj   => test_dialog_window,
         Title => "Dropdown Properties");


      Mcc.Gui.Widget.Label.Create(
         Obj     => label1,
         Parent  => test_dialog_window,
         X       => 0,
         Y       => 35,
         Width   => 110,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Widget name");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label1,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry1,
         Parent => test_dialog_window,
         X      => 110,
         Y      => 35,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label2,
         Parent  => test_dialog_window,
         X       => 0,
         Y       => 65,
         Width   => 110,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "X");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label2,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry2,
         Parent => test_dialog_window,
         X      => 110,
         Y      => 65,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label3,
         Parent  => test_dialog_window,
         X       => 0,
         Y       => 95,
         Width   => 110,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Y");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label3,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry3,
         Parent => test_dialog_window,
         X      => 110,
         Y      => 95,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label4,
         Parent  => test_dialog_window,
         X       => 0,
         Y       => 125,
         Width   => 110,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Width");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label4,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry4,
         Parent => test_dialog_window,
         X      => 110,
         Y      => 125,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label5,
         Parent  => test_dialog_window,
         X       => 0,
         Y       => 155,
         Width   => 110,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Height");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label5,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry5,
         Parent => test_dialog_window,
         X      => 110,
         Y      => 155,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label6,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 35,
         Width   => 95,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Foreground Color");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label6,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry6,
         Parent => test_dialog_window,
         X      => 318,
         Y      => 36,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label7,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 65,
         Width   => 95,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Background Color");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label7,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry7,
         Parent => test_dialog_window,
         X      => 318,
         Y      => 65,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label8,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 95,
         Width   => 95,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Number of Rows");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => label8,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => Row_Entry,
         Parent => test_dialog_window,
         X      => 318,
         Y      => 95,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => autofill,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 121,
         Width   => 210,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Specify fully qualfied names or leave blank");
      Mcc.Gui.Widget.Label.Set_Background_Color(
         Obj       => autofill,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.LightBlue));
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => autofill,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Label.Create(
         Obj     => enum_label,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 155,
         Width   => 95,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Enumeration Type");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => enum_label,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Label.Create(
         Obj     => variable_label,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 185,
         Width   => 95,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Variable");
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => variable_label,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry8,
         Parent => test_dialog_window,
         X      => 318,
         Y      => 155,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => entry9,
         Parent => test_dialog_window,
         X      => 318,
         Y      => 185,
         Width  => 100,
         Height => 20);
      Mcc.Gui.Widget.Label.Create(
         Obj     => option1,
         Parent  => test_dialog_window,
         X       => 3,
         Y       => 5,
         Width   => 207,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "General Options");
      Mcc.Gui.Widget.Label.Set_Background_Color(
         Obj       => option1,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.LightBlue));
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => option1,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Label.Create(
         Obj     => option2,
         Parent  => test_dialog_window,
         X       => 220,
         Y       => 5,
         Width   => 210,
         Height  => 20,
         Justify => Mcc.Gui.Widget.Label.center,
         Text    => "Dropdown Options");
      Mcc.Gui.Widget.Label.Set_Background_Color(
         Obj       => option2,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.LightBlue));
      Mcc.Gui.Widget.Label.Set_Foreground_Color(
         Obj       => option2,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.black));
      Mcc.Gui.Widget.Button.Text.Create(
         Obj    => applyButton,
         Parent => test_dialog_window,
         X      => 12,
         Y      => 200,
         Width  => 60,
         Height => 20,
         Text   => "Apply");
      Mcc.Gui.Widget.Button.Set_Push_Callback(
         Obj      => applyButton'access,
         Callback => Subwindow_Actions.Apply_Properties_Dialog'access);
      Mcc.Gui.Widget.Button.Text.Create(
         Obj    => okbutton,
         Parent => test_dialog_window,
         X      => 82,
         Y      => 200,
         Width  => 60,
         Height => 20,
         Text   => "OK");
      Mcc.Gui.Widget.Button.Set_Push_Callback(
         Obj      => okbutton'access,
         Callback => Subwindow_Actions.Done_Properties_Dialog'access);
      Mcc.Gui.Widget.Button.Text.Create(
         Obj    => cancelButton,
         Parent => test_dialog_window,
         X      => 152,
         Y      => 200,
         Width  => 60,
         Height => 20,
         Text   => "Cancel");
      Mcc.Gui.Widget.Button.Set_Push_Callback(
         Obj      => cancelButton'access,
         Callback => Subwindow_Actions.Cancel_Properties_Dialog'access);
      Mcc.Gui.Widget.Dropdown.Create(
         Obj                  => tom,
         Parent               => test_dialog_window,
         X                    => 237,
         Y                    => 213,
         Width                => 73,
         Height               => 18,
         Number_Rows          => 5);
         for E in fred.susie loop
            Mcc.Gui.Widget.Dropdown.Add_Entry(
               Obj      => tom,
               Location => fred.susie'Pos(E),
               Text     => fred.susie'Image(E),
        end loop

   end Generate_Window;


   procedure Fill_Window is
   begin
      null; -- in case there aren't any widgets to fill
            Mcc.Gui.Widget.Dropdown.Select_Item(
               Obj      => tom,
               Number   => fred.susie'Pos(fred.tom)+1);

   end Fill_Window;

   procedure Generate_and_Fill_Window is
   begin
       Generate_Window;
       Fill_Window;
   end Generate_and_Fill_Window;

   procedure Read_Window(
         Success         :    out Boolean;
         Highlight_Error : in     Boolean := True;
         Beep_On_Error   : in     Boolean := True) is
   begin
      Success := True;
         declare
            Position : Integer := Mcc.Gui.Widget.Dropdown.Get_Selected(tom) - 1;
         begin
         fred.tom:= fred.susie'Val(Position);
         end;
   exception when others => Success := False;
   end Read_Window;

   procedure Close_Window is
   begin
      Mcc.Gui.Destroy(Mcc.Gui.Object(test_dialog_window));
   end Close_Window;


end test_dialog_window;
