LinkButton.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 20:53:39 +0200
changeset 6083 7a2c0a30e75c
parent 6057 8c54bab4666f
child 6215 4480fe34e420
permissions -rw-r--r--
#REFACTORING by exept class: NoteBookView changed: #buttonPress:x:y: Transcript showCR:(... bindWith:...) -> Transcript showCR:... with:...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
     1
"{ Encoding: utf8 }"
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
     2
5478
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     3
"
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     4
 COPYRIGHT (c) 2009 by Claus Gittinger
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     5
              All Rights Reserved
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     6
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     7
 This software is furnished under a license and may be used
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     8
 only in accordance with the terms of that license and with the
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    10
 be provided or otherwise made available to, or used by, any
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    11
 other person.  No title to or ownership of the software is
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    12
 hereby transferred.
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    13
"
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
4985
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
    16
"{ NameSpace: Smalltalk }"
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
    17
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
Button subclass:#LinkButton
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    19
	instanceVariableNames:'labelsAndActions'
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
    20
	classVariableNames:'DefaultLinkColor'
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Views-Layout'
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!LinkButton class methodsFor:'documentation'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
5478
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    27
copyright
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    28
"
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    29
 COPYRIGHT (c) 2009 by Claus Gittinger
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    30
              All Rights Reserved
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    31
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    32
 This software is furnished under a license and may be used
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    33
 only in accordance with the terms of that license and with the
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    35
 be provided or otherwise made available to, or used by, any
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    36
 other person.  No title to or ownership of the software is
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    37
 hereby transferred.
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    38
"
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    39
!
ac5fa8f12f47 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5111
diff changeset
    40
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    Looks like a Label, but behaves like a button with individually clickable text components.
5045
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
    44
    Can be used to create html-page-look-alike links in a view,
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
    45
    especially to make label-looking action buttons (as in the browser's info view).
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    [author:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
        cg (cg@CG-VOSTRO)
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    [instance variables:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    [class variables:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    [see also:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
examples
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
"
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    61
                                                                    [exBegin]
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    |v l|
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    v := StandardSystemView new.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    l := LinkButton in:v.
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    66
    l label:
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    67
        (('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) 
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    68
        , ' '
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    69
        , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    70
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    71
    v open
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    72
                                                                    [exEnd]
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    73
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    74
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    75
                                                                    [exBegin]
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    76
    |v l|
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    77
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    78
    v := StandardSystemView new.
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    79
    l := LinkButton in:v.
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    80
    l label:
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    81
        ((('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) colorizeAllWith:(Color blue)) 
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    82
        , ' '
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    83
        , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    84
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    85
    v open
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    86
                                                                    [exEnd]
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    87
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    88
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    89
                                                                    [exBegin]
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    90
    |v l|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    91
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    92
    v := StandardSystemView new.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    93
    l := LinkButton in:v.
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    l labelsAndActions:{ 
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
    95
                        'Hello' -> [ Transcript showCR:'Hello Clicked'].
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
                        ' ' -> nil.
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
    97
                        'World' -> [ Transcript showCR:'World Clicked'].
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
                       }.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    l foregroundColor:Color blue.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    v open
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   101
                                                                    [exEnd]
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   102
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   103
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   104
                                                                    [exBegin]
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   105
    |v l|
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   106
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   107
    v := StandardSystemView new.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   108
    l := LinkButton in:v.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   109
    l labelsAndActions:{ 
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   110
                        'Hello' -> nil.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   111
                        ' ' -> nil.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   112
                        'World' -> [ Transcript showCR:'World Clicked'].
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   113
                       }.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   114
    l foregroundColor:Color blue.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   115
    v open
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   116
                                                                    [exEnd]
4985
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   117
    Dialog aboutToOpenBoxNotificationSignal handle:[:ex |
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   118
        |lbl|
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   119
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   120
        lbl := LinkButton label:(('XXX' 
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   121
                                        colorizeAllWith:Color blue)
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   122
                                        actionForAll:[ Transcript showCR:'xxx' ]).
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   123
        ex box verticalPanel addComponent:lbl.
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   124
    ] do:[
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   125
        self warn:'Bla bla bla'
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   126
    ].
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   127
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
! !
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   131
!LinkButton class methodsFor:'defaults'!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   132
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   133
updateStyleCache
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   134
    "extract values from the styleSheet and cache them in class variables"
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   135
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   136
    <resource: #style ( #'linkButton.linkColor' )>
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   137
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   138
    DefaultLinkColor := StyleSheet colorAt:#'linkButton.linkColor' default:Color blue.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   139
! !
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   140
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
!LinkButton methodsFor:'accessing'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   143
actionAt:aPoint
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   144
    |pressAction emphasisAction emphasis pointInLabel|
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   145
5988
724556a52a4b #BUGFIX by sr
sr
parents: 5605
diff changeset
   146
    self enabled ifFalse:[
724556a52a4b #BUGFIX by sr
sr
parents: 5605
diff changeset
   147
        ^ nil
724556a52a4b #BUGFIX by sr
sr
parents: 5605
diff changeset
   148
    ].
724556a52a4b #BUGFIX by sr
sr
parents: 5605
diff changeset
   149
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   150
    pressAction := self pressAction ifNil:[ self releaseAction ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   151
    pressAction isNil ifTrue:[
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   152
        pressAction := self pressChannel ifNil:[ self releaseChannel ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   153
    ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   154
    labelsAndActions isNil ifTrue:[
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   155
        "take action from logo, which is normally a text with an action-emphasis"
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   156
        logo notNil ifTrue:[
5111
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   157
            pointInLabel := (aPoint - (labelOriginX@labelOriginY)).
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   158
            logo isStringCollection ifTrue:[
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   159
                |lineIndex line pointInLine|
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   160
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   161
                lineIndex := (pointInLabel y // self font height) + 1.
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   162
                line := logo at:lineIndex ifAbsent:nil.
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   163
                line notNil ifTrue:[
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   164
                    pointInLine := pointInLabel - (0 @ ((lineIndex - 1) * self font height)).
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   165
                    emphasis := line emphasisAtPoint:pointInLine on:self. 
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   166
                ].    
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   167
            ] ifFalse:[    
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   168
                emphasis := logo emphasisAtPoint:pointInLabel on:self. 
ce09771c85a9 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
   169
            ].
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   170
            (emphasisAction := Text actionBlockFromEmphasis:emphasis) notNil ifTrue:[
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   171
                ^ emphasisAction
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   172
            ].    
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   173
        ].    
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   174
        ^ pressAction.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   175
    ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   176
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   177
    self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX |
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   178
        (aPoint x between:leftX and:rightX) ifTrue:[
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   179
            ^ labelsAndActions notNil ifTrue:action ifFalse:pressAction
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   180
        ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   181
    ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   182
    ^ nil
5988
724556a52a4b #BUGFIX by sr
sr
parents: 5605
diff changeset
   183
724556a52a4b #BUGFIX by sr
sr
parents: 5605
diff changeset
   184
    "Modified: / 30-01-2019 / 15:42:31 / sr"
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   185
    "Modified: / 28-05-2019 / 11:04:13 / Claus Gittinger"
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   186
!
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   187
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
labelsAndActions
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "returns the collection of label->action associations. 
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
     For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
     When clicked on a string, the corresponding action is called"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    ^ labelsAndActions
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
labelsAndActions:aCollectionOfAssociations
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    "set the collection of label->action associations. 
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
     For display, the label strings are drawn as one concatenated string (add separating spaces, if you have to).
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
     When clicked on a string, the corresponding action is called"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    labelsAndActions := aCollectionOfAssociations.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    self label:((aCollectionOfAssociations collect:[:assoc | assoc key]) asStringWith:'')
5045
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
   203
!
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
   204
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
   205
level:anInteger
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
   206
    enterLevel := leaveLevel := onLevel := offLevel := level := anInteger.
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
   207
    margin := level abs.
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
! !
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!LinkButton methodsFor:'initialization'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
4677
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   212
allViewBackground:something if:condition
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   213
    "set the viewBackground to something, a color, image or form,
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   214
     in myself and recursively in all of my subviews"
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   215
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   216
    self viewBackground:something if:condition.
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   217
    self backgroundColor:something.
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   218
!
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   219
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
defaultControllerClass
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    ^ LinkButtonController
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   222
!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   223
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   224
initStyle
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   225
    super initStyle.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   226
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   227
    level := enterLevel := leaveLevel := onLevel := offLevel := 0.
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   228
    self borderWidth: 0.
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   229
    DefaultLinkColor notNil ifTrue:[
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   230
        |color|
4987
82bb0a9fecdb #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 4985
diff changeset
   231
        self paint:(color := DefaultLinkColor onDevice:device).
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   232
        self foreground:color.
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   233
    ].
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   234
    enteredFgColor := nil.
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   235
    enteredBgColor := nil.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   236
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   237
"/    activeFgColor := enteredFgColor := foreground.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   238
"/    activeBgColor := enteredBgColor := viewBackground.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   239
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   240
    "Modified: / 07-09-2011 / 04:29:29 / cg"
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   241
!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   242
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   243
initialize
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   244
    super initialize.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   245
    self enableMotionEvents
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   246
! !
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   247
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   248
!LinkButton methodsFor:'private'!
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   249
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   250
actionEmphasisIn:aText atPoint:aPoint
5605
8718eba88418 #BUGFIX by mawalch
mawalch
parents: 5478
diff changeset
   251
    "check for an actionBlock-emphasis in aText at aPoint.
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   252
     Answer an Array with the whole emphasis and the actionBlock,
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   253
     or nil"
5605
8718eba88418 #BUGFIX by mawalch
mawalch
parents: 5478
diff changeset
   254
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   255
    |emphasis action|
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   256
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   257
    emphasis := aText emphasisAtPoint:aPoint on:self.
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   258
    emphasis notNil ifTrue:[
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   259
        action := Text actionBlockFromEmphasis:emphasis.
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   260
        action notNil ifTrue:[
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   261
            ^ { emphasis . action }
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   262
        ].
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   263
    ].    
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   264
    ^ #(nil nil).
5605
8718eba88418 #BUGFIX by mawalch
mawalch
parents: 5478
diff changeset
   265
8718eba88418 #BUGFIX by mawalch
mawalch
parents: 5478
diff changeset
   266
    "Modified: / 13-09-2017 / 18:14:58 / mawalch"
6057
8c54bab4666f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5988
diff changeset
   267
    "Modified: / 28-05-2019 / 11:03:05 / Claus Gittinger"
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   268
!
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   269
5110
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   270
labelsAndActionsWithPositionsDo:aFourArgBlock
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   271
    |leftX rightX w|
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   272
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   273
    leftX := labelOriginX.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   274
    labelsAndActions isNil ifTrue:[
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   275
        w := (self font widthOf:logo on:device).
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   276
        rightX := leftX + w-1.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   277
        aFourArgBlock 
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   278
            value:logo
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   279
            value:self pressAction
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   280
            value:leftX
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   281
            value:rightX.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   282
        ^ self
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   283
    ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   284
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   285
    labelsAndActions do:[:assoc | 
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   286
        |lbl wEach|
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   287
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   288
        lbl := assoc key.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   289
        wEach := (self font widthOf:lbl on:device).
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   290
        rightX := leftX + wEach-1.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   291
        aFourArgBlock 
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   292
            value:assoc key
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   293
            value:assoc value
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   294
            value:leftX
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   295
            value:rightX.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   296
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   297
        leftX := rightX+1.
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   298
    ].
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   299
    ^ nil
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   300
! !
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   301
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   302
!LinkButton methodsFor:'redrawing'!
dd99c089bf65 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5096
diff changeset
   303
4680
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   304
drawFocusFrame
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   305
    "/ intentionally ignored
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   306
    ^ self
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   307
!
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   308
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   309
drawStringLogo:aString x:x y:y
5045
50eb267766b2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4987
diff changeset
   310
    "redefined to draw any anchor under the mouse pointer with an underlined emphasis"
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   311
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   312
    |str entered mousePoint start len emphasis|
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   313
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   314
    mousePoint := controller lastMousePoint.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   315
    entered := controller entered.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   316
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   317
    labelsAndActions isNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   318
        (entered not or:[mousePoint isNil]) ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   319
            self displayString:aString x:x y:y.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   320
            ^ self.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   321
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   322
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   323
        str := aString.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   324
        emphasis := (self actionEmphasisIn:aString atPoint:mousePoint) first.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   325
        emphasis notNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   326
            start := 1.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   327
            aString emphasisCollection runsDo:[:eachLen :eachEmphasis|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   328
                len isNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   329
                    eachEmphasis == emphasis ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   330
                        len := eachLen.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   331
                    ] ifFalse:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   332
                        start := start + eachLen.  
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   333
                    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   334
                ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   335
            ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   336
            len notNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   337
                str := str deepCopy.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   338
                str emphasisFrom:start to:start+len-1 add:#underline.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   339
                "/ str emphasisFrom:start to:start+len-1 add:(#color -> foreground).
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   340
            ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   341
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   342
        self displayString:str x:x y:y.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   343
        ^ self.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   344
    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   345
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   346
    self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX |
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   347
        |l|
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   348
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   349
        l := lbl.
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   350
        action notNil ifTrue:[
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   351
            (entered and:[mousePoint notNil and:[mousePoint x between:leftX and:rightX]]) ifTrue:[
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   352
                l := l allUnderlined
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   353
            ].
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   354
        ].
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   355
        self displayString:l x:leftX y:y.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   356
    ].
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   357
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   358
    "Modified: / 07-09-2011 / 04:47:13 / cg"
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   359
!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   360
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   361
is3D
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   362
    ^ false.
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
! !
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
!LinkButton class methodsFor:'documentation'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
version
4985
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   368
    ^ '$Header$'
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   369
!
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   370
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   371
version_CVS
4985
Claus Gittinger <cg@exept.de>
parents: 4681
diff changeset
   372
    ^ '$Header$'
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
! !
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   374