; Assembler header file for Menu
; Written by DefMod (Dec  9 2012) on Sun Dec  9 15:43:59 2012
; Jonathan Coxhead, jonathan@doves.demon.co.uk, 5 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.

        [       :LNOT: :DEF: Menu_Hdr
        GBLS    Menu_Hdr

        [       :LNOT: :DEF: Get_Types
        GBLS    Get_Types
        ]
        [       :LNOT: :DEF: Types_Hdr
Get_Types                       SETS    "GET oslib/Types.Hdr"
        |
Get_Types                       SETS    ""
        ]
        $Get_Types

        [       :LNOT: :DEF: Get_OS
        GBLS    Get_OS
        ]
        [       :LNOT: :DEF: OS_Hdr
Get_OS                          SETS    "GET oslib/OS.Hdr"
        |
Get_OS                          SETS    ""
        ]
        $Get_OS

        [       :LNOT: :DEF: Get_Toolbox
        GBLS    Get_Toolbox
        ]
        [       :LNOT: :DEF: Toolbox_Hdr
Get_Toolbox                     SETS    "GET oslib/Toolbox.Hdr"
        |
Get_Toolbox                     SETS    ""
        ]
        $Get_Toolbox

;Symbols for constants
Class_Menu                      *       &828C0
Menu_GenerateAboutToBeShown     *       &1
Menu_GenerateDialogueCompleted  *       &2
Menu_GenerateHasBeenHidden      *       &2
Menu_EntryTicked                *       &1
Menu_EntrySeparate              *       &2
Menu_EntryFaded                 *       &100
Menu_EntryIsSprite              *       &200
Menu_EntrySubMenu               *       &400
Menu_EntryGenerateSubMenuAction *       &800
Menu_EntryIsMenu                *       &1000
Action_MenuAboutToBeShown       *       &828C0
Action_MenuDialogueCompleted    *       &828C1
Action_MenuHasBeenHidden        *       &828C1
Action_MenuSubMenu              *       &828C2
Action_MenuSelection            *       &828C3
Error_MenuTasksActive           *       &80AA00
Error_MenuAllocFailed           *       &80AA01
Error_MenuShortBuffer           *       &80AA02
Error_MenuNoSuchTask            *       &80AA11
Error_MenuNoSuchMethod          *       &80AA12
Error_MenuNoSuchMiscOpMethod    *       &80AA13
Error_MenuNoSuchComponent       *       &80AA14
Error_MenuSpriteNotText         *       &80AA21
Error_MenuTextNotSprite         *       &80AA22
Error_MenuNoTopMenu             *       &80AA31
Error_MenuUnknownSubMenu        *       &80AA32
Error_MenuNoSpriteName          *       &80AA33
Menu_ShowPersistent             *       &0
Menu_ShowTransient              *       &1
Menu_AddBefore                  *       &1
Menu_AddAtStart                 *       &FFFFFFFF
Menu_AddAtEnd                   *       &FFFFFFFE

;Symbols for structure offsets and sizes
        ^       0
        #       Bits
Menu_Flags                      *       @

        ^       0
        #       Bits
Menu_EntryFlags                 *       @

        ^       0
Menu_EntryObject_flags          #       Menu_EntryFlags
Menu_EntryObject_cmp            #       Toolbox_C
Menu_EntryObject_text           #       Toolbox_MsgReference
Menu_EntryObject_text_limit     #       Int
Menu_EntryObject_click_object_name #       Toolbox_StringReference
Menu_EntryObject_sub_menu_object_name #       Toolbox_StringReference
Menu_EntryObject_sub_menu_action #       Bits
Menu_EntryObject_click_action   #       Bits
Menu_EntryObject_help           #       Toolbox_MsgReference
Menu_EntryObject_help_limit     #       Int
Menu_EntryObject                *       @

        ^       0
Menu_Object_flags               #       Menu_Flags
Menu_Object_title               #       Toolbox_MsgReference
Menu_Object_title_limit         #       Int
Menu_Object_help                #       Toolbox_MsgReference
Menu_Object_help_limit          #       Int
Menu_Object_show_action         #       Bits
Menu_Object_hide_action         #       Bits
Menu_Object_entry_count         #       Int
Menu_Object_entries             #       Menu_EntryObject
Menu_Object                     *       @
        
        MACRO
$label                          Menu_Object_MEMBERS
$label._flags                   #       Menu_Flags
$label._title                   #       Toolbox_MsgReference
$label._title_limit             #       Int
$label._help                    #       Toolbox_MsgReference
$label._help_limit              #       Int
$label._show_action             #       Bits
$label._hide_action             #       Bits
$label._entry_count             #       Int
        MEND
        
        ^       0
Menu_ObjectBase                 Menu_Object_MEMBERS
Menu_ObjectBase                 *       @

        ^       0
Menu_ObjectTemplate             Toolbox_ResourceFileObject_MEMBERS
Menu_ObjectTemplate_objectflags #       Menu_Flags
Menu_ObjectTemplate_title       #       Toolbox_MsgReference
Menu_ObjectTemplate_title_limit #       Int
Menu_ObjectTemplate_help        #       Toolbox_MsgReference
Menu_ObjectTemplate_help_limit  #       Int
Menu_ObjectTemplate_show_action #       Bits
Menu_ObjectTemplate_hide_action #       Bits
Menu_ObjectTemplate_entry_count #       Int
Menu_ObjectTemplate_entries     #       Menu_EntryObject
Menu_ObjectTemplate             *       @
        
        MACRO
$label                          Menu_ObjectTemplate_MEMBERS
$label                          Toolbox_ResourceFileObject_MEMBERS
$label._objectflags             #       Menu_Flags
$label._title                   #       Toolbox_MsgReference
$label._title_limit             #       Int
$label._help                    #       Toolbox_MsgReference
$label._help_limit              #       Int
$label._show_action             #       Bits
$label._hide_action             #       Bits
$label._entry_count             #       Int
        MEND
        
        ^       0
Menu_ObjectTemplateBase         Menu_ObjectTemplate_MEMBERS
Menu_ObjectTemplateBase         *       @

Menu_Full                       *       OS_Coord

        ^       0
Menu_ActionAboutToBeShownBlock  Toolbox_ActionHeader_MEMBERS
Menu_ActionAboutToBeShownBlock_tag #       Toolbox_PositionTag
Menu_ActionAboutToBeShownBlock_position *       @
Menu_ActionAboutToBeShownBlock_position_top_left #       OS_Coord
        ^       Menu_ActionAboutToBeShownBlock_position
Menu_ActionAboutToBeShownBlock_position_full #       Menu_Full
Menu_ActionAboutToBeShownBlock  *       @

        ^       0
Menu_ActionAboutToBeShown_tag   #       Toolbox_PositionTag
Menu_ActionAboutToBeShown_position *       @
Menu_ActionAboutToBeShown_position_top_left #       OS_Coord
        ^       Menu_ActionAboutToBeShown_position
Menu_ActionAboutToBeShown_position_full #       Menu_Full
Menu_ActionAboutToBeShown       *       @

Menu_ActionHasBeenHiddenBlock   *       Toolbox_ActionHeaderBase

Menu_ActionDialogueCompletedBlock *       Toolbox_ActionHeaderBase

        ^       0
Menu_ActionSubMenu_pos          #       OS_Coord
Menu_ActionSubMenu              *       @

        ^       0
Menu_ActionSubMenuBlock         Toolbox_ActionHeader_MEMBERS
Menu_ActionSubMenuBlock_pos     #       OS_Coord
Menu_ActionSubMenuBlock         *       @

Menu_ActionSelectionBlock       *       Toolbox_ActionHeaderBase

        ^       0
        #       Bits
Menu_ShowFlags                  *       @

        ^       0
        #       Bits
Menu_AddFlags                   *       @

Menu_AddAt                      *       Toolbox_C


;Symbols for SWI's and SWI reason codes
XMenu_ClassSWI                  *       &A28C0
Menu_ClassSWI                   *       &828C0

XMenu_PostFilter                *       &A28C1
Menu_PostFilter                 *       &828C1

XMenu_PreFilter                 *       &A28C2
Menu_PreFilter                  *       &828C2

XMenu_UpdateTree                *       &A28C3
Menu_UpdateTree                 *       &828C3
   ;Entry
   ;  R0 = flags (Bits)
   ;Exit
   ;  R0 corrupted

Menu_SetTick                    *       &0
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &0
   ;  R3 = entry (Toolbox_C)
   ;  R4 = tick (Bool)

Menu_GetTick                    *       &1
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &1
   ;  R3 = entry (Toolbox_C)
   ;Exit
   ;  R0 = tick (Bool)

Menu_SetFade                    *       &2
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &2
   ;  R3 = entry (Toolbox_C)
   ;  R4 = fade (Bool)

Menu_GetFade                    *       &3
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &3
   ;  R3 = entry (Toolbox_C)
   ;Exit
   ;  R0 = fade (Bool)

Menu_SetEntryText               *       &4
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &4
   ;  R3 = entry (Toolbox_C)
   ;  R4 -> text (String)

Menu_GetEntryText               *       &5
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &5
   ;  R3 = entry (Toolbox_C)
   ;  R4 = buffer (pointer to String)
   ;  R5 = size (Int)
   ;Exit
   ;  R5 = used (Int)

Menu_SetEntrySprite             *       &6
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &6
   ;  R3 = entry (Toolbox_C)
   ;  R4 -> sprite_name (String)

Menu_GetEntrySprite             *       &7
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &7
   ;  R3 = entry (Toolbox_C)
   ;  R4 = buffer (pointer to String)
   ;  R5 = size (Int)
   ;Exit
   ;  R5 = used (Int)

Menu_SetSubMenuShow             *       &8
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &8
   ;  R3 = entry (Toolbox_C)
   ;  R4 = sub_menu (Toolbox_O)

Menu_GetSubMenuShow             *       &9
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &9
   ;  R3 = entry (Toolbox_C)
   ;Exit
   ;  R0 = sub_menu (Toolbox_O)

Menu_SetSubMenuAction           *       &A
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &A
   ;  R3 = entry (Toolbox_C)
   ;  R4 = action (Bits)

Menu_GetSubMenuAction           *       &B
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &B
   ;  R3 = entry (Toolbox_C)
   ;Exit
   ;  R0 = action (Bits)

Menu_SetClickShow               *       &C
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &C
   ;  R3 = entry (Toolbox_C)
   ;  R4 = show (Toolbox_O)
   ;  R5 = show_flags (Menu_ShowFlags)

Menu_GetClickShow               *       &D
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &D
   ;  R3 = entry (Toolbox_C)
   ;Exit
   ;  R0 = show (Toolbox_O)
   ;  R1 = show_flags (Menu_ShowFlags)

Menu_SetClickAction             *       &E
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &E
   ;  R3 = entry (Toolbox_C)
   ;  R4 = action (Bits)

Menu_GetClickAction             *       &F
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &F
   ;  R3 = entry (Toolbox_C)
   ;Exit
   ;  R0 = action (Bits)

Menu_SetHelpMessage             *       &10
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &10
   ;  R3 -> help (String)

Menu_GetHelpMessage             *       &11
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &11
   ;  R3 = buffer (pointer to String)
   ;  R4 = size (Int)
   ;Exit
   ;  R4 = used (Int)

Menu_SetEntryHelpMessage        *       &12
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &12
   ;  R3 = entry (Toolbox_C)
   ;  R4 -> help (String)

Menu_GetEntryHelpMessage        *       &13
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &13
   ;  R3 = entry (Toolbox_C)
   ;  R4 = buffer (pointer to String)
   ;  R5 = size (Int)
   ;Exit
   ;  R5 = used (Int)

Menu_AddEntry                   *       &14
   ;Entry
   ;  R0 = flags (Menu_AddFlags)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &14
   ;  R3 = at (Menu_AddAt)
   ;  R4 -> entry (Menu_EntryObject)
   ;Exit
   ;  R0 = entry_out (Toolbox_C)

Menu_RemoveEntry                *       &15
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &15
   ;  R3 = entry (Toolbox_C)

Menu_GetHeight                  *       &16
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &16
   ;Exit
   ;  R0 = height (Int)

Menu_GetWidth                   *       &17
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &17
   ;Exit
   ;  R0 = width (Int)

Menu_SetTitle                   *       &18
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &18
   ;  R3 -> title (String)

Menu_GetTitle                   *       &19
   ;Entry
   ;  R0 = flags (Bits)
   ;  R1 = menu (Toolbox_O)
   ;  R2 = &19
   ;  R3 = buffer (pointer to String)
   ;  R4 = size (Int)
   ;Exit
   ;  R4 = used (Int)

        ]
        END
