; ; mbox.s ; ; Handling for monologue boxes (MDW) ; ; © 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. ;----- Standard header ------------------------------------------------------ GET libs:header GET libs:swis ;----- External dependencies ------------------------------------------------ GET sapphire:dbox GET sapphire:help GET sapphire:msgs ;----- Main code ------------------------------------------------------------ AREA |Sapphire$$Code|,CODE,READONLY ; --- mbox --- ; ; On entry: R0 == dialogue box handle ; R1 == pointer to help message tag for dialogue box ; R2 == icon handle for embedded title ; ; On exit: -- ; ; Use: Displays a `monologue' box (i.e. a dialogue box which just ; displays information to the user) on the screen and sets up ; an event handler for it. The dialogue box is destroyed when ; it is closed. ; ; If the dialogue box does not have a title bar (read by ; dbox_hasTitle) then R2 is used to give the monologue box ; an embedded title. R2 is not used otherwise, and thus may ; safely contain any old rubbish. EXPORT mbox mbox ROUT STMFD R13!,{R1-R3,R14} ;Save some registers BL dbox_hasTitle ;Does it have a title bar? MOVCC R1,R2 ;Yes -- move icon number in BLCC dbox_setEmbeddedTitle ;Give dbox embedded title BLCC dbox_setClickDrag ;And make clicks move it LDR R3,[R13,#0] ;Pass help message in R12 MOV R2,R0 ;Pass dbox handle in R10 ADR R1,mbox__handler ;Point to event handler BL dbox_eventHandler ;Register my event handler MOV R1,#dbOpen_pointer :OR: dbOpen_trans BL dbox_open ;Open as transient dialogue LDMFD R13!,{R1-R3,PC}^ ;Return to caller LTORG ; --- mbox__handler --- ; ; On entry: R0 == dialogue box event code ; R1-R9 == dependent on event type ; R10 == dialogue box handle ; R12 == pointer to help message for the dialogue box ; ; On exit: -- ; ; Use: Handles events for a monologue box window. mbox__handler ROUT ; --- Return unknown events very quickly --- CMP R0,#dbEvent_close ;Is the window closing? BEQ %00mbox__handler ;Yes -- jump round to it CMPNE R0,#dbEvent_help ;Or is the user wanting help? MOVNES PC,R14 ;Neither -- ignore it ; --- User wants some help on the dbox --- STMFD R13!,{R0,R14} ;Save some registers MOV R0,R12 ;Find the help message BL msgs_lookup ;Translate it nicely BL help_add ;Add it to the help message BL dbox_help ;Read help from the window LDMFD R13!,{R0,R14} ;Restore the registers ORRS PC,R14,#C_flag ;I handled the event ; --- Something closed the window --- 00mbox__handler STMFD R13!,{R0,R14} ;Save some registers MOV R0,R10 ;Get the dialogue box handle BL dbox_destroy ;Get rid of the dialogue LDMFD R13!,{R0,R14} ;Restore the registers ORRS PC,R14,#C_flag ;I handled the event again LTORG ;----- That's all, folks ---------------------------------------------------- END