-----------------------------------------------------------------------
--          GtkAda - Ada95 binding for the Gimp Toolkit              --
--                                                                   --
--                     Copyright (C) 1998-1999                       --
--        Emmanuel Briot, Joel Brobecker and Arnaud Charlet          --
--                                                                   --
-- Item_Factory Copyright (c) 1999 by Martin C. Carlisle             --
--                                    carlislem@acm.org              --
--                                                                   --
-- This library is free software; you can redistribute it and/or     --
-- modify it under the terms of the GNU General Public               --
-- License as published by the Free Software Foundation; either      --
-- version 2 of the License, or (at your option) any later version.  --
--                                                                   --
-- This library is distributed in the hope that it will be useful,   --
-- but WITHOUT 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 along with this library; if not, write to the             --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      --
-- Boston, MA 02111-1307, USA.                                       --
--                                                                   --
-- As a special exception, if other files instantiate generics from  --
-- this unit, or you link this unit with other files to produce an   --
-- executable, this  unit  does not  by itself cause  the resulting  --
-- executable to be covered by the GNU General Public License. This  --
-- exception does not however invalidate any other reasons why the   --
-- executable file  might be covered by the  GNU Public License.     --
-----------------------------------------------------------------------
with Gdk;
with Gtk.Accel_Group;
with Gtk.Enums;
with Gtk.Widget;
with Interfaces.C.Strings;
package Gtk.Item_Factory is
   type Gtk_Item_Factory_Record is new Gdk.Root_Type with private;
   type Gtk_Item_Factory is access all Gtk_Item_Factory_Record'Class;
   
   -- Use these to create the item factory
   -- see Item_Factory_Entry below for how to add items
   procedure Gtk_New(
      Factory        :    out Gtk_Item_Factory;
      Container_Type : in     Gtk.Enums.Gtk_Menu_Factory_Type;
      Path           : in     String;
      Accel_Group    : in     Gtk.Accel_Group.Gtk_Accel_Group'Class);
   procedure Initialize(
      Factory        : access Gtk_Item_Factory_Record;
      Container_Type : in     Gtk.Enums.Gtk_Menu_Factory_Type;
      Path           : in     String;
      Accel_Group    : in     Gtk.Accel_Group.Gtk_Accel_Group'Class);

   -- Delete by path, e.g. "/File/Quit"
   procedure Delete_Item(
      Factory        : access Gtk_Item_Factory_Record;
      Path           : in     String);
   -- get the associated widget.  Perhaps useful for disabling
   -- a menu item
   function Get_Widget(
      Factory        : access Gtk_Item_Factory_Record;
      Path           : in     String) return Gtk.Widget.Gtk_Widget;
   
   type Gtk_Item_Factory_Callback is access procedure;

   type Item_Type_Enum is (Title,Item,Check_Item,Toggle_Item,
      Radio_Item,Separator,Branch,Last_Branch);
      
   type Gtk_Item_Factory_Entry_Record is private;
   type Gtk_Item_Factory_Entry is access all Gtk_Item_Factory_Entry_Record;
   
   procedure Gtk_New(
      Factory_Entry  :    out Gtk_Item_Factory_Entry;
      Path           : in     String;
      Accelerator    : in     String;
      Callback       : in     Gtk_Item_Factory_Callback;
      Item_Type      : in     Item_Type_Enum);
   procedure Initialize(
      Factory_Entry  : access Gtk_Item_Factory_Entry_Record;
      Path           : in     String;
      Accelerator    : in     String;
      Callback       : in     Gtk_Item_Factory_Callback;
      Item_Type      : in     Item_Type_Enum);
      
   procedure Create_Item(
      Factory_Entry  : access Gtk_Item_Factory_Entry_Record;
      Factory        : access Gtk_Item_Factory_Record'Class);
   procedure Delete_Entry(
      Factory_Entry  : access Gtk_Item_Factory_Entry_Record;
      Factory        : access Gtk_Item_Factory_Record'Class);
      
private
   type Gtk_Item_Factory_Record is new Gdk.Root_Type with null record;
   type Gtk_Item_Factory_Entry_Record is record
      Path            : Interfaces.C.Strings.Chars_Ptr;
      Accelerator     : Interfaces.C.Strings.Chars_Ptr;
      Callback        : Gtk_Item_Factory_Callback;
      Callback_Action : Glib.Guint := 0;
      Item_Type       : Interfaces.C.Strings.Chars_Ptr;
   end record;
   pragma Convention(C,Gtk_Item_Factory_Entry_Record);
end Gtk.Item_Factory;