4 ; Managing dialogue box control types
6 ; © 1994-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sapphire library.
13 ; Sapphire is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sapphire is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sapphire. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Overview -------------------------------------------------------------
47 ;+ LIB sapphire:^.bsh.dbx
51 ; On entry: R0 == dialogue box handle from dbox
52 ; R1 == pointer to dialogue box definition block
56 ; Use: Declares a dialogue box to be dbx-managed, and declares the
57 ; control types of all its controls.
61 ; --- dbx_sendEvent ---
63 ; On entry: R0 == event code to send
64 ; R1-R7 == depend on the event code
65 ; R10 == dialogue box handle
67 ; On exit: C flag as set by event handler
69 ; Use: Sends an event to the specified dialogue box. This is
70 ; intended to be used by control handlers, hence the unusual
71 ; placing of the dialogue handle in R10.
75 ; --- dbx_findData ---
77 ; On entry: R0 == icon handle
78 ; R10 == dialogue box handle
80 ; On exit: If found, CS and
81 ; R8 == pointer to writable control data
82 ; R9 == pointer to static control data
86 ; Use: Allows a control to find its data when called by client
91 ; --- dbx_controlBBox ---
93 ; On entry: R0 == dialogue box handle
94 ; R1 == control icon number
96 ; On exit: R0,R1 preserved
97 ; R2-R5 == inclusive screen coordinates of icon bounding box
99 ; Use: Calculates the position *on the screen* of the given control
100 ; icon, and returns it to you as a set of four inclusive
101 ; coordinates (*not* inclusive-exclusve as the WIMP tends to
104 IMPORT dbx_controlBBox
108 ; On entry: R0 == dialogue box handle
109 ; R1 == icon number of control to update
113 ; Use: Redraws the specified control immediately. If the control
114 ; does not redraw itself, this call does nothing.
118 ; --- dbx_qUpdate ---
120 ; On entry: R0 == dialogue box handle
121 ; R1 == icon number of control to update
125 ; Use: Makes a control quickly update itself in whichever way it
126 ; needs to in order to be perfect again. It is anticipated
127 ; that this is used to update EORed areas of the control.
131 ;----- Creating dialogue definitions ----------------------------------------
133 ; --- Some internal definitions ---
138 ; --- Macro: CONTROL ---
140 ; Arguments: icon == icon number for control
141 ; control == pointer to control definition
142 ; baseReg == base register for data
143 ; flags == other flags for this control
144 ; data == offset within data area
146 ; Use: Creates a control header block. Intended to be used by
147 ; specifiec control defining macros.
150 $label CONTROL $icon,$control,$baseReg,$flags,$data
165 ctf SETA ctf :OR: dbxFlag_dataR10
169 ctf SETA ctf :OR: dbxFlag_dataR12
181 ; --- Macro: ECTRL ---
185 ; Use: Ends a control definition
191 dbx__sz$dbx__c EQU {PC}-dbx__s$dbx__c
195 ; --- Macro: DBXEND ---
199 ; Use: Terminates a list of control entries for a dialogue box.
206 ;----- Standard dbx flags ---------------------------------------------------
208 ; Individual controls may have their own flags starting at bit 8.
210 dbxFlag_dataR10 EQU (1<<0) ;Has R10-relative data
211 dbxFlag_dataR12 EQU (1<<1) ;Has R12-relative data
213 ;----- dbx event codes ------------------------------------------------------
218 ; R1 == icon handle of control
219 ; R8 == pointer to control workspace
220 ; R9 == pointer to control definition body
221 ; R10 == dialogue box handle
222 ; R12 == control handler workspace
225 dbxEvent_click # 1 ;Mouse click on the control
228 dbxEvent_redraw # 1 ;Redraw or update the control
229 ;R2-R5 == coords of control
230 ;R6 == ptr to graphics window
232 dbxEvent_key # 1 ;Key pressed
235 dbxEvent_drop # 1 ;File dropped on control
237 ;R3 == pointer to filename
238 ;R4 == estimated file size
239 ;R5 == subreason code
241 dbxEvent_help # 1 ;Help request for control
243 dbxEvent_update # 1 ;Quick update request
244 ;R2-R5 == coords of control
245 ;R6 == ptr to graphics window
247 dbxEvent_lifeCycle # 1 ;Dialogue state change
248 ;R1 == dblc lifecycle code
250 ; --- dbxEvent_drop subreason codes ---
256 ; --- dbx event masks ---
258 dbxMask_click EQU (1<<dbxEvent_click)
259 dbxMask_redraw EQU (1<<dbxEvent_redraw)
260 dbxMask_key EQU (1<<dbxEvent_key)
261 dbxMask_drop EQU (1<<dbxEvent_drop)
262 dbxMask_help EQU (1<<dbxEvent_help)
263 dbxMask_update EQU (1<<dbxEvent_update)
264 dbxMask_lifeCycle EQU (1<<dbxEvent_lifeCycle)
268 ;----- That's all, folks ----------------------------------------------------