"
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
DisplaySurface subclass:#DisplayRootView
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Views-Special'
!
!DisplayRootView class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
this class describes Xs rootWindow (which is the background window and
can be used for drawing outside of Views i.e. for dragging between Views).
For historic and compatibility reasons, there is a global variable
called 'RootView', which is bound to the default displays ('Display')
rootview. We recommend, not to access this variable, instead, get a
displays rootView via the #rootView message (sent to the device).
Otherwise, your application will not work in a multiScreen environment.
Instances of myself (i.e. these rootViews) are light-weight views;
they do not support events, models etc.
They are pure drawing canvases and should be only used for special
applications (i.e. dragging).
There may be display systems in which rootViews are not
supported/allowed implemented. So be VERY careful when using them.
Be aware, that the rootView is not always visible - some
windowManagers install another (pseudoRoot), into which icons and
windowManager menus are drawn. If that is the case, your paining
into the rootView may not be visible, unless you set the #noClipByChildren
option (see below).
In general, you should never use the rootView for normal applications.
To draw in the (Displays) root window:
|rootView|
rootView := Screen current rootView.
rootView paint:(Color red).
rootView fillRectangleX:10 y:10 width:100 height:100.
of course, all stuff from View and its superclasses can be used:
|rootView|
rootView := Screen current rootView.
rootView paint:(Color red).
rootView noClipByChildren.
rootView fillRectangleX:10 y:10 width:100 height:100.
[author:]
Claus Gittinger
"
! !
!DisplayRootView class methodsFor:'initialization'!
initialize
Display isNil ifTrue:[
Workstation initialize
].
super initialize
! !
!DisplayRootView class methodsFor:'instance creation'!
on:aDisplay
"since there is only one RootView - catch new and return
the one and only rootView."
aDisplay == Display ifTrue:[
RootView notNil ifTrue:[^ RootView].
RootView := super on:aDisplay.
^ RootView
].
^ super on:aDisplay
! !
!DisplayRootView methodsFor:'accessing'!
controller
"I have no controller"
^ nil
!
name
^ 'RootWindow'
!
sensor
"I have no sensor"
^ nil
!
windowGroup
"I have no windowGroup"
^ nil
! !
!DisplayRootView methodsFor:'destroying'!
destroy
"catch destroy - some windowmanagers get confused if
we destroy the rootWindow if its a virtual root window"
^ self
! !
!DisplayRootView methodsFor:'initialization'!
initialize
super initialize.
width := device width.
height := device height.
drawableId := device rootWindowFor:self.
realized := true.
!
reinitialize
"reinit after snapin"
width := device width.
height := device height.
drawableId := device rootWindowFor:self.
realized := true.
gcId := nil.
! !
!DisplayRootView methodsFor:'queries'!
canDrop:anObjectOrCollection
"return true, if anObjectOrCollection can be
dropped in the receiver. This method should be
redefined in views which can take objects"
^ false
!
isRootView
"yes, I am a rootview"
^ true
"Created: 5.7.1996 / 13:48:24 / cg"
"Modified: 5.7.1996 / 14:57:44 / cg"
!
isWindowManagerRunning
"answer true, if a window manager is currently running.
This is done by performing an action (enabling button events of
root window), which will fail if a window manager is running."
|errorOccured|
errorOccured := false.
device class deviceErrorSignal handle:[:ex |
errorOccured := true.
ex return
] do:[
self enableButtonEvents.
device flush.
].
^ errorOccured
"
DisplayRootView new
RootView isWindowManagerRunning
"
!
shown
"a rootview is always assumed to be visible"
^ true
"Created: 5.7.1996 / 13:48:05 / cg"
"Modified: 5.7.1996 / 14:57:34 / cg"
! !
!DisplayRootView class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview/Attic/DRootView.st,v 1.19 1997-01-18 17:22:06 cg Exp $'
! !
DisplayRootView initialize!