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