PopUpView.st
changeset 89 ea2bf46eb669
parent 81 4ba554473294
child 135 cf8e46015072
equal deleted inserted replaced
88:8f9c629a4245 89:ea2bf46eb669
    20 
    20 
    21 PopUpView comment:'
    21 PopUpView comment:'
    22 COPYRIGHT (c) 1989 by Claus Gittinger
    22 COPYRIGHT (c) 1989 by Claus Gittinger
    23 	      All Rights Reserved
    23 	      All Rights Reserved
    24 
    24 
    25 $Header: /cvs/stx/stx/libview/PopUpView.st,v 1.9 1994-11-17 14:29:40 claus Exp $
    25 $Header: /cvs/stx/stx/libview/PopUpView.st,v 1.10 1995-02-06 00:37:38 claus Exp $
    26 '!
    26 '!
    27 
    27 
    28 !PopUpView class methodsFor:'documentation'!
    28 !PopUpView class methodsFor:'documentation'!
    29 
    29 
    30 copyright
    30 copyright
    41 "
    41 "
    42 !
    42 !
    43 
    43 
    44 version
    44 version
    45 "
    45 "
    46 $Header: /cvs/stx/stx/libview/PopUpView.st,v 1.9 1994-11-17 14:29:40 claus Exp $
    46 $Header: /cvs/stx/stx/libview/PopUpView.st,v 1.10 1995-02-06 00:37:38 claus Exp $
    47 "
    47 "
    48 !
    48 !
    49 
    49 
    50 documentation
    50 documentation
    51 "
    51 "
    52     this class implements an abstract superclass for all views which bypass the 
    52     this class implements an abstract superclass for all views which bypass the 
    53     window manager and pop up on top of the screen. 
    53     window manager and pop up on top of the screen. A typical example is
    54     They are usually not decorated by window managers.
    54     a PopUpMenu. PopUpView itself is abstract, providing basic mechanisms.
       
    55     They are not decorated by window managers.
    55 
    56 
    56     styleSheet parameters:
    57     styleSheet parameters:
    57 
    58 
    58 	popupShadow         <Boolean>           if true, popupViews show a shadow below
    59 	popupShadow         <Boolean>           if true, popupViews show a shadow below
    59 	popupLevel          <nil | Integer>     3D level
    60 	popupLevel          <nil | Integer>     3D level
    72     DefaultLevel := StyleSheet at:'popupLevel'.
    73     DefaultLevel := StyleSheet at:'popupLevel'.
    73     DefaultBorderWidth := StyleSheet at:'popupBorderWidth'.
    74     DefaultBorderWidth := StyleSheet at:'popupBorderWidth'.
    74     DefaultBorderColor := StyleSheet colorAt:'popupBorderColor'.
    75     DefaultBorderColor := StyleSheet colorAt:'popupBorderColor'.
    75 ! !
    76 ! !
    76 
    77 
    77 !PopUpView methodsFor:'initialization / release'!
    78 !PopUpView methodsFor:'initialize / release'!
    78 
    79 
    79 initialize
    80 initialize
    80     |center|
    81     |center|
    81 
    82 
    82     super initialize.
    83     super initialize.
   153     device dispatchFor:drawableId while:[haveControl]
   154     device dispatchFor:drawableId while:[haveControl]
   154 !
   155 !
   155 
   156 
   156 leaveControl
   157 leaveControl
   157     haveControl := false
   158     haveControl := false
       
   159 !
       
   160 
       
   161 regainControl
       
   162     device grabPointerInView:self 
       
   163 ! !
       
   164 
       
   165 !PopUpView methodsFor:'activation'!
       
   166 
       
   167 show
       
   168     "realize the view at its last position"
       
   169 
       
   170     self fixSize.
       
   171     self openModal:[true] "realize     "
       
   172 !
       
   173 
       
   174 showAt:aPoint resizing:aBoolean
       
   175     "realize the view at aPoint"
       
   176 
       
   177     aBoolean ifTrue:[
       
   178 	self fixSize.
       
   179     ].
       
   180     self origin:aPoint.
       
   181     self makeFullyVisible.
       
   182     self openModal:[true] "realize     "
       
   183 !
       
   184 
       
   185 showAt:aPoint
       
   186     "realize the view at aPoint"
       
   187 
       
   188     self showAt:aPoint resizing:true 
       
   189 !
       
   190 
       
   191 showCenteredIn:aView
       
   192     "make myself visible at the screen center."
       
   193 
       
   194     |top|
       
   195 
       
   196     top := aView topView.
       
   197     top raise.
       
   198     self showAt:(top origin 
       
   199 		 + (aView originRelativeTo:top) 
       
   200 		 + (aView extent // 2)
       
   201 		 - (self extent // 2))
       
   202 !
       
   203 
       
   204 showAtPointer
       
   205     "realize the view at the current pointer position"
       
   206 
       
   207     self showAt:(device pointerPosition) resizing:true
       
   208 !
       
   209 
       
   210 hide
       
   211     "hide the view, leave its modal event loop"
       
   212 
       
   213     windowGroup notNil ifTrue:[
       
   214 	windowGroup removeView:self.
       
   215 	windowGroup := nil.
       
   216     ].
       
   217     self unrealize.
   158 ! !
   218 ! !
   159 
   219 
   160 !PopUpView methodsFor:'realize / unrealize'!
   220 !PopUpView methodsFor:'realize / unrealize'!
   161 
   221 
   162 mapped
   222 mapped