DisplayRootView.st
author matilk
Wed, 13 Sep 2017 09:40:34 +0200
changeset 8174 2704c965b97b
parent 7979 46a3a8b1ee23
child 8249 71f1fac253b3
permissions -rw-r--r--
#BUGFIX by Maren class: DeviceGraphicsContext changed: #displayDeviceOpaqueForm:x:y: nil check
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
3253
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
    12
"{ Package: 'stx:libview' }"
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
    13
6753
57fff98ba620 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6574
diff changeset
    14
"{ NameSpace: Smalltalk }"
57fff98ba620 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6574
diff changeset
    15
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 626
diff changeset
    16
DisplaySurface subclass:#DisplayRootView
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    17
	instanceVariableNames:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    18
	classVariableNames:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    19
	poolDictionaries:''
626
9f4a3aa6f8e2 class category changes
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    20
	category:'Views-Special'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    21
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    22
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    23
!DisplayRootView class methodsFor:'documentation'!
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    24
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    25
copyright
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    26
"
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    27
 COPYRIGHT (c) 1988 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    28
	      All Rights Reserved
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    29
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    30
 This software is furnished under a license and may be used
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    31
 only in accordance with the terms of that license and with the
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    33
 be provided or otherwise made available to, or used by, any
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    34
 other person.  No title to or ownership of the software is
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    35
 hereby transferred.
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    36
"
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    37
!
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    38
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    39
documentation
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    40
"
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    41
    this class describes the rootWindow (which is the background window or
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    42
    desktop and can be used for drawing outside of Views 
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    43
    i.e. for dragging between Views).
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    44
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    45
    For historic and compatibility reasons, there is a global variable 
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    46
    called 'RootView', which is bound to the default displays ('Display')
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    47
    rootview. We recommend, not to access this variable, instead, get a
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    48
    displays rootView via the #rootView message (sent to the device).
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    49
    Otherwise, your application will not work in a multiScreen environment.
180
claus
parents: 134
diff changeset
    50
claus
parents: 134
diff changeset
    51
    Instances of myself (i.e. these rootViews) are light-weight views; 
claus
parents: 134
diff changeset
    52
    they do not support events, models etc.
claus
parents: 134
diff changeset
    53
    They are pure drawing canvases and should be only used for special
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    54
    applications (i.e. dragging). 
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    55
    There may be display systems in which rootViews are not
180
claus
parents: 134
diff changeset
    56
    supported/allowed implemented. So be VERY careful when using them.
134
claus
parents: 109
diff changeset
    57
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    58
    Be aware, that the rootView is not always visible - some
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    59
    windowManagers install another (pseudoRoot), into which icons and
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    60
    windowManager menus are drawn. If that is the case, your paining
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    61
    into the rootView may not be visible, unless you set the #noClipByChildren
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    62
    option (see below).
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    63
    Also, it is not guaranteed, that all devices support drawing in the
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    64
    root window - especially if the device is a simulated one, such as
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    65
    a remote webBrowser ...
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    66
    In general, you should never use the rootView for normal applications.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    67
134
claus
parents: 109
diff changeset
    68
    To draw in the (Displays) root window:
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    69
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    70
        |rootView|
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    71
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    72
        rootView := Screen current rootView.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    73
        rootView paint:(Color red).
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    74
        rootView fillRectangleX:10 y:10 width:100 height:100.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    75
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    76
    of course, all stuff from View and its superclasses can be used:
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    77
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    78
        |rootView|
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    79
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    80
        rootView := Screen current rootView.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    81
        rootView paint:(Color red).
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    82
        rootView noClipByChildren.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    83
        rootView fillRectangleX:10 y:10 width:100 height:100.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    84
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    85
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    86
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    87
        Claus Gittinger
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    88
"
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    89
! !
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    90
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    91
!DisplayRootView class methodsFor:'instance creation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    92
1256
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
    93
onDevice:aDisplay
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    94
    "since there is only one RootView - catch new and return
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    95
     the one and only rootView."
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    96
134
claus
parents: 109
diff changeset
    97
    aDisplay == Display ifTrue:[
3337
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
    98
        RootView notNil ifTrue:[
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
    99
            RootView device == aDisplay ifTrue:[
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
   100
                ^ RootView
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
   101
            ]
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
   102
        ].
1256
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   103
        RootView := super onDevice:aDisplay.
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   104
        ^ RootView
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   105
    ].
1256
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   106
    ^ super onDevice:aDisplay
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   107
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3337
diff changeset
   108
    "Created: 18.1.1997 / 18:23:22 / cg"
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3337
diff changeset
   109
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   110
48194c26a46c Initial revision
claus
parents:
diff changeset
   111
!DisplayRootView methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   112
4214
4b2fa686d9a1 *** empty log message ***
penk
parents: 4213
diff changeset
   113
model
4b2fa686d9a1 *** empty log message ***
penk
parents: 4213
diff changeset
   114
    ^ nil
4b2fa686d9a1 *** empty log message ***
penk
parents: 4213
diff changeset
   115
!
4b2fa686d9a1 *** empty log message ***
penk
parents: 4213
diff changeset
   116
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   117
name
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   118
    "return my name - always 'RootWindow'"
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   119
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   120
    ^ 'RootWindow'
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   121
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   122
3253
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   123
subViews
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   124
    "return the collection of subviews - none here"
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   125
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   126
    ^ #()
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   127
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   128
4981
780ccc05227b +view uuids
fm
parents: 4650
diff changeset
   129
!
780ccc05227b +view uuids
fm
parents: 4650
diff changeset
   130
780ccc05227b +view uuids
fm
parents: 4650
diff changeset
   131
uuid
4989
fm
parents: 4981
diff changeset
   132
    "return my uuid - always the same here.
fm
parents: 4981
diff changeset
   133
     TODO: think what happens with multiple screens..."
4981
780ccc05227b +view uuids
fm
parents: 4650
diff changeset
   134
7654
d38246725fb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7627
diff changeset
   135
    ^ UUID readFrom:'31be9300-41fc-11dd-b99f-001558137da0'  "/ do not change - ask cg if you don't know why
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   136
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   137
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   138
!DisplayRootView methodsFor:'destroying'!
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   139
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   140
destroy
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   141
    "catch destroy - some windowmanagers get confused if
7880
bf75e8d6bbe1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7654
diff changeset
   142
     we destroy the rootWindow if it's a virtual root window"
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   143
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   144
    ^ self
7880
bf75e8d6bbe1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7654
diff changeset
   145
bf75e8d6bbe1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 7654
diff changeset
   146
    "Modified (comment): / 13-02-2017 / 20:01:04 / cg"
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   147
! !
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   148
3253
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   149
!DisplayRootView methodsFor:'dummy'!
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   150
7627
86ebf06e43a1 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7266
diff changeset
   151
keyboardZoom:larger
86ebf06e43a1 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7266
diff changeset
   152
    "/ MUST be ignored here
86ebf06e43a1 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7266
diff changeset
   153
!
86ebf06e43a1 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 7266
diff changeset
   154
3253
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   155
redrawX:x y:y width:width height:height
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   156
    "ignored"
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   157
! !
0dd15811ccc2 dummies added
Claus Gittinger <cg@exept.de>
parents: 2916
diff changeset
   158
6574
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   159
!DisplayRootView methodsFor:'hotkeys'!
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   160
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   161
addHotKeyHandler:handler forKey:aKey modifierMask:optionalModifierMaskOrNil
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   162
    "install a handler (which should implement keyPress:x:y:view:
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   163
     and keyRelease:x:y:view: on aKey.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   164
     aKey should be a symbolic key (like #F2).
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   165
     modifierMask may constraint the key to be only handled when a certain
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   166
     modifier is pressed (use a bitOr combination of device ctrlModifierMask,
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   167
     altModifierMask etc.) or nil, so the key is always treated as a hotkey"
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   168
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   169
    self sensor addEventListener:handler.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   170
    device 
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   171
        grabKey:aKey
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   172
        modifier:optionalModifierMaskOrNil
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   173
        window:self.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   174
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   175
    "
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   176
     Display rootView sensor removeAllEventListeners.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   177
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   178
     Display rootView
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   179
        addHotKeyHandler:[:ev |
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   180
Transcript showCR:ev.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   181
            ev key = 'F3' ifTrue:[
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   182
                Dialog information:'YES!!'.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   183
            ].
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   184
            false.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   185
        ]
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   186
        forKey:'F3'
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   187
        modifierMask:nil
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   188
    "
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   189
!
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   190
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   191
removeHotKeyHandler:handler forKey:aKey modifierMask:optionalModifierMaskOrNil
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   192
    "install a handler (which should implement keyPress:x:y:view:
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   193
     and keyRelease:x:y:view: on aKey.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   194
     aKey should be a symbolic key (like #F2).
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   195
     modifierMask may constraint the key to be only handled when a certain
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   196
     modifier is pressed (use a bitOr combination of device ctrlModifierMask,
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   197
     altModifierMask etc.) or nil, so the key is always treated as a hotkey"
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   198
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   199
    self sensor removeEventListener:handler.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   200
    device 
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   201
        ungrabKey:aKey
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   202
        modifier:optionalModifierMaskOrNil
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   203
        window:self.
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   204
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   205
    "
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   206
    "
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   207
! !
34a582daa1a3 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6373
diff changeset
   208
3883
4e01a59afccb method category rename
Claus Gittinger <cg@exept.de>
parents: 3856
diff changeset
   209
!DisplayRootView methodsFor:'initialization & release'!
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   210
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   211
initialize
6233
b746fb9ba0e3 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 4989
diff changeset
   212
    |dev|
b746fb9ba0e3 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 4989
diff changeset
   213
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   214
    super initialize.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   215
6233
b746fb9ba0e3 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 4989
diff changeset
   216
    dev := self device.
b746fb9ba0e3 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 4989
diff changeset
   217
    width := dev width.
b746fb9ba0e3 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 4989
diff changeset
   218
    height := dev height.
6342
d2a4135ecf36 Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents: 6282
diff changeset
   219
    self createRootWindow.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   220
    realized := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   221
!
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   222
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   223
reinitialize
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   224
    "reinit after snapin"
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   225
6349
61ffd119fe62 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 6342
diff changeset
   226
    self recreate.
61ffd119fe62 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 6342
diff changeset
   227
    self createRootWindow.
7266
6b9ccc0ad0c8 device access
Claus Gittinger <cg@exept.de>
parents: 6986
diff changeset
   228
    width := device width.
6b9ccc0ad0c8 device access
Claus Gittinger <cg@exept.de>
parents: 6986
diff changeset
   229
    height := device height.
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   230
    realized := true.
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   231
! !
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   232
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   233
!DisplayRootView methodsFor:'queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   234
4650
fd25e32de1e3 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 4221
diff changeset
   235
canDropObjects:aCollectionOfDropObjects
1584
03d62f063935 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   236
    "return true, if aCollectionOfDropObjects can be
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   237
     dropped in the receiver. 
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   238
     False is returned here, since nothing can be dropped on the desktop.
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   239
     (for now - actually some systems do allow dropping things on the desktop
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   240
      and this query should be forwarded to my display device)"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   241
48194c26a46c Initial revision
claus
parents:
diff changeset
   242
    ^ false
1584
03d62f063935 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   243
4650
fd25e32de1e3 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 4221
diff changeset
   244
    "Created: / 13-10-2006 / 15:55:54 / cg"
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   245
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   246
6764
aef0ae36406c class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
   247
isActive
aef0ae36406c class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
   248
    "for protocol compatibility with regular views"
aef0ae36406c class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
   249
aef0ae36406c class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
   250
    ^ false.
aef0ae36406c class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
   251
!
aef0ae36406c class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
   252
6753
57fff98ba620 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6574
diff changeset
   253
isComponentOf: aView
57fff98ba620 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6574
diff changeset
   254
    ^ false
57fff98ba620 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6574
diff changeset
   255
!
57fff98ba620 class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6574
diff changeset
   256
919
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   257
isRootView
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   258
    "return true, since yes, I am a rootview"
919
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   259
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   260
    ^ true
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   261
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   262
    "Created: 5.7.1996 / 13:48:24 / cg"
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   263
    "Modified: 5.7.1996 / 14:57:44 / cg"
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   264
!
47b7aff0f1e4 added #isRootView & #shown queries
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   265
6986
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   266
isSameOrComponentOf:aView
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   267
    "return true, if I am aView or a (direct or indirect) component of aView"
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   268
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   269
    ^ self == aView
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   270
!
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   271
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   272
isWindowManagerRunning
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   273
    "answer true, if a window manager is currently running.
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   274
     This is done by performing an action (enabling button events of
23
4a7e02de7b72 *** empty log message ***
claus
parents: 6
diff changeset
   275
     root window), which will fail if a window manager is running."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   276
6373
70df108aa81f class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6349
diff changeset
   277
    device isWindowsPlatform ifTrue:[^ true].
70df108aa81f class: DisplayRootView
Claus Gittinger <cg@exept.de>
parents: 6349
diff changeset
   278
    device class deviceErrorSignal handle:[:ex |
4221
666dea8f4aa7 Do not move messages to superclass (where they are sent)
Stefan Vogel <sv@exept.de>
parents: 4214
diff changeset
   279
        ^ false.
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   280
    ] do:[
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
   281
        self enableButtonEvents.
6267
5eb0ba53aa2a class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 6233
diff changeset
   282
        self flush.
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   283
    ].
4221
666dea8f4aa7 Do not move messages to superclass (where they are sent)
Stefan Vogel <sv@exept.de>
parents: 4214
diff changeset
   284
    ^ true
23
4a7e02de7b72 *** empty log message ***
claus
parents: 6
diff changeset
   285
134
claus
parents: 109
diff changeset
   286
    "
claus
parents: 109
diff changeset
   287
     DisplayRootView new
claus
parents: 109
diff changeset
   288
     RootView isWindowManagerRunning
claus
parents: 109
diff changeset
   289
    "
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   290
! !
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   291
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
   292
!DisplayRootView class methodsFor:'documentation'!
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   293
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   294
version
6986
b19cc6ab184e #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 6764
diff changeset
   295
    ^ '$Header$'
269
ea536bb319a6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   296
! !
6233
b746fb9ba0e3 class: DisplayRootView
Stefan Vogel <sv@exept.de>
parents: 4989
diff changeset
   297