------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008 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: 3093 $ $Date: 2009-01-16 22:19:17 +0300 (Fri, 16 Jan 2009) $
------------------------------------------------------------------------------
with Qt_Ada.Application;
with Qt4.Core_Applications;
with Qt4.Fonts;
with Qt4.Objects;
with Qt4.Push_Buttons.Constructors;
with Qt4.Strings;
with Qt4.Widgets.Constructors;

procedure Main is
begin
   Qt_Ada.Application.Initialize;

   declare
      Window : constant not null access Qt4.Widgets.Q_Widget'Class
        := Qt4.Widgets.Constructors.Create;
      Quit   : constant not null access Qt4.Push_Buttons.Q_Push_Button'Class
        := Qt4.Push_Buttons.Constructors.Create
            (Qt4.Strings.From_Utf_16 ("Quit"), Window);
      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
      Window.Resize (200, 120);

      Quit.Set_Font (Font);
      Quit.Set_Geometry (10, 40, 180, 40);

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

      Window.Show;
      Qt_Ada.Application.Execute;
   end;
end Main;
