Layout.st
author Stefan Vogel <sv@exept.de>
Mon, 03 Jul 2006 18:11:48 +0200
changeset 2137 1cc62200836d
parent 949 0eb888b21192
child 2294 0bae42618306
permissions -rw-r--r--
Fix comments. Streamline #literalArrayEncoding
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
88
claus
parents: 83
diff changeset
     1
"
claus
parents: 83
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
     3
	      All Rights Reserved
88
claus
parents: 83
diff changeset
     4
claus
parents: 83
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    10
 hereby transferred.
claus
parents: 83
diff changeset
    11
"
claus
parents: 83
diff changeset
    12
2137
1cc62200836d Fix comments.
Stefan Vogel <sv@exept.de>
parents: 949
diff changeset
    13
"{ Package: 'stx:libview2' }"
1cc62200836d Fix comments.
Stefan Vogel <sv@exept.de>
parents: 949
diff changeset
    14
77
claus
parents:
diff changeset
    15
Object subclass:#Layout
216
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    16
	instanceVariableNames:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    17
	classVariableNames:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    18
	poolDictionaries:''
a5f97668e99a commentary
Claus Gittinger <cg@exept.de>
parents: 126
diff changeset
    19
	category:'Graphics-Geometry'
77
claus
parents:
diff changeset
    20
!
claus
parents:
diff changeset
    21
88
claus
parents: 83
diff changeset
    22
!Layout class methodsFor:'documentation'!
claus
parents: 83
diff changeset
    23
claus
parents: 83
diff changeset
    24
copyright
claus
parents: 83
diff changeset
    25
"
claus
parents: 83
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    27
	      All Rights Reserved
88
claus
parents: 83
diff changeset
    28
claus
parents: 83
diff changeset
    29
 This software is furnished under a license and may be used
claus
parents: 83
diff changeset
    30
 only in accordance with the terms of that license and with the
claus
parents: 83
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
claus
parents: 83
diff changeset
    32
 be provided or otherwise made available to, or used by, any
claus
parents: 83
diff changeset
    33
 other person.  No title to or ownership of the software is
claus
parents: 83
diff changeset
    34
 hereby transferred.
claus
parents: 83
diff changeset
    35
"
claus
parents: 83
diff changeset
    36
!
claus
parents: 83
diff changeset
    37
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    38
documentation
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    39
"
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    40
    This is an abstract superclass for geometry controlling objects.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    41
    While old smalltalks used relative origin/extent/corner and absolute
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    42
    origin/corner/extents, these mechanisms are now being removed from the
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    43
    view itself into geometry controlling objects, which are given a superviews
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    44
    size and are to return a components size upon request.
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    45
    This allows more flexible geometry management, since any algorithm can
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    46
    be implemented (if the existing ones are not sufficient, add you own subclass
96
claus
parents: 94
diff changeset
    47
    and install it as layout-object in your view).
93
f2389560b8eb *** empty log message ***
claus
parents: 88
diff changeset
    48
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    49
    Notice: 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    50
        this class was implemented using protocol information
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    51
        from alpha testers - it may not be complete or compatible to
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    52
        the corresponding ST-80 class. 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    53
        If you encounter any incompatibilities, please forward a note 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    54
        describing the incompatibility verbal (i.e. no code) to the ST/X team.
219
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    55
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    56
    [author:]
106b86ca81da documentation
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
    57
        Claus Gittinger
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    58
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    59
    [see also:]
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    60
        View
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    61
        LayoutOrigin LayoutFrame AlignmentOrigin
94
8888ddd11323 *** empty log message ***
claus
parents: 93
diff changeset
    62
"
88
claus
parents: 83
diff changeset
    63
! !
claus
parents: 83
diff changeset
    64
77
claus
parents:
diff changeset
    65
!Layout class methodsFor:'instance creation'!
claus
parents:
diff changeset
    66
785
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    67
decodeFromLiteralArray:anArray
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    68
    "create & return a new instance from information encoded in anArray.
2137
1cc62200836d Fix comments.
Stefan Vogel <sv@exept.de>
parents: 949
diff changeset
    69
     Redefined since no initialization is needed 
1cc62200836d Fix comments.
Stefan Vogel <sv@exept.de>
parents: 949
diff changeset
    70
     (the values are all set from the specArray."
785
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    71
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    72
    ^ self basicNew fromLiteralArrayEncoding:anArray.
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    73
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    74
    "Modified: / 28.1.1998 / 17:42:25 / cg"
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    75
!
e7e50d798cfc no need to initialize values twice (when decoding from a literalArray).
Claus Gittinger <cg@exept.de>
parents: 417
diff changeset
    76
77
claus
parents:
diff changeset
    77
new
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    78
    "return a new initialized instance"
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    79
77
claus
parents:
diff changeset
    80
    ^ self basicNew initialize
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    81
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    82
    "Modified: 27.4.1996 / 14:47:08 / cg"
77
claus
parents:
diff changeset
    83
! !
claus
parents:
diff changeset
    84
284
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    85
!Layout methodsFor:'converting'!
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    86
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    87
asLayout
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    88
    "return the receiver"
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    89
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    90
    ^ self
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    91
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    92
    "Created: 29.5.1996 / 15:12:13 / cg"
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    93
! !
b31698e4ebb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 229
diff changeset
    94
77
claus
parents:
diff changeset
    95
!Layout methodsFor:'initialization'!
claus
parents:
diff changeset
    96
claus
parents:
diff changeset
    97
initialize
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    98
    "setup the instance - to be redefined by concrete subclasses"
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
    99
77
claus
parents:
diff changeset
   100
    ^ self subclassResponsibility
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   101
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   102
    "Modified: 27.4.1996 / 14:46:56 / cg"
77
claus
parents:
diff changeset
   103
! !
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   104
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   105
!Layout methodsFor:'queries'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   106
415
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   107
isAlignmentOrigin
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   108
    "return true, if this is an alignmentOrigin"
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   109
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   110
    ^ false
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   111
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   112
!
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   113
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   114
isLayout
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   115
    "return true, if the recevier is a layout object. 
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   116
     Always return true here."
415
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   117
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   118
    ^ true
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   119
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   120
    "Modified: 27.4.1996 / 14:45:27 / cg"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   121
!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   122
417
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   123
isLayoutFrame
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   124
    "return true, if this is a layoutFrame"
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   125
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   126
    ^ false
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   127
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   128
!
3b5a3b678ede *** empty log message ***
ca
parents: 415
diff changeset
   129
415
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   130
isLayoutOrigin
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   131
    "return true, if this is a layoutOrigin"
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   132
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   133
    ^ false
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   134
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   135
!
5d1bf4dffbf5 *** empty log message ***
ca
parents: 284
diff changeset
   136
949
0eb888b21192 prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   137
rectangleRelativeTo:superRectangle preferred:prefRectHolder
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   138
    "compute the rectangle represented by the receiver,
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   139
     given the superViews rectangle and the views preferredExtent.
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   140
     Must be implemented by concrete subclasses."
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   141
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   142
    ^ self subclassResponsibility
229
612861ef768a examples
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   143
949
0eb888b21192 prefRect may now be a valueHolder or block
Claus Gittinger <cg@exept.de>
parents: 785
diff changeset
   144
    "Modified: / 27.5.1998 / 10:19:21 / cg"
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   145
! !
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   146
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   147
!Layout class methodsFor:'documentation'!
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   148
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   149
version
2137
1cc62200836d Fix comments.
Stefan Vogel <sv@exept.de>
parents: 949
diff changeset
   150
    ^ '$Header: /cvs/stx/stx/libview2/Layout.st,v 1.17 2006-07-03 16:11:48 stefan Exp $'
126
25df58661f32 version at the end
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   151
! !