@ GNU AS assembler header file for Window
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:48:09 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk; Simon Middleton, Uniqueway Ltd, 18 Aug 1996

@ 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 Window_Hdr
#  define Window_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

#  ifndef Get_KeyboardShortcut
#    define Get_KeyboardShortcut
#    include "oslib/KeyboardShortcut.Hdr"
#  endif

#  ifndef Get_Gadget
#    define Get_Gadget
#    include "oslib/Gadget.Hdr"
#  endif

@Symbols for constants
#  define Class_Window 0x82880
#  define Error_WindowAllocFailed 0x80a901
#  define Error_WindowShortBuffer 0x80a902
#  define Error_WindowBadVersion 0x80a903
#  define Error_WindowInvalidFlags 0x80a904
#  define Error_WindowTasksActive 0x80a905
#  define Error_WindowNoSuchTask 0x80a911
#  define Error_WindowNoSuchMethod 0x80a912
#  define Error_WindowNoSuchMiscOpMethod 0x80a913
#  define Error_WindowInvalidComponentID 0x80a914
#  define Error_WindowDuplicateComponentID 0x80a915
#  define Error_WindowInvalidGadgetType 0x80a920
#  define Window_GenerateAboutToBeShown 0x1
#  define Window_AutoOpen 0x2
#  define Window_AutoClose 0x4
#  define Window_GenerateDialogueCompleted 0x8
#  define Window_IsToolBar 0x10
#  define Window_NoFocus 0xffffffff
#  define Window_SetFocusToWindow 0xfffffffe
#  define Action_WindowAboutToBeShown 0x82880
#  define Action_WindowDialogueCompleted 0x82890
#  define Window_ToolBarIBL 0x1
#  define Window_ToolBarITL 0x2
#  define Window_ToolBarEBL 0x4
#  define Window_ToolBarETL 0x8
#  define Window_ClickAdjust 0x1
#  define Window_ClickMenu 0x2
#  define Window_ClickSelect 0x4
#  define Window_ClickNotToolbox 0x100

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

        .struct 0
        .skip   Bits
Window_GadgetFlags             : 

        .struct 0
Window_IconData_indirected_text_text: .skip   Toolbox_MsgReference
Window_IconData_indirected_text_validation: .skip   Toolbox_StringReference
Window_IconData_indirected_text_size: .skip   Int
Window_IconData                : 

        .struct 0
Window_Window_visible          : .skip   OS_Box
Window_Window_xscroll          : .skip   Int
Window_Window_yscroll          : .skip   Int
Window_Window_next             : .skip   Wimp_W
Window_Window_flags            : .skip   Wimp_WindowFlags
Window_Window_title_fg         : .skip   Wimp_Colour
Window_Window_title_bg         : .skip   Wimp_Colour
Window_Window_work_fg          : .skip   Wimp_Colour
Window_Window_work_bg          : .skip   Wimp_Colour
Window_Window_scroll_outer     : .skip   Wimp_Colour
Window_Window_scroll_inner     : .skip   Wimp_Colour
Window_Window_highlight_bg     : .skip   Wimp_Colour
Window_Window_extra_flags      : .skip   Wimp_ExtraWindowFlags
Window_Window_extent           : .skip   OS_Box
Window_Window_title_flags      : .skip   Wimp_IconFlags
Window_Window_work_flags       : .skip   Wimp_IconFlags
Window_Window_sprite_area      : .skip   Toolbox_SpriteAreaReference
Window_Window_xmin             : .skip   Short
Window_Window_ymin             : .skip   Short
Window_Window_title_data       : .skip   Window_IconData
Window_Window_icon_count       : .skip   Int
Window_Window                  : 

        .struct 0
Window_Object_flags            : .skip   Window_Flags
Window_Object_help_message     : .skip   Toolbox_MsgReference
Window_Object_help_limit       : .skip   Int
Window_Object_sprite_name      : .skip   Toolbox_StringReference
Window_Object_pointer_limit    : .skip   Int
Window_Object_hotspot          : .skip   OS_Coord
Window_Object_menu_name        : .skip   Toolbox_StringReference
Window_Object_shortcut_count   : .skip   Int
Window_Object_shortcuts        : .skip   Toolbox_ObjectOffset
Window_Object_gadget_count     : .skip   Int
Window_Object_gadgets          : .skip   Toolbox_ObjectOffset
Window_Object_default_focus    : .skip   Toolbox_C
Window_Object_show_action      : .skip   Bits
Window_Object_hide_action      : .skip   Bits
Window_Object_toolbar_ibl      : .skip   Toolbox_StringReference
Window_Object_toolbar_itl      : .skip   Toolbox_StringReference
Window_Object_toolbar_ebl      : .skip   Toolbox_StringReference
Window_Object_toolbar_etl      : .skip   Toolbox_StringReference
Window_Object_window           : .skip   Window_Window
Window_Object_data             : .skip   Int
Window_Object                  : 
        
        .altmacro
        .macro  Window_Object_MEMBERS label
\label&_flags                  : .skip   Window_Flags
\label&_help_message           : .skip   Toolbox_MsgReference
\label&_help_limit             : .skip   Int
\label&_sprite_name            : .skip   Toolbox_StringReference
\label&_pointer_limit          : .skip   Int
\label&_hotspot                : .skip   OS_Coord
\label&_menu_name              : .skip   Toolbox_StringReference
\label&_shortcut_count         : .skip   Int
\label&_shortcuts              : .skip   Toolbox_ObjectOffset
\label&_gadget_count           : .skip   Int
\label&_gadgets                : .skip   Toolbox_ObjectOffset
\label&_default_focus          : .skip   Toolbox_C
\label&_show_action            : .skip   Bits
\label&_hide_action            : .skip   Bits
\label&_toolbar_ibl            : .skip   Toolbox_StringReference
\label&_toolbar_itl            : .skip   Toolbox_StringReference
\label&_toolbar_ebl            : .skip   Toolbox_StringReference
\label&_toolbar_etl            : .skip   Toolbox_StringReference
\label&_window                 : .skip   Window_Window
        .endm
        
        .struct 0
        Window_Object_MEMBERS Window_ObjectBase
Window_ObjectBase              : 

        .struct 0
        Toolbox_ResourceFileObject_MEMBERS Window_ObjectTemplate
Window_ObjectTemplate_objectflags: .skip   Window_Flags
Window_ObjectTemplate_help_message: .skip   Toolbox_MsgReference
Window_ObjectTemplate_help_limit: .skip   Int
Window_ObjectTemplate_sprite_name: .skip   Toolbox_StringReference
Window_ObjectTemplate_pointer_limit: .skip   Int
Window_ObjectTemplate_hotspot  : .skip   OS_Coord
Window_ObjectTemplate_menu_name: .skip   Toolbox_StringReference
Window_ObjectTemplate_shortcut_count: .skip   Int
Window_ObjectTemplate_shortcuts: .skip   Toolbox_ObjectOffset
Window_ObjectTemplate_gadget_count: .skip   Int
Window_ObjectTemplate_gadgets  : .skip   Toolbox_ObjectOffset
Window_ObjectTemplate_default_focus: .skip   Toolbox_C
Window_ObjectTemplate_show_action: .skip   Bits
Window_ObjectTemplate_hide_action: .skip   Bits
Window_ObjectTemplate_toolbar_ibl: .skip   Toolbox_StringReference
Window_ObjectTemplate_toolbar_itl: .skip   Toolbox_StringReference
Window_ObjectTemplate_toolbar_ebl: .skip   Toolbox_StringReference
Window_ObjectTemplate_toolbar_etl: .skip   Toolbox_StringReference
Window_ObjectTemplate_window   : .skip   Window_Window
Window_ObjectTemplate_data     : .skip   Int
Window_ObjectTemplate          : 
        
        .altmacro
        .macro  Window_ObjectTemplate_MEMBERS label
        Toolbox_ResourceFileObject_MEMBERS \label
\label&_objectflags            : .skip   Window_Flags
\label&_help_message           : .skip   Toolbox_MsgReference
\label&_help_limit             : .skip   Int
\label&_sprite_name            : .skip   Toolbox_StringReference
\label&_pointer_limit          : .skip   Int
\label&_hotspot                : .skip   OS_Coord
\label&_menu_name              : .skip   Toolbox_StringReference
\label&_shortcut_count         : .skip   Int
\label&_shortcuts              : .skip   Toolbox_ObjectOffset
\label&_gadget_count           : .skip   Int
\label&_gadgets                : .skip   Toolbox_ObjectOffset
\label&_default_focus          : .skip   Toolbox_C
\label&_show_action            : .skip   Bits
\label&_hide_action            : .skip   Bits
\label&_toolbar_ibl            : .skip   Toolbox_StringReference
\label&_toolbar_itl            : .skip   Toolbox_StringReference
\label&_toolbar_ebl            : .skip   Toolbox_StringReference
\label&_toolbar_etl            : .skip   Toolbox_StringReference
\label&_window                 : .skip   Window_Window
        .endm
        
        .struct 0
        Window_ObjectTemplate_MEMBERS Window_ObjectTemplateBase
Window_ObjectTemplateBase      : 

        .struct 0
        .skip   Toolbox_Full
Window_Full                    : 

        .struct 0
Window_ActionShowObject_visible: .skip   OS_Box
Window_ActionShowObject_xscroll: .skip   Int
Window_ActionShowObject_yscroll: .skip   Int
Window_ActionShowObject_next   : .skip   Wimp_W
Window_ActionShowObject        : 

        .struct 0
Window_ActionAboutToBeShown_tag: .skip   Toolbox_PositionTag
Window_ActionAboutToBeShown_position: 
Window_ActionAboutToBeShown_position_top_left: .skip   OS_Coord
        .struct Window_ActionAboutToBeShown_position
Window_ActionAboutToBeShown_position_full: .skip   Window_Full
Window_ActionAboutToBeShown    : 

        .struct 0
        Toolbox_ActionHeader_MEMBERS Window_ActionAboutToBeShownBlock
Window_ActionAboutToBeShownBlock_tag: .skip   Toolbox_PositionTag
Window_ActionAboutToBeShownBlock_position: 
Window_ActionAboutToBeShownBlock_position_top_left: .skip   OS_Coord
        .struct Window_ActionAboutToBeShownBlock_position
Window_ActionAboutToBeShownBlock_position_full: .skip   Window_Full
Window_ActionAboutToBeShownBlock: 

        .struct 0
        .skip   Toolbox_ActionHeaderBase
Window_ActionDialogueCompletedBlock: 

        .struct 0
        .skip   Bits
Window_ToolBarFlags            : 

        .struct 0
        .skip   Bits
Window_MouseState              : 


@Symbols for SWI's and SWI reason codes
.set XWindow_ClassSWI,0xa2880
.set Window_ClassSWI,0x82880

.set XWindow_PostFilter,0xa2881
.set Window_PostFilter,0x82881

.set XWindow_PreFilter,0xa2882
.set Window_PreFilter,0x82882

.set XWindow_GetPointerInfo,0xa2883
.set Window_GetPointerInfo,0x82883
   @Entry
   @  R0 = flags (Bits)
   @Exit
   @  R0 = x (Int)
   @  R1 = y (Int)
   @  R2 = state (Window_MouseState)
   @  R3 = obj (Toolbox_O)
   @  R4 = cmp (Toolbox_C)

.set XWindow_WimpToToolbox,0xa2884
.set Window_WimpToToolbox,0x82884
   @Entry
   @  R0 = flags (Bits)
   @  R1 = w (Wimp_W)
   @  R2 = i (Wimp_I)
   @Exit
   @  R0 = obj (Toolbox_O)
   @  R1 = cmp (Toolbox_C)

.set XWindow_RegisterExternal,0xa2885
.set Window_RegisterExternal,0x82885
   @Entry
   @  R0 = flags (Bits)
   @  R1 -> types (Gadget_ExtensionList)
   @  R2 = handler_swi_number (Int)

.set XWindow_DeregisterExternal,0xa2886
.set Window_DeregisterExternal,0x82886
   @Entry
   @  R0 = flags (Bits)
   @  R1 = type (Int)
   @  R2 = handler_swi_number (Int)

.set XWindow_RegisterFilter,0xa2888
.set Window_RegisterFilter,0x82888

.set XWindow_DeregisterFilter,0xa2889
.set Window_DeregisterFilter,0x82889

.set XWindow_EnumerateGadgets,0xa288a
.set Window_EnumerateGadgets,0x8288a

.set XWindow_GadgetGetIconList,0xa288b
.set Window_GadgetGetIconList,0x8288b

.set XWindow_ExtractGadgetInfo,0xa28be
.set Window_ExtractGadgetInfo,0x828be
   @Entry
   @  R0 = flags (Bits)
   @  R1 -> object (Toolbox_ResourceFileObject)
   @  R2 = cmp (Toolbox_C)
   @Exit
   @  R0 -> gadget (Gadget_Object)
   @  R1 = size (Int)

.set XWindow_PlotGadget,0xa28bf
.set Window_PlotGadget,0x828bf

#  define Window_GetWimpHandle 0x0
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &0
   @Exit
   @  R0 = w (Wimp_W)

#  define Window_AddGadget 0x1
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &1
   @  R3 -> object (Gadget_Object)
   @Exit
   @  R0 = gadget (Toolbox_C)

#  define Window_RemoveGadget 0x2
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &2
   @  R3 = gadget (Toolbox_C)

#  define Window_SetMenu 0x3
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &3
   @  R3 = menu (Toolbox_O)

#  define Window_GetMenu 0x4
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &4
   @Exit
   @  R0 = menu (Toolbox_O)

#  define Window_SetPointer 0x5
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &5
   @  R3 -> sprite_name (String)
   @  R4 = xhotspot (Int)
   @  R5 = yhotspot (Int)

#  define Window_GetPointer 0x6
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &6
   @  R3 = buffer (pointer to String)
   @  R4 = size (Int)
   @Exit
   @  R4 = used (Int)
   @  R5 = xhotspot (Int)
   @  R6 = yhotspot (Int)

#  define Window_SetHelpMessage 0x7
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &7
   @  R3 -> help (String)

#  define Window_GetHelpMessage 0x8
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &8
   @  R3 = buffer (pointer to String)
   @  R4 = size (Int)
   @Exit
   @  R4 = used (Int)

#  define Window_AddKeyboardShortcuts 0x9
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &9
   @  R3 = add_count (Int)
   @  R4 -> shortcuts (KeyboardShortcut_Object)

#  define Window_RemoveKeyboardShortcuts 0xa
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &A
   @  R3 = remove_count (Int)
   @  R4 -> shortcuts (KeyboardShortcut_Object)

#  define Window_SetTitle 0xb
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &B
   @  R3 -> title (String)

#  define Window_GetTitle 0xc
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &C
   @  R3 = buffer (pointer to String)
   @  R4 = size (Int)
   @Exit
   @  R4 = used (Int)

#  define Window_SetDefaultFocus 0xd
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &D
   @  R3 = focus (Toolbox_C)

#  define Window_GetDefaultFocus 0xe
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &E
   @Exit
   @  R0 = focus (Toolbox_C)

#  define Window_SetExtent 0xf
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &F
   @  R3 -> extent (OS_Box)

#  define Window_GetExtent 0x10
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &10
   @  R3 = extent (pointer to OS_Box)

#  define Window_ForceRedraw 0x11
   @Entry
   @  R0 = flags (Bits)
   @  R1 = window (Toolbox_O)
   @  R2 = &11
   @  R3 -> redraw (OS_Box)

#  define Window_SetToolBars 0x12
   @Entry
   @  R0 = flags (Window_ToolBarFlags)
   @  R1 = window (Toolbox_O)
   @  R2 = &12
   @  R3 = ibl (Toolbox_O)
   @  R4 = itl (Toolbox_O)
   @  R5 = ebl (Toolbox_O)
   @  R6 = etl (Toolbox_O)

#  define Window_GetToolBars 0x13
   @Entry
   @  R0 = flags (Window_ToolBarFlags)
   @  R1 = window (Toolbox_O)
   @  R2 = &13
   @Exit
   @  R0 = ibl (Toolbox_O)
   @  R1 = itl (Toolbox_O)
   @  R2 = ebl (Toolbox_O)
   @  R3 = etl (Toolbox_O)

#  define Service_WindowModuleStarting 0x82881
   @Entry
   @  R1 = &82881

#  define Service_WindowModuleDying 0x82882
   @Entry
   @  R1 = &82882

#  define Service_GadgetRegistered 0x82883
   @Entry
   @  R0 = type (Int)
   @  R1 = &82883
   @  R2 = handler_swi_number (Int)
   @  R3 = feature_mask (Bits)

#  define Service_GadgetDeregistered 0x82884
   @Entry
   @  R0 = type (Int)
   @  R1 = &82884
   @  R2 = handler_swi_number (Int)

#endif
