------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-2011 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: 3821 $ $Date: 2011-01-24 17:14:50 +0300 (Mon, 24 Jan 2011) $
------------------------------------------------------------------------------
with Analog_Clocks;

package body Analog_Clock_Plugin is

   Initialized : Boolean := False;

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

   package body Constructors is

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

      function Create return not null access Analog_Clock_Plugin'Class is
      begin
         return Self : constant not null access Analog_Clock_Plugin'Class
           := new Analog_Clock_Plugin
         do
            Qt4.Objects.Directors.Constructors.Initialize (Self);
            Initialized := False;
         end return;
      end Create;

   end Constructors;

   -------------------
   -- Create_Widget --
   -------------------

   overriding function Create_Widget
    (Self   : not null access Analog_Clock_Plugin;
     Parent : access Qt4.Widgets.Q_Widget'Class)
       return not null access Qt4.Widgets.Q_Widget'Class is
   begin
      return Analog_Clocks.Constructors.Create (Parent);
   end Create_Widget;

   -------------
   -- Dom_Xml --
   -------------

   overriding function Dom_Xml
    (Self : not null access Analog_Clock_Plugin) return Qt4.Strings.Q_String is
   begin
      return
        Qt4.Strings.From_Utf_8
         ("<widget class=""QtAdaAnalogClock"" name=""analogClock""/>");
--              ("<widget class=""QtAdaAnalogClock"" name=""analogClock"">"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & " <property name=""geometry"">"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "  <rect>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "   <x>0</x>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "   <y>0</y>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "   <width>100</width>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "   <height>100</height>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "  </rect>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & " </property>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & " <property name=""toolTip"" >"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "  <string>The current time (QtAda)</string>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & " </property>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & " <property name=""whatsThis"" >"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "  <string>The analog clock widget displays "
--                 & "the current time.</string>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & " </property>"
--                 & Ada.Characters.Wide_Latin_1.LF
--                 & "</widget>"
--                 & Ada.Characters.Wide_Latin_1.LF);
   end Dom_Xml;

   -----------
   -- Group --
   -----------

   overriding function Group
    (Self  : not null access Analog_Clock_Plugin)
       return Qt4.Strings.Q_String is
   begin
      return Qt4.Strings.From_Utf_8 ("QtAda-Widgets [Examples]");
   end Group;

   ------------------
   -- Include_File --
   ------------------

   overriding function Include_File
    (Self  : not null access Analog_Clock_Plugin)
       return Qt4.Strings.Q_String is
   begin
      return Qt4.Strings.From_Utf_8 ("");
   end Include_File;

   ----------------
   -- Initialize --
   ----------------

   overriding procedure Initialize
    (Self        : not null access Analog_Clock_Plugin;
     Form_Editor :
       not null access
         Qt4.Designer_Form_Editor_Interfaces.Q_Designer_Form_Editor_Interface'Class) is
   begin
      if not Initialized then
         Initialized := True;
      end if;
   end Initialize;

   ------------------
   -- Is_Container --
   ------------------

   overriding function Is_Container
    (Self  : not null access Analog_Clock_Plugin)
       return Boolean is
   begin
      return False;
   end Is_Container;

   --------------------
   -- Is_Initialized --
   --------------------

   function Is_Initialized
    (Self  : not null access Analog_Clock_Plugin)
     return Boolean is
   begin
      return Initialized;
   end Is_Initialized;

   ----------
   -- Name --
   ----------

   overriding function Name
    (Self  : not null access Analog_Clock_Plugin)
       return Qt4.Strings.Q_String is
   begin
      return Qt4.Strings.From_Utf_8 ("QtAdaAnalogClock");
   end Name;

   --------------
   -- Tool_Tip --
   --------------

   overriding function Tool_Tip
    (Self  : not null access Analog_Clock_Plugin)
     return Qt4.Strings.Q_String is
   begin
      return Qt4.Strings.From_Utf_8 ("");
   end Tool_Tip;

   ----------------
   -- Whats_This --
   ----------------

   overriding function Whats_This
    (Self  : not null access Analog_Clock_Plugin)
       return Qt4.Strings.Q_String is
   begin
      return Qt4.Strings.From_Utf_8 ("");
   end Whats_This;

end Analog_Clock_Plugin;
