--------------------------------------------------------------------------------
--                                                                            --
-- Copyright (C) 2004, RISC OS Ada Library (RASCAL) developers.               --
--                                                                            --
-- This library is free software; you can redistribute it and/or              --
-- modify it under the terms of the GNU Lesser General Public                 --
-- License as published by the Free Software Foundation; either               --
-- version 2.1 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           --
-- Lesser General Public License for more details.                            --
--                                                                            --
-- You should have received a copy of the GNU Lesser 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    --
--                                                                            --
--------------------------------------------------------------------------------

-- @brief Toolbox FontMenu related types and methods.
-- $Author$
-- $Date$
-- $Revision$

with RASCAL.Toolbox;          use RASCAL.Toolbox;
with RASCAL.OS;               use RASCAL.OS;
with RASCAL.Utility;          use RASCAL.Utility;

with System.Unsigned_Types;   use System.Unsigned_Types;

package RASCAL.ToolboxFontMenu is

   -- Flags
   Fontmenu_Generate_About_To_Be_Shown  : constant := 16#1#;
   Fontmenu_Generate_Dialogue_Completed : constant := 16#2#;
   Fontmenu_Generate_Has_Been_Hidden    : constant := 16#2#;
   Fontmenu_Include_System_Font         : constant := 16#4#;

   type FontMenuTemplate is
   record
   Flags       : System.Unsigned_Types.Unsigned;
   Ticked_Font : Address;
   end record;
   pragma Convention (C, FontMenuTemplate);

   --
   -- Event is raised just before the Font Menu window is displayed.
   --
   type Toolbox_FontMenu_AboutToBeShown is
   record
   Header    : Toolbox_Event_Header;
   Show_Type : Integer;
   Position  : OS_Coordinate;
   end record;
   pragma Convention (C, Toolbox_FontMenu_AboutToBeShown);

   type Toolbox_FontMenu_AboutToBeShown_Pointer is access Toolbox_FontMenu_AboutToBeShown;

   type ATEL_Toolbox_FontMenu_AboutToBeShown is abstract
        new Toolbox_EventListener(Toolbox_Event_FontMenu_AboutToBeShown,-1,-1) with

   record
   Event : Toolbox_FontMenu_AboutToBeShown_Pointer;
   end record;

   --
   -- Event is raised when the user selects a font.
   --
   type Toolbox_FontMenu_Selection is
   record
   Header  : Toolbox_Event_Header;
   Font_ID : Char_Array(1..216);
   end record;
   pragma Convention (C, Toolbox_FontMenu_Selection);

   type Toolbox_FontMenu_Selection_Pointer is access Toolbox_FontMenu_Selection;

   type ATEL_Toolbox_FontMenu_Selection is abstract
        new Toolbox_EventListener(Toolbox_Event_FontMenu_Selection,-1,-1) with

   record
   Event : Toolbox_FontMenu_Selection_Pointer;
   end record;

   --
   -- Event is raised when the Font Menu is closed.
   --
   type Toolbox_FontMenu_HasBeenHidden is
   record
   Header  : Toolbox_Event_Header;
   end record;
   pragma Convention (C, Toolbox_FontMenu_HasBeenHidden);

   type Toolbox_FontMenu_HasBeenHidden_Pointer is access Toolbox_FontMenu_HasBeenHidden;

   type ATEL_Toolbox_FontMenu_HasBeenHidden is abstract
        new Toolbox_EventListener(Toolbox_Event_FontMenu_HasBeenHidden,-1,-1) with

   record
   Event : Toolbox_FontMenu_HasBeenHidden_Pointer;
   end record;

   --
   -- Returns the selected font for the menu.
   --
   function Get_Font (FontMenu : in Object_ID;
                      Flags    : in System.Unsigned_Types.Unsigned := 0) return string;

   --
   -- Selects a font in the menu.
   --
   procedure Set_Font (FontMenu  : in Object_ID;
                       Font      : in String;
                       Flags     : in System.Unsigned_Types.Unsigned := 0);

end RASCAL.ToolboxFontMenu;
