New class LicenceBox.
authorStefan Vogel <sv@exept.de>
Mon, 09 Sep 1996 19:06:47 +0200
changeset 240 f24a0853e754
parent 239 a0e97ba3d7f4
child 241 687df61a0e84
New class LicenceBox.
LicenceBox.st
Make.proto
resources/LicenceBox.rs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LicenceBox.st	Mon Sep 09 19:06:47 1996 +0200
@@ -0,0 +1,145 @@
+'From Smalltalk/X, Version:2.10.9 on 9-sep-1996 at 18:00:22'                    !
+
+DialogBox subclass:#LicenceBox
+	instanceVariableNames:'accepted destroySemaphore'
+	classVariableNames:'LicenceRejectSignal'
+	poolDictionaries:''
+	category:'Views-DialogBoxes'
+!
+
+!LicenceBox  class methodsFor:'documentation'!
+
+documentation
+"
+    LicenceBox shows a licence text when opened, an returns true,
+    if the licence has been accepted, false otherwise.
+"
+!
+
+examples
+"
+                                                [exBegin]
+    LicenceRejectSignal handle:[:ex|
+        Transcript showCR:'Licence rejected'.
+    ] do:[
+        LicenceBox open.
+        Transcript showCR:'Licence accepted'.
+    ] 
+                                                [exEnd]
+"
+!
+
+history
+
+    "Created: 6.9.1996 / 13:29:15 / stefan"
+    "Modified: 9.9.1996 / 14:53:11 / stefan"
+! !
+
+!LicenceBox  class methodsFor:'initialization'!
+
+initialize
+    LicenceRejectSignal isNil ifTrue:[
+        LicenceRejectSignal := ErrorSignal newSignalMayProceed:true.
+        LicenceRejectSignal nameClass:self message:#licenceRejectSignal.
+        LicenceRejectSignal notifierString:'licence rejected by user'.
+    ].
+
+    "
+     self initialize
+    "
+! !
+
+!LicenceBox  class methodsFor:'instance creation'!
+
+open
+    "open myself modal and return true if accepted, false otherwise"
+
+    ^ super open accepted.
+
+    "
+     self open
+    "
+
+    "Modified: 9.9.1996 / 17:52:48 / stefan"
+! !
+
+!LicenceBox  class methodsFor:'Signal constants'!
+
+licenceRejectSignal
+    "licence has been rejected by user"
+
+    ^ LicenceRejectSignal
+
+! !
+
+!LicenceBox methodsFor:'accessing'!
+
+accepted
+    "return accepted"
+
+    ^ accepted
+
+    "Created: 6.9.1996 / 13:24:44 / stefan"
+!
+
+accepted:something
+    "set accepted"
+
+    accepted := something.
+
+    "Created: 6.9.1996 / 13:24:44 / stefan"
+! !
+
+!LicenceBox methodsFor:'destroying'!
+
+terminate
+    "this is the close from a windowmanager
+     (only if UseTransientViews == true).
+     Redefined, since ModalBox keeps the View alive (only hidden)"
+
+    self destroy.
+
+    "Created: 9.9.1996 / 15:15:31 / stefan"
+! !
+
+!LicenceBox methodsFor:'initialization'!
+
+initialize    
+    |textView|
+
+    super initialize.
+    accepted := false.
+
+    (self addTextLabel:(resources string:'Please read the licence terms:')) adjust:#left.
+    textView := self addTextBoxOn:nil 
+                        class:HTMLDocumentView
+                        withNumberOfLines:40 
+                        hScrollable:true 
+                        vScrollable:true.
+    self width:(textView preferredExtentForLines:40 cols:70) x.
+    textView setText:(self licenceText).
+    self addAbortButtonLabelled:(resources string:'reject licence terms').
+    self addOkButtonLabelled:(resources string:'accept licence terms').
+    self abortAction:[self destroy. accepted := false. LicenceRejectSignal raise].
+    self okAction:[self destroy. accepted := true].
+    self stickAtBottomWithVariableHeight:textView.
+
+    "Modified: 9.9.1996 / 17:52:13 / stefan"
+! !
+
+!LicenceBox methodsFor:'private'!
+
+licenceText
+   "get licence text"
+
+   ^ (resources at:'LICENCEFILE') asFilename readStream contents.
+
+    "Created: 6.9.1996 / 12:17:07 / stefan"
+! !
+
+!LicenceBox  class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libwidg2/LicenceBox.st,v 1.1 1996-09-09 17:06:46 stefan Exp $'
+! !
+LicenceBox initialize!
--- a/Make.proto	Thu Sep 05 11:55:57 1996 +0200
+++ b/Make.proto	Mon Sep 09 19:06:47 1996 +0200
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libwidg2/Make.proto,v 1.49 1996-07-22 23:25:28 cg Exp $
+# $Header: /cvs/stx/stx/libwidg2/Make.proto,v 1.50 1996-09-09 17:06:46 stefan Exp $
 #
 # -------------- no need to change anything below ----------
 
@@ -70,6 +70,7 @@
 		ViewScroller.$(O)
 
 OBJS= \
+		LicenceBox.$(O)		\
 		Slider.$(O)             \
 		HSlider.$(O)            \
 		LEnterFld.$(O)          \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/resources/LicenceBox.rs	Mon Sep 09 19:06:47 1996 +0200
@@ -0,0 +1,20 @@
+; $Header: /cvs/stx/stx/libwidg2/resources/Attic/LicenceBox.rs,v 1.1 1996-09-09 17:06:47 stefan Exp $
+;
+; LicenceBox
+;
+; messages & button labels
+;
+; this file contains 8bit national characters;
+; DONT EDIT this file with an old vi !
+;
+
+'LICENCEFILE'                           '../../doc/online/english/LICENCE.STX'     
+
+#if (Language == #german) or:[Language == #de]
+'LICENCEFILE'                           '../../doc/online/german/LICENCE.STX'     
+'Please read the licence terms:'        'Bitte lesen Sie die Lizenzbedingungen:'
+'accept licence terms'                  'Lizenzbedingungen akzeptieren'
+'reject licence terms'                  'Lizenzbedingungen ablehnen'
+#endif
+
+