CheckBox.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 5642 c7b964aa14df
child 5883 c441a78650db
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     1
"
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
49
claus
parents: 44
diff changeset
     3
	      All Rights Reserved
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     4
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
97c1c943bef6 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    11
"
1769
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
    13
4913
68829b96da60 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4684
diff changeset
    14
"{ NameSpace: Smalltalk }"
68829b96da60 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4684
diff changeset
    15
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    16
HorizontalPanelView subclass:#CheckBox
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    17
	instanceVariableNames:'toggleView labelView labelForegroundColor
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
    18
		disabledLabelForegroundColor disabledLabelEtchedForegroundColor
4120
fcbdc6b3998d class definition (backgroundChannel pushed up to PanelView)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4018
diff changeset
    19
		foregroundChannel resizeForLabel'
320
bf5e928d027a option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
    20
	classVariableNames:'DefaultLabelForegroundColor DefaultDisabledLabelForegroundColor
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
    21
		DefaultDisabledLabelEtchedForegroundColor CheckToggleLeft'
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    22
	poolDictionaries:''
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    23
	category:'Views-Interactors'
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    24
!
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    25
273
01541272ce8d resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    26
!CheckBox class methodsFor:'documentation'!
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    27
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    28
copyright
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    29
"
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    30
 COPYRIGHT (c) 1995 by Claus Gittinger
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    31
	      All Rights Reserved
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    32
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    33
 This software is furnished under a license and may be used
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    34
 only in accordance with the terms of that license and with the
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    36
 be provided or otherwise made available to, or used by, any
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    37
 other person.  No title to or ownership of the software is
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    38
 hereby transferred.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    39
"
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    40
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    41
!
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    42
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    43
documentation
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    44
"
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    45
    CheckBoxes consist of a checkToggle and a label;
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    46
    if used without a model, its action block is evaluated
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    47
    when toggled (see Toggle for more information).
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    48
    Otherwise, a valueHolder on a boolean is the preferred model
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    49
    (other models are possible - this may required different aspect
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    50
     and/or changeMessage settings; make certain to set those before
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    51
     a model is assigned, since the toggle fetches the value when
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    52
     a new model is assigned.)
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    53
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    54
    [author:]
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    55
        Claus Gittinger
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    56
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
    57
    [see also:]
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    58
        Button CheckToggle
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    59
        DialogBox
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    60
        ValueHolder
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    61
"
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    62
!
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    63
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    64
examples
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    65
"
188
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    66
  no-op checkBox without a label:
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    67
                                                                        [exBegin]
188
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    68
     |b|
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    69
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    70
     b := CheckBox new.
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    71
     b open
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    72
                                                                        [exEnd]
188
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    73
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
    74
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    75
  no-op checkBox:
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    76
                                                                        [exBegin]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    77
     |b|
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    78
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    79
     b := CheckBox new.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    80
     b label:'foo'.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    81
     b open
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    82
                                                                        [exEnd]
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    83
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    84
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    85
  combined instance creation & label setup:
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    86
                                                                        [exBegin]
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    87
     |b|
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    88
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    89
     b := CheckBox label:'foo'.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    90
     b open
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    91
                                                                        [exEnd]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    92
97c1c943bef6 Initial revision
claus
parents:
diff changeset
    93
56
claus
parents: 55
diff changeset
    94
  no-op checkBox, disabled:
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    95
                                                                        [exBegin]
56
claus
parents: 55
diff changeset
    96
     |b|
claus
parents: 55
diff changeset
    97
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
    98
     b := CheckBox label:'foo'.
56
claus
parents: 55
diff changeset
    99
     b disable.
claus
parents: 55
diff changeset
   100
     b open
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   101
                                                                        [exEnd]
56
claus
parents: 55
diff changeset
   102
claus
parents: 55
diff changeset
   103
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   104
  changing colors
56
claus
parents: 55
diff changeset
   105
  (a demo only: it is no good style to fight the styleSheet):
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   106
                                                                        [exBegin]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   107
     |panel b|
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   108
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   109
     panel := VerticalPanelView new.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   110
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   111
     b := CheckBox label:'foo' in:panel.
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   112
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   113
     b := CheckBox label:'bar' in:panel.
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   114
     b labelView foregroundColor:Color red.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   115
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   116
     b := CheckBox label:'baz' in:panel.
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   117
     b toggleView activeForegroundColor:Color blue.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   118
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   119
     panel open
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   120
                                                                        [exEnd]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   121
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   122
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   123
  using action-blocks:
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   124
                                                                        [exBegin]
49
claus
parents: 44
diff changeset
   125
     |b|
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   126
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   127
     b := CheckBox label:'check'.
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   128
     b action:[:value | Transcript show:'set to: '; showCR:value].
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   129
     b open.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   130
                                                                        [exEnd]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   131
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   132
49
claus
parents: 44
diff changeset
   133
  with a model (default ST-80 behavior, sending #value: to the model):
claus
parents: 44
diff changeset
   134
  (see changing value in the inspector)
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   135
                                                                        [exBegin]
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   136
     |b model|
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   137
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   138
     model := ValueHolder newBoolean.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   139
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   140
     b := CheckBox label:'check'.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   141
     b model:model.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   142
     b open.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   143
     model inspect.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   144
                                                                        [exEnd]
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   145
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   146
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   147
  combined instance creation & model setup:
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   148
                                                                        [exBegin]
49
claus
parents: 44
diff changeset
   149
     |b model|
claus
parents: 44
diff changeset
   150
claus
parents: 44
diff changeset
   151
     model := ValueHolder newBoolean.
claus
parents: 44
diff changeset
   152
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   153
     b := CheckBox label:'check' model:model .
49
claus
parents: 44
diff changeset
   154
     b open.
claus
parents: 44
diff changeset
   155
     model inspect.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   156
                                                                        [exEnd]
49
claus
parents: 44
diff changeset
   157
56
claus
parents: 55
diff changeset
   158
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   159
  with a model and different aspect & changeSelector
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   160
  setting the aspect to nil suppresses fetching the value from the model.
49
claus
parents: 44
diff changeset
   161
  (using a plug here, for demonstration only):
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   162
                                                                        [exBegin]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   163
     |b model|
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   164
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   165
     model := Plug new.
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   166
     model respondTo:#changeCheck: with:[:arg | Transcript showCR:'change to ' , arg printString].
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   167
     model respondTo:#value with:[false].
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   168
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   169
     b := CheckBox label:'check'.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   170
     b aspectMessage:nil; model:model; changeMessage:#changeCheck:.
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   171
     b open.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   172
                                                                        [exEnd]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   173
56
claus
parents: 55
diff changeset
   174
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   175
  with an enableChannel
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   176
                                                                        [exBegin]
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   177
     |b enaToggle enaHolder|
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   178
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   179
     enaHolder := true asValue.
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   180
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   181
     enaToggle := Toggle label:'enable'.
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   182
     enaToggle model:enaHolder.
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   183
     enaToggle open.
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   184
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   185
     b := CheckBox label:'check'.
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   186
     b action:[:value | Transcript show:'set to: '; showCR:value].
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   187
     b enableChannel:enaHolder.
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   188
     b open.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   189
                                                                        [exEnd]
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   190
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   191
56
claus
parents: 55
diff changeset
   192
  with models, one checkBox disabling the others:
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   193
                                                                        [exBegin]
56
claus
parents: 55
diff changeset
   194
     |dialog translator enableChannel val1 val2 val3 eBox box1 box2 box3|
claus
parents: 55
diff changeset
   195
claus
parents: 55
diff changeset
   196
     translator := Plug new.
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   197
     translator respondTo:#enableDisable
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   198
                with:[
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   199
                        enableChannel value
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   200
                            ifTrue:[
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   201
                                box1 enable.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   202
                                box2 enable.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   203
                                box3 enable.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   204
                            ]
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   205
                            ifFalse:[
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   206
                                box1 disable.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   207
                                box2 disable.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   208
                                box3 disable.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   209
                            ]
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   210
                     ].
56
claus
parents: 55
diff changeset
   211
claus
parents: 55
diff changeset
   212
     enableChannel := true asValue.
claus
parents: 55
diff changeset
   213
     enableChannel onChangeSend:#enableDisable to:translator.
claus
parents: 55
diff changeset
   214
     val1 := true asValue.
claus
parents: 55
diff changeset
   215
     val2 := false asValue.
claus
parents: 55
diff changeset
   216
     val3 := true asValue.
claus
parents: 55
diff changeset
   217
claus
parents: 55
diff changeset
   218
     dialog := Dialog new.
claus
parents: 55
diff changeset
   219
     dialog addCheckBox:'enable' on:enableChannel.
claus
parents: 55
diff changeset
   220
     dialog addVerticalSpace.
claus
parents: 55
diff changeset
   221
     dialog leftIndent:30.
claus
parents: 55
diff changeset
   222
     box1 := dialog addCheckBox:'value1' on:val1.
claus
parents: 55
diff changeset
   223
     dialog addVerticalSpace.
claus
parents: 55
diff changeset
   224
     box2 := dialog addCheckBox:'value2' on:val2.
claus
parents: 55
diff changeset
   225
     dialog addVerticalSpace.
claus
parents: 55
diff changeset
   226
     box3 := dialog addCheckBox:'value3' on:val3.
claus
parents: 55
diff changeset
   227
     dialog addVerticalSpace.
claus
parents: 55
diff changeset
   228
     dialog addOkButton.
claus
parents: 55
diff changeset
   229
claus
parents: 55
diff changeset
   230
     dialog open.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   231
                                                                        [exEnd]
56
claus
parents: 55
diff changeset
   232
claus
parents: 55
diff changeset
   233
49
claus
parents: 44
diff changeset
   234
  multiple checkBoxes on a single model (using different aspects)
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   235
                                                                        [exBegin]
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   236
     |top panel b model value1 value2|
49
claus
parents: 44
diff changeset
   237
claus
parents: 44
diff changeset
   238
     value1 := true.
claus
parents: 44
diff changeset
   239
     value2 := false.
claus
parents: 44
diff changeset
   240
     model := Plug new.
claus
parents: 44
diff changeset
   241
     model respondTo:#value1 with:[value1].
claus
parents: 44
diff changeset
   242
     model respondTo:#value1: with:[:val | value1 := val].
claus
parents: 44
diff changeset
   243
     model respondTo:#value2 with:[value2].
claus
parents: 44
diff changeset
   244
     model respondTo:#value2: with:[:val | value2 := val].
claus
parents: 44
diff changeset
   245
claus
parents: 44
diff changeset
   246
     top := DialogBox new.
claus
parents: 44
diff changeset
   247
     top extent:200@300.
claus
parents: 44
diff changeset
   248
claus
parents: 44
diff changeset
   249
     panel := VerticalPanelView new.
claus
parents: 44
diff changeset
   250
claus
parents: 44
diff changeset
   251
     b := CheckBox in:panel.
claus
parents: 44
diff changeset
   252
     b label:'check1'.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   253
     b aspect:#value1; model:model; changeMessage:#value1:.
49
claus
parents: 44
diff changeset
   254
claus
parents: 44
diff changeset
   255
     b := CheckBox in:panel.
claus
parents: 44
diff changeset
   256
     b label:'check2'.
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   257
     b aspect:#value2; model:model; changeMessage:#value2:.
49
claus
parents: 44
diff changeset
   258
claus
parents: 44
diff changeset
   259
     top addComponent:panel.
claus
parents: 44
diff changeset
   260
     top addAbortButton; addOkButton.
claus
parents: 44
diff changeset
   261
     top openModal.
claus
parents: 44
diff changeset
   262
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   263
     top accepted ifTrue:[
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   264
         Transcript show:'value1: '; showCR:model value1.
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   265
         Transcript show:'value2: '; showCR:model value2.
49
claus
parents: 44
diff changeset
   266
     ]
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   267
                                                                        [exEnd]
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   268
"
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   269
! !
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   270
273
01541272ce8d resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   271
!CheckBox class methodsFor:'instance creation'!
62
claus
parents: 59
diff changeset
   272
76
claus
parents: 66
diff changeset
   273
label:aStringOrImage model:aModel
claus
parents: 66
diff changeset
   274
    "create & return a new checkBox, on aModel (typically a ValueHolder),
claus
parents: 66
diff changeset
   275
     with aStringOrImage as label."
claus
parents: 66
diff changeset
   276
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   277
    ^ (self model:aModel) label:aStringOrImage
76
claus
parents: 66
diff changeset
   278
claus
parents: 66
diff changeset
   279
    "Created: 17.9.1995 / 14:20:58 / claus"
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   280
    "Modified: 28.2.1997 / 19:23:59 / cg"
56
claus
parents: 55
diff changeset
   281
! !
claus
parents: 55
diff changeset
   282
273
01541272ce8d resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   283
!CheckBox class methodsFor:'defaults'!
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   284
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   285
updateStyleCache
134
049f033265f9 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   286
    "extract values from the styleSheet and cache them in class variables"
049f033265f9 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   287
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   288
    <resource: #style (#'checkBox.labelForegroundColor'
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   289
                       #'checkBox.disabledLabelForegroundColor'
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2742
diff changeset
   290
                       #'checkBox.disabledLabelEtchedForegroundColor'
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   291
                       #'checkBox.toggleLeft')>
134
049f033265f9 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 119
diff changeset
   292
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   293
    DefaultFont                         := StyleSheet fontAt:'label.font'.
830
028b7bf9aaad take default font from class Label
tz
parents: 820
diff changeset
   294
    DefaultLabelForegroundColor         := StyleSheet colorAt:'checkBox.labelForegroundColor'.
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   295
    DefaultDisabledLabelForegroundColor := StyleSheet colorAt:'checkBox.disabledLabelForegroundColor'.
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   296
    DefaultDisabledLabelForegroundColor isNil ifTrue:[
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   297
        DefaultDisabledLabelForegroundColor := StyleSheet colorAt:'button.disabledForegroundColor'.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   298
    ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   299
    DefaultDisabledLabelEtchedForegroundColor := StyleSheet colorAt:'checkBox.disabledLabelEtchedForegroundColor'.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   300
    DefaultDisabledLabelEtchedForegroundColor isNil ifTrue:[
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   301
        DefaultDisabledLabelEtchedForegroundColor := StyleSheet colorAt:'button.disabledEtchedForegroundColor'.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   302
    ].
830
028b7bf9aaad take default font from class Label
tz
parents: 820
diff changeset
   303
    CheckToggleLeft                     := StyleSheet at:'checkBox.toggleLeft' default:true
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   304
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   305
    "
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   306
     self updateStyleCache
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   307
    "
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   308
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   309
    "Created: 14.12.1995 / 14:47:22 / cg"
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 527
diff changeset
   310
    "Modified: 20.10.1997 / 13:51:30 / cg"
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   311
! !
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   312
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   313
!CheckBox methodsFor:'accessing-behavior'!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   314
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   315
action:aBlock
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   316
    "set the actionBlock; forwarded to the toggle"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   317
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   318
    toggleView action:aBlock
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   319
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   320
    "Modified: 25.4.1996 / 16:31:19 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   321
!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   322
299
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   323
enabled
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   324
    "return true, if the checkBox is enabled.
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   325
     forwarded to toggle"
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   326
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   327
    ^ toggleView enabled.
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   328
!
740258e44b3c added #enabled.
ca
parents: 284
diff changeset
   329
1297
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   330
enabled:aBoolean
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   331
    "enable/diable the checkBox; forwarded to toggle & change labels color"
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   332
1505
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   333
    |clr cursor|
1297
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   334
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   335
    toggleView enabled:aBoolean.
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   336
    self enableStateChanged.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   337
"/    aBoolean ifTrue:[
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   338
"/        labelView etchedForegroundColor:nil.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   339
"/        clr := labelForegroundColor.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   340
"/        clr isNil ifTrue:[ clr := labelView foregroundColor ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   341
"/        cursor := Cursor hand.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   342
"/    ] ifFalse:[
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   343
"/        disabledLabelEtchedForegroundColor notNil ifTrue:[ labelView etchedForegroundColor:disabledLabelEtchedForegroundColor ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   344
"/        clr := disabledLabelForegroundColor.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   345
"/        clr isNil ifTrue:[ clr := toggleView disabledForegroundColor ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   346
"/        cursor := Cursor normal.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   347
"/    ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   348
"/    labelView cursor:cursor.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   349
"/    self cursor:cursor.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   350
"/    toggleView cursor:cursor.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   351
"/    labelView foregroundColor:clr.
1297
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   352
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   353
    "Modified: / 25.4.1996 / 16:31:40 / cg"
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   354
    "Created: / 30.3.1999 / 14:54:48 / stefan"
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   355
!
c7ece249c083 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1276
diff changeset
   356
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   357
pressAction:aBlock
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   358
    "set the pressAction; forwarded to the toggle"
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   359
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   360
    toggleView pressAction:aBlock.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   361
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   362
    "Created: 22.9.1995 / 15:54:04 / claus"
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   363
    "Modified: 25.4.1996 / 16:31:52 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   364
!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   365
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   366
releaseAction:aBlock
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   367
    "set the releaseAction; forwarded to the toggle"
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   368
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   369
    toggleView releaseAction:aBlock.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   370
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   371
    "Created: 22.9.1995 / 15:54:11 / claus"
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   372
    "Modified: 25.4.1996 / 16:32:00 / cg"
78
claus
parents: 76
diff changeset
   373
! !
claus
parents: 76
diff changeset
   374
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   375
!CheckBox methodsFor:'accessing-channels'!
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   376
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   377
backgroundChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   378
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   379
    ^labelView backgroundChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   380
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   381
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   382
backgroundChannel:aChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   383
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   384
    labelView backgroundChannel: (backgroundChannel := aChannel).
1675
355c448a2570 no need for an extra block to send #enableStateChanged
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   385
    aChannel onChangeSend:#enableStateChanged to:self.
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   386
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   387
164
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   388
enableChannel
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   389
    "return a valueHolder for enable/disable"
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   390
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   391
    ^ toggleView enableChannel
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   392
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   393
    "Created: 30.4.1996 / 15:11:13 / cg"
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   394
!
74f32e7b92fc added enableChannel
Claus Gittinger <cg@exept.de>
parents: 159
diff changeset
   395
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   396
enableChannel:aChannel
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   397
    "set the enableChannel"
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   398
119
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   399
    |wasEnabled|
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   400
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   401
    wasEnabled := toggleView enabled.
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   402
    toggleView enableChannel:aChannel.
1675
355c448a2570 no need for an extra block to send #enableStateChanged
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   403
    aChannel onChangeSend:#enableStateChanged to:self.
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   404
119
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   405
    aChannel value ~~ wasEnabled ifTrue:[
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   406
        self enableStateChanged
119
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   407
    ]
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   408
!
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   409
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   410
foregroundChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   411
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   412
    ^labelView foregroundChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   413
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   414
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   415
foregroundChannel:aChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   416
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   417
    labelView foregroundChannel: (foregroundChannel := aChannel).
1675
355c448a2570 no need for an extra block to send #enableStateChanged
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   418
    aChannel onChangeSend:#enableStateChanged to:self.
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   419
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   420
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   421
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   422
labelChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   423
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   424
    ^labelView labelChannel
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   425
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   426
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   427
labelChannel:aChannel
1769
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   428
    labelView labelChannel notNil ifTrue:[
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   429
        labelView labelChannel removeDependent:self
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   430
    ].
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   431
    labelView labelChannel: aChannel.
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   432
    aChannel notNil ifTrue:[
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   433
        aChannel addDependent:self
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   434
    ].
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   435
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   436
! !
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   437
5642
c7b964aa14df #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5455
diff changeset
   438
!CheckBox methodsFor:'accessing-color & font'!
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   439
851
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   440
backgroundColor
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   441
    "get backgroundColor of the label view"
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   442
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   443
    ^labelView backgroundColor
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   444
!
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   445
3528
7ba2b9cfb354 Fix background color setting
Stefan Vogel <sv@exept.de>
parents: 3479
diff changeset
   446
backgroundColor:aColor
7ba2b9cfb354 Fix background color setting
Stefan Vogel <sv@exept.de>
parents: 3479
diff changeset
   447
    "set backgroundColor only for myself and the label view"
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   448
3528
7ba2b9cfb354 Fix background color setting
Stefan Vogel <sv@exept.de>
parents: 3479
diff changeset
   449
    super backgroundColor:aColor.
7ba2b9cfb354 Fix background color setting
Stefan Vogel <sv@exept.de>
parents: 3479
diff changeset
   450
    labelView backgroundColor:aColor.
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   451
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   452
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   453
disabledLabelEtchedForegroundColor
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   454
    "get the disabledLabelForegroundColor; forwarded to the toggle"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   455
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   456
    ^ toggleView disabledEtchedForegroundColor
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   457
!
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   458
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   459
disabledLabelForegroundColor
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   460
    "get the disabledLabelForegroundColor; forwarded to the toggle"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   461
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   462
    disabledLabelForegroundColor isNil ifTrue:[ ^ toggleView disabledForegroundColor ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   463
    ^ disabledLabelForegroundColor
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   464
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   465
    "Created: 16.12.1995 / 19:47:45 / cg"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   466
    "Modified: 22.5.1996 / 13:16:55 / cg"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   467
!
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   468
851
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   469
foregroundColor
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   470
    "get foregroundColor of the label view"
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   471
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   472
    ^labelView foregroundColor
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   473
!
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   474
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   475
foregroundColor: foregroundColor
851
f7e436fe29ee get colors selectors added
tz
parents: 830
diff changeset
   476
    "set foregroundColor only for the label view"
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   477
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   478
    labelView foregroundColor: (labelForegroundColor := foregroundColor).
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   479
    foregroundChannel notNil ifTrue: [foregroundChannel value: foregroundColor]
903
77a51b230754 viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   480
!
77a51b230754 viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   481
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   482
labelForegroundColor
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   483
    "get the labels foregroundColor"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   484
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   485
    labelForegroundColor isNil ifTrue:[ ^ labelView foregroundColor ].
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   486
    ^ labelForegroundColor
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   487
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   488
    "Created: 16.12.1995 / 19:47:20 / cg"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   489
    "Modified: 25.4.1996 / 16:33:26 / cg"
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   490
!
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   491
903
77a51b230754 viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   492
viewBackground: backgroundColor
77a51b230754 viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   493
    "set backgroundColor"
77a51b230754 viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   494
77a51b230754 viewBackground setting must change mine too
Claus Gittinger <cg@exept.de>
parents: 851
diff changeset
   495
    labelView backgroundColor: backgroundColor.
3287
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   496
    super viewBackground: backgroundColor.
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   497
! !
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   498
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   499
!CheckBox methodsFor:'accessing-components'!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   500
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   501
labelView
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   502
    "return the labelView; allows manipulation of the
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   503
     labels attributes (colors etc.)"
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   504
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   505
    ^ labelView
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   506
!
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   507
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   508
toggleView
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   509
    "return the toggleView; allows manipulation of the
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   510
     toggles attributes (colors etc.)"
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   511
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   512
    ^ toggleView
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   513
! !
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   514
56
claus
parents: 55
diff changeset
   515
!CheckBox methodsFor:'accessing-look'!
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   516
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   517
activeLogo:anImageOrString
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   518
    "set the activeLogo; forwarded to the toggle"
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   519
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   520
    toggleView activeLogo:anImageOrString
56
claus
parents: 55
diff changeset
   521
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   522
    "Created: 22.9.1995 / 15:44:08 / claus"
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   523
    "Modified: 25.4.1996 / 16:32:50 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   524
!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   525
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   526
font
185
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   527
    "return the font. Forward from label"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   528
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   529
    ^ labelView font
185
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   530
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   531
    "Modified: 22.5.1996 / 13:17:07 / cg"
49
claus
parents: 44
diff changeset
   532
!
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   533
56
claus
parents: 55
diff changeset
   534
font:aFont
185
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   535
    "set the font. Forward to the label & resize myself.
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   536
     CAVEAT: with the addition of Text objects,
268
978db6396b49 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   537
	     this method is going to be obsoleted by a textStyle
978db6396b49 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   538
	     method, which allows specific control over
978db6396b49 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
   539
	     normalFont/boldFont/italicFont parameters."
55
claus
parents: 49
diff changeset
   540
56
claus
parents: 55
diff changeset
   541
    labelView font:aFont.
claus
parents: 55
diff changeset
   542
    labelView forceResize.
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   543
    self layoutChanged.
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   544
    self resize.
185
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   545
846c548b3c77 method comments
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   546
    "Modified: 22.5.1996 / 13:17:28 / cg"
49
claus
parents: 44
diff changeset
   547
!
claus
parents: 44
diff changeset
   548
56
claus
parents: 55
diff changeset
   549
label
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   550
    "return the label's logo"
56
claus
parents: 55
diff changeset
   551
claus
parents: 55
diff changeset
   552
    ^ labelView label
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   553
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   554
    "Modified: 25.4.1996 / 16:33:08 / cg"
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   555
!
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   556
1879
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   557
label:aStringOrImageOrForm
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   558
    "set the logo; forward to label & resize"
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   559
1879
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   560
    |xlatedLabel|
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   561
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   562
    xlatedLabel := self defineShortcutAndTranslateLabelStringFrom:aStringOrImageOrForm.
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   563
    self isNativeWidget ifTrue:[
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   564
        gc drawableId notNil ifTrue:[
4996
86f2a261a11a device access
Claus Gittinger <cg@exept.de>
parents: 4913
diff changeset
   565
            device changeLabel:xlatedLabel in:gc drawableId
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   566
        ]
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   567
    ].
1879
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   568
    labelView label:xlatedLabel.
1769
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   569
    self resizeForChangedLabel.
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   570
!
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   571
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   572
passiveLogo:anImageOrString
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   573
    "set the passiveLogo; forwarded to the toggle"
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   574
79
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   575
    toggleView passiveLogo:anImageOrString
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   576
Claus Gittinger <cg@exept.de>
parents: 78
diff changeset
   577
    "Created: 22.9.1995 / 15:44:14 / claus"
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   578
    "Modified: 25.4.1996 / 16:33:41 / cg"
1769
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   579
!
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   580
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   581
resizeForLabel
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   582
    ^ resizeForLabel ? false
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   583
!
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   584
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   585
resizeForLabel:aBoolean
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   586
    resizeForLabel := aBoolean
56
claus
parents: 55
diff changeset
   587
! !
claus
parents: 55
diff changeset
   588
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   589
!CheckBox methodsFor:'accessing-mvc'!
63
claus
parents: 62
diff changeset
   590
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   591
aspectMessage:aspectSymbol
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   592
    "set the aspectMessage; forward to label & toggle"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   593
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   594
    labelView aspectMessage:aspectSymbol. "/ in case the label updates its logo from the model
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   595
    toggleView aspectMessage:aspectSymbol
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   596
313
64fd625d3107 comments
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   597
    "Modified: 28.2.1997 / 19:50:53 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   598
!
63
claus
parents: 62
diff changeset
   599
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   600
changeMessage:aChangeSelector
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   601
    "set the changeMessage; forward to toggle"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   602
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   603
    toggleView changeMessage:aChangeSelector
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   604
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   605
    "Modified: 25.4.1996 / 16:33:55 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   606
!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   607
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   608
model:aModel
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   609
    "set the model; forward to label & toggle"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   610
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   611
    labelView model:aModel.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   612
    toggleView model:aModel
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   613
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   614
    "Modified: 25.4.1996 / 16:34:00 / cg"
63
claus
parents: 62
diff changeset
   615
! !
claus
parents: 62
diff changeset
   616
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   617
!CheckBox methodsFor:'accessing-state'!
55
claus
parents: 49
diff changeset
   618
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   619
isOn
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   620
    "return true, if the check is on; false otherwise"
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   621
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   622
    ^ toggleView isOn
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   623
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   624
    "Modified: 25.4.1996 / 16:34:15 / cg"
159
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   625
!
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   626
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   627
turnOff
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   628
    "turn the check off; forwarded to the toggle"
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   629
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   630
    toggleView turnOff
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   631
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   632
    "Modified: 25.4.1996 / 16:32:14 / cg"
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   633
!
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   634
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   635
turnOn
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   636
    "turn the check on; forwarded to the toggle"
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   637
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   638
    toggleView turnOn
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   639
0596de11a136 examples
Claus Gittinger <cg@exept.de>
parents: 155
diff changeset
   640
    "Modified: 25.4.1996 / 16:32:21 / cg"
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   641
! !
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   642
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   643
!CheckBox methodsFor:'change & update'!
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   644
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   645
enableStateChanged
1675
355c448a2570 no need for an extra block to send #enableStateChanged
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   646
    "handle changes on the enableChannel or fg/bg color, change labels color."
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   647
119
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   648
    |clr|
913df6ba1ccc immediately change fg color when enableChannel is set
Claus Gittinger <cg@exept.de>
parents: 115
diff changeset
   649
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   650
    self enabled ifTrue:[
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   651
        labelView etchedForegroundColor:nil.
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   652
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   653
        (foregroundChannel notNil and: [foregroundChannel value notNil])
820
0f0b4a82bdc5 set correct FG color after enabling
tz
parents: 817
diff changeset
   654
            ifTrue:  [labelView foregroundChannel: foregroundChannel]
1652
311b68620aff foregroundColor of label (if not black; i.e. decWindowsStyle)
Claus Gittinger <cg@exept.de>
parents: 1505
diff changeset
   655
            ifFalse: [labelView foregroundColor:(labelForegroundColor ? (Label defaultForegroundColor))].
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   656
        labelForegroundColor := labelView foregroundColor
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   657
    ] ifFalse:[
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   658
        disabledLabelEtchedForegroundColor notNil ifTrue:[ labelView etchedForegroundColor:disabledLabelEtchedForegroundColor ].
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   659
        labelView foregroundChannel: nil
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   660
    ].
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   661
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   662
    toggleView enabled ifTrue:[
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   663
        clr := self labelForegroundColor.
1505
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   664
        cursor := Cursor hand.
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   665
    ] ifFalse:[
1505
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   666
        clr := self disabledLabelForegroundColor.
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   667
        cursor := Cursor normal.
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   668
    ].
817
f6d08ea5b82b revised for the docu
tz
parents: 757
diff changeset
   669
    labelView foregroundColor:clr.
1505
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   670
    labelView cursor:cursor.
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   671
    self cursor:cursor.
1d7b8a023233 cursor when disabled
tm
parents: 1481
diff changeset
   672
    toggleView cursor:cursor.
1769
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   673
!
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   674
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   675
update:something with:aParameter from:changedObject
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   676
    changedObject == labelView ifTrue:[
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   677
        something == #sizeOfView ifTrue:[
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   678
            self resizeForChangedLabel.
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   679
            ^ self
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   680
        ]
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   681
    ].
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   682
"/    changedObject == labelView labelChannel ifTrue:[
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   683
"/        self resizeForChangedLabel.
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   684
"/        ^ self
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   685
"/    ].
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   686
    super update:something with:aParameter from:changedObject
115
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   687
! !
0147e9d06caa added support for enableChannel
Claus Gittinger <cg@exept.de>
parents: 114
diff changeset
   688
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   689
!CheckBox methodsFor:'event handling'!
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   690
341
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   691
invalidate
484
e2b01fd13ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
   692
    super invalidate.
341
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   693
    toggleView invalidate.
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   694
    labelView invalidate
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   695
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   696
    "Created: 1.4.1997 / 13:22:09 / cg"
484
e2b01fd13ade checkin from browser
Claus Gittinger <cg@exept.de>
parents: 383
diff changeset
   697
    "Modified: 6.8.1997 / 18:20:12 / cg"
341
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   698
!
50cc3123977e invalidation
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
   699
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   700
keyPress:aKey x:x y:y
2868
0050e38370ed comment
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
   701
    "forward some key-events to my toggle-button"
0050e38370ed comment
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
   702
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   703
    aKey == Character space ifTrue:[
2868
0050e38370ed comment
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
   704
        self hasFocus ifTrue:[
0050e38370ed comment
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
   705
            ^ toggleView toggle
0050e38370ed comment
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
   706
        ]
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   707
    ].
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   708
    super keyPress:aKey x:x y:y
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   709
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   710
    "Created: 10.7.1996 / 11:24:16 / cg"
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   711
    "Modified: 10.7.1996 / 11:54:52 / cg"
1879
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   712
!
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   713
4648f3ae6293 shortcut-key support;
ca
parents: 1821
diff changeset
   714
performShortcutAction
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   715
    toggleView toggle
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   716
! !
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   717
1265
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   718
!CheckBox methodsFor:'focus handling'!
1138
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   719
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   720
showFocus:explicit
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   721
    "the button got the keyboard focus
1265
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   722
     (either explicit, via tabbing; or implicit, by pointer movement)
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   723
      - change any display attributes as req'd."
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   724
1696
f1bae6d68ffe eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
   725
    (styleSheet at:#'focusHighlightStyle') == #win95 ifTrue:[
1138
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   726
        labelView hasFocus:true.
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   727
        labelView invalidate.
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   728
    ] ifFalse:[
4684
825ea8638c00 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4659
diff changeset
   729
        super showFocus:explicit
1138
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   730
    ]
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   731
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   732
    "Created: / 17.9.1998 / 14:11:49 / cg"
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   733
    "Modified: / 17.9.1998 / 14:19:33 / cg"
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   734
!
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   735
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   736
showNoFocus:explicit
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   737
    "the button lost the keyboard focus
1265
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   738
     (either explicit, via tabbing; or implicit, by pointer movement)
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   739
      - change any display attributes as req'd."
8d0ea1b4b97c comments
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   740
2066
06618ad5f49f win95 style noFocus drawing
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   741
    (styleSheet at:#'focusHighlightStyle') == #win95 ifTrue:[
1138
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   742
        labelView hasFocus:false.
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   743
        labelView invalidate.
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   744
    ] ifFalse:[
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   745
        ^ super showNoFocus:explicit
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   746
    ]
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   747
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   748
    "Created: / 17.9.1998 / 14:11:49 / cg"
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   749
    "Modified: / 17.9.1998 / 14:19:22 / cg"
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   750
! !
14dc9f6791d2 use a checkLabel for win95 style
Claus Gittinger <cg@exept.de>
parents: 903
diff changeset
   751
2500
1477b0a5a918 method category rename
Claus Gittinger <cg@exept.de>
parents: 2157
diff changeset
   752
!CheckBox methodsFor:'initialization & release'!
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   753
3287
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   754
defaultCheckToggleClass
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   755
    ^ CheckToggle
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   756
!
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   757
218
9b155a06f6e6 handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   758
defaultControllerClass
9b155a06f6e6 handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   759
    ^ ToggleController
9b155a06f6e6 handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   760
9b155a06f6e6 handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   761
    "Created: 18.7.1996 / 11:57:01 / cg"
9b155a06f6e6 handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   762
!
9b155a06f6e6 handle input to my label (allow clicking on it)
Claus Gittinger <cg@exept.de>
parents: 216
diff changeset
   763
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   764
initStyle
284
8e6ed630468b commentary
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
   765
    "setup viewStyle specifics"
8e6ed630468b commentary
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
   766
4502
7d7514bd47ff class: CheckBox
Stefan Vogel <sv@exept.de>
parents: 4432
diff changeset
   767
    |graphicsDevice|
7d7514bd47ff class: CheckBox
Stefan Vogel <sv@exept.de>
parents: 4432
diff changeset
   768
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   769
    super initStyle.
4996
86f2a261a11a device access
Claus Gittinger <cg@exept.de>
parents: 4913
diff changeset
   770
    graphicsDevice := device.
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   771
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   772
    DefaultLabelForegroundColor notNil ifTrue:[
4502
7d7514bd47ff class: CheckBox
Stefan Vogel <sv@exept.de>
parents: 4432
diff changeset
   773
        labelForegroundColor := DefaultLabelForegroundColor onDevice:graphicsDevice.
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   774
    ].
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   775
    DefaultDisabledLabelForegroundColor notNil ifTrue:[
4502
7d7514bd47ff class: CheckBox
Stefan Vogel <sv@exept.de>
parents: 4432
diff changeset
   776
        disabledLabelForegroundColor := DefaultDisabledLabelForegroundColor onDevice:graphicsDevice.
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   777
    ].
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   778
    DefaultDisabledLabelEtchedForegroundColor notNil ifTrue:[
4502
7d7514bd47ff class: CheckBox
Stefan Vogel <sv@exept.de>
parents: 4432
diff changeset
   779
        disabledLabelEtchedForegroundColor := DefaultDisabledLabelEtchedForegroundColor onDevice:graphicsDevice.
2060
ec6351a7cb37 support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 1879
diff changeset
   780
    ].
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   781
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   782
    "Created: 14.12.1995 / 14:50:03 / cg"
284
8e6ed630468b commentary
Claus Gittinger <cg@exept.de>
parents: 282
diff changeset
   783
    "Modified: 22.1.1997 / 11:57:03 / cg"
112
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   784
!
bb2cb6c553d2 allow labels colors to be set from styleSheet
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   785
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   786
initialize
273
01541272ce8d resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   787
    <resource: #style (#name)>
5455
d48ce74ca92a #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4996
diff changeset
   788
    <modifier: #super> "must be called if redefined"
273
01541272ce8d resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   789
3287
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   790
    |checkToggleClass|
0022d5b3949b allow redefinition of used CheckToggle class
ca
parents: 2868
diff changeset
   791
56
claus
parents: 55
diff changeset
   792
    super initialize.
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   793
3822
389019ebbbec border handling
Claus Gittinger <cg@exept.de>
parents: 3818
diff changeset
   794
    self borderWidth:0.
49
claus
parents: 44
diff changeset
   795
    hLayout := #fixLeftSpace.
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   796
    vLayout := #center.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   797
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   798
    checkToggleClass := self defaultCheckToggleClass.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   799
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   800
    self isNativeWidget ifTrue:[
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   801
        toggleView := checkToggleClass new. "/ but not in self - never realized
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   802
        labelView := CheckLabel new.        "/ but not in self - never realized
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   803
    ] ifFalse:[
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   804
        CheckToggleLeft ~~ false ifTrue:[
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   805
            "/ toggle first ...
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   806
            toggleView := checkToggleClass in:self.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   807
        ].
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   808
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   809
        labelView := CheckLabel in:self.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   810
        "/ a kludge
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   811
        styleSheet name ~~ #motif ifTrue:[
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   812
            labelView label:'check'; borderWidth:0.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   813
        ].
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   814
        labelView forceResize.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   815
        labelView adjust:#left.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   816
        self initialHeight:labelView preferredHeight + ViewSpacing.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   817
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   818
        CheckToggleLeft == false ifTrue:[
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   819
            "/ toggle last ...
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   820
            toggleView := checkToggleClass in:self.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   821
        ].
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   822
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   823
        (styleSheet at:'checkBoxStyle' default:styleSheet name) == #motif ifTrue:[
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   824
            toggleView activeLogo:nil.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   825
            toggleView passiveLogo:nil.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   826
            toggleView activeLevel:-2.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   827
            toggleView passiveLevel:2.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   828
            toggleView extent:10@10.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   829
            toggleView sizeFixed:true.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   830
        ].
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   831
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   832
        "/ my controller handles both components
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   833
        labelView setController:controller.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   834
        toggleView setController:controller.
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   835
        "/ the label can be clicked as well
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   836
        labelView cursor:Cursor hand.
320
bf5e928d027a option to place the toggle at the right.
Claus Gittinger <cg@exept.de>
parents: 318
diff changeset
   837
    ].
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   838
579
ba6e90f651d8 pass down background changes to my components
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   839
    self cursor:Cursor hand.
ba6e90f651d8 pass down background changes to my components
Claus Gittinger <cg@exept.de>
parents: 566
diff changeset
   840
56
claus
parents: 55
diff changeset
   841
    "
claus
parents: 55
diff changeset
   842
     all of my input goes to the toggle
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   843
     disabled - normally there is already an outer delegate
56
claus
parents: 55
diff changeset
   844
    "
209
448124e85ccd keyboard delegation made explicit, for space only
Claus Gittinger <cg@exept.de>
parents: 192
diff changeset
   845
"/    self delegate:(KeyboardForwarder toView:toggleView).
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   846
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   847
    "
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   848
     |b|
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   849
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   850
     b := CheckBox new.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   851
     b label:'foo'.
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   852
     b open
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   853
    "
188
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
   854
5455
d48ce74ca92a #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4996
diff changeset
   855
    "Modified: / 08-02-2017 / 00:35:24 / cg"
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   856
!
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   857
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   858
release
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   859
    "release dependencies"
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   860
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   861
    |channel|
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   862
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   863
    toggleView notNil ifTrue:[
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   864
        (channel := toggleView enableChannel) notNil ifTrue:[
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   865
            channel retractInterestsFor:self
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   866
        ]
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   867
    ].
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2066
diff changeset
   868
    super release
44
97c1c943bef6 Initial revision
claus
parents:
diff changeset
   869
! !
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   870
2742
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   871
!CheckBox methodsFor:'native widget support'!
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   872
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   873
beNativeWidget
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   874
    super beNativeWidget.
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   875
"/    self makeElementsInvisible.
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   876
!
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   877
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   878
makeElementsInvisible
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   879
    "when using native widget, my toggle is not visible.
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   880
     (it is not destroyed, to keep a place for its attributes,
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   881
      and to allow future dynamic switching and snapshot restore on
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   882
      a non-native system)"
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   883
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   884
    toggleView notNil ifTrue:[
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   885
        toggleView beInvisible.
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   886
    ].
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   887
!
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   888
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   889
nativeWindowType
4659
4c833dabb9f8 Access device and drawableId wia message send.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4658
diff changeset
   890
    "return a symbol describing my native window type
4913
68829b96da60 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4684
diff changeset
   891
     (may be used internally by the device as a native window creation hint,
68829b96da60 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4684
diff changeset
   892
      if the device supports native windows)"
4658
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   893
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   894
    ^ #CheckBox
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   895
24bddb17e7f2 class: CheckBox
Claus Gittinger <cg@exept.de>
parents: 4502
diff changeset
   896
    "Created: 2.5.1997 / 14:41:00 / cg"
2742
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   897
! !
d2fd4c68feb3 *** empty log message ***
ca
parents: 2500
diff changeset
   898
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   899
!CheckBox methodsFor:'private'!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   900
1769
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   901
resizeForChangedLabel
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   902
    labelView forceResize.
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   903
    resizeForLabel == true ifTrue:[
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   904
        self extent:(self preferredExtent)
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   905
    ].
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   906
    self layoutChanged.
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   907
    self resize.
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   908
!
68d65f17df56 added resizeForLabel attribute
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
   909
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   910
sendChangeMessageWith:aValue
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   911
    "redefined to have mimic changes being sent from the toggle
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   912
     instead of myself"
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   913
3952
c50a70a511c3 changed: #sendChangeMessageWith:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
   914
    toggleView sendChangeMessageWith:aValue.
c50a70a511c3 changed: #sendChangeMessageWith:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
   915
    toggleView invalidate.
c50a70a511c3 changed: #sendChangeMessageWith:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
   916
c50a70a511c3 changed: #sendChangeMessageWith:
Claus Gittinger <cg@exept.de>
parents: 3822
diff changeset
   917
    "Modified: / 22-10-2010 / 15:53:45 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   918
! !
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   919
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   920
!CheckBox methodsFor:'queries'!
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   921
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   922
preferredExtent
155
bc94dad4ad31 documentation
Claus Gittinger <cg@exept.de>
parents: 153
diff changeset
   923
    "compute & return the boxes preferredExtent from the components' sizes"
153
5167176d204b commentary
Claus Gittinger <cg@exept.de>
parents: 134
diff changeset
   924
3569
0e01d084e624 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3528
diff changeset
   925
    "/ If I have an explicit preferredExtent..
0e01d084e624 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3528
diff changeset
   926
    explicitExtent notNil ifTrue:[
0e01d084e624 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3528
diff changeset
   927
        ^ explicitExtent
0e01d084e624 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3528
diff changeset
   928
    ].
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   929
3569
0e01d084e624 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3528
diff changeset
   930
    "/ If I have a cached preferredExtent value..
192
e060e80f8e24 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   931
    preferredExtent notNil ifTrue:[
3317
25a5e8fc2c0d changed #preferredExtent
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   932
        ^ preferredExtent
192
e060e80f8e24 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   933
    ].
e060e80f8e24 care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 188
diff changeset
   934
3317
25a5e8fc2c0d changed #preferredExtent
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   935
    (labelView isNil or:[labelView label isEmptyOrNil]) ifTrue:[
25a5e8fc2c0d changed #preferredExtent
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   936
        ^ super preferredExtent
188
3649c62aad46 no label, if motif style
Claus Gittinger <cg@exept.de>
parents: 185
diff changeset
   937
    ].
153
5167176d204b commentary
Claus Gittinger <cg@exept.de>
parents: 134
diff changeset
   938
    ^ super preferredExtent + (10@0).
5167176d204b commentary
Claus Gittinger <cg@exept.de>
parents: 134
diff changeset
   939
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   940
"/    prefCheck := toggleView preferredExtent.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   941
"/    prefLabel := labelView preferredExtent.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   942
"/    bw2 := borderWidth * 2.
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   943
"/    ^ (prefCheck x + prefLabel x + (3 * ViewSpacing)) @ ((prefCheck y max:prefLabel y) + bw2 + 2)
153
5167176d204b commentary
Claus Gittinger <cg@exept.de>
parents: 134
diff changeset
   944
3317
25a5e8fc2c0d changed #preferredExtent
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   945
    "Modified: / 12-01-2008 / 23:27:45 / cg"
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   946
! !
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   947
273
01541272ce8d resource spec updated; cache device form
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
   948
!CheckBox class methodsFor:'documentation'!
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   949
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   950
version
4913
68829b96da60 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4684
diff changeset
   951
    ^ '$Header$'
3818
539895b3c032 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
   952
!
539895b3c032 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
   953
539895b3c032 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 3569
diff changeset
   954
version_CVS
4913
68829b96da60 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4684
diff changeset
   955
    ^ '$Header$'
100
3d33433f459c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   956
! !
4432
4b132f377d09 class: CheckBox
Stefan Vogel <sv@exept.de>
parents: 4120
diff changeset
   957