LinkButton.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 21 May 2015 21:14:57 +0100
branchjv
changeset 4770 6634b540fea2
parent 4681 b97620c35200
child 5010 48191c4158e8
permissions -rw-r--r--
Added PluggableHierarchicalList to define ad-hoc tree models. This is especially handy for creating tree-like representations for inspector
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
4770
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4681
diff changeset
    14
"{ NameSpace: Smalltalk }"
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
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.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    42
    Can be used to create html-page-look-alike links in a view.
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    [author:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
        cg (cg@CG-VOSTRO)
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    [instance variables:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [class variables:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    [see also:]
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
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
examples
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
"
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    58
                                                                    [exBegin]
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    |v l|
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    v := StandardSystemView new.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    l := LinkButton in:v.
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    63
    l label:
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    64
        (('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) 
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    65
        , ' '
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    66
        , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    67
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    68
    v open
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    69
                                                                    [exEnd]
3670
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
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    72
                                                                    [exBegin]
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    73
    |v l|
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    74
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    75
    v := StandardSystemView new.
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    76
    l := LinkButton in:v.
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    77
    l label:
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    78
        ((('Hello' actionForAll:[ Transcript showCR:'Hello Clicked']) colorizeAllWith:(Color blue)) 
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    79
        , ' '
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    80
        , ('World' actionForAll:[ Transcript showCR:'World Clicked'])).
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    81
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    82
    v open
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    83
                                                                    [exEnd]
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    84
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    85
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    86
                                                                    [exBegin]
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    87
    |v l|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    88
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    89
    v := StandardSystemView new.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
    90
    l := LinkButton in:v.
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    l labelsAndActions:{ 
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
    92
                        'Hello' -> [ Transcript showCR:'Hello Clicked'].
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
                        ' ' -> nil.
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
    94
                        'World' -> [ Transcript showCR:'World Clicked'].
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
                       }.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    l foregroundColor:Color blue.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    v open
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
    98
                                                                    [exEnd]
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
    99
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   100
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   101
                                                                    [exBegin]
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   102
    |v l|
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   103
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   104
    v := StandardSystemView new.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   105
    l := LinkButton in:v.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   106
    l labelsAndActions:{ 
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   107
                        'Hello' -> nil.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   108
                        ' ' -> nil.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   109
                        'World' -> [ Transcript showCR:'World Clicked'].
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   110
                       }.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   111
    l foregroundColor:Color blue.
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   112
    v open
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   113
                                                                    [exEnd]
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
! !
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   117
!LinkButton class methodsFor:'defaults'!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   118
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   119
updateStyleCache
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   120
    "extract values from the styleSheet and cache them in class variables"
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   121
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   122
    <resource: #style ( #'linkButton.linkColor' )>
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   123
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   124
    DefaultLinkColor := StyleSheet colorAt:#'linkButton.linkColor' default:Color blue.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   125
! !
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   126
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
!LinkButton methodsFor:'accessing'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
labelsAndActions
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    "returns the collection of label->action associations. 
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
     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
   132
     When clicked on a string, the corresponding action is called"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    ^ labelsAndActions
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
labelsAndActions:aCollectionOfAssociations
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    "set the collection of label->action associations. 
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
     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
   140
     When clicked on a string, the corresponding action is called"
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    labelsAndActions := aCollectionOfAssociations.
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    self label:((aCollectionOfAssociations collect:[:assoc | assoc key]) asStringWith:'')
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
! !
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
!LinkButton methodsFor:'initialization'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
4677
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   148
allViewBackground:something if:condition
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   149
    "set the viewBackground to something, a color, image or form,
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   150
     in myself and recursively in all of my subviews"
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   151
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   152
    self viewBackground:something if:condition.
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   153
    self backgroundColor:something.
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   154
!
e6a348494211 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4572
diff changeset
   155
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
defaultControllerClass
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    ^ LinkButtonController
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   158
!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   159
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   160
initStyle
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   161
    super initStyle.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   162
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   163
    level := enterLevel := leaveLevel := onLevel := offLevel := 0.
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   164
    self borderWidth: 0.
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   165
    DefaultLinkColor notNil ifTrue:[
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   166
        |color|
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   167
        self paint:(color := DefaultLinkColor onDevice:self graphicsDevice).
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   168
        self foreground:color.
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   169
    ].
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   170
    enteredFgColor := nil.
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   171
    enteredBgColor := nil.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   172
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   173
"/    activeFgColor := enteredFgColor := foreground.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   174
"/    activeBgColor := enteredBgColor := viewBackground.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   175
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   176
    "Modified: / 07-09-2011 / 04:29:29 / cg"
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   177
!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   178
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   179
initialize
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   180
    super initialize.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   181
    self enableMotionEvents
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   182
! !
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   183
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   184
!LinkButton methodsFor:'redrawing'!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   185
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   186
actionAt:aPoint
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   187
    |pressAction emphasis|
3664
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   188
4572
612d49704e0f class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4508
diff changeset
   189
    pressAction := self pressAction ifNil:[ self releaseAction ].
612d49704e0f class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4508
diff changeset
   190
    pressAction isNil ifTrue:[
612d49704e0f class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4508
diff changeset
   191
        pressAction := self pressChannel ifNil:[ self releaseChannel ].
612d49704e0f class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4508
diff changeset
   192
    ].
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   193
    labelsAndActions isNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   194
        "take action from logo, which is normally a text"
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   195
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   196
        emphasis := logo emphasisAtPoint:aPoint on:self.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   197
        (emphasis isNil or:[emphasis isSymbol]) ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   198
            ^ pressAction.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   199
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   200
        emphasis isAssociation ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   201
            emphasis key == #actionBlock ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   202
                ^ emphasis value.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   203
            ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   204
            ^ pressAction.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   205
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   206
        emphasis do:[:eachElement|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   207
            eachElement isAssociation ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   208
                eachElement key == #actionBlock ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   209
                    ^ eachElement value.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   210
                ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   211
            ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   212
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   213
        ^ pressAction.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   214
    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   215
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   216
    self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX |
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   217
        (aPoint x between:leftX and:rightX) ifTrue:[
3664
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   218
            ^ labelsAndActions notNil ifTrue:action ifFalse:pressAction
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   219
        ].
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   220
    ].
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   221
    ^ nil
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
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   224
actionEmphasisIn:aText atPoint:aPoint
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   225
    "check for a actionBlock emphasis in aString at aPoint.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   226
     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
   227
     or nil"
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
    |emphasis|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   230
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   231
    emphasis := aText emphasisAtPoint:aPoint on:self.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   232
    (emphasis isNil or:[emphasis isSymbol]) ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   233
        ^ #(nil nil).
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   234
    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   235
    emphasis isAssociation ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   236
        emphasis key == #actionBlock ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   237
            ^ Array with:emphasis with:emphasis value.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   238
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   239
        ^ #(nil nil).
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   240
    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   241
    emphasis detect:[:eachElement|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   242
        eachElement isAssociation ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   243
            eachElement key == #actionBlock ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   244
                ^ Array with:emphasis with:eachElement value.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   245
            ].
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
    ] ifNone:[].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   248
    ^ #(nil nil).
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   249
!
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   250
4680
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   251
drawFocusFrame
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   252
    "/ intentionally ignored
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   253
    ^ self
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   254
!
6c266588d588 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4677
diff changeset
   255
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   256
drawStringLogo:aString x:x y:y
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   257
    "redefined to draw the part under the mouse pointer with an underined emphasis"
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   258
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   259
    |str entered mousePoint start len emphasis|
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   260
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   261
    mousePoint := controller lastMousePoint.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   262
    entered := controller entered.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   263
3670
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   264
    labelsAndActions isNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   265
        (entered not or:[mousePoint isNil]) ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   266
            self displayString:aString x:x y:y.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   267
            ^ self.
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
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   270
        str := aString.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   271
        emphasis := (self actionEmphasisIn:aString atPoint:mousePoint) first.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   272
        emphasis notNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   273
            start := 1.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   274
            aString emphasisCollection runsDo:[:eachLen :eachEmphasis|
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   275
                len isNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   276
                    eachEmphasis == emphasis ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   277
                        len := eachLen.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   278
                    ] ifFalse:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   279
                        start := start + eachLen.  
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   280
                    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   281
                ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   282
            ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   283
            len notNil ifTrue:[
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   284
                str := str deepCopy.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   285
                str emphasisFrom:start to:start+len-1 add:#underline.
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   286
                "/ 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
   287
            ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   288
        ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   289
        self displayString:str x:x y:y.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   290
        ^ self.
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   291
    ].
ccfd04be9736 Now works with Text/actionBlocks
Stefan Vogel <sv@exept.de>
parents: 3668
diff changeset
   292
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   293
    self labelsAndActionsWithPositionsDo:[:lbl :action :leftX :rightX |
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   294
        |l|
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   295
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   296
        l := lbl.
3668
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   297
        action notNil ifTrue:[
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   298
            (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
   299
                l := l allUnderlined
e1888e938d68 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3666
diff changeset
   300
            ].
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   301
        ].
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   302
        self displayString:l x:leftX y:y.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   303
    ].
4071
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   304
d056c9f9b595 changed:
Claus Gittinger <cg@exept.de>
parents: 3671
diff changeset
   305
    "Modified: / 07-09-2011 / 04:47:13 / cg"
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   306
!
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   307
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   308
is3D
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   309
    ^ false.
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   310
!
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   311
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   312
labelsAndActionsWithPositionsDo:aFourArgBlock
3664
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   313
    |leftX rightX w|
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   314
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   315
    leftX := labelOriginX.
3664
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   316
    labelsAndActions isNil ifTrue:[
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   317
        w := (self font widthOf:logo on:self graphicsDevice).
3664
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   318
        rightX := leftX + w-1.
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   319
        aFourArgBlock 
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   320
            value:logo
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   321
            value:self pressAction
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   322
            value:leftX
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   323
            value:rightX.
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   324
        ^ self
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   325
    ].
b49c21d9aac4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3662
diff changeset
   326
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   327
    labelsAndActions do:[:assoc | 
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   328
        |lbl wEach|
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   329
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   330
        lbl := assoc key.
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   331
        wEach := (self font widthOf:lbl on:self graphicsDevice).
3662
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   332
        rightX := leftX + wEach-1.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   333
        aFourArgBlock 
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   334
            value:assoc key
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   335
            value:assoc value
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   336
            value:leftX
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   337
            value:rightX.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   338
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   339
        leftX := rightX+1.
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   340
    ].
fb3778b66ce3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3650
diff changeset
   341
    ^ nil
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
! !
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
!LinkButton class methodsFor:'documentation'!
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
version
4681
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   347
    ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.13 2014-12-02 18:35:56 cg Exp $'
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   348
!
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   349
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   350
version_CVS
b97620c35200 class: LinkButton
Claus Gittinger <cg@exept.de>
parents: 4680
diff changeset
   351
    ^ '$Header: /cvs/stx/stx/libwidg2/LinkButton.st,v 1.13 2014-12-02 18:35:56 cg Exp $'
3650
60a95483b993 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
! !
4508
5c8959e41aa6 class: LinkButton
Stefan Vogel <sv@exept.de>
parents: 4071
diff changeset
   353