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