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