; ; dbx.dbx.sh ; ; Managing dialogue box control types ; ; © 1994-1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Sapphire library. ; ; Sapphire 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 2, or (at your option) ; any later version. ; ; Sapphire 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 Sapphire. If not, write to the Free Software Foundation, ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;----- Overview ------------------------------------------------------------- ; ; Functions provided: ; ; dbx_declare ; dbx_sendEvent ; dbx_findData ; dbx_controlBBox ; dbx_update ; dbx_qUpdate ; ; Macros provided: ; ; CONTROL ; ECTRL ; DBXEND [ :LNOT::DEF:dbx__dfn GBLL dbx__dfn ;+ LIB sapphire:^.bsh.dbx ; --- dbx_declare --- ; ; On entry: R0 == dialogue box handle from dbox ; R1 == pointer to dialogue box definition block ; ; On exit: -- ; ; Use: Declares a dialogue box to be dbx-managed, and declares the ; control types of all its controls. IMPORT dbx_declare ; --- dbx_sendEvent --- ; ; On entry: R0 == event code to send ; R1-R7 == depend on the event code ; R10 == dialogue box handle ; ; On exit: C flag as set by event handler ; ; Use: Sends an event to the specified dialogue box. This is ; intended to be used by control handlers, hence the unusual ; placing of the dialogue handle in R10. IMPORT dbx_sendEvent ; --- dbx_findData --- ; ; On entry: R0 == icon handle ; R10 == dialogue box handle ; ; On exit: If found, CS and ; R8 == pointer to writable control data ; R9 == pointer to static control data ; else CC and ; R8, R9 corrupted ; ; Use: Allows a control to find its data when called by client ; code. IMPORT dbx_findData ; --- dbx_controlBBox --- ; ; On entry: R0 == dialogue box handle ; R1 == control icon number ; ; On exit: R0,R1 preserved ; R2-R5 == inclusive screen coordinates of icon bounding box ; ; Use: Calculates the position *on the screen* of the given control ; icon, and returns it to you as a set of four inclusive ; coordinates (*not* inclusive-exclusve as the WIMP tends to ; return to you) IMPORT dbx_controlBBox ; --- dbx_update --- ; ; On entry: R0 == dialogue box handle ; R1 == icon number of control to update ; ; On exit: -- ; ; Use: Redraws the specified control immediately. If the control ; does not redraw itself, this call does nothing. IMPORT dbx_update ; --- dbx_qUpdate --- ; ; On entry: R0 == dialogue box handle ; R1 == icon number of control to update ; ; On exit: -- ; ; Use: Makes a control quickly update itself in whichever way it ; needs to in order to be perfect again. It is anticipated ; that this is used to update EORed areas of the control. IMPORT dbx_qUpdate ;----- Creating dialogue definitions ---------------------------------------- ; --- Some internal definitions --- GBLA dbx__c dbx__c SETA 0 ; --- Macro: CONTROL --- ; ; Arguments: icon == icon number for control ; control == pointer to control definition ; baseReg == base register for data ; flags == other flags for this control ; data == offset within data area ; ; Use: Creates a control header block. Intended to be used by ; specifiec control defining macros. MACRO $label CONTROL $icon,$control,$baseReg,$flags,$data dbx__c SETA dbx__c+1 ALIGN $label dbx__s$dbx__c LCLA ctf ctf SETA $flags DCD $icon DCD $control [ "$baseReg" = "R10" ctf SETA ctf :OR: dbxFlag_dataR10 ] [ "$baseReg" = "R12" ctf SETA ctf :OR: dbxFlag_dataR12 ] DCD ctf DCD dbx__sz$dbx__c [ ctf :AND: 3 <> 0 DCD $data ] MEND ; --- Macro: ECTRL --- ; ; Arguments: -- ; ; Use: Ends a control definition MACRO ECTRL ALIGN dbx__sz$dbx__c EQU {PC}-dbx__s$dbx__c MEND ; --- Macro: DBXEND --- ; ; Arguments: -- ; ; Use: Terminates a list of control entries for a dialogue box. MACRO DBXEND DCD -1 MEND ;----- Standard dbx flags --------------------------------------------------- ; ; Individual controls may have their own flags starting at bit 8. dbxFlag_dataR10 EQU (1<<0) ;Has R10-relative data dbxFlag_dataR12 EQU (1<<1) ;Has R12-relative data ;----- dbx event codes ------------------------------------------------------ ; ; All events have: ; ; R0 == event code ; R1 == icon handle of control ; R8 == pointer to control workspace ; R9 == pointer to control definition body ; R10 == dialogue box handle ; R12 == control handler workspace ^ 0 dbxEvent_click # 1 ;Mouse click on the control ;R2 == button status dbxEvent_redraw # 1 ;Redraw or update the control ;R2-R5 == coords of control ;R6 == ptr to graphics window dbxEvent_key # 1 ;Key pressed ;R2 == key code dbxEvent_drop # 1 ;File dropped on control ;R2 == filetype ;R3 == pointer to filename ;R4 == estimated file size ;R5 == subreason code dbxEvent_help # 1 ;Help request for control dbxEvent_update # 1 ;Quick update request ;R2-R5 == coords of control ;R6 == ptr to graphics window dbxEvent_lifeCycle # 1 ;Dialogue state change ;R1 == dblc lifecycle code ; --- dbxEvent_drop subreason codes --- ^ 0 dbxDrop_load # 1 dbxDrop_save # 1 ; --- dbx event masks --- dbxMask_click EQU (1<