; ; buttons.sh ; ; Definitions for button blocks ; ; © 1995-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: ; ; buttons_setup ; ; Macros provided: ; ; BUTTON ; BUTEND ; BCANCEL ; BOK ; BHELP ; BGAP [ :LNOT::DEF:buttons__dfn GBLL buttons__dfn ;+ LIB sapphire:^.bsh.stdDbox ; --- buttons_setup --- ; ; On entry: R0 == dialogue box handle ; R1 == pointer to buttons block ; R2 == buttons base icon ; R3 == number of buttons to allow ; ; On exit: R2 == buttons flag mask ; R3 == cancel button icon, or -1 ; ; Use: Sets up a dialogue box's buttons according to a buttons ; block. IMPORT buttons_setup ;----- Macros --------------------------------------------------------------- GBLA but__c but__c SETA 0 GBLA but__fl but__fl SETA 0 ; --- Macro: BUTTON --- ; ; Arguments: msg == message tag to put in button ; ; Use: Inserts a text button into a buttons definition block. MACRO $label BUTTON $msg but__f$but__c EQU but__fl but__c SETA but__c+1 but__fl SETA bFlag_text $label DCD but__f$but__c DCB "$msg",0 ALIGN MEND ; --- Macro: BCANCEL --- ; ; Arguments: text == optional text string (default is `Cancel') ; ; Use: Inserts a cancel button into a buttons definition block. MACRO $label BCANCEL $text but__f$but__c EQU but__fl but__c SETA but__c+1 but__fl SETA bFlag_cancel $label DCD but__f$but__c [ "$text"<>"" but__fl SETA but__fl :OR: bFlag_text DCB "$text",0 ] MEND ; --- Macro: BOK --- ; ; Arguments: -- ; ; Use: Inserts an OK button into a buttons definition block. MACRO $label BOK but__f$but__c EQU but__fl but__c SETA but__c+1 but__fl SETA bFlag_ok $label DCD but__f$but__c MEND ; --- Macro: BHELP --- ; ; Arguments: -- ; ; Use: Inserts a help button into a buttons definition block. MACRO $label BHELP but__f$but__c EQU but__fl but__c SETA but__c+1 but__fl SETA bFlag_help $label DCD but__f$but__c MEND ; --- Macro: BGAP --- ; ; Arguments: -- ; ; Use: Omits a button in a buttons definition block. MACRO $label BGAP but__f$but__c EQU but__fl but__c SETA but__c+1 but__fl SETA 0 $label DCD but__f$but__c MEND ; --- Macro: BUTEND --- ; ; Arguments: -- ; ; Use: Terminates a buttons definition block. MACRO $label BUTEND but__f$but__c EQU but__fl+bFlag_last but__c SETA but__c+1 $label MEND ;----- Button block formats ------------------------------------------------- bFlag_cancel EQU (1<<0) ;This is the cancel button ;+0 bFlag_ok EQU (1<<1) ;This is the OK button ;+0 bFlag_help EQU (1<<2) ;This is the help button ;+0 bFlag_text EQU (1<<3) ;This button contains text ;+0 == message tag ;+n bFlag_last EQU (1<<31) ;This is the last item ;+0 ] ;----- That's all, folks ---------------------------------------------------- END