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