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

with main_callback;
with main_callback;

with File_Menu;
with File_Menu;
with File_Menu;

with Mcc.Gui.Fonts;

package body main_window is

   procedure Generate_Window is
   begin

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

      Mcc.Gui.Container.Window.Create(
         Obj    => main_window,
         X      => 0,
         Y      => 0,
         Width  => 300,
         Height => 300);

      Mcc.Gui.Container.Window.Set_Title(
         Obj   => main_window,
         Title => "main");

      Mcc.Gui.Menu.Create(
         Obj    => main_Menu,
         Window => main_window);

      Mcc.Gui.Menu.Add_SubMenu(
         Obj         => File_SubMenu,
         Text        => "File",
         Underline   => 0,
         Parent_Menu => main_Menu);
      Mcc.Gui.Menu.Add_Choice(
         Obj         => Open_Choice,
         To_Menu     => File_SubMenu,
         Text        => "Open",
         Action      => File_Menu.Open'access,
         Underline   => 0,
         Accelerator => "Ctrl+O");
      Mcc.Gui.Menu.Add_Choice(
         Obj         => Save_Choice,
         To_Menu     => File_SubMenu,
         Text        => "Save",
         Action      => File_Menu.Save'access,
         Underline   => 0,
         Accelerator => "Ctrl+S");
      Mcc.Gui.Menu.Add_Choice(
         Obj         => Quit_Choice,
         To_Menu     => File_SubMenu,
         Text        => "Quit",
         Action      => File_Menu.Quit'access,
         Underline   => 0,
         Accelerator => "Ctrl+Q");

      Mcc.Gui.Widget.Label.Create(
         Obj     => person,
         Parent  => main_window,
         X       => 20,
         Y       => 19,
         Width   => 59,
         Height  => 29,
         Justify => Mcc.Gui.Widget.Label.left,
         Text    => "Pick a person");
      Mcc.Gui.Widget.Button.Radio.Create(
         Obj    => tom,
         Parent => main_window,
         X      => 15,
         Y      => 73,
         Width  => 124,
         Height => 18,
         Text   => "tom");
      Mcc.Gui.Widget.Button.Radio.Add_To_Group(
         Group    => group,
         Button   => tom'access);
      Mcc.Gui.Widget.Button.Radio.Create(
         Obj    => fred,
         Parent => main_window,
         X      => 15,
         Y      => 100,
         Width  => 124,
         Height => 18,
         Text   => "fred");
      Mcc.Gui.Widget.Button.Radio.Add_To_Group(
         Group    => group,
         Button   => fred'access);
      Mcc.Gui.Widget.Button.Radio.Create(
         Obj    => mary,
         Parent => main_window,
         X      => 16,
         Y      => 128,
         Width  => 124,
         Height => 18,
         Text   => "mary");
      Mcc.Gui.Widget.Button.Radio.Add_To_Group(
         Group    => group,
         Button   => mary'access);
      Mcc.Gui.Widget.Text_Entry.Create(
         Obj    => my_entry,
         Parent => main_window,
         X      => 148,
         Y      => 33,
         Width  => 87,
         Height => 31);
      Mcc.Gui.Widget.Label.Create(
         Obj     => label2,
         Parent  => main_window,
         X       => 127,
         Y       => 12,
         Width   => 163,
         Height  => 15,
         Justify => Mcc.Gui.Widget.Label.left,
         Text    => "Enter number");
      Mcc.Gui.Widget.Button.Text.Create(
         Obj    => other,
         Parent => main_window,
         X      => 52,
         Y      => 217,
         Width  => 94,
         Height => 36,
         Text   => "Other");
      Mcc.Gui.Widget.Button.Set_Push_Callback(
         Obj      => other'access,
         Callback => main_callback.display_other'access);
      Mcc.Gui.Image.Create(
         Obj  => rapid_gif_Image,
         Name => "rapid.gif");
      Mcc.Gui.Widget.Button.Picture.Create(
         Obj    => rapid,
         Parent => main_window,
         X      => 157,
         Y      => 92,
         Width  => 127,
         Height => 175,
         Image  => rapid_gif_Image);
      Mcc.Gui.Widget.Button.Set_Push_Callback(
         Obj      => rapid'access,
         Callback => main_callback.go_rapid'access);

   end Generate_Window;


   procedure Set_Group(Which : in group_Enum) is
   begin
      case Which is
         when tom_Enum =>
            Mcc.Gui.Widget.Button.Radio.Select_Radio(tom);
         when fred_Enum =>
            Mcc.Gui.Widget.Button.Radio.Select_Radio(fred);
         when mary_Enum =>
            Mcc.Gui.Widget.Button.Radio.Select_Radio(mary);
      end case;
   end Set_Group;

   function Read_Group return group_Enum is
      Selected : Mcc.Gui.Widget.Button.Radio.Radio_Pointer;
      use type Mcc.Gui.Widget.Button.Radio.Radio_Pointer;
   begin
      Selected := Mcc.Gui.Widget.Button.Radio.Get_Selected(group);
      if Selected =  tom'access then
         return tom_Enum;
      elsif Selected =  fred'access then
         return fred_Enum;
      elsif Selected =  mary'access then
         return mary_Enum;
      end if;
   end Read_Group;

   procedure Fill_Window is
   begin
      null; -- in case there aren't any widgets to fill

   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;
   exception when others =>
      Success := False;
      if Beep_On_Error then
         Mcc.Gui.Bell;
      end if;
   end Read_Window;

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


end main_window;
