DisplayRootView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 26 Nov 2016 21:09:32 +0000
branchjv
changeset 7719 c2f802dd340a
parent 7715 925b859e1758
child 8420 76e39223f5ab
permissions -rw-r--r--
XFT: Forbid XFT rendering on bitmaps (depth-1 pixmaps) In theory it could work if XFT would just turn gray into either black or white. But XFT doesn't do it and simply draw nothing without failing in any way. To prevent this silent failures, forbid drawing XFT onto bitmaps (depth-1 pixmaps). After all, the while point of XFT is to use anti-aliased fonts.
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
727
bf23a306b6f2 renamed PseudoView to DisplaySurface
Claus Gittinger <cg@exept.de>
parents: 626
diff changeset
    14
DisplaySurface subclass:#DisplayRootView
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    15
	instanceVariableNames:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    16
	classVariableNames:''
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    17
	poolDictionaries:''
626
9f4a3aa6f8e2 class category changes
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    18
	category:'Views-Special'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    20
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    21
!DisplayRootView class methodsFor:'documentation'!
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    22
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    23
copyright
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    24
"
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    25
 COPYRIGHT (c) 1988 by Claus Gittinger
71
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
    26
	      All Rights Reserved
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    27
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    28
 This software is furnished under a license and may be used
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    29
 only in accordance with the terms of that license and with the
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    31
 be provided or otherwise made available to, or used by, any
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    32
 other person.  No title to or ownership of the software is
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    33
 hereby transferred.
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    34
"
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    35
!
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    36
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    37
documentation
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    38
"
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    39
    this class describes the rootWindow (which is the background window or
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
    40
    desktop and can be used for drawing outside of Views
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    41
    i.e. for dragging between Views).
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    42
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
    43
    For historic and compatibility reasons, there is a global variable
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    44
    called 'RootView', which is bound to the default displays ('Display')
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    45
    rootview. We recommend, not to access this variable, instead, get a
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    46
    displays rootView via the #rootView message (sent to the device).
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    47
    Otherwise, your application will not work in a multiScreen environment.
180
claus
parents: 134
diff changeset
    48
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
    49
    Instances of myself (i.e. these rootViews) are light-weight views;
180
claus
parents: 134
diff changeset
    50
    they do not support events, models etc.
claus
parents: 134
diff changeset
    51
    They are pure drawing canvases and should be only used for special
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
    52
    applications (i.e. dragging).
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    53
    There may be display systems in which rootViews are not
180
claus
parents: 134
diff changeset
    54
    supported/allowed implemented. So be VERY careful when using them.
134
claus
parents: 109
diff changeset
    55
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    56
    Be aware, that the rootView is not always visible - some
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    57
    windowManagers install another (pseudoRoot), into which icons and
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    58
    windowManager menus are drawn. If that is the case, your paining
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    59
    into the rootView may not be visible, unless you set the #noClipByChildren
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    60
    option (see below).
2916
79eedd2e05ac checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
    61
    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
    62
    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
    63
    a remote webBrowser ...
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    64
    In general, you should never use the rootView for normal applications.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    65
134
claus
parents: 109
diff changeset
    66
    To draw in the (Displays) root window:
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    67
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    68
        |rootView|
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    69
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    70
        rootView := Screen current rootView.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    71
        rootView paint:(Color red).
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    72
        rootView fillRectangleX:10 y:10 width:100 height:100.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    73
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    74
    of course, all stuff from View and its superclasses can be used:
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    75
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    76
        |rootView|
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    77
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    78
        rootView := Screen current rootView.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    79
        rootView paint:(Color red).
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    80
        rootView noClipByChildren.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    81
        rootView fillRectangleX:10 y:10 width:100 height:100.
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    82
616
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    83
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    84
    [author:]
56cf67c82664 documentation
Claus Gittinger <cg@exept.de>
parents: 269
diff changeset
    85
        Claus Gittinger
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    86
"
7317
cea144a15948 Backed out changeset ce64e30ecf54
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7287
diff changeset
    87
!
45
d2d5bc481ebb *** empty log message ***
claus
parents: 23
diff changeset
    88
1254
6bb4afe072f1 commentary
Claus Gittinger <cg@exept.de>
parents: 919
diff changeset
    89
!DisplayRootView class methodsFor:'instance creation'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    90
1256
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
    91
onDevice:aDisplay
89
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    92
    "since there is only one RootView - catch new and return
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    93
     the one and only rootView."
ea2bf46eb669 *** empty log message ***
claus
parents: 71
diff changeset
    94
134
claus
parents: 109
diff changeset
    95
    aDisplay == Display ifTrue:[
3337
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
    96
        RootView notNil ifTrue:[
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
    97
            RootView device == aDisplay ifTrue:[
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
    98
                ^ RootView
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
    99
            ]
65bba570ff76 care for changed display (in cached RootView)
martin
parents: 3253
diff changeset
   100
        ].
1256
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   101
        RootView := super onDevice:aDisplay.
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   102
        ^ RootView
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   103
    ].
1256
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   104
    ^ super onDevice:aDisplay
4a633daff594 on: -> onDevice:
Claus Gittinger <cg@exept.de>
parents: 1254
diff changeset
   105
3630
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3337
diff changeset
   106
    "Created: 18.1.1997 / 18:23:22 / cg"
2b2f6649c014 Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents: 3337
diff changeset
   107
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   108
48194c26a46c Initial revision
claus
parents:
diff changeset
   109
!DisplayRootView methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   110
4213
38e47961a6cc *** empty log message ***
penk
parents: 4042
diff changeset
   111
application
38e47961a6cc *** empty log message ***
penk
parents: 4042
diff changeset
   112
    ^ nil
38e47961a6cc *** empty log message ***
penk
parents: 4042
diff changeset
   113
!
38e47961a6cc *** empty log message ***
penk
parents: 4042
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
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   144
     we destroy the rootWindow if its a virtual root window"
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   145
6a42b2b115f8 *** empty log message ***
claus
parents: 54
diff changeset
   146
    ^ self
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.
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
   170
    self device
6574
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.
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
   200
    self device
6574
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
6616
9dad6d1245cc Merged ea4e1faf457a and 160cf8d7ea05 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6524 6574
diff changeset
   237
     dropped in the receiver.
2916
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