CheckToggle.st
author Claus Gittinger <cg@exept.de>
Fri, 27 Jun 1997 11:56:45 +0200
changeset 1254 c9e604f03e6a
parent 1236 529f36ae3217
child 1280 460131bb2a9a
permissions -rw-r--r--
code compactified (slightly)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
4
88eb91574867 *** empty log message ***
claus
parents: 2
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
Toggle subclass:#CheckToggle
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    14
	instanceVariableNames:''
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    15
	classVariableNames:'DefaultCheckForm DefaultCheckColor DefaultActiveFGColor
265
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    16
		DefaultActiveBGColor DefaultFGColor DefaultBGColor
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
    17
		DefaultActiveLevel DefaultPassiveLevel DefaultBorderWidth
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
    18
		LabelOverMargin'
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    19
	poolDictionaries:''
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
    20
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    21
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
    23
!CheckToggle class methodsFor:'documentation'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    24
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    25
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    26
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    27
 COPYRIGHT (c) 1991 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    28
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    29
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    30
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    31
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    33
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    34
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    35
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    36
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    37
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    38
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    39
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    40
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    41
    CheckButtons are like Toggles in toggling their state when pressed.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
    42
    However, they show an ok-marker if on; nothing if off.
118
claus
parents: 77
diff changeset
    43
    CheckButtons are mostly used as part of a checkBox (since normally,
147
claus
parents: 146
diff changeset
    44
    you want to have some label along the check) and often grouped for
claus
parents: 146
diff changeset
    45
    many-in-many or one-in-many setups.
130
claus
parents: 128
diff changeset
    46
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    47
    [StyleSheet values:]
130
claus
parents: 128
diff changeset
    48
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    49
        checkToggleCheckColor   <Color>         color to draw check-image with.
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    50
                                                defaults to value of #buttonActiveForegroundColor.
130
claus
parents: 128
diff changeset
    51
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    52
        checkToggleActiveBackgroundColor        background color to draw active checki-image with
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    53
        checkToggleForegroundColor              foreground color to use if off
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    54
        checkToggleBackgroundColor              background color to use if off
130
claus
parents: 128
diff changeset
    55
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    56
        checkToggleBitmapFile   <String>        name of bitmap file for check-image
130
claus
parents: 128
diff changeset
    57
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    58
        checkToggleStyle        <Symbol>        default checkForm style.
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    59
                                                used if above is nil or file not readable
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    60
                                                can be #cross or #check; defaults to #check 
130
claus
parents: 128
diff changeset
    61
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    62
        checkToggleAvtiveLevel  <Number>        active level - defaults to value of #buttonPassiveLevel
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    63
        checkTogglePassiveLevel <Number>        active level - defaults to value of #buttonPassiveLevel
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    64
        checkToggleBorderWidth  <Number>        borderWidth - defaults buttons default
130
claus
parents: 128
diff changeset
    65
139
claus
parents: 136
diff changeset
    66
    (if not set in the styleSheet, Toggle values are taken)
claus
parents: 136
diff changeset
    67
130
claus
parents: 128
diff changeset
    68
    See examples.
claus
parents: 128
diff changeset
    69
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    70
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    71
        Claus Gittinger
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    72
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
    73
    [see also:]
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    74
        CheckBox RadioButton RadioButtonGroup Toggle Button
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    75
        Dialog
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    76
        ValueHolder TriggerValue
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    77
        Block
118
claus
parents: 77
diff changeset
    78
"
claus
parents: 77
diff changeset
    79
!
claus
parents: 77
diff changeset
    80
claus
parents: 77
diff changeset
    81
examples 
claus
parents: 77
diff changeset
    82
"
claus
parents: 77
diff changeset
    83
    checkToggle alone:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    84
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    85
        |top check|
118
claus
parents: 77
diff changeset
    86
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    87
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    88
        top extent:100@100.
118
claus
parents: 77
diff changeset
    89
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    90
        check := CheckToggle in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    91
        check origin:10@10.
118
claus
parents: 77
diff changeset
    92
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    93
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    94
                                                                        [exEnd]
118
claus
parents: 77
diff changeset
    95
claus
parents: 77
diff changeset
    96
claus
parents: 77
diff changeset
    97
    give it an action:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    98
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    99
        |top check|
118
claus
parents: 77
diff changeset
   100
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   101
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   102
        top extent:100@100.
118
claus
parents: 77
diff changeset
   103
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   104
        check := CheckToggle in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   105
        check origin:10@10.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   106
        check action:[:value | Transcript showCR:'changed to: ' , value printString].
118
claus
parents: 77
diff changeset
   107
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   108
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   109
                                                                        [exEnd]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   110
118
claus
parents: 77
diff changeset
   111
claus
parents: 77
diff changeset
   112
    give it a model:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   113
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   114
        |top check model|
118
claus
parents: 77
diff changeset
   115
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   116
        model := false asValue.
118
claus
parents: 77
diff changeset
   117
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   118
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   119
        top extent:100@100.
118
claus
parents: 77
diff changeset
   120
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   121
        check := CheckToggle in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   122
        check origin:10@10.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   123
        check model:model.
118
claus
parents: 77
diff changeset
   124
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   125
        top openModal.
118
claus
parents: 77
diff changeset
   126
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   127
        Transcript showCR:'value after closing box: ' , model value printString
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   128
                                                                        [exEnd]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   129
118
claus
parents: 77
diff changeset
   130
claus
parents: 77
diff changeset
   131
    multiple checks on a single model (with different change selectors):
claus
parents: 77
diff changeset
   132
    (using a checkBox here, for the demonstration ...)
147
claus
parents: 146
diff changeset
   133
    (this is a typical many-in-many setup)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   134
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   135
        |top model panel ext1 ext2
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   136
         readFlag writeFlag executeFlag|
118
claus
parents: 77
diff changeset
   137
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   138
        readFlag := writeFlag := true.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   139
        executeFlag := false.
118
claus
parents: 77
diff changeset
   140
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   141
        model := Plug new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   142
        model respondTo:#read with:[readFlag].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   143
        model respondTo:#write with:[writeFlag].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   144
        model respondTo:#execute with:[executeFlag].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   145
        model respondTo:#read: with:[:val | readFlag := val].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   146
        model respondTo:#write: with:[:val | writeFlag := val].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   147
        model respondTo:#execute: with:[:val | executeFlag := val].
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   148
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   149
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   150
        top extent:200@200.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   151
        top label:'File permissions:'.
118
claus
parents: 77
diff changeset
   152
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   153
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   154
        panel horizontalLayout:#leftSpace.
118
claus
parents: 77
diff changeset
   155
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   156
        #(read write execute) do:[:sym |
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   157
            |check|
118
claus
parents: 77
diff changeset
   158
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   159
            check := CheckBox in:panel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   160
            check label:sym.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   161
            check model:model; aspect:sym; changeMessage:(sym , ':') asSymbol.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   162
        ].
118
claus
parents: 77
diff changeset
   163
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   164
        top openModal.
118
claus
parents: 77
diff changeset
   165
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   166
        Transcript showCR:'settings after closing box:'.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   167
        Transcript showCR:'  read -> ' , readFlag printString.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   168
        Transcript showCR:'  write -> ' , writeFlag printString.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   169
        Transcript showCR:'  execute -> ' , executeFlag printString.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   170
                                                                        [exEnd]
130
claus
parents: 128
diff changeset
   171
claus
parents: 128
diff changeset
   172
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   173
    checkToggles in a group - now, they have RadioButton behavior.
147
claus
parents: 146
diff changeset
   174
    (this is a typical one-in-many setup)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   175
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   176
        |top panel check1 check2 check3 grp|
130
claus
parents: 128
diff changeset
   177
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   178
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   179
        top extent:200@300.
130
claus
parents: 128
diff changeset
   180
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   181
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
130
claus
parents: 128
diff changeset
   182
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   183
        check1 := CheckToggle in:panel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   184
        check2 := CheckToggle in:panel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   185
        check3 := CheckToggle in:panel.
130
claus
parents: 128
diff changeset
   186
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   187
        grp := RadioButtonGroup new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   188
        grp add:check1.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   189
        grp add:check2.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   190
        grp add:check3.
130
claus
parents: 128
diff changeset
   191
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   192
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   193
                                                                        [exEnd]
146
claus
parents: 139
diff changeset
   194
claus
parents: 139
diff changeset
   195
claus
parents: 139
diff changeset
   196
     Channel operation 
claus
parents: 139
diff changeset
   197
     -----------------
claus
parents: 139
diff changeset
   198
claus
parents: 139
diff changeset
   199
       enabling other toggles via a toggle
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   200
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   201
        |top panel t enableChannel|
146
claus
parents: 139
diff changeset
   202
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   203
        top := StandardSystemView new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   204
        top extent:(400 @ 200).
146
claus
parents: 139
diff changeset
   205
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   206
        panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
146
claus
parents: 139
diff changeset
   207
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   208
        enableChannel := false asValue.
146
claus
parents: 139
diff changeset
   209
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   210
        1 to:10 do:[:i |
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   211
            t := CheckToggle in:panel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   212
            t enableChannel:enableChannel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   213
        ].
146
claus
parents: 139
diff changeset
   214
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   215
        t := Toggle in:panel.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   216
        t activeLogo:'enabled'; passiveLogo:'disabled'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   217
        t pressChannel:enableChannel.
146
claus
parents: 139
diff changeset
   218
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   219
        top open
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   220
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
   221
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 18
diff changeset
   222
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   223
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   224
!CheckToggle class methodsFor:'defaults'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   225
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   226
checkFormOn:aDevice
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   227
    "return the form used when checkToggle is turned on.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   228
     Provided as public entry, to allow other views
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   229
     to share the same check-image."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   230
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   231
    ^ DefaultCheckForm on:aDevice.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   232
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   233
1236
ca
parents: 1171
diff changeset
   234
checkImageForStyle:aStyleSymbol
ca
parents: 1171
diff changeset
   235
    "helper & public access to useful checkToggle images"
ca
parents: 1171
diff changeset
   236
ca
parents: 1171
diff changeset
   237
    |bits|
ca
parents: 1171
diff changeset
   238
ca
parents: 1171
diff changeset
   239
    aStyleSymbol == #cross ifTrue:[
ca
parents: 1171
diff changeset
   240
        bits := #[2r10000000 2r00000001
ca
parents: 1171
diff changeset
   241
                  2r01000000 2r00000010
ca
parents: 1171
diff changeset
   242
                  2r00100000 2r00000100
ca
parents: 1171
diff changeset
   243
                  2r00010000 2r00001000
ca
parents: 1171
diff changeset
   244
                  2r00001000 2r00010000
ca
parents: 1171
diff changeset
   245
                  2r00000100 2r00100000
ca
parents: 1171
diff changeset
   246
                  2r00000010 2r01000000
ca
parents: 1171
diff changeset
   247
                  2r00000001 2r10000000
ca
parents: 1171
diff changeset
   248
                  2r00000001 2r10000000
ca
parents: 1171
diff changeset
   249
                  2r00000010 2r01000000
ca
parents: 1171
diff changeset
   250
                  2r00000100 2r00100000
ca
parents: 1171
diff changeset
   251
                  2r00001000 2r00010000
ca
parents: 1171
diff changeset
   252
                  2r00010000 2r00001000
ca
parents: 1171
diff changeset
   253
                  2r00100000 2r00000100
ca
parents: 1171
diff changeset
   254
                  2r01000000 2r00000010
ca
parents: 1171
diff changeset
   255
                  2r10000000 2r00000001]
ca
parents: 1171
diff changeset
   256
    ] ifFalse:[
ca
parents: 1171
diff changeset
   257
        aStyleSymbol == #borderedCross ifTrue:[
ca
parents: 1171
diff changeset
   258
            bits := #[2r11111111 2r11111111
ca
parents: 1171
diff changeset
   259
                      2r11000000 2r00000011
ca
parents: 1171
diff changeset
   260
                      2r10100000 2r00000101
ca
parents: 1171
diff changeset
   261
                      2r10010000 2r00001001
ca
parents: 1171
diff changeset
   262
                      2r10001000 2r00010001
ca
parents: 1171
diff changeset
   263
                      2r10000100 2r00100001
ca
parents: 1171
diff changeset
   264
                      2r10000010 2r01000001
ca
parents: 1171
diff changeset
   265
                      2r10000001 2r10000001
ca
parents: 1171
diff changeset
   266
                      2r10000001 2r10000001
ca
parents: 1171
diff changeset
   267
                      2r10000010 2r01000001
ca
parents: 1171
diff changeset
   268
                      2r10000100 2r00100001
ca
parents: 1171
diff changeset
   269
                      2r10001000 2r00010001
ca
parents: 1171
diff changeset
   270
                      2r10010000 2r00001001
ca
parents: 1171
diff changeset
   271
                      2r10100000 2r00000101
ca
parents: 1171
diff changeset
   272
                      2r11000000 2r00000011
ca
parents: 1171
diff changeset
   273
                      2r11111111 2r11111111]
ca
parents: 1171
diff changeset
   274
        ] ifFalse:[
ca
parents: 1171
diff changeset
   275
            aStyleSymbol == #fatcross ifTrue:[
ca
parents: 1171
diff changeset
   276
                bits := #[2r11000000 2r00000011
ca
parents: 1171
diff changeset
   277
                          2r11100000 2r00000111
ca
parents: 1171
diff changeset
   278
                          2r01110000 2r00001110
ca
parents: 1171
diff changeset
   279
                          2r00111000 2r00011100
ca
parents: 1171
diff changeset
   280
                          2r00011100 2r00111000
ca
parents: 1171
diff changeset
   281
                          2r00001110 2r01110000
ca
parents: 1171
diff changeset
   282
                          2r00000111 2r11100000
ca
parents: 1171
diff changeset
   283
                          2r00000011 2r11000000
ca
parents: 1171
diff changeset
   284
                          2r00000011 2r11000000
ca
parents: 1171
diff changeset
   285
                          2r00000111 2r11100000
ca
parents: 1171
diff changeset
   286
                          2r00001110 2r01110000
ca
parents: 1171
diff changeset
   287
                          2r00011100 2r00111000
ca
parents: 1171
diff changeset
   288
                          2r00111000 2r00011100
ca
parents: 1171
diff changeset
   289
                          2r01110000 2r00001110
ca
parents: 1171
diff changeset
   290
                          2r11100000 2r00000111
ca
parents: 1171
diff changeset
   291
                          2r11000000 2r00000011]
ca
parents: 1171
diff changeset
   292
            ] ifFalse:[
ca
parents: 1171
diff changeset
   293
                aStyleSymbol == #borderedFatcross ifTrue:[
ca
parents: 1171
diff changeset
   294
                    bits := #[2r11111111 2r11111111
ca
parents: 1171
diff changeset
   295
                              2r11100000 2r00000111
ca
parents: 1171
diff changeset
   296
                              2r11110000 2r00001111
ca
parents: 1171
diff changeset
   297
                              2r10111000 2r00011101
ca
parents: 1171
diff changeset
   298
                              2r10011100 2r00111001
ca
parents: 1171
diff changeset
   299
                              2r10001110 2r01110001
ca
parents: 1171
diff changeset
   300
                              2r10000111 2r11100001
ca
parents: 1171
diff changeset
   301
                              2r10000011 2r11000001
ca
parents: 1171
diff changeset
   302
                              2r10000011 2r11000001
ca
parents: 1171
diff changeset
   303
                              2r10000111 2r11100001
ca
parents: 1171
diff changeset
   304
                              2r10001110 2r01110001
ca
parents: 1171
diff changeset
   305
                              2r10011100 2r00111001
ca
parents: 1171
diff changeset
   306
                              2r10111000 2r00011101
ca
parents: 1171
diff changeset
   307
                              2r11110000 2r00001111
ca
parents: 1171
diff changeset
   308
                              2r11100000 2r00000111
ca
parents: 1171
diff changeset
   309
                              2r11111111 2r11111111]
ca
parents: 1171
diff changeset
   310
                ] ifFalse:[
ca
parents: 1171
diff changeset
   311
                    aStyleSymbol == #border ifTrue:[
ca
parents: 1171
diff changeset
   312
                        bits := #[2r11111111 2r11111111
ca
parents: 1171
diff changeset
   313
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   314
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   315
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   316
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   317
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   318
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   319
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   320
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   321
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   322
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   323
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   324
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   325
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   326
                                  2r10000000 2r00000001
ca
parents: 1171
diff changeset
   327
                                  2r11111111 2r11111111]
ca
parents: 1171
diff changeset
   328
                    ] ifFalse:[
ca
parents: 1171
diff changeset
   329
                        bits := #[2r00000000 2r00000000
ca
parents: 1171
diff changeset
   330
                                  2r00000000 2r00000010
ca
parents: 1171
diff changeset
   331
                                  2r00000000 2r00000010
ca
parents: 1171
diff changeset
   332
                                  2r00000000 2r00000100
ca
parents: 1171
diff changeset
   333
                                  2r00000000 2r00000100
ca
parents: 1171
diff changeset
   334
                                  2r00000000 2r00001000
ca
parents: 1171
diff changeset
   335
                                  2r00000000 2r00001000
ca
parents: 1171
diff changeset
   336
                                  2r00000000 2r00010000
ca
parents: 1171
diff changeset
   337
                                  2r01000000 2r00110000
ca
parents: 1171
diff changeset
   338
                                  2r00100000 2r01100000
ca
parents: 1171
diff changeset
   339
                                  2r00011000 2r01100000
ca
parents: 1171
diff changeset
   340
                                  2r00001110 2r11000000
ca
parents: 1171
diff changeset
   341
                                  2r00000111 2r11000000
ca
parents: 1171
diff changeset
   342
                                  2r00000011 2r10000000
ca
parents: 1171
diff changeset
   343
                                  2r00000001 2r10000000
ca
parents: 1171
diff changeset
   344
                                  2r00000000 2r00000000]
ca
parents: 1171
diff changeset
   345
                    ]
ca
parents: 1171
diff changeset
   346
                ]
ca
parents: 1171
diff changeset
   347
            ]
ca
parents: 1171
diff changeset
   348
        ]
ca
parents: 1171
diff changeset
   349
    ].
ca
parents: 1171
diff changeset
   350
    ^ Form width:16 height:16 fromArray:bits on:Display                                           
ca
parents: 1171
diff changeset
   351
ca
parents: 1171
diff changeset
   352
    "
ca
parents: 1171
diff changeset
   353
     self checkImageForStyle:#cross
ca
parents: 1171
diff changeset
   354
     self checkImageForStyle:#fatcross
ca
parents: 1171
diff changeset
   355
     self checkImageForStyle:#borderedCross
ca
parents: 1171
diff changeset
   356
     self checkImageForStyle:#borderedFatcross
ca
parents: 1171
diff changeset
   357
    "
ca
parents: 1171
diff changeset
   358
ca
parents: 1171
diff changeset
   359
    "Modified: 7.3.1997 / 21:15:13 / cg"
ca
parents: 1171
diff changeset
   360
!
ca
parents: 1171
diff changeset
   361
128
claus
parents: 127
diff changeset
   362
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   363
    "extract values from the styleSheet and cache them in class variables"
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   364
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   365
    <resource: #style (#checkToggleCheckColor
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   366
                       #checkToggleBackgroundColor #checkToggleForegroundColor
836
703b9e95ead5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   367
                       #checkToggleActiveBackgroundColor #checkToggleActiveForegroundColor
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   368
                       #checkToggleActiveLevel #checkTogglePassiveLevel
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   369
                       #checkToggleBorderWidth 
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   370
                       #checkToggleBitmapFile
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   371
                       #checkToggleLabelOverMargin 
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   372
                       #checkToggleStyle)>
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   373
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   374
    |checkFileName bits checkStyle|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   375
130
claus
parents: 128
diff changeset
   376
    DefaultCheckColor := StyleSheet colorAt:'checkToggleCheckColor'.
139
claus
parents: 136
diff changeset
   377
    DefaultFGColor := StyleSheet colorAt:'checkToggleForegroundColor'.
130
claus
parents: 128
diff changeset
   378
    DefaultBGColor := StyleSheet colorAt:'checkToggleBackgroundColor'.
139
claus
parents: 136
diff changeset
   379
    DefaultActiveFGColor := StyleSheet colorAt:'checkToggleActiveForegroundColor'.
130
claus
parents: 128
diff changeset
   380
    DefaultActiveBGColor := StyleSheet colorAt:'checkToggleActiveBackgroundColor'.
claus
parents: 128
diff changeset
   381
    DefaultActiveLevel := StyleSheet at:'checkToggleActiveLevel'.
claus
parents: 128
diff changeset
   382
    DefaultPassiveLevel := StyleSheet at:'checkTogglePassiveLevel'.
claus
parents: 128
diff changeset
   383
    DefaultBorderWidth := StyleSheet at:'checkToggleBorderWidth'.
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   384
    LabelOverMargin := StyleSheet at:'checkToggleLabelOverMargin' default:false.
130
claus
parents: 128
diff changeset
   385
136
claus
parents: 133
diff changeset
   386
    DefaultCheckForm := nil.
128
claus
parents: 127
diff changeset
   387
    checkFileName := StyleSheet at:'checkToggleBitmapFile' default:'CheckOn.xbm'.
claus
parents: 127
diff changeset
   388
    checkFileName notNil ifTrue:[
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   389
        DefaultCheckForm := Image fromFile:checkFileName 
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   390
                                resolution:100
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   391
                                        on:Display.
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   392
        DefaultCheckForm isNil ifTrue:[
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   393
            DefaultCheckForm := Image fromFile:'bitmaps/' , checkFileName 
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   394
                                    resolution:100
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   395
                                            on:Display.
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   396
        ]
130
claus
parents: 128
diff changeset
   397
    ].
claus
parents: 128
diff changeset
   398
    DefaultCheckForm isNil ifTrue:[
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   399
        checkStyle := StyleSheet at:'checkToggleStyle' default:#check.
1236
ca
parents: 1171
diff changeset
   400
        DefaultCheckForm := self checkImageForStyle:checkStyle
128
claus
parents: 127
diff changeset
   401
    ]
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   402
1001
eb7a8b2f4347 checkin from browser
ca
parents: 967
diff changeset
   403
    "
eb7a8b2f4347 checkin from browser
ca
parents: 967
diff changeset
   404
     self updateStyleCache
eb7a8b2f4347 checkin from browser
ca
parents: 967
diff changeset
   405
    "
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   406
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   407
    "Modified: 7.3.1997 / 21:15:13 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   408
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   409
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   410
!CheckToggle methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   411
18
66bf62e27141 *** empty log message ***
claus
parents: 4
diff changeset
   412
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   413
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   414
18
66bf62e27141 *** empty log message ***
claus
parents: 4
diff changeset
   415
    super initStyle.
66bf62e27141 *** empty log message ***
claus
parents: 4
diff changeset
   416
128
claus
parents: 127
diff changeset
   417
    onLevel := offLevel.
130
claus
parents: 128
diff changeset
   418
    DefaultActiveLevel notNil ifTrue:[onLevel := DefaultActiveLevel].
136
claus
parents: 133
diff changeset
   419
    DefaultPassiveLevel notNil ifTrue:[offLevel := DefaultPassiveLevel].
130
claus
parents: 128
diff changeset
   420
128
claus
parents: 127
diff changeset
   421
    activeLogo := DefaultCheckForm on:device.
claus
parents: 127
diff changeset
   422
    passiveLogo := nil.
claus
parents: 127
diff changeset
   423
139
claus
parents: 136
diff changeset
   424
    DefaultActiveFGColor notNil ifTrue:[self activeForegroundColor:DefaultActiveFGColor].
130
claus
parents: 128
diff changeset
   425
    DefaultCheckColor notNil ifTrue:[self activeForegroundColor:DefaultCheckColor].
claus
parents: 128
diff changeset
   426
    DefaultActiveBGColor notNil ifTrue:[self activeBackgroundColor:DefaultActiveBGColor].
139
claus
parents: 136
diff changeset
   427
    DefaultFGColor notNil ifTrue:[self foregroundColor:DefaultFGColor].
130
claus
parents: 128
diff changeset
   428
    DefaultBGColor notNil ifTrue:[self backgroundColor:DefaultBGColor].
claus
parents: 128
diff changeset
   429
128
claus
parents: 127
diff changeset
   430
    showLamp := false.
130
claus
parents: 128
diff changeset
   431
claus
parents: 128
diff changeset
   432
    DefaultBorderWidth notNil ifTrue:[self borderWidth:DefaultBorderWidth].
claus
parents: 128
diff changeset
   433
claus
parents: 128
diff changeset
   434
    offLevel ~~ level ifTrue:[self level:offLevel].
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   435
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   436
    "Modified: 22.1.1997 / 11:57:05 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   437
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   438
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   439
initialize
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   440
    super initialize.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   441
    passiveLogo := nil.
1023
74e837fb617e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   442
    self label:activeLogo "/ to let me compute some defaultExtent
74e837fb617e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   443
74e837fb617e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   444
    "Modified: 18.2.1997 / 14:03:39 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   445
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   446
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   447
!CheckToggle methodsFor:'queries'!
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   448
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   449
preferredExtent
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   450
    "/ If I have an explicit preferredExtent ..
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   451
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   452
    |pref|
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   453
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   454
    preferredExtent notNil ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   455
        ^ preferredExtent
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   456
    ].
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   457
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   458
    pref := super preferredExtent.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   459
    LabelOverMargin ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   460
        pref := pref - (margin*2)
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   461
    ].
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   462
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   463
    ^ pref
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   464
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   465
    "Modified: 7.3.1997 / 17:52:53 / cg"
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   466
! !
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   467
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   468
!CheckToggle methodsFor:'redrawing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   469
133
claus
parents: 132
diff changeset
   470
drawWith:fg and:bg
265
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   471
    controller pressed ifTrue:[
1169
982c3fd58d67 better highlighting on enter/leave
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   472
        logo := activeLogo.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   473
    ] ifFalse:[
1169
982c3fd58d67 better highlighting on enter/leave
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   474
        logo := passiveLogo.
133
claus
parents: 132
diff changeset
   475
    ].
1171
71f7a035396f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1169
diff changeset
   476
71f7a035396f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1169
diff changeset
   477
    (controller entered 
71f7a035396f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1169
diff changeset
   478
    and:[enteredBgColor notNil]) ifTrue:[
1169
982c3fd58d67 better highlighting on enter/leave
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   479
        super drawWith:fg and:enteredBgColor
982c3fd58d67 better highlighting on enter/leave
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   480
    ] ifFalse:[
982c3fd58d67 better highlighting on enter/leave
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   481
        super drawWith:fg and:bgColor "/ bg
982c3fd58d67 better highlighting on enter/leave
Claus Gittinger <cg@exept.de>
parents: 1154
diff changeset
   482
    ]
164
Claus Gittinger <cg@exept.de>
parents: 147
diff changeset
   483
Claus Gittinger <cg@exept.de>
parents: 147
diff changeset
   484
    "Modified: 22.9.1995 / 15:45:02 / claus"
1171
71f7a035396f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1169
diff changeset
   485
    "Modified: 1.4.1997 / 13:35:48 / cg"
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   486
!
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   487
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   488
edgeDrawn:which
1154
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   489
    "redraw my logo if it overlaps the edge"
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   490
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   491
    LabelOverMargin ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   492
        (logo notNil and:[logo isImageOrForm]) ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   493
            self paint:fgColor on:bgColor.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   494
            self clippingRectangle:nil.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   495
            self displayForm:logo x:labelOriginX y:labelOriginY.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   496
            self clippingRectangle:innerClipRect
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   497
       ]
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   498
    ].
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   499
1154
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   500
    "Modified: 22.3.1997 / 18:23:50 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   501
! !
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   502
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   503
!CheckToggle class methodsFor:'documentation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   504
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   505
version
1236
ca
parents: 1171
diff changeset
   506
    ^ '$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.36 1997-06-04 11:26:13 ca Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   507
! !