Initial revision
[ssr] / StraySrc / Libraries / Sapphire / sh / writable
1 ;
2 ; writable.sh
3 ;
4 ; Writable dialogue boxes
5 ;
6 ; © 1994-1998 Straylight
7 ;
8
9 ;----- Licensing note -------------------------------------------------------
10 ;
11 ; This file is part of Straylight's Sapphire library.
12 ;
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)
16 ; any later version.
17 ;
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.
22 ;
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.
26
27 ;----- Overview -------------------------------------------------------------
28 ;
29 ; Functions provided:
30 ;
31 ; writable
32 ; wrt_init
33 ;
34 ; Macros provided:
35 ;
36 ; WRTABLE
37
38 [ :LNOT::DEF:writable__dfn
39 GBLL writable__dfn
40
41 ;+ LIB sapphire:^.bsh.stdDbox
42
43 ; --- writable ---
44 ;
45 ; On entry: R0 == pointer to writable dialogue block
46 ; R1 == pointer to default string to display, or 0 for null
47 ; R2 == pointer to routine to call when string set
48 ; R3 == value to pass to routine in R10
49 ; R4 == value to pass to routine in R12
50 ;
51 ; On exit: R0 == dialogue handle of created dialogue box
52 ; May return an error
53 ;
54 ; Use: Displays a writable dialogue box, i.e. one with a writable
55 ; icon and OK button, used instead of writable menu items,
56 ; for reasons to do with caret blinking and pointer changing.
57 ;
58 ; The writable dialogue block consists of:
59 ;
60 ; Size Meaning
61 ; ~~~~ ~~~~~~~
62 ; 4 Flags (see below)
63 ; n Validation string to use, may be null
64 ; m Title string (message tag) to display
65 ;
66 ; The flags are:
67 ;
68 ; Bit Meaning
69 ; ~~~ ~~~~~~~
70 ; 0-7 Maximum string length
71 ; 8 Right align text in writable icon
72 ; 9-31 Reserved; must be 0
73 ;
74 ; The routine returns a dialogue handle because you may want
75 ; to attach a numWrite control to the writable icon, which
76 ; is icon number 0.
77 ;
78 ; The handler routine is passed:
79 ;
80 ; R0 == pointer to string typed in
81 ; R1 == dialogue box handle (for numWrite again)
82 ; R10, R12 as set up here
83 ;
84 ; It must preserve all registers. If the carry flag is set
85 ; on exit, the dialogue box will not be closed. If it is
86 ; clear, the dialogue may be closed depending on the button
87 ; status.
88 ;
89 ; Note that this routine does *not* require a template --
90 ; a suitable window is generated at run-time.
91
92 IMPORT writable
93
94 ; --- wrt_init ---
95 ;
96 ; On entry: --
97 ;
98 ; On exit: --
99 ;
100 ; Use: Initialises the writable dialogue box for use.
101
102 IMPORT wrt_init
103
104 ; --- Useful constants ---
105
106 wrtFlag_rAlign EQU (1<<8) ;Right align text in icon
107
108 ; --- Macro: WRTABLE ---
109 ;
110 ; Arguments: len == maximum string length to allow
111 ; flags == other flags to set
112 ; valid == (optional) validation string
113 ; title == title message tag string
114 ;
115 ; Use: Builds a writable definition block.
116
117 MACRO
118 $label WRTABLE $len,$flags,$valid,$title
119 ALIGN
120 $label
121 DCD $len :OR: $flags
122 DCB "$valid",0
123 DCB "$title",0
124 MEND
125
126 ]
127
128 ;----- That's all, folks ----------------------------------------------------
129
130 END