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

with main_Actions;


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 => "My First App");


      Mcc.Gui.Widget.Label.Create(
         Obj     => my_label,
         Parent  => main_window,
         X       => 44,
         Y       => 28,
         Width   => 125,
         Height  => 91,
         Justify => Mcc.Gui.Widget.Label.left,
         Text    => "Here's some text");
      Mcc.Gui.Widget.Label.Set_Background_Color(
         Obj       => my_label,
         New_Color => Mcc.Gui.Colors.Named_Color(
            Mcc.Gui.Colors.red));
      Mcc.Gui.Widget.Button.Text.Create(
         Obj    => push_me,
         Parent => main_window,
         X      => 58,
         Y      => 166,
         Width  => 113,
         Height => 61,
         Text   => "Push Me");
      Mcc.Gui.Widget.Button.Set_Push_Callback(
         Obj      => push_me'access,
         Callback => main_Actions.push_me_Pushed'access);

   end Generate_Window;


   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;
