CheckToggle.st
author Claus Gittinger <cg@exept.de>
Sat, 22 Mar 1997 18:24:49 +0100
changeset 1154 bb9a71579a88
parent 1123 9d691272a9ec
child 1169 982c3fd58d67
permissions -rw-r--r--
commentary
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
128
claus
parents: 127
diff changeset
   234
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   235
    "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
   236
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   237
    <resource: #style (#checkToggleCheckColor
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   238
                       #checkToggleBackgroundColor #checkToggleForegroundColor
836
703b9e95ead5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   239
                       #checkToggleActiveBackgroundColor #checkToggleActiveForegroundColor
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   240
                       #checkToggleActiveLevel #checkTogglePassiveLevel
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   241
                       #checkToggleBorderWidth 
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   242
                       #checkToggleBitmapFile
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   243
                       #checkToggleLabelOverMargin 
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   244
                       #checkToggleStyle)>
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   245
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   246
    |checkFileName bits checkStyle|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   247
130
claus
parents: 128
diff changeset
   248
    DefaultCheckColor := StyleSheet colorAt:'checkToggleCheckColor'.
139
claus
parents: 136
diff changeset
   249
    DefaultFGColor := StyleSheet colorAt:'checkToggleForegroundColor'.
130
claus
parents: 128
diff changeset
   250
    DefaultBGColor := StyleSheet colorAt:'checkToggleBackgroundColor'.
139
claus
parents: 136
diff changeset
   251
    DefaultActiveFGColor := StyleSheet colorAt:'checkToggleActiveForegroundColor'.
130
claus
parents: 128
diff changeset
   252
    DefaultActiveBGColor := StyleSheet colorAt:'checkToggleActiveBackgroundColor'.
claus
parents: 128
diff changeset
   253
    DefaultActiveLevel := StyleSheet at:'checkToggleActiveLevel'.
claus
parents: 128
diff changeset
   254
    DefaultPassiveLevel := StyleSheet at:'checkTogglePassiveLevel'.
claus
parents: 128
diff changeset
   255
    DefaultBorderWidth := StyleSheet at:'checkToggleBorderWidth'.
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   256
    LabelOverMargin := StyleSheet at:'checkToggleLabelOverMargin' default:false.
130
claus
parents: 128
diff changeset
   257
136
claus
parents: 133
diff changeset
   258
    DefaultCheckForm := nil.
128
claus
parents: 127
diff changeset
   259
    checkFileName := StyleSheet at:'checkToggleBitmapFile' default:'CheckOn.xbm'.
claus
parents: 127
diff changeset
   260
    checkFileName notNil ifTrue:[
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   261
        DefaultCheckForm := Image fromFile:checkFileName 
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   262
                                resolution:100
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   263
                                        on:Display.
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   264
        DefaultCheckForm isNil ifTrue:[
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   265
            DefaultCheckForm := Image fromFile:'bitmaps/' , checkFileName 
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   266
                                    resolution:100
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   267
                                            on:Display.
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   268
        ]
130
claus
parents: 128
diff changeset
   269
    ].
claus
parents: 128
diff changeset
   270
    DefaultCheckForm isNil ifTrue:[
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   271
        checkStyle := StyleSheet at:'checkToggleStyle' default:#check.
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   272
        checkStyle == #cross ifTrue:[
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   273
            bits := #[2r10000000 2r00000001
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   274
                      2r01000000 2r00000010
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   275
                      2r00100000 2r00000100
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   276
                      2r00010000 2r00001000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   277
                      2r00001000 2r00010000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   278
                      2r00000100 2r00100000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   279
                      2r00000010 2r01000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   280
                      2r00000001 2r10000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   281
                      2r00000001 2r10000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   282
                      2r00000010 2r01000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   283
                      2r00000100 2r00100000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   284
                      2r00001000 2r00010000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   285
                      2r00010000 2r00001000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   286
                      2r00100000 2r00000100
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   287
                      2r01000000 2r00000010
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   288
                      2r10000000 2r00000001]
128
claus
parents: 127
diff changeset
   289
375
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   290
        ] ifFalse:[
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   291
            checkStyle == #fatcross ifTrue:[
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   292
                bits := #[2r11000000 2r00000011
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   293
                          2r11100000 2r00000111
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   294
                          2r01110000 2r00001110
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   295
                          2r00111000 2r00011100
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   296
                          2r00011100 2r00111000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   297
                          2r00001110 2r01110000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   298
                          2r00000111 2r11100000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   299
                          2r00000011 2r11000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   300
                          2r00000011 2r11000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   301
                          2r00000111 2r11100000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   302
                          2r00001110 2r01110000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   303
                          2r00011100 2r00111000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   304
                          2r00111000 2r00011100
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   305
                          2r01110000 2r00001110
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   306
                          2r11100000 2r00000111
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   307
                          2r11000000 2r00000011]
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   308
            ] ifFalse:[
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   309
                bits := #[2r00000000 2r00000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   310
                          2r00000000 2r00000010
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   311
                          2r00000000 2r00000010
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   312
                          2r00000000 2r00000100
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   313
                          2r00000000 2r00000100
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   314
                          2r00000000 2r00001000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   315
                          2r00000000 2r00001000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   316
                          2r00000000 2r00010000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   317
                          2r01000000 2r00110000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   318
                          2r00100000 2r01100000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   319
                          2r00011000 2r01100000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   320
                          2r00001110 2r11000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   321
                          2r00000111 2r11000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   322
                          2r00000011 2r10000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   323
                          2r00000001 2r10000000
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   324
                          2r00000000 2r00000000]
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   325
            ]
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   326
        ].
6656f7e8ae20 added just another checkType: #fatcross
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
   327
        DefaultCheckForm := Form width:16 height:16 fromArray:bits on:Display                                           
128
claus
parents: 127
diff changeset
   328
    ]
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 375
diff changeset
   329
1001
eb7a8b2f4347 checkin from browser
ca
parents: 967
diff changeset
   330
    "
eb7a8b2f4347 checkin from browser
ca
parents: 967
diff changeset
   331
     self updateStyleCache
eb7a8b2f4347 checkin from browser
ca
parents: 967
diff changeset
   332
    "
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   333
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   334
    "Modified: 7.3.1997 / 21:15:13 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   335
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   336
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   337
!CheckToggle methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   338
18
66bf62e27141 *** empty log message ***
claus
parents: 4
diff changeset
   339
initStyle
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   340
    "setup viewStyle specifics"
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   341
18
66bf62e27141 *** empty log message ***
claus
parents: 4
diff changeset
   342
    super initStyle.
66bf62e27141 *** empty log message ***
claus
parents: 4
diff changeset
   343
128
claus
parents: 127
diff changeset
   344
    onLevel := offLevel.
130
claus
parents: 128
diff changeset
   345
    DefaultActiveLevel notNil ifTrue:[onLevel := DefaultActiveLevel].
136
claus
parents: 133
diff changeset
   346
    DefaultPassiveLevel notNil ifTrue:[offLevel := DefaultPassiveLevel].
130
claus
parents: 128
diff changeset
   347
128
claus
parents: 127
diff changeset
   348
    activeLogo := DefaultCheckForm on:device.
claus
parents: 127
diff changeset
   349
    passiveLogo := nil.
claus
parents: 127
diff changeset
   350
139
claus
parents: 136
diff changeset
   351
    DefaultActiveFGColor notNil ifTrue:[self activeForegroundColor:DefaultActiveFGColor].
130
claus
parents: 128
diff changeset
   352
    DefaultCheckColor notNil ifTrue:[self activeForegroundColor:DefaultCheckColor].
claus
parents: 128
diff changeset
   353
    DefaultActiveBGColor notNil ifTrue:[self activeBackgroundColor:DefaultActiveBGColor].
139
claus
parents: 136
diff changeset
   354
    DefaultFGColor notNil ifTrue:[self foregroundColor:DefaultFGColor].
130
claus
parents: 128
diff changeset
   355
    DefaultBGColor notNil ifTrue:[self backgroundColor:DefaultBGColor].
claus
parents: 128
diff changeset
   356
128
claus
parents: 127
diff changeset
   357
    showLamp := false.
130
claus
parents: 128
diff changeset
   358
claus
parents: 128
diff changeset
   359
    DefaultBorderWidth notNil ifTrue:[self borderWidth:DefaultBorderWidth].
claus
parents: 128
diff changeset
   360
claus
parents: 128
diff changeset
   361
    offLevel ~~ level ifTrue:[self level:offLevel].
967
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   362
6739eb5496da commentary
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   363
    "Modified: 22.1.1997 / 11:57:05 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   364
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   365
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   366
initialize
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   367
    super initialize.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   368
    passiveLogo := nil.
1023
74e837fb617e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   369
    self label:activeLogo "/ to let me compute some defaultExtent
74e837fb617e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   370
74e837fb617e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1001
diff changeset
   371
    "Modified: 18.2.1997 / 14:03:39 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   372
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   373
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   374
!CheckToggle methodsFor:'queries'!
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   375
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   376
preferredExtent
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   377
    "/ If I have an explicit preferredExtent ..
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   378
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   379
    |pref|
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   380
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   381
    preferredExtent notNil ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   382
        ^ preferredExtent
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   383
    ].
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   384
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   385
    pref := super preferredExtent.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   386
    LabelOverMargin ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   387
        pref := pref - (margin*2)
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   388
    ].
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   389
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   390
    ^ pref
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   391
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   392
    "Modified: 7.3.1997 / 17:52:53 / cg"
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   393
! !
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   394
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   395
!CheckToggle methodsFor:'redrawing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   396
133
claus
parents: 132
diff changeset
   397
drawWith:fg and:bg
265
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   398
    controller pressed ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   399
	logo := activeLogo.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   400
    ] ifFalse:[
164
Claus Gittinger <cg@exept.de>
parents: 147
diff changeset
   401
	logo := passiveLogo.
133
claus
parents: 132
diff changeset
   402
    ].
claus
parents: 132
diff changeset
   403
    super drawWith:fg and:bg
164
Claus Gittinger <cg@exept.de>
parents: 147
diff changeset
   404
Claus Gittinger <cg@exept.de>
parents: 147
diff changeset
   405
    "Modified: 22.9.1995 / 15:45:02 / claus"
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
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   408
edgeDrawn:which
1154
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   409
    "redraw my logo if it overlaps the edge"
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   410
1123
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   411
    LabelOverMargin ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   412
        (logo notNil and:[logo isImageOrForm]) ifTrue:[
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   413
            self paint:fgColor on:bgColor.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   414
            self clippingRectangle:nil.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   415
            self displayForm:logo x:labelOriginX y:labelOriginY.
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   416
            self clippingRectangle:innerClipRect
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   417
       ]
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   418
    ].
9d691272a9ec nice check-mark on iris.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   419
1154
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   420
    "Modified: 22.3.1997 / 18:23:50 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   421
! !
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   422
899
aa84d3d39d94 use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 836
diff changeset
   423
!CheckToggle class methodsFor:'documentation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   424
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   425
version
1154
bb9a71579a88 commentary
Claus Gittinger <cg@exept.de>
parents: 1123
diff changeset
   426
    ^ '$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.33 1997-03-22 17:24:49 cg Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   427
! !