36 documentation |
36 documentation |
37 " |
37 " |
38 this class describes Xs rootWindow (which is the background window and |
38 this class describes Xs rootWindow (which is the background window and |
39 can be used for drawing outside of Views i.e. for dragging between Views). |
39 can be used for drawing outside of Views i.e. for dragging between Views). |
40 |
40 |
41 There is one global variable (RootView) which is the Displays rootview. |
41 For historic and compatibility reasons, there is a global variable |
42 (this is the default displays rootView; to access other devices' rootView, |
42 called 'RootView', which is bound to the default displays ('Display') |
43 use someDisplay rootView), |
43 rootview. We recommend, not to access this variable, instead, get a |
|
44 displays rootView via the #rootView message (sent to the device). |
|
45 Otherwise, your application will not work in a multiScreen environment. |
44 |
46 |
45 Instances of myself (i.e. these rootViews) are light-weight views; |
47 Instances of myself (i.e. these rootViews) are light-weight views; |
46 they do not support events, models etc. |
48 they do not support events, models etc. |
47 They are pure drawing canvases and should be only used for special |
49 They are pure drawing canvases and should be only used for special |
48 applications. There may be display systems in which rootViews are not |
50 applications (i.e. dragging). |
|
51 There may be display systems in which rootViews are not |
49 supported/allowed implemented. So be VERY careful when using them. |
52 supported/allowed implemented. So be VERY careful when using them. |
50 |
53 |
|
54 Be aware, that the rootView is not always visible - some |
|
55 windowManagers install another (pseudoRoot), into which icons and |
|
56 windowManager menus are drawn. If that is the case, your paining |
|
57 into the rootView may not be visible, unless you set the #noClipByChildren |
|
58 option (see below). |
|
59 |
|
60 In general, you should never use the rootView for normal applications. |
|
61 |
51 To draw in the (Displays) root window: |
62 To draw in the (Displays) root window: |
52 |
63 |
53 RootView paint:(Color red). |
64 |rootView| |
54 RootView fillRectangleX:10 y:10 width:100 height:100. |
65 |
|
66 rootView := Screen current rootView. |
|
67 rootView paint:(Color red). |
|
68 rootView fillRectangleX:10 y:10 width:100 height:100. |
55 |
69 |
56 of course, all stuff from View and its superclasses can be used: |
70 of course, all stuff from View and its superclasses can be used: |
57 |
71 |
58 RootView paint:(Color red). |
72 |rootView| |
59 RootView noClipByChildren. |
73 |
60 RootView fillRectangleX:10 y:10 width:100 height:100. |
74 rootView := Screen current rootView. |
61 |
75 rootView paint:(Color red). |
62 you have to be careful with some window managers, since what you |
76 rootView noClipByChildren. |
63 see on the screen is not always really the root window. Some Desktops |
77 rootView fillRectangleX:10 y:10 width:100 height:100. |
64 add their own view in between (although the Xworkstation class does |
78 |
65 care for this, it seems not to work correctly on all systems). |
|
66 In general, you should never use the RootView for normal applications. |
|
67 |
79 |
68 [author:] |
80 [author:] |
69 Claus Gittinger |
81 Claus Gittinger |
70 " |
82 " |
71 ! ! |
83 ! ! |
72 |
84 |
73 !DisplayRootView class methodsFor:'initialization'! |
85 !DisplayRootView class methodsFor:'initialization'! |
74 |
86 |
75 initialize |
87 initialize |
76 Display isNil ifTrue:[ |
88 Display isNil ifTrue:[ |
77 Workstation initialize |
89 Workstation initialize |
78 ]. |
90 ]. |
79 super initialize |
91 super initialize |
80 ! ! |
92 ! ! |
81 |
93 |
82 !DisplayRootView class methodsFor:'instance creation'! |
94 !DisplayRootView class methodsFor:'instance creation'! |
83 |
95 |
84 on:aDisplay |
96 on:aDisplay |
85 "since there is only one RootView - catch new and return |
97 "since there is only one RootView - catch new and return |
86 the one and only rootView." |
98 the one and only rootView." |
87 |
99 |