@ GNU AS assembler header file for Gadget
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:45:47 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Sept 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib 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 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib 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 programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef Gadget_Hdr
#  define Gadget_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_Wimp
#    define Get_Wimp
#    include "oslib/Wimp.Hdr"
#  endif

#  ifndef Get_Toolbox
#    define Get_Toolbox
#    include "oslib/Toolbox.Hdr"
#  endif

@Symbols for constants
#  define Gadget_Faded 0x80000000
#  define Gadget_AtBack 0x40000000
#  define Gadget_NoHandler 0x0
#  define Gadget_DefaultHandler 0x1
#  define Gadget_PrivateHandler 0x2
#  define Gadget_FeatureAddShift 0x0
#  define Gadget_FeatureAdd 0x3
#  define Gadget_FeatureRemoveShift 0x2
#  define Gadget_FeatureRemove 0xc
#  define Gadget_FeaturePostAddShift 0x4
#  define Gadget_FeaturePostAdd 0x30
#  define Gadget_FeatureMethodShift 0x6
#  define Gadget_FeatureMethod 0xc0
#  define Gadget_FeatureClickShift 0xa
#  define Gadget_FeatureClick 0xc00
#  define Gadget_FeaturePlotShift 0x10
#  define Gadget_FeaturePlot 0x30000
#  define Gadget_FeatureSetFocusShift 0x12
#  define Gadget_FeatureSetFocus 0xc0000
#  define Gadget_FeatureMoveShift 0x14
#  define Gadget_FeatureMove 0x300000
#  define Gadget_FeatureFadeShift 0x16
#  define Gadget_FeatureFade 0xc00000

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Bits
Gadget_Flags                   : 

        .struct 0
Gadget_Object_flags            : .skip   Gadget_Flags
Gadget_Object_class_no_and_size: .skip   Bits
Gadget_Object_bbox             : .skip   OS_Box
Gadget_Object_cmp              : .skip   Toolbox_C
Gadget_Object_help_message     : .skip   Toolbox_MsgReference
Gadget_Object_help_limit       : .skip   Int
Gadget_Object_gadget           : .skip   Int
Gadget_Object                  : 
        
        .altmacro
        .macro  Gadget_Object_MEMBERS label
\label&_flags                  : .skip   Gadget_Flags
\label&_class_no_and_size      : .skip   Bits
\label&_bbox                   : .skip   OS_Box
\label&_cmp                    : .skip   Toolbox_C
\label&_help_message           : .skip   Toolbox_MsgReference
\label&_help_limit             : .skip   Int
        .endm
        
        .struct 0
        Gadget_Object_MEMBERS Gadget_ObjectBase
Gadget_ObjectBase              : 

        .struct 0
        .skip   Bits
Gadget_Feature                 : 

        .struct 0
Gadget_Extension_type          : .skip   Int
Gadget_Extension_valid_flags   : .skip   Gadget_Flags
Gadget_Extension_features      : .skip   Gadget_Feature
Gadget_Extension               : 

        .struct 0
Gadget_ExtensionList_gadget    : .skip   Gadget_Extension
Gadget_ExtensionList           : 


@Symbols for SWI's and SWI reason codes
#  define Gadget_GetFlags 0x40
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &40
   @  R3 = gadget (Toolbox_C)
   @Exit
   @  R0 = flags_out (Gadget_Flags)

#  define Gadget_SetFlags 0x41
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &41
   @  R3 = gadget (Toolbox_C)
   @  R4 = flags_in (Gadget_Flags)

#  define Gadget_SetHelpMessage 0x42
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &42
   @  R3 = gadget (Toolbox_C)
   @  R4 -> help_message (String)

#  define Gadget_GetHelpMessage 0x43
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &43
   @  R3 = gadget (Toolbox_C)
   @  R4 = help_message (pointer to String)
   @  R5 = size (Int)
   @Exit
   @  R5 = used (Int)

#  define Gadget_GetIconList 0x44
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &44
   @  R3 = gadget (Toolbox_C)
   @  R4 = buffer (pointer to Wimp_I)
   @  R5 = size (Int)
   @Exit
   @  R5 = used (Int)

#  define Gadget_SetFocus 0x45
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &45
   @  R3 = gadget (Toolbox_C)

#  define Gadget_GetType 0x46
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &46
   @  R3 = gadget (Toolbox_C)
   @Exit
   @  R0 = type (Int)

#  define Gadget_MoveGadget 0x47
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &47
   @  R3 = gadget (Toolbox_C)
   @  R4 -> bbox (OS_Box)

#  define Gadget_GetBBox 0x48
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &48
   @  R3 = gadget (Toolbox_C)
   @  R4 = bbox (pointer to OS_Box)

#endif
