------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2009 Vadim Godunko <vgodunko@gmail.com>                      --
--                                                                          --
-- QtAda is free software;  you can  redistribute it and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion. QtAda is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License distributed with QtAda;  see file COPYING.  If not, write --
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
-- Boston, MA 02110-1301, USA.                                              --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3230 $ $Date: 2009-04-04 20:14:18 +0400 (Sat, 04 Apr 2009) $
------------------------------------------------------------------------------
with Qt4.Core_Applications;
with Qt4.Fonts;
with Qt4.Objects;
with Qt4.Push_Buttons.Constructors;
with Qt4.Strings;

with My_Widgets.MOC;
pragma Warnings (Off, My_Widgets.MOC);
--  Child package MOC must be included in the application.

package body My_Widgets is

   ------------------
   -- Constructors --
   ------------------

   package body Constructors is

      ------------
      -- Create --
      ------------

      function Create return not null My_Widget_Access is
         Self   : constant My_Widgets.My_Widget_Access
           := new My_Widgets.My_Widget;
         Family : constant Qt4.Strings.Q_String
           := Qt4.Strings.From_Utf_16 ("Times");
         Font   : constant Qt4.Fonts.Q_Font
           := Qt4.Fonts.Create (Family, 18, Qt4.Fonts.Weight_Bold);

      begin
         Qt4.Widgets.Directors.Constructors.Initialize (Self);

         Self.Set_Fixed_Size (200, 120);
         Self.Quit :=
           Qt4.Push_Buttons.Constructors.Create
            (Qt4.Strings.From_Utf_16 ("Quit"), Self);
         Self.Quit.Set_Geometry (62, 40, 75, 30);
         Self.Quit.Set_Font (Font);

         Qt4.Objects.Connect
          (Self.Quit,
           Qt4.Signal ("clicked()"),
           Qt4.Core_Applications.Instance,
           Qt4.Slot ("quit()"));

         return Self;
      end Create;

   end Constructors;

end My_Widgets;
