Label.st
author Claus Gittinger <cg@exept.de>
Sat, 24 Feb 1996 17:35:36 +0100
changeset 392 81343306d796
parent 391 b52dfc7728d9
child 416 ac9754b3df67
permissions -rw-r--r--
eliminated all DefaultFont classVars (are now classINSTvars)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
View subclass:#Label
254
aa15cac0670f oops - foregroundColor was overwritten by backgroundColor (if defined in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    14
	instanceVariableNames:'logo labelWidth labelHeight labelOriginX labelOriginY adjust
250
77012e65ac84 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    15
		hSpace vSpace bgColor fgColor fixSize labelMsg converter
77012e65ac84 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    16
		labelChannel foregroundChannel backgroundChannel'
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
    17
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor'
254
aa15cac0670f oops - foregroundColor was overwritten by backgroundColor (if defined in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    18
	poolDictionaries:''
aa15cac0670f oops - foregroundColor was overwritten by backgroundColor (if defined in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
    19
	category:'Views-Layout'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    20
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    21
3
claus
parents: 0
diff changeset
    22
!Label class methodsFor:'documentation'!
claus
parents: 0
diff changeset
    23
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    24
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    25
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    26
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
    27
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    28
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    29
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    30
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    32
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    33
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    34
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    35
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    36
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    37
3
claus
parents: 0
diff changeset
    38
documentation
claus
parents: 0
diff changeset
    39
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    40
    This class implements labels, which are views to display a string or image.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    41
    The Label will try to do its best to make its contents fit into the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    42
    view. The contents can be a String, a collection of Strings (i.e.
118
claus
parents: 113
diff changeset
    43
    a StringCollection) or a Form/Image. 
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    44
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    45
    The contents is drawn in fgColor/bgColor, which can be changed using:
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    46
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
    47
	aLabel foregroundColor:aColor
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
    48
	aLabel backgroundColor:aColor
3
claus
parents: 0
diff changeset
    49
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    50
    When a label is assigned a contents, it will resize itself to fit
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    51
    the required size. This resizing can be suppressed by setting the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    52
    fixsize attribute to true using:
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    53
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
    54
	aLabel sizeFixed:true
3
claus
parents: 0
diff changeset
    55
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    56
    This can be used, if resizing of the label is not wanted.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    57
    However, in this case you have to make certain that the size is big enough
118
claus
parents: 113
diff changeset
    58
    to hold any changed logos later. (usually, you create the label first with
claus
parents: 113
diff changeset
    59
    the longest string first to have it compute its size, then set the fixSize 
claus
parents: 113
diff changeset
    60
    attribute to avoid resizing later).
125
claus
parents: 118
diff changeset
    61
    Be careful when placing self-resizing labels into panels - by default,
claus
parents: 118
diff changeset
    62
    panels do not react on the size change - leading to ugly looking geometry.
claus
parents: 118
diff changeset
    63
    (but you can tell the panel to watch for changes with #elementsCHangeSize:)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    64
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    65
    The placement of the contents within the label is controlled by
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    66
    the adjust attribute, it can be set with:
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    67
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
    68
	aLabel adjust:how
3
claus
parents: 0
diff changeset
    69
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
    70
    where how is one of the symbols left, #right, #center, #centerLeft,
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
    71
    #centerRight, #leftRight or #rightLeft (see the comment in Label>>adjust:). 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
    72
    The default is #center.
3
claus
parents: 0
diff changeset
    73
145
claus
parents: 144
diff changeset
    74
    model-less operation (ok for static labels):
118
claus
parents: 113
diff changeset
    75
      if no model is set, the labels contents is set with:
claus
parents: 113
diff changeset
    76
claus
parents: 113
diff changeset
    77
	aLabel label:aStringOrImage
claus
parents: 113
diff changeset
    78
claus
parents: 113
diff changeset
    79
      and stays constant unless changed by new calls to #label:.
claus
parents: 113
diff changeset
    80
claus
parents: 113
diff changeset
    81
145
claus
parents: 144
diff changeset
    82
    model operation (ST-80 style):
118
claus
parents: 113
diff changeset
    83
      labels with a model, aspectMsg and labelMsg react to 
claus
parents: 113
diff changeset
    84
      changes of the aspect, and send a labelMsg-message 
claus
parents: 113
diff changeset
    85
      to the model in order to aquire a new labelString or image.
claus
parents: 113
diff changeset
    86
      The model should send 'self changed:aspectMsg' if it thinks the label 
claus
parents: 113
diff changeset
    87
      should change and return a string or image from the labelMsg-message.
claus
parents: 113
diff changeset
    88
claus
parents: 113
diff changeset
    89
	label model:aModel.
claus
parents: 113
diff changeset
    90
	label aspect:aspectSymbol.
claus
parents: 113
diff changeset
    91
	label labelMessage:labelSymbol.
claus
parents: 113
diff changeset
    92
claus
parents: 113
diff changeset
    93
	model sends #changed:aspectSymbol
claus
parents: 113
diff changeset
    94
	---> label will redraw its label from value of model perform:labelSymbol
claus
parents: 113
diff changeset
    95
claus
parents: 113
diff changeset
    96
      Having a labelSymbol different from the aspectSymbol allows for two labels
claus
parents: 113
diff changeset
    97
      to react on the same aspect-change, but use different messages when asking
claus
parents: 113
diff changeset
    98
      the model for a new label contents. By default, the labelMsg is nil,
claus
parents: 113
diff changeset
    99
      so the label does NOT update its shown contents.
claus
parents: 113
diff changeset
   100
      The aspectMsg defaults to #value.
claus
parents: 113
diff changeset
   101
125
claus
parents: 118
diff changeset
   102
145
claus
parents: 144
diff changeset
   103
claus
parents: 144
diff changeset
   104
    channel operation (new ST/X style):
claus
parents: 144
diff changeset
   105
claus
parents: 144
diff changeset
   106
      the label will react on changes of the token found in the
claus
parents: 144
diff changeset
   107
      channels: foregroundChannel, backgroundChannel and labelChannel.
claus
parents: 144
diff changeset
   108
      These are valueHolders and can be shared between labels.
claus
parents: 144
diff changeset
   109
claus
parents: 144
diff changeset
   110
claus
parents: 144
diff changeset
   111
        
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   112
    Instance variables:
3
claus
parents: 0
diff changeset
   113
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   114
	logo                <Object>        the logo, can be a Form, String or Text
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   115
	labelWidth          <Integer>       the width of the logo in device units
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   116
	labelHeight         <Integer>       the height of the logo in device units
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   117
	labelOriginX        <Integer>       the x-position of the logo withing the Label
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   118
	labelOriginY        <Integer>       the y-position of the logo withing the Label
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   119
	adjust              <Symbol>        controls how the logo is positioned within the
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   120
					    label. Can be one of:#left,#right,#center,
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   121
					    #centerLeft or #centerRight (see comment in adjust:)
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   122
	hSpace              <Integer>       number of horizontal pixels around logo
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   123
	vSpace              <Integer>       number of vertical pixels around logo
3
claus
parents: 0
diff changeset
   124
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   125
	bgColor             <Color>         background color
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   126
	fgColor             <Color>         foreground color
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   127
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   128
	fixSize             <Boolean>       if true, a change of the logo change will not
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   129
					    resize the label; otherwise, its size is adjusted.
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   130
					    default:false.
50
e2a1b5f187ef MVC support
claus
parents: 38
diff changeset
   131
118
claus
parents: 113
diff changeset
   132
	labelMsg            <Symbol>        if non-nil, this is sent to the model to
claus
parents: 113
diff changeset
   133
					    aquire the labelString or labelImage.
claus
parents: 113
diff changeset
   134
					    If nil, the label stays as is
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   135
118
claus
parents: 113
diff changeset
   136
    styleSheet parameters:
50
e2a1b5f187ef MVC support
claus
parents: 38
diff changeset
   137
118
claus
parents: 113
diff changeset
   138
      labelForegroundColor    <Color>         color to draw foreground pixels (i.e. the string)
claus
parents: 113
diff changeset
   139
      labelBackgroundColor    <Color>         color to draw background pixels
claus
parents: 113
diff changeset
   140
      labelFont               <Font>          font to use for textual labels
3
claus
parents: 0
diff changeset
   141
"
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   142
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   143
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   144
examples
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   145
"
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   146
    Notice, that Buttons and others inherit from Label; 
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   147
    therefore, the following geometry examples apply to all subclasses too.
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   148
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   149
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   150
    simple (default position is 0@0):
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   151
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   152
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   153
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   154
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   155
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   156
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   157
	l label:'hello world'.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   158
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   159
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   160
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   161
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   162
    there is also a creation message which sets the label:
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   163
	|top l|
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   164
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   165
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   166
	top extent:(200 @ 200).
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   167
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   168
	l := Label label:'hello world' in:top.
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   169
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   170
	top open
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   171
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   172
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   173
    placement:
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   174
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   175
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   176
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   177
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   178
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   179
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   180
	l label:'hello world'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   181
	l origin:50@100.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   182
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   183
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   184
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   185
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   186
    level:
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   187
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   188
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   189
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   190
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   191
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   192
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   193
	l level:5.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   194
	l label:'hello world'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   195
	l origin:50@100.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   196
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   197
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   198
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   199
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   200
    another level:    
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   201
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   202
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   203
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   204
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   205
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   206
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   207
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   208
	l label:'hello world'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   209
	l origin:50@100.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   210
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   211
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   212
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   213
118
claus
parents: 113
diff changeset
   214
    colors & font:    
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   215
	|top l|
118
claus
parents: 113
diff changeset
   216
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   217
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   218
	top extent:(200 @ 200).
118
claus
parents: 113
diff changeset
   219
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   220
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   221
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   222
	l font:(Font family:'Times' size:18).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   223
	l foregroundColor:Color yellow.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   224
	l backgroundColor:Color red.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   225
	l label:'hello world'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   226
	l origin:50@100.
118
claus
parents: 113
diff changeset
   227
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   228
	top open
118
claus
parents: 113
diff changeset
   229
claus
parents: 113
diff changeset
   230
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   231
    border & colors:    
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   232
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   233
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   234
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   235
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   236
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   237
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   238
	l level:0.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   239
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   240
	l borderColor:Color red.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   241
	l foregroundColor:Color green darkened.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   242
	l backgroundColor:Color green lightened.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   243
	l label:'hello world'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   244
	l origin:50@100.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   245
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   246
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   247
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   248
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   249
    different adjusts (resize to see):    
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   250
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   251
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   252
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   253
	top extent:(300 @ 250).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   254
	top label:'make me smaller'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   255
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   256
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   257
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   258
	l label:'default - #centered'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   259
	l origin:0.1@40.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   260
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   261
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   262
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   263
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   264
	l adjust:#left.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   265
	l label:'#left adjust'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   266
	l origin:0.1@70.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   267
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   268
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   269
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   270
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   271
	l adjust:#right.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   272
	l label:'#right adjust'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   273
	l origin:0.1@100.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   274
	l width:0.8.
118
claus
parents: 113
diff changeset
   275
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   276
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   277
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   278
	l adjust:#centerLeft.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   279
	l label:'#centerLeft adjust with a long text'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   280
	l origin:0.1@130.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   281
	l width:0.8.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   282
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   283
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   284
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   285
	l adjust:#centerRight.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   286
	l label:'#centerRight adjust with a long text'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   287
	l origin:0.1@160.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   288
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   289
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   290
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   291
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   292
	l adjust:#leftRight.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   293
	l label:'#leftRight adjust with a long text'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   294
	l origin:0.1@190.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   295
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   296
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   297
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   298
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   299
	l adjust:#rightLeft.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   300
	l label:'#rightLeft adjust with a long text'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   301
	l origin:0.1@220.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   302
	l width:0.8.
118
claus
parents: 113
diff changeset
   303
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   304
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   305
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   306
131
claus
parents: 130
diff changeset
   307
    fitting-adjust (resize to see):
claus
parents: 130
diff changeset
   308
    Warning: #fit is experimental and should not be used.
claus
parents: 130
diff changeset
   309
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   310
	|top l|
131
claus
parents: 130
diff changeset
   311
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   312
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   313
	top extent:(200 @ 200).
131
claus
parents: 130
diff changeset
   314
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   315
	l := Label origin:0.25 @ 0.25 corner:0.75@0.75 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   316
	l label:'stretch'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   317
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   318
	l adjust:#fit.
131
claus
parents: 130
diff changeset
   319
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   320
	top open
131
claus
parents: 130
diff changeset
   321
claus
parents: 130
diff changeset
   322
    or:
claus
parents: 130
diff changeset
   323
    Warning: #fit is experimental and should not be used.
claus
parents: 130
diff changeset
   324
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   325
	|top l|
131
claus
parents: 130
diff changeset
   326
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   327
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   328
	top extent:(200 @ 200).
131
claus
parents: 130
diff changeset
   329
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   330
	l := Label origin:0.25 @ 0.25 corner:0.75@0.75 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   331
	l label:(Image fromFile:'bitmaps/SBrowser.xbm').
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   332
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   333
	l adjust:#fit.
131
claus
parents: 130
diff changeset
   334
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   335
	top open
131
claus
parents: 130
diff changeset
   336
claus
parents: 130
diff changeset
   337
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   338
    just a reminder, that instead of doing placement manually
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   339
    as in ...:    
118
claus
parents: 113
diff changeset
   340
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   341
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   342
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   343
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   344
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   345
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   346
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   347
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   348
	l label:'default - centered'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   349
	l origin:0.1@70.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   350
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   351
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   352
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   353
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   354
	l adjust:#left.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   355
	l label:'left adjust'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   356
	l origin:0.1@100.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   357
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   358
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   359
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   360
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   361
	l adjust:#right.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   362
	l label:'right adjust'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   363
	l origin:0.1@130.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   364
	l width:0.8.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   365
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   366
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   367
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   368
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   369
    ... it is much easier, to use a geometry handler, such as
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   370
    a VerticalPanel. Try:
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   371
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   372
	|top panel l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   373
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   374
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   375
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   376
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   377
	panel := VerticalPanelView 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   378
			origin:0.1 @ 0.0 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   379
			corner:0.9 @ 1.0 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   380
			    in:top.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   381
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   382
	panel horizontalLayout:#fit.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   383
	panel verticalLayout:#center.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   384
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   385
	l := Label in:panel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   386
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   387
	l label:'default - centered'.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   388
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   389
	l := Label in:panel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   390
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   391
	l adjust:#left.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   392
	l label:'left adjust'.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   393
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   394
	l := Label in:panel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   395
	l borderWidth:1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   396
	l adjust:#right.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   397
	l label:'right adjust'.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   398
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   399
	top open
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   400
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   401
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   402
    labels with bitmaps or images:
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   403
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   404
	|top l|
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   405
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   406
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   407
	top extent:(200 @ 200).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   408
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   409
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   410
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   411
	l label:((Image fromFile:'bitmaps/garfield.gif') magnifyBy:0.2 @ 0.2).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   412
	l origin:50@100.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   413
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   414
	top open
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   415
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   416
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   417
     that even works with #fit:
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   418
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   419
	|top l|
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   420
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   421
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   422
	top extent:(200 @ 200).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   423
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   424
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   425
	l adjust:#fit.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   426
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   427
	l label:(Image fromFile:'bitmaps/garfield.gif').
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   428
	l origin:0.2@0.2 corner:0.8@0.8.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   429
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   430
	top open
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   431
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   432
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   433
     notice, that Buttons inherit from Label; thus:
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   434
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   435
	|top b|
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   436
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   437
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   438
	top extent:(200 @ 200).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   439
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   440
	b := Button in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   441
	b adjust:#fit.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   442
	b label:(Image fromFile:'bitmaps/garfield.gif').
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   443
	b origin:0.2@0.2 corner:0.8@0.8.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   444
	b action:[Transcript showCr:'wow'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   445
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   446
	top open
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   447
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   448
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   449
     Channel operation (controlling gf, bg and labelText via ValueHolders)
145
claus
parents: 144
diff changeset
   450
     -----------------
claus
parents: 144
diff changeset
   451
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   452
	|top panel logoChannel fgChannel bgChannel l b|
145
claus
parents: 144
diff changeset
   453
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   454
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   455
	top extent:(450 @ 200).
145
claus
parents: 144
diff changeset
   456
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   457
	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
145
claus
parents: 144
diff changeset
   458
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   459
	l := Label in:panel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   460
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   461
	l label:'change my colors'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   462
	l origin:50@100.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   463
	l sizeFixed:true.
145
claus
parents: 144
diff changeset
   464
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   465
	fgChannel := Color blue asValue.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   466
	bgChannel := Color grey asValue.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   467
	logoChannel := 'change me' asValue.
145
claus
parents: 144
diff changeset
   468
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   469
	b := Toggle label:'change fg' in:panel. b showLamp:false; onLevel:-2.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   470
	b pressAction:[fgChannel value:Color red].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   471
	b releaseAction:[fgChannel value:Color blue].
145
claus
parents: 144
diff changeset
   472
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   473
	b := Toggle label:'change bg' in:panel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   474
	b pressAction:[bgChannel value:Color yellow].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   475
	b releaseAction:[bgChannel value:Color grey].
145
claus
parents: 144
diff changeset
   476
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   477
	b := Toggle label:'change text' in:panel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   478
	b pressAction:[logoChannel value:'wow'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   479
	b releaseAction:[logoChannel value:'not bad' ].
145
claus
parents: 144
diff changeset
   480
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   481
	l labelChannel:logoChannel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   482
	l foregroundChannel:fgChannel.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   483
	l backgroundChannel:bgChannel.
145
claus
parents: 144
diff changeset
   484
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   485
	top open
145
claus
parents: 144
diff changeset
   486
claus
parents: 144
diff changeset
   487
146
claus
parents: 145
diff changeset
   488
       multiple labels on one channel:
claus
parents: 145
diff changeset
   489
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   490
	|l1 l2 b conv|
146
claus
parents: 145
diff changeset
   491
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   492
	l1 := Label label:'label1'.
146
claus
parents: 145
diff changeset
   493
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   494
	l2 := Label label:'label2'.
146
claus
parents: 145
diff changeset
   495
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   496
	b := Button label:'change'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   497
	conv := (ConvertedValue new
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   498
			    conversion:[:input | 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   499
					input ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   500
					    Color red
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   501
					] ifFalse:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   502
					    Color blue
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   503
					]]).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   504
	conv value:false.
146
claus
parents: 145
diff changeset
   505
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   506
	b controller pressChannel:conv.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   507
	l1 foregroundChannel:conv.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   508
	l2 foregroundColor:Color white; backgroundChannel:conv.
146
claus
parents: 145
diff changeset
   509
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   510
	b open.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   511
	l1 open.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   512
	l2 open.
146
claus
parents: 145
diff changeset
   513
        
claus
parents: 145
diff changeset
   514
125
claus
parents: 118
diff changeset
   515
     MVC operation 
145
claus
parents: 144
diff changeset
   516
     -------------
claus
parents: 144
diff changeset
   517
125
claus
parents: 118
diff changeset
   518
       model provides the label):
claus
parents: 118
diff changeset
   519
       (have to use a plug to simulate a model which responds to
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   520
	the #someAspect message):
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   521
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   522
	|top l model|
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   523
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   524
	model := Plug new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   525
	model respondTo:#someAspect with:['models labelString'].
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   526
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   527
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   528
	top extent:(200 @ 200).
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   529
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   530
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   531
	l model:model; labelMessage:#someAspect.
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   532
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   533
	top open
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   534
	...
118
claus
parents: 113
diff changeset
   535
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   536
	model changed:#someAspect
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   537
	...
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   538
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   539
118
claus
parents: 113
diff changeset
   540
    concrete example (track a counters value):
125
claus
parents: 118
diff changeset
   541
      (here, the default aspect #value is used both to notify the label about
claus
parents: 118
diff changeset
   542
       changes and to aquire a new value from the model).
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   543
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   544
	|top l model|
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   545
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   546
	model := ValueHolder new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   547
	model value:'0'.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   548
	[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   549
	    1 to:20 do:[:i |
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   550
		(Delay forSeconds:1) wait.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   551
		model value:i printString
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   552
	    ].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   553
	    top destroy
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   554
	] fork.
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   555
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   556
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   557
	top extent:(200 @ 200).
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   558
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   559
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   560
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   561
	l model:model; labelMessage:#value.
118
claus
parents: 113
diff changeset
   562
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   563
	top open
118
claus
parents: 113
diff changeset
   564
claus
parents: 113
diff changeset
   565
133
claus
parents: 132
diff changeset
   566
      with a printConverter:
claus
parents: 132
diff changeset
   567
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   568
	|top l model|
133
claus
parents: 132
diff changeset
   569
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   570
	model := Date today asValue.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   571
	[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   572
	    1 to:50 do:[:i |
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   573
		(Delay forSeconds:1) wait.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   574
		model value:(model value addDays:1) 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   575
	    ].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   576
	    top destroy
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   577
	] fork.
133
claus
parents: 132
diff changeset
   578
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   579
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   580
	top extent:(200 @ 200).
133
claus
parents: 132
diff changeset
   581
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   582
	l := Label in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   583
	l level:-1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   584
	l converter:(PrintConverter new initForDate).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   585
	l model:model; labelMessage:#value.
133
claus
parents: 132
diff changeset
   586
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   587
	top open
133
claus
parents: 132
diff changeset
   588
claus
parents: 132
diff changeset
   589
125
claus
parents: 118
diff changeset
   590
       model changes aspect after a while; two labels on the same model:
118
claus
parents: 113
diff changeset
   591
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   592
	|top l model|
118
claus
parents: 113
diff changeset
   593
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   594
	model := Plug new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   595
	model respondTo:#labelValue1 with:['models labelString1'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   596
	model respondTo:#labelValue2 with:['models labelString2'].
118
claus
parents: 113
diff changeset
   597
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   598
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   599
	top extent:(200 @ 200).
118
claus
parents: 113
diff changeset
   600
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   601
	l := Label origin:0.0@0.0 corner:1.0@0.5 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   602
	l model:model; aspect:#someAspect; labelMessage:#labelValue1.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   603
	l := Label origin:0.0@0.5 corner:1.0@1.0 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   604
	l model:model; aspect:#someAspect; labelMessage:#labelValue2.
113
fdd18cfff57e *** empty log message ***
claus
parents: 110
diff changeset
   605
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   606
	top open.
118
claus
parents: 113
diff changeset
   607
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   608
	(Delay forSeconds:5) wait.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   609
	model respondTo:#labelValue1 with:['new string1'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   610
	model respondTo:#labelValue2 with:['new string2'].
118
claus
parents: 113
diff changeset
   611
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   612
	model changed:#someAspect 
118
claus
parents: 113
diff changeset
   613
claus
parents: 113
diff changeset
   614
125
claus
parents: 118
diff changeset
   615
      plugged MVC operation (getBlock returns the label): 
118
claus
parents: 113
diff changeset
   616
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   617
	|top l model|
118
claus
parents: 113
diff changeset
   618
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   619
	model := PluggableAdaptor new
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   620
			getBlock:[:m | 'hello']
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   621
			putBlock:nil
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   622
			updateBlock:nil.
118
claus
parents: 113
diff changeset
   623
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   624
	top := StandardSystemView new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   625
	top extent:(200 @ 200).
118
claus
parents: 113
diff changeset
   626
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   627
	l := Label origin:0.0@0.0 corner:1.0@0.5 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   628
	l model:model; labelMessage:#value.
118
claus
parents: 113
diff changeset
   629
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   630
	top open.
125
claus
parents: 118
diff changeset
   631
claus
parents: 118
diff changeset
   632
claus
parents: 118
diff changeset
   633
      use different label-selectors to access fields of a complex model:
claus
parents: 118
diff changeset
   634
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   635
	|top panel model|
125
claus
parents: 118
diff changeset
   636
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   637
	model := Plug new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   638
	model respondTo:#field1 with:['value1'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   639
	model respondTo:#field2 with:['value2'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   640
	model respondTo:#field3 with:['value3'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   641
	model respondTo:#field4 with:['value4'].
125
claus
parents: 118
diff changeset
   642
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   643
	top := StandardSystemView new.
125
claus
parents: 118
diff changeset
   644
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   645
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   646
	panel elementsChangeSize:true.
125
claus
parents: 118
diff changeset
   647
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   648
	panel addSubView:((Label on:model) labelMessage:#field1).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   649
	panel addSubView:((Label on:model) labelMessage:#field2).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   650
	panel addSubView:((Label on:model) labelMessage:#field3).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   651
	panel addSubView:((Label on:model) labelMessage:#field4).
125
claus
parents: 118
diff changeset
   652
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   653
	top extent:(200 @ 200).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   654
	top open.
125
claus
parents: 118
diff changeset
   655
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   656
	(Delay forSeconds:5) wait.
125
claus
parents: 118
diff changeset
   657
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   658
	model respondTo:#field2 with:['new value2'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   659
	model changed:#value  
125
claus
parents: 118
diff changeset
   660
claus
parents: 118
diff changeset
   661
claus
parents: 118
diff changeset
   662
      same as above, using default aspects in the label, and an adaptor
claus
parents: 118
diff changeset
   663
      to translate aspects:
claus
parents: 118
diff changeset
   664
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   665
	|top panel model v1|
125
claus
parents: 118
diff changeset
   666
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   667
	model := Plug new.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   668
	model respondTo:#field1 with:[v1].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   669
	model respondTo:#field1: with:[:arg | v1 := arg. model changed:#field1].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   670
	model respondTo:#field2 with:['value2'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   671
	model respondTo:#field2: with:[:arg |].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   672
	model respondTo:#field3 with:['value3'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   673
	model respondTo:#field3: with:[:arg |].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   674
	model respondTo:#field4 with:['value4'].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   675
	model respondTo:#field4: with:[:arg |].
125
claus
parents: 118
diff changeset
   676
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   677
	top := StandardSystemView new.
125
claus
parents: 118
diff changeset
   678
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   679
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   680
	panel elementsChangeSize:true.
125
claus
parents: 118
diff changeset
   681
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   682
	panel addSubView:((Label on:((AspectAdaptor subject:model) forAspect:#field1)) labelMessage:#value).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   683
	panel addSubView:((Label on:((AspectAdaptor subject:model) forAspect:#field2)) labelMessage:#value).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   684
	panel addSubView:((Label on:((AspectAdaptor subject:model) forAspect:#field3)) labelMessage:#value).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   685
	panel addSubView:((Label on:((AspectAdaptor subject:model) forAspect:#field4)) labelMessage:#value).
125
claus
parents: 118
diff changeset
   686
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   687
	top extent:(200 @ 200).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   688
	top open.
125
claus
parents: 118
diff changeset
   689
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   690
	(Delay forSeconds:5) wait.
125
claus
parents: 118
diff changeset
   691
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   692
	model field1:'new value1'.
125
claus
parents: 118
diff changeset
   693
claus
parents: 118
diff changeset
   694
claus
parents: 118
diff changeset
   695
      use an adapter to access fields of a complex model:
claus
parents: 118
diff changeset
   696
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   697
	|top l panel model|
125
claus
parents: 118
diff changeset
   698
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   699
	model := #('one' 'two' 'three') asValue.
125
claus
parents: 118
diff changeset
   700
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   701
	top := StandardSystemView new.
125
claus
parents: 118
diff changeset
   702
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   703
	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   704
	panel elementsChangeSize:true.
125
claus
parents: 118
diff changeset
   705
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   706
	panel addSubView:((Label on:(ProtocolAdaptor
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   707
					subjectChannel:model
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   708
					accessPath:#(1))) labelMessage:#value).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   709
	panel addSubView:((Label on:(ProtocolAdaptor
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   710
					subjectChannel:model
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   711
					accessPath:#(2))) labelMessage:#value).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   712
	panel addSubView:((Label on:(ProtocolAdaptor
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   713
					subjectChannel:model
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   714
					accessPath:#(3))) labelMessage:#value).
125
claus
parents: 118
diff changeset
   715
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   716
	top extent:(200 @ 200).
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   717
	top open.
125
claus
parents: 118
diff changeset
   718
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   719
	(Delay forSeconds:5) wait.
125
claus
parents: 118
diff changeset
   720
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   721
	model value:#('oneone' 'twotwo' 'threethree').
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   722
"
3
claus
parents: 0
diff changeset
   723
! !
claus
parents: 0
diff changeset
   724
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   725
!Label class methodsFor:'instance creation'!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   726
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   727
form:aForm
118
claus
parents: 113
diff changeset
   728
    "return a new Label showing a form.
claus
parents: 113
diff changeset
   729
     OBSOLETE: you should now use #label: for both text and bitmap labels."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   730
131
claus
parents: 130
diff changeset
   731
    ^ (self on:Screen current) form:aForm
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   732
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   733
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   734
form:aForm in:aView
118
claus
parents: 113
diff changeset
   735
    "return a new Label showing a form.
claus
parents: 113
diff changeset
   736
     OBSOLETE: you should now use #label:in: for both text and bitmap labels."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   737
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   738
    ^ (self in:aView) form:aForm
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   739
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   740
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   741
!Label class methodsFor:'defaults'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   742
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   743
defaultExtent
3
claus
parents: 0
diff changeset
   744
    "return default extent"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   745
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   746
    ^ 16 @ 16
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   747
!
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   748
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
   749
updateStyleCache
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   750
    DefaultForegroundColor := StyleSheet colorAt:'labelForegroundColor'.
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   751
    DefaultForegroundColor isNil ifTrue:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   752
	DefaultForegroundColor := StyleSheet colorAt:'foregroundColor' default:Black.
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   753
    ].
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   754
    DefaultBackgroundColor := StyleSheet colorAt:'labelBackgroundColor'.
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   755
    DefaultBackgroundColor isNil ifTrue:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   756
	DefaultBackgroundColor := StyleSheet colorAt:'backgroundColor'.
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
   757
    ].
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   758
    DefaultFont := StyleSheet fontAt:'labelFont'.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   759
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   760
    "
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   761
     self updateStyleCache
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   762
    "
254
aa15cac0670f oops - foregroundColor was overwritten by backgroundColor (if defined in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   763
aa15cac0670f oops - foregroundColor was overwritten by backgroundColor (if defined in styleSheet)
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   764
    "Modified: 14.12.1995 / 14:33:55 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   765
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   766
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   767
!Label methodsFor:'accessing-channels'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   768
260
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   769
backgroundChannel
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   770
    ^ backgroundChannel.
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   771
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   772
    "Created: 16.12.1995 / 15:50:08 / cg"
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   773
!
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   774
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   775
backgroundChannel:aValueHolder
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   776
    |prev|
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   777
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   778
    prev := backgroundChannel.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   779
    backgroundChannel := aValueHolder.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   780
    self setupChannel:aValueHolder for:#backgroundChannelChanged withOld:prev 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   781
!
145
claus
parents: 144
diff changeset
   782
260
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   783
foregroundChannel
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   784
    ^ foregroundChannel.
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   785
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   786
    "Created: 16.12.1995 / 15:50:01 / cg"
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   787
!
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   788
145
claus
parents: 144
diff changeset
   789
foregroundChannel:aValueHolder
146
claus
parents: 145
diff changeset
   790
    |prev|
claus
parents: 145
diff changeset
   791
claus
parents: 145
diff changeset
   792
    prev := foregroundChannel.
145
claus
parents: 144
diff changeset
   793
    foregroundChannel := aValueHolder.
146
claus
parents: 145
diff changeset
   794
    self setupChannel:aValueHolder for:#foregroundChannelChanged withOld:prev 
145
claus
parents: 144
diff changeset
   795
!
claus
parents: 144
diff changeset
   796
260
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   797
labelChannel
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   798
    ^ labelChannel.
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   799
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   800
    "Created: 16.12.1995 / 15:50:18 / cg"
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   801
!
475aa7b7d0e9 channel accessors added
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
   802
145
claus
parents: 144
diff changeset
   803
labelChannel:aValueHolder
146
claus
parents: 145
diff changeset
   804
    |prev|
claus
parents: 145
diff changeset
   805
claus
parents: 145
diff changeset
   806
    prev := labelChannel.
145
claus
parents: 144
diff changeset
   807
    labelChannel := aValueHolder.
146
claus
parents: 145
diff changeset
   808
    self setupChannel:aValueHolder for:#labelChannelChanged withOld:prev 
145
claus
parents: 144
diff changeset
   809
! !
claus
parents: 144
diff changeset
   810
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   811
!Label methodsFor:'accessing-colors'!
125
claus
parents: 118
diff changeset
   812
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   813
backgroundColor
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   814
    "return the background color"
125
claus
parents: 118
diff changeset
   815
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   816
    ^ bgColor 
125
claus
parents: 118
diff changeset
   817
!
claus
parents: 118
diff changeset
   818
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   819
backgroundColor:aColor
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   820
    "set the background color"
125
claus
parents: 118
diff changeset
   821
263
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   822
    aColor ~~ bgColor ifTrue:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   823
	bgColor := aColor on:device.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   824
	shown ifTrue:[self redraw]
263
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   825
    ]
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   826
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   827
    "Modified: 17.12.1995 / 15:09:03 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   828
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   829
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   830
foregroundColor
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   831
    "return the foreground color"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   832
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   833
    ^ fgColor
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   834
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   835
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   836
foregroundColor:aColor
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   837
    "set the foreground color"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   838
263
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   839
    aColor ~~ fgColor ifTrue:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   840
	fgColor := aColor on:device.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   841
	shown ifTrue:[self redraw]
263
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   842
    ].
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   843
74a282375195 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 260
diff changeset
   844
    "Modified: 17.12.1995 / 15:09:15 / cg"
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   845
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   846
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   847
foregroundColor:fg backgroundColor:bg
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   848
    "set the colors to be used for drawing"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   849
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   850
    fgColor := fg on:device.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   851
    bgColor := bg on:device.
131
claus
parents: 130
diff changeset
   852
    shown ifTrue:[self redraw]
133
claus
parents: 132
diff changeset
   853
! !
claus
parents: 132
diff changeset
   854
claus
parents: 132
diff changeset
   855
!Label methodsFor:'accessing-contents'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   856
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   857
form:aForm
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   858
    "set the labels form; adjust extent if not already realized.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   859
     OBSOLETE: you should now use #label: for both strings and images"
118
claus
parents: 113
diff changeset
   860
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   861
    self label:aForm
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   862
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   863
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   864
label
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   865
    "return the labels string or image"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   866
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   867
    ^ logo
118
claus
parents: 113
diff changeset
   868
!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   869
118
claus
parents: 113
diff changeset
   870
label:aStringOrFormOrImage
claus
parents: 113
diff changeset
   871
    "set the labelString or image; adjust extent if not already realized and
claus
parents: 113
diff changeset
   872
     not fixedSize"
claus
parents: 113
diff changeset
   873
claus
parents: 113
diff changeset
   874
    (aStringOrFormOrImage ~~ logo) ifTrue:[
claus
parents: 113
diff changeset
   875
	"/
claus
parents: 113
diff changeset
   876
	"/ avoid recompute of size, if its an image with
claus
parents: 113
diff changeset
   877
	"/ the same size
claus
parents: 113
diff changeset
   878
	"/
claus
parents: 113
diff changeset
   879
	aStringOrFormOrImage isImageOrForm ifTrue:[
claus
parents: 113
diff changeset
   880
	    logo notNil ifTrue:[
claus
parents: 113
diff changeset
   881
		logo isImageOrForm ifTrue:[
claus
parents: 113
diff changeset
   882
		    logo extent = aStringOrFormOrImage extent ifTrue:[
claus
parents: 113
diff changeset
   883
			logo := aStringOrFormOrImage.
claus
parents: 113
diff changeset
   884
			^ self
claus
parents: 113
diff changeset
   885
		    ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   886
		]
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   887
	    ]
118
claus
parents: 113
diff changeset
   888
	] ifFalse:[
claus
parents: 113
diff changeset
   889
	    (logo = aStringOrFormOrImage) ifTrue:[
claus
parents: 113
diff changeset
   890
		^ self
claus
parents: 113
diff changeset
   891
	    ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   892
	].
118
claus
parents: 113
diff changeset
   893
	logo := aStringOrFormOrImage.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   894
	self newLayout
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   895
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   896
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   897
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   898
labelString:aString
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   899
    "for ST-80 compatibility: same as #label:
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   900
     set the label-string; adjust extent if not already realized and not fixedSize"
118
claus
parents: 113
diff changeset
   901
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   902
    self label:aString
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   903
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   904
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   905
labelWidth
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   906
    "return the logos width in pixels"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   907
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   908
    ^ labelWidth
118
claus
parents: 113
diff changeset
   909
!
claus
parents: 113
diff changeset
   910
claus
parents: 113
diff changeset
   911
logo:something
claus
parents: 113
diff changeset
   912
    "set the labels form or string.
claus
parents: 113
diff changeset
   913
     OBSOLETE: the old version used #form: for images and #label: for strings.
claus
parents: 113
diff changeset
   914
	       you should now use #label: for any."
claus
parents: 113
diff changeset
   915
claus
parents: 113
diff changeset
   916
    self label:something
133
claus
parents: 132
diff changeset
   917
! !
claus
parents: 132
diff changeset
   918
claus
parents: 132
diff changeset
   919
!Label methodsFor:'accessing-layout'!
claus
parents: 132
diff changeset
   920
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   921
adjust
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   922
    "return the adjust symbol"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   923
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   924
    ^ adjust
125
claus
parents: 118
diff changeset
   925
!
claus
parents: 118
diff changeset
   926
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   927
adjust:how
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   928
    "set the adjust, how which must be one of
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   929
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   930
     #left        -> left adjust logo
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   931
     #right       -> right adjust logo
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   932
     #center      -> center logo
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   933
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   934
     #centerRight -> center logo if it fits; 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   935
		     if it does not fit, right adjust
258
ae4b8f1a6738 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   936
		     (use with filenames, where the interesting part is
118
claus
parents: 113
diff changeset
   937
		      at the right if the label is too small)
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   938
     #centerLeft  -> center logo if it fits; 
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   939
		     if it does not fit, left adjust it
258
ae4b8f1a6738 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 254
diff changeset
   940
		     (use with strings where the interesting part is at the
118
claus
parents: 113
diff changeset
   941
		      left if the label is too small)
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   942
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   943
     #leftRight   -> left adjust logo if it fits
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   944
		     if it does not fit, right adjust
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   945
		     (use with filenames, where the interesting part is
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   946
		      at the right if the label is too small)
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   947
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   948
     #rightLeft   -> right adjust logo if it fits
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
   949
		     if it does not fit, left adjust
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   950
    "
118
claus
parents: 113
diff changeset
   951
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   952
    (adjust ~~ how) ifTrue:[
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   953
	adjust := how.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   954
	self newLayout
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   955
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   956
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   957
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   958
font:aFont
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   959
    "set the font - if I'm not realized and not fixedSize, adjust my size"
125
claus
parents: 118
diff changeset
   960
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   961
    (aFont ~~ font) ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   962
	super font:(aFont on:device).
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   963
	self newLayout
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   964
    ]
133
claus
parents: 132
diff changeset
   965
!
claus
parents: 132
diff changeset
   966
claus
parents: 132
diff changeset
   967
horizontalSpace:aNumber
claus
parents: 132
diff changeset
   968
    "set the number of pixels by which the logo
claus
parents: 132
diff changeset
   969
     is horizontally inset from the border"
claus
parents: 132
diff changeset
   970
162
claus
parents: 155
diff changeset
   971
    hSpace := aNumber.
claus
parents: 155
diff changeset
   972
    self newLayout
133
claus
parents: 132
diff changeset
   973
!
claus
parents: 132
diff changeset
   974
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   975
layout
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   976
    "for protocol compatibility: alias for #adjust.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   977
     Please use #adjust, since #layout conflicts with a method
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   978
     in VW (which has a completely different meaning).
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   979
     In future versions of ST/X, #layout will behave the VW way."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   980
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   981
    self obsoleteMethodWarning:'use #adjust'.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   982
    ^ self adjust
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   983
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   984
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   985
layout:something
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   986
    "OBSOLETE compatibility interface. Will vanish.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   987
     for protocol compatibility: alias for #adjust:.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   988
     Please use #adjust:, since #layout: conflicts with a method
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   989
     in VW (which has a completely different meaning).
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   990
     In future versions of ST/X, #layout: will behave the VW way.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   991
     In the meantime, try to figure out what is meant ... a kludge"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   992
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   993
    something isLayout ifTrue:[^ super layout:something].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   994
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   995
    self obsoleteMethodWarning:'use #adjust:'.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   996
    self adjust:something
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   997
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   998
    "Modified: 31.8.1995 / 23:08:13 / claus"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
   999
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1000
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1001
sizeFixed
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1002
    "return the fix-size attribute"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1003
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1004
    ^ fixSize
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1005
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1006
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1007
sizeFixed:aBoolean
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1008
    "set/clear the fix-size attribute. 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1009
     If true, the receiver will not change its size when the labelString/logo
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1010
     changes. If false (the default), it will resize itself to make the logo
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1011
     fit."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1012
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1013
    fixSize := aBoolean
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1014
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1015
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1016
verticalSpace:aNumber
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1017
    "set the number of pixels by which the logo
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1018
     is vertically inset from the border"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1019
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1020
    vSpace := aNumber.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1021
    self newLayout
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1022
! !
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1023
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1024
!Label methodsFor:'accessing-mvc'!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1025
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1026
addModelInterfaceTo:aDictionary
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1027
    "see comment in View>>modelInterface"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1028
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1029
    super addModelInterfaceTo:aDictionary.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1030
    aDictionary at:#labelMessage put:labelMsg
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1031
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1032
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1033
converter:aConverter
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1034
    "set the printConverter;
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1035
     that one is asked to convert the models value to a printed
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1036
     representation (if non-nil). If nil, the model is supposed to
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1037
     return a string or bitmap image."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1038
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1039
    converter := aConverter
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1040
!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1041
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1042
labelMessage 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1043
    "return the symbol used to aquire the labelString/image from the model
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1044
     when the aspect changes.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1045
     The default is nil, which means: leave the label unchanged."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1046
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1047
    ^ labelMsg
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1048
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1049
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1050
labelMessage:aSymbol 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1051
    "set the symbol used to aquire the labelString/image from the model.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1052
     The default is nil, which means: leave the label unchanged."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1053
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1054
    labelMsg ~~ aSymbol ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1055
	labelMsg := aSymbol.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1056
	self getLabelFromModel
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1057
    ]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1058
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1059
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1060
model:aModel
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1061
    super model:aModel.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1062
    self getLabelFromModel.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1063
! !
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1064
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1065
!Label methodsFor:'change & update'!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1066
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1067
backgroundChannelChanged
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1068
    self backgroundColor:(backgroundChannel value)
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1069
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1070
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1071
foregroundChannelChanged
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1072
    self foregroundColor:(foregroundChannel value)
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1073
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1074
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1075
labelChannelChanged
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1076
    self label:(labelChannel value)
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1077
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1078
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1079
update:something with:aParameter from:changedObject
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1080
    "the MVC way of changing the label ..."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1081
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1082
    changedObject == model ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1083
	something == aspectMsg ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1084
	    self getLabelFromModel.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1085
	    ^ self.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1086
	]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1087
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1088
    ^ super update:something with:aParameter from:changedObject
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1089
! !
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1090
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1091
!Label methodsFor:'event handling'!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1092
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1093
sizeChanged:how
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1094
    "sent whenever size is changed by someone else - recompute the
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1095
     logos position within the View."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1096
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1097
    |prevPosition|
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1098
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1099
    super sizeChanged:how.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1100
    prevPosition := labelOriginX.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1101
    self computeLabelOrigin
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1102
    shown ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1103
	(adjust == #fit
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1104
	or:[labelOriginX ~~ prevPosition 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1105
	or:[how ~~ #smaller]]) ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1106
	    "/ self clear.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1107
	    self redraw.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1108
	    self redrawEdges
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1109
	]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1110
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1111
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1112
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1113
!Label methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1114
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1115
initStyle
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1116
    super initStyle.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1117
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  1118
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device].
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  1119
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1120
    DefaultBackgroundColor notNil ifTrue:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1121
	bgColor := DefaultBackgroundColor on:device
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
  1122
    ] ifFalse:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1123
	bgColor := viewBackground on:device.
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1124
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1125
    DefaultForegroundColor notNil ifTrue:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1126
	fgColor := DefaultForegroundColor on:device
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1127
    ] ifFalse:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1128
	fgColor := Black on:device.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
  1129
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1130
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1131
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1132
initialize
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1133
    super initialize.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1134
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1135
    font := font on:device.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1136
    self height:(font height + font descent).
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1137
    adjust := #center.
118
claus
parents: 113
diff changeset
  1138
    labelOriginX := labelOriginY := 0.
claus
parents: 113
diff changeset
  1139
    labelWidth := labelHeight := 0.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1140
    logo := nil.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1141
    fixSize := false.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1142
    hSpace := (self horizontalPixelPerMillimeter:0.5) rounded.
131
claus
parents: 130
diff changeset
  1143
    vSpace := (self verticalPixelPerMillimeter:0.25) rounded
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1144
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1145
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1146
recreate
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1147
    "after snapin, labels dimensions may have changed due to
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1148
     different font parameters"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1149
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1150
    super recreate.
3
claus
parents: 0
diff changeset
  1151
    font := font on:device.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1152
    self computeLabelSize.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1153
    self computeLabelOrigin
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1154
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1155
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1156
!Label methodsFor:'private'!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1157
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1158
computeLabelOrigin
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1159
    "(re)compute the origin of the label whenever label, font or view-size changes"
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1160
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1161
    |x y a|
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1162
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1163
    labelHeight isNil ifTrue:[^ self].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1164
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1165
    adjust == #fit ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1166
	labelOriginX := labelOriginY := margin.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1167
	^ self
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1168
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1169
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1170
    "if it does not fit, should we make the origin visible,
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1171
     or the center (for text, the center seems better. For images,
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1172
     I dont really know which is better ...
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1173
     The commented code below makes the origin visible
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1174
   "
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1175
"/    (labelHeight < height) ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1176
"/        y := (height - labelHeight) // 2
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1177
"/    ] ifFalse:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1178
"/        y := 0
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1179
"/    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1180
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1181
    "always center vertically"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1182
    y := (height - labelHeight) // 2.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1183
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1184
    labelOriginY := y.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1185
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1186
    a := adjust.
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1187
    (width < labelWidth) ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1188
	((adjust == #centerRight) or:[adjust == #leftRight]) ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1189
	    a := #right
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1190
	] ifFalse:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1191
	    ((adjust == #centerLeft) or:[adjust == #rightLeft]) ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1192
		a := #left
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1193
	    ].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1194
	]
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1195
    ] ifFalse:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1196
	((adjust == #centerRight) or:[adjust == #centerLeft]) ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1197
	    a := #center
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1198
	] ifFalse:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1199
	    adjust == #leftRight ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1200
		a := #left
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1201
	    ] ifFalse:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1202
		adjust == #rightLeft ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1203
		    a := #right
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1204
		]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1205
	    ]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1206
	]
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1207
    ].
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1208
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1209
    (a == #center) ifTrue:[
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1210
	" center text/form in button "
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1211
	x := (width - labelWidth) // 2.
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1212
    ] ifFalse:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1213
	(a == #left) ifTrue:[
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1214
	    x := margin
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1215
	] ifFalse:[
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1216
	    "/ #right
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1217
	    x := width - labelWidth - margin
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1218
	]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1219
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1220
    labelOriginX := x
318
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1221
73ea409232c0 new adjusts: #leftRight and #rightLeft (sounds wierd - mhmh)
Claus Gittinger <cg@exept.de>
parents: 304
diff changeset
  1222
    "Modified: 4.2.1996 / 21:03:17 / cg"
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1223
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1224
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1225
computeLabelSize
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1226
    "compute the extent needed to hold the label; aForm or aString"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1227
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1228
    |numberOfLines textHeight textWidth|
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1229
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1230
    logo isNil ifTrue:[^ self].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1231
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1232
    logo isImageOrForm ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1233
	labelWidth := logo width. 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1234
	labelHeight := logo height.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1235
	^ self
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1236
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1237
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1238
    "must be a String or collection of strings"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1239
    logo isString ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1240
	numberOfLines := 1 + (logo occurrencesOf:(Character cr)).
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1241
	(numberOfLines ~~ 1) ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1242
	    logo := logo asStringCollection
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1243
	]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1244
    ] ifFalse:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1245
	numberOfLines := logo size.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1246
	(numberOfLines <= 1) ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1247
	    logo := logo asString
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1248
	]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1249
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1250
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1251
"/    textHeight := font height * numberOfLines + font descent.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1252
    textHeight := font height * numberOfLines.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1253
    textWidth := font widthOf:logo.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1254
    labelWidth := textWidth + (hSpace * 2) .
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1255
    labelHeight := textHeight + (vSpace * 2)
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1256
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1257
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1258
getLabelFromModel
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1259
    "ask my model for the label to show.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1260
     Here, we use labelMsg (instead of aspectMsg). 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1261
     This allows multiple labels to react on the same aspect, 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1262
     but show different labels when changed 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1263
     (also, since labelMsg defaults to nil, constant labels
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1264
      which have a nil labelMsg will not try to aquire a labelString)."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1265
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1266
    |val|
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1267
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1268
    (model notNil 
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1269
    and:[labelMsg notNil]) ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1270
	val := model perform:labelMsg.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1271
	converter notNil ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1272
	    val := converter printStringFor:val
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1273
	].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1274
	self label:val.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1275
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1276
!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1277
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1278
newLayout
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1279
    "recompute position/size after a change
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1280
     - helper for form:/font: etc."
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1281
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1282
    self computeLabelSize.
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1283
    fixSize ifFalse:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1284
	self resize
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1285
    ] ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1286
	self computeLabelOrigin
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1287
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1288
    shown ifTrue:[
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1289
	self redraw
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1290
    ]
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1291
! !
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1292
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1293
!Label methodsFor:'queries'!
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1294
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1295
preferredExtent
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1296
    "return my preferred extent - this is the minimum size I would like to have"
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1297
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1298
    |extra|
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1299
361
b5cb40f55316 if size is fixed, return my actual size in #preferredExtent
ca
parents: 318
diff changeset
  1300
    fixSize ifTrue:[^ self extent].
b5cb40f55316 if size is fixed, return my actual size in #preferredExtent
ca
parents: 318
diff changeset
  1301
303
8408cec09472 if undefined, set label to empty string when asked for preferredExtent (would otherwise return 0@0)
ah
parents: 275
diff changeset
  1302
    logo isNil ifTrue:[
361
b5cb40f55316 if size is fixed, return my actual size in #preferredExtent
ca
parents: 318
diff changeset
  1303
        self label:''
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1304
    ].
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1305
303
8408cec09472 if undefined, set label to empty string when asked for preferredExtent (would otherwise return 0@0)
ah
parents: 275
diff changeset
  1306
    logo notNil ifTrue:[
361
b5cb40f55316 if size is fixed, return my actual size in #preferredExtent
ca
parents: 318
diff changeset
  1307
        extra := margin * 2.
b5cb40f55316 if size is fixed, return my actual size in #preferredExtent
ca
parents: 318
diff changeset
  1308
        ^ (labelWidth + extra + hSpace) @ (labelHeight + extra + vSpace)
303
8408cec09472 if undefined, set label to empty string when asked for preferredExtent (would otherwise return 0@0)
ah
parents: 275
diff changeset
  1309
    ]. 
8408cec09472 if undefined, set label to empty string when asked for preferredExtent (would otherwise return 0@0)
ah
parents: 275
diff changeset
  1310
        
202
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1311
    ^ super preferredExtent
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1312
! !
01f3cbb8e20e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
  1313
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1314
!Label methodsFor:'redrawing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1315
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1316
clearInsideWith:bg
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1317
    |cutOff mustClear|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1318
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1319
    cutOff := margin * 2.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1320
3
claus
parents: 0
diff changeset
  1321
    mustClear := true.
claus
parents: 0
diff changeset
  1322
87
2c6ab478466a *** empty log message ***
claus
parents: 81
diff changeset
  1323
    (logo notNil and:[logo isImageOrForm]) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1324
	(labelOriginX == 0 and:[labelOriginY == 0]) ifTrue:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1325
	    logo width >= (width - cutOff) ifTrue:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1326
		logo height >= (height - cutOff) ifTrue:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1327
		    "no need to clear before - avoid flicker"
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1328
		    mustClear := false
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1329
		]
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1330
	    ]
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1331
	].
3
claus
parents: 0
diff changeset
  1332
    ].
claus
parents: 0
diff changeset
  1333
claus
parents: 0
diff changeset
  1334
    mustClear ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1335
	self paint:bg.
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1336
	self fillRectangleX:margin y:margin
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1337
		      width:(width - cutOff)
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1338
		     height:(height - cutOff).
3
claus
parents: 0
diff changeset
  1339
    ].
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1340
!
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1341
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1342
drawWith:fg and:bg
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1343
    "redraw my label with fg/bg - this generic method is also used by subclasses
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1344
     (especially Button) to redraw the logo in different colors."
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1345
132
claus
parents: 131
diff changeset
  1346
    |x y scaleH scaleV nW nH hSep vSep m2|
77
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1347
565b052f5277 *** empty log message ***
claus
parents: 70
diff changeset
  1348
    self clearInsideWith:bg.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1349
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1350
    logo notNil ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1351
	self paint:fg on:bg.
131
claus
parents: 130
diff changeset
  1352
133
claus
parents: 132
diff changeset
  1353
	m2 := margin * 2.
claus
parents: 132
diff changeset
  1354
	hSep := (hSpace*2).
claus
parents: 132
diff changeset
  1355
	vSep := (vSpace*2).
claus
parents: 132
diff changeset
  1356
87
2c6ab478466a *** empty log message ***
claus
parents: 81
diff changeset
  1357
	logo isImageOrForm ifTrue:[
131
claus
parents: 130
diff changeset
  1358
	    x := labelOriginX.
claus
parents: 130
diff changeset
  1359
	    y := labelOriginY.
claus
parents: 130
diff changeset
  1360
claus
parents: 130
diff changeset
  1361
	    adjust == #fit ifTrue:[
claus
parents: 130
diff changeset
  1362
		scaleH := ((width - hSep) / (logo width)) asFloat.
claus
parents: 130
diff changeset
  1363
		scaleV := ((height - vSep) / (logo height)) asFloat.
claus
parents: 130
diff changeset
  1364
		self scale:(scaleH @ scaleV).
claus
parents: 130
diff changeset
  1365
		x := transformation applyInverseScaleX:x.
claus
parents: 130
diff changeset
  1366
		y := transformation applyInverseScaleY:y.
claus
parents: 130
diff changeset
  1367
	    ].
claus
parents: 130
diff changeset
  1368
87
2c6ab478466a *** empty log message ***
claus
parents: 81
diff changeset
  1369
	    logo := logo on:device.
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1370
"/            self background:bg.
131
claus
parents: 130
diff changeset
  1371
	    self displayOpaqueForm:logo x:x y:y 
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1372
	] ifFalse:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1373
	    x := labelOriginX + hSpace.
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1374
	    y := labelOriginY + (font ascent) + vSpace.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1375
131
claus
parents: 130
diff changeset
  1376
	    adjust == #fit ifTrue:[
claus
parents: 130
diff changeset
  1377
		scaleH := ((width - m2 - hSep) / (labelWidth - hSpace)) asFloat.
claus
parents: 130
diff changeset
  1378
		scaleV := ((height - m2 - vSep) / (labelHeight - vSpace)) asFloat.
claus
parents: 130
diff changeset
  1379
		self scale:(scaleH min: scaleV).
claus
parents: 130
diff changeset
  1380
		x := transformation applyInverseScaleX:x.
claus
parents: 130
diff changeset
  1381
		y := y - font ascent + (transformation applyScaleY:font ascent).
claus
parents: 130
diff changeset
  1382
		y := transformation applyInverseScaleY:y.
claus
parents: 130
diff changeset
  1383
		scaleH < scaleV ifTrue:[
claus
parents: 130
diff changeset
  1384
		    nH := labelHeight * scaleH.
claus
parents: 130
diff changeset
  1385
		    "/ now, center vertically
claus
parents: 130
diff changeset
  1386
		    y := y + ((height - nH - m2 - vSep) / scaleH / 2).
claus
parents: 130
diff changeset
  1387
		].
claus
parents: 130
diff changeset
  1388
		scaleV < scaleH ifTrue:[
claus
parents: 130
diff changeset
  1389
		    "/ now, center horizontally
claus
parents: 130
diff changeset
  1390
		    nW := labelWidth * scaleV.
claus
parents: 130
diff changeset
  1391
		    x := x + ((width - nW - m2 - hSep) / scaleV / 2) 
claus
parents: 130
diff changeset
  1392
		].
claus
parents: 130
diff changeset
  1393
	    ].
claus
parents: 130
diff changeset
  1394
87
2c6ab478466a *** empty log message ***
claus
parents: 81
diff changeset
  1395
	    logo isString ifTrue:[
250
77012e65ac84 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
  1396
		self displayOpaqueString:logo x:x y:y
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1397
	    ] ifFalse:[
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1398
		logo do:[ :line |
250
77012e65ac84 draw strings as opaque strings - OS/2 server has a bug with non-image strings
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
  1399
		    self displayOpaqueString:(line printString) x:x y:y.
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1400
		    y := y + (font height)
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1401
		]
131
claus
parents: 130
diff changeset
  1402
	    ].
claus
parents: 130
diff changeset
  1403
claus
parents: 130
diff changeset
  1404
	].
claus
parents: 130
diff changeset
  1405
claus
parents: 130
diff changeset
  1406
	adjust == #fit ifTrue:[
claus
parents: 130
diff changeset
  1407
	    self scale:1
claus
parents: 130
diff changeset
  1408
	].
claus
parents: 130
diff changeset
  1409
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1410
    ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1411
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1412
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1413
redraw
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1414
    "redraw my label"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1415
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1416
    shown ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 50
diff changeset
  1417
	self drawWith:fgColor and:bgColor
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1418
    ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1419
! !
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1420
110
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1421
!Label methodsFor:'resizing'!
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1422
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1423
forceResize
118
claus
parents: 113
diff changeset
  1424
    "resize myself to make text fit into myself. Here, this is done even if
claus
parents: 113
diff changeset
  1425
     fixSize is set."
110
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1426
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1427
    logo notNil ifTrue:[
130
claus
parents: 128
diff changeset
  1428
	self extent:self preferredExtent.
110
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1429
	self computeLabelOrigin
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1430
    ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1431
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1432
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1433
resize
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1434
    "resize myself to make text fit into myself.
118
claus
parents: 113
diff changeset
  1435
     but only do so, if I am not fixedSize and I have NOT been 
claus
parents: 113
diff changeset
  1436
     given a relative extent or an extend computation block."
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1437
110
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1438
    (logo notNil 
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1439
    and:[fixSize not
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1440
    and:[relativeExtent isNil
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1441
    and:[extentRule isNil
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1442
    and:[relativeCorner isNil 
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1443
    and:[cornerRule isNil]]]]]) ifTrue:[
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1444
	self forceResize
eb59f6e31e84 *** empty log message ***
claus
parents: 105
diff changeset
  1445
    ] ifFalse:[
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1446
	self computeLabelOrigin
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1447
    ]
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1448
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1449
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1450
!Label class methodsFor:'documentation'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1451
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1452
version
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  1453
    ^ '$Header: /cvs/stx/stx/libwidg/Label.st,v 1.48 1996-02-24 16:34:03 cg Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1454
! !