--------------------------------------------------------------------------------
--                                                                            --
-- 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 Event definitions for the !Configure plugin protocol.
-- $Author$
-- $Date$
-- $Revision$

with RASCAL.OS;          use RASCAL.OS;

package RASCAL.Configure is

   Top_Level_CPI    : constant Integer := 16#50DBF#;
   Boot_CPI         : constant Integer := 16#50DBE#;
   Font_CPI         : constant Integer := 16#50DBD#;
   Network_CPI      : constant Integer := 16#50DBC#;
   Sound_CPI        : constant Integer := 16#50DBB#;
   Disc_CPI         : constant Integer := 16#50DBA#;
   Screen_CPI       : constant Integer := 16#50DB9#;
   Apps_CPI         : constant Integer := 16#50DB8#;
   Extension_CPI    : constant Integer := 16#50DB7#;
   System_Tools_CPI : constant Integer := 16#50DB6#;
   Window_CPI       : constant Integer := 16#50DB5#;
   User_CPI         : constant Integer := 16#50DB4#;

   --
   -- This message is sent to plug-ins to let them know that they are about to be quit, in order to allow them to take action if they have unsaved data.
   --If a top-level parent plug-in is sending this message to a second-level child plug-in as a result of the user clicking on Set , bit1 will be set in the flag word.
   --The child plug-in should therefore save its data immediately and not issue a promp.
   --
   type Message_PlugInQuit is
   record
   Header         : Message_Event_Header;
   Descriptor     : Integer;
   Flags          : Integer;
   end record;
   pragma Convention (C, Message_PlugInQuit);

   type Message_PlugInQuit_Pointer is access Message_PlugInQuit;

   type AMEL_Message_PlugInQuit is abstract new
        Message_EventListener(Message_Event_PlugInQuit) with
   record
   Event : Message_PlugInQuit_Pointer;
   end record;

   --
   -- This message is sent by plug-ins to their parent application  to tell the parent to resume the quitting process.
   --(i.e. Configure for top-level plug-ins, or the parent plug-in for second-level plug-ins)
   --In other words, the message is sent once the user has chosen to discard or save data, but not to abort the quit operation.
   --
   type Message_PlugInQuitContinue is
   record
   Header         : Message_Event_Header;
   Descriptor     : Integer;
   end record;
   pragma Convention (C, Message_PlugInQuitContinue);

   type Message_PlugInQuitContinue_Pointer is access Message_PlugInQuitContinue;

   type AMEL_Message_PlugInQuitContinue is abstract new
        Message_EventListener(Message_Event_PlugInQuitContinue) with
   record
   Event : Message_PlugInQuitContinue_Pointer;
   end record;

   --
   -- This message is sent by a plug-in if the user chooses to cancel the quit procedure when offered the choice of Discard, Save or Cancel.
   --On receipt of this message from a plug-in of its own class, the plug-in should reset its internal 'complain' flag and once again be ready to complain at subsequent quits.
   --
   type Message_PlugInQuitAbort is
   record
   Header         : Message_Event_Header;
   Descriptor     : Integer;
   end record;
   pragma Convention (C, Message_PlugInQuitAbort);

   type Message_PlugInQuitAbort_Pointer is access Message_PlugInQuitAbort;

   type AMEL_Message_PlugInQuitAbort is abstract new
        Message_EventListener(Message_Event_PlugInQuitAbort) with
   record
   Event : Message_PlugInQuitAbort_Pointer;
   end record;

   --
   -- If a plug-in receives this message from Configure, it means that the user has 'lost' the window on the screen and has clicked the plug-in's icon in Configure again.
   --The action to take is very simple: we must bring our window to the front of the window stack, but we must not move it to a new position.
   --Nor must we alter its contents in any way
   --
   type Message_OpenConfigWindow is
   record
   Header         : Message_Event_Header;
   end record;
   pragma Convention (C, Message_OpenConfigWindow);

   type Message_OpenConfigWindow_Pointer is access Message_OpenConfigWindow;

   type AMEL_Message_OpenConfigWindow is abstract new
        Message_EventListener(Message_Event_OpenConfigWindow) with
   record
   Event : Message_OpenConfigWindow_Pointer;
   end record;

end RASCAL.Configure;
