MenuItem.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Jun 2019 08:49:48 +0200
changeset 4283 0d95d298a44b
parent 4274 ac618664faba
child 4292 c97a98a89da1
permissions -rw-r--r--
#OTHER by cg self class name -> self className
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4084
c8e84f0ba64e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
     1
"{ Encoding: utf8 }"
c8e84f0ba64e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
     2
1196
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     3
"
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     4
 COPYRIGHT (c) 1998 by eXept Software AG
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     5
              All Rights Reserved
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     6
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     7
 This software is furnished under a license and may be used
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     8
 only in accordance with the terms of that license and with the
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    10
 be provided or otherwise made available to, or used by, any
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    11
 other person.  No title to or ownership of the software is
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    12
 hereby transferred.
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    13
"
1369
281acc9f1a73 dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
    14
"{ Package: 'stx:libview2' }"
281acc9f1a73 dont store choiceValue for non-choice items.
Claus Gittinger <cg@exept.de>
parents: 1360
diff changeset
    15
3843
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
    16
"{ NameSpace: Smalltalk }"
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
    17
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
Object subclass:#MenuItem
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
    19
	instanceVariableNames:'flags activeHelpKey enabled label itemValue nameKey startGroup
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
    20
		isVisible indication submenu submenuChannel submenuProvider
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
    21
		shortcutKey labelImage accessCharacterPosition argument choice
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
    22
		choiceValue font auxValue uuid'
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
    23
	classVariableNames:'FLAG_FORCE_MENUINDICATOR FLAG_TRANSLATE_LABEL FLAG_ISBUTTON
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
    24
		FLAG_HIDE_ONACTIVATED FLAG_TRIGGER_ONDOWN
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
    25
		FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING FLAG_KEEP_LINKEDMENU
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
    26
		FLAG_SEND_TO_ORIGINATOR FLAG_IGNORE_MNEMONIC_KEYS
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
    27
		FLAG_IGNORE_SHORTCUTS FLAG_IS_MENUSLICE FLAG_HORIZONTAL_LAYOUT
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
    28
		FLAG_NOHIDE_ONACTIVATED FLAG_NOTRANSLATE_LABEL'
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	poolDictionaries:''
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
	category:'Views-Support'
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
!MenuItem class methodsFor:'documentation'!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
1196
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    35
copyright
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    36
"
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    37
 COPYRIGHT (c) 1998 by eXept Software AG
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    38
              All Rights Reserved
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    39
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    40
 This software is furnished under a license and may be used
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    41
 only in accordance with the terms of that license and with the
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    42
 inclusion of the above copyright notice.   This software may not
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    43
 be provided or otherwise made available to, or used by, any
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    44
 other person.  No title to or ownership of the software is
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    45
 hereby transferred.
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    46
"
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    47
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    48
!
27897663fc97 docu & copyright
Claus Gittinger <cg@exept.de>
parents: 1044
diff changeset
    49
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
documentation
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
"
4034
1e94a92845a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    52
    This together with MenuPanel will eventually replace
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    most of the MenuView and PopUpMenu stuff.
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    (and hopefully be ST-80 compatible ...)
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    For now, only a subset of the full protocol is implemented.
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
4034
1e94a92845a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    58
    new:
1e94a92845a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    59
        %(xx) in label text will be expanded by asking the application
1e94a92845a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    60
        for the xx labelFor:-aspect.
1e94a92845a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
    61
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
    [author:]
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
        Claus Gittinger
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
    65
    [instance variables:]
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
    66
        label: MUST be a CharacterArray.
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
    67
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    [see also:]
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
        MenuItem
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
        PopUpMenu
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
"
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
! !
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
490
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
    74
!MenuItem class methodsFor:'instance creation'!
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
    75
1044
5ecf46d0f1b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    76
label:aString
5ecf46d0f1b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    77
    "create and return a new menuItem, given a label string"
5ecf46d0f1b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    78
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    79
    ^ (self new)
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
    80
        label:aString;
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
    81
        yourself
1044
5ecf46d0f1b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    82
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
    83
    "Created: / 14-08-1998 / 19:19:14 / cg"
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    84
    "Modified (format): / 27-12-2018 / 16:21:01 / Claus Gittinger"
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    85
!
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    86
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    87
label:labelString argument:messageArg
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    88
    "create and return a new menuItem, given its label and value
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    89
     and an argument to be passed with the action"
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    90
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    91
    ^ (self new)
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    92
        label:labelString argument:messageArg;
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    93
        yourself
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    94
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
    95
    "Created: / 27-12-2018 / 16:19:35 / Claus Gittinger"
1044
5ecf46d0f1b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    96
!
5ecf46d0f1b7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1041
diff changeset
    97
2813
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
    98
label:labelString choice:choiceAspect choiceValue:selectorOrValue
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
    99
    "create and return a new menuItem, given its label and choice/value.
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
   100
     This will create a Radio-Button-like item."
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
   101
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   102
    ^ (self new)
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   103
        label:labelString; choice:choiceAspect; choiceValue:selectorOrValue;
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   104
        yourself
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   105
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   106
    "Modified (format): / 26-04-2012 / 12:06:41 / cg"
2813
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
   107
!
Claus Gittinger <cg@exept.de>
parents: 2755
diff changeset
   108
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   109
label:labelString itemValue:selectorOrValue
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   110
    "create and return a new menuItem, given its label and value"
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   111
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   112
    ^ (self new)
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   113
        label:labelString itemValue:selectorOrValue;
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   114
        yourself
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   115
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   116
    "Created: / 09-09-2012 / 13:21:48 / cg"
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   117
!
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   118
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   119
label:labelString itemValue:selectorOrValue argument:messageArg
3353
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   120
    "create and return a new menuItem, given its label and value
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   121
     and an argument to be passed with the action"
1030
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   122
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   123
    ^ (self new)
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   124
        label:labelString itemValue:selectorOrValue argument:messageArg;
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   125
        yourself
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   126
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   127
    "Created: / 09-09-2012 / 13:22:31 / cg"
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   128
    "Modified: / 27-12-2018 / 16:19:57 / Claus Gittinger"
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   129
!
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   130
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   131
label:labelString itemValue:selectorOrValue enabled:enabledHolder
3353
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   132
    "create and return a new menuItem, given its label, value
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   133
     and enabled holder, which can be a boolean, a boolean valueHolder,
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   134
     a block or a selector (to be sent to the application)"
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   135
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   136
    ^ (self new)
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   137
        label:labelString itemValue:selectorOrValue enabled:enabledHolder;
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   138
        yourself
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   139
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   140
    "Created: / 09-09-2012 / 13:23:05 / cg"
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   141
    "Modified: / 27-12-2018 / 16:20:23 / Claus Gittinger"
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   142
!
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   143
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   144
label:labelString itemValue:selectorOrValue translateLabel:translateLabel
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   145
    "create and return a new menuItem, given its label, value and translateLabel flag"
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   146
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   147
    ^ (self new)
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   148
        label:labelString itemValue:selectorOrValue translateLabel:translateLabel;
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   149
        yourself
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   150
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   151
    "Modified: / 27-12-2018 / 16:20:34 / Claus Gittinger"
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   152
!
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   153
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   154
label:labelString submenuChannel:aSymbolOrValueHolder
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   155
    "create and return a new menuItem, given its label and value"
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   156
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   157
    ^ (self new)
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   158
        label:labelString submenuChannel:aSymbolOrValueHolder;
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   159
        yourself
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   160
!
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   161
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   162
label:labelString value:selectorOrValue
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   163
    <resource: #obsolete>
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   164
    "create and return a new menuItem, given its label and value"
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   165
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   166
    ^ self label:labelString itemValue:selectorOrValue
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   167
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   168
    "Created: / 04-08-1998 / 17:34:18 / cg"
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   169
!
1030
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   170
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   171
label:labelString value:selectorOrValue argument:messageArg
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   172
    <resource: #obsolete>
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   173
    "create and return a new menuItem, given its label and value"
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   174
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   175
    ^ (self new)
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   176
        label:labelString; value:selectorOrValue; argument:messageArg;
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   177
        yourself
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   178
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   179
    "Created: / 26-04-2012 / 12:06:34 / cg"
1030
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   180
!
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   181
2876
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   182
label:labelString value:selectorOrValue enabled:enabledHolder
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   183
    <resource: #obsolete>
2876
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   184
    "create and return a new menuItem, given its label and value"
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   185
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   186
    ^ (self new)
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   187
        label:labelString; value:selectorOrValue;
2876
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   188
        enabled:enabledHolder;
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   189
        yourself
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   190
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   191
    "Created: / 29-10-2010 / 12:21:27 / cg"
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   192
!
de49b76ae355 added: #label:value:enabled:
Claus Gittinger <cg@exept.de>
parents: 2875
diff changeset
   193
490
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   194
labeled:aString
3225
7cfefeb97495 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3221
diff changeset
   195
    <resource: #obsolete>
7cfefeb97495 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3221
diff changeset
   196
1030
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   197
    "create and return a new menuItem, given a label string"
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   198
3225
7cfefeb97495 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3221
diff changeset
   199
    ^ self label:aString
1030
3684379a1ac8 added inst-creation #label:value:
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
   200
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   201
    "Modified: / 26-04-2012 / 12:07:12 / cg"
1486
251879696655 *** empty log message ***
martin
parents: 1468
diff changeset
   202
!
251879696655 *** empty log message ***
martin
parents: 1468
diff changeset
   203
251879696655 *** empty log message ***
martin
parents: 1468
diff changeset
   204
separator
3964
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   205
    "create and return a new menuItem for a '----' separator"
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   206
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   207
    ^ self separator:'-'
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   208
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   209
    "Modified: / 19-07-2017 / 09:17:30 / cg"
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   210
!
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   211
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   212
separator2
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   213
    "create and return a new menuItem for a '====' separator"
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   214
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   215
    ^ self separator:'='
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   216
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   217
    "Created: / 19-07-2017 / 09:16:54 / cg"
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   218
!
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   219
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   220
separator:sepString
1486
251879696655 *** empty log message ***
martin
parents: 1468
diff changeset
   221
    "create and return a new menuItem for a separator"
251879696655 *** empty log message ***
martin
parents: 1468
diff changeset
   222
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   223
    ^ (self new)
3964
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   224
        label:sepString; translateLabel:false;
3003
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   225
        yourself
e2177537ecb8 added: #label:value:argument:
Claus Gittinger <cg@exept.de>
parents: 2987
diff changeset
   226
3964
6badb85f429d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 3844
diff changeset
   227
    "Created: / 19-07-2017 / 09:17:21 / cg"
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   228
    "Modified (format): / 27-12-2018 / 16:21:13 / Claus Gittinger"
490
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   229
! !
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   230
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   231
!MenuItem class methodsFor:'class initialization'!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   232
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   233
initialize
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   234
    FLAG_HORIZONTAL_LAYOUT                := 16r0001.
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   235
    FLAG_NOTRANSLATE_LABEL                := 16r0002.
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   236
    FLAG_ISBUTTON                         := 16r0004.
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   237
    FLAG_NOHIDE_ONACTIVATED               := 16r0008.
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   238
    FLAG_TRIGGER_ONDOWN                   := 16r0010.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   239
    FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING := 16r0020.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   240
    FLAG_KEEP_LINKEDMENU                  := 16r0040.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   241
    FLAG_SEND_TO_ORIGINATOR               := 16r0080.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   242
    FLAG_IGNORE_MNEMONIC_KEYS             := 16r0100.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   243
    FLAG_IGNORE_SHORTCUTS                 := 16r0200.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   244
    FLAG_IS_MENUSLICE                     := 16r0400.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   245
    FLAG_FORCE_MENUINDICATOR              := 16r0800.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   246
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   247
    "Created: / 09-08-2018 / 16:36:25 / Claus Gittinger"
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   248
    "Modified: / 14-08-2018 / 12:29:30 / Claus Gittinger"
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   249
! !
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   250
2264
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   251
!MenuItem class methodsFor:'constants'!
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   252
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   253
supportedStartGroupValues
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   254
    "start group #left #right #conditionalRight ...
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   255
     At the moment only #left/nil, #right/#conditionalRight are implemented.
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   256
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   257
     The meanings are:
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   258
        nil                 - default under control of the menu
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   259
        #left               - left align
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   260
        #right              - place at the right far end
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   261
        #conditionalRight   - controlled by a styleSheet variable;
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   262
                              like #right under all non-win32 systems,
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   263
                              ignored on win32.
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   264
                              Use with help-menu, which should be at the far right on some
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   265
                              viewStyles, but not under win32."
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   266
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   267
    ^ #(nil #left #right #conditionalRight)
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   268
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   269
    "Created: / 16-10-2006 / 13:09:27 / cg"
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   270
! !
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
   271
1763
fabe0b506e33 method category rename
Claus Gittinger <cg@exept.de>
parents: 1761
diff changeset
   272
!MenuItem methodsFor:'Compatibility-ST80'!
724
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   273
2755
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   274
enablementSelector:aSymbol
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   275
    "dummy for now - for visualworks compatibility (specs)"
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   276
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   277
    "/ self halt.
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   278
!
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   279
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   280
helpText:aString
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   281
    "dummy for now - for visualworks compatibility (specs)"
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   282
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   283
    activeHelpKey := aString.
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   284
!
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   285
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   286
indicationSelector:aSymbol
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   287
    "dummy for now - for visualworks compatibility (specs)"
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   288
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   289
    "/ self halt.
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   290
!
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   291
724
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   292
isEnabled:aBoolean
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   293
    self enabled:aBoolean
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   294
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   295
    "Created: / 27.10.1997 / 16:34:55 / cg"
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   296
!
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   297
2755
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   298
shortcutModifiers:something
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   299
    "dummy for now - for visualworks compatibility (specs)"
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   300
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   301
    "/ self halt.
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   302
!
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
   303
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   304
value
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   305
    "obsolete - please use #itemValue (value is bad: it prevents us from using a valueHolder)"
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   306
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   307
    ^ itemValue
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   308
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   309
    "Created: 25.2.1997 / 19:50:14 / cg"
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   310
!
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   311
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   312
value:something
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   313
    "obsolete - please use #itemValue: (value is bad: it prevents us from using a valueHolder)"
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   314
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   315
    itemValue := something
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   316
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
   317
    "Created: 25.2.1997 / 19:11:13 / cg"
724
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   318
! !
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   319
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
!MenuItem methodsFor:'accessing'!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   322
accessCharacterPosition
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   323
    "get the index of the access character in the label text or string, or nil if none"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   324
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   325
    ^ accessCharacterPosition
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   328
accessCharacterPosition:index 
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   329
    "set the index of the access character in the label text or string, or nil if none"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   330
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   331
    accessCharacterPosition := index
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
640
4e1c0d0a633b add active help for items
ca
parents: 590
diff changeset
   334
activeHelpKey
4165
15cc5643f1b0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4163
diff changeset
   335
    "the key used as index (and argument) to the helpSpec.
15cc5643f1b0 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4163
diff changeset
   336
     New: may also be an association; then the assoc's key is the help-text provider,
4166
a45838209337 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4165
diff changeset
   337
     and the assoc's value is the key in that provider's helpspec."
3215
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   338
4274
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   339
    ^ activeHelpKey
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   340
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   341
    "Modified (comment): / 30-05-2019 / 09:42:26 / Claus Gittinger"
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   342
!
4158
8dca33d57bb6 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 4147
diff changeset
   343
4274
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   344
activeHelpKey:aSymbolicKeyOrClassPlusSymbolAssoc
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   345
    "the key used as index (and argument) to the helpSpec.
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   346
     New: may also be an association; then the assoc's key is the help-text provider,
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   347
     and the assoc's value is the key in that provider's helpspec."
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   348
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   349
    activeHelpKey := aSymbolicKeyOrClassPlusSymbolAssoc
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   350
ac618664faba #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4217
diff changeset
   351
    "Modified (format): / 30-05-2019 / 09:40:16 / Claus Gittinger"
640
4e1c0d0a633b add active help for items
ca
parents: 590
diff changeset
   352
!
4e1c0d0a633b add active help for items
ca
parents: 590
diff changeset
   353
684
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   354
argument
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   355
    "get argument given to the value (selector)"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   356
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   357
    ^ argument
684
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   358
!
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   359
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   360
argument:something
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   361
    "set argument given to the value (selector)"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   362
684
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   363
    |arg|
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   364
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   365
    (arg := something) notNil ifTrue:[
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   366
        arg isString ifTrue:[
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   367
            (arg size == 0 or:[ (arg indexOfNonSeparatorStartingAt:1) == 0 ]) ifTrue:[
684
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   368
                arg := nil
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   369
            ]
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   370
        ]
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   371
    ].
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   372
    argument := arg
684
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   373
!
184dd159d02e support of arguments
ca
parents: 666
diff changeset
   374
1213
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   375
auxValue
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   376
    "an additional, arbitrary value"
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   377
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   378
    ^ auxValue
1213
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   379
!
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   380
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   381
auxValue:something
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   382
    "set the auxValue - an arbitrary user value"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   383
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   384
    auxValue := something
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   385
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   386
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   387
choice:something
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   388
    choice := something.
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   389
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   390
    "Created: / 14.8.1998 / 14:32:06 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   391
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   392
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   393
choiceValue
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   394
    ^ choiceValue
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   395
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   396
    "Created: / 14.8.1998 / 15:39:26 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   397
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   398
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   399
choiceValue:something
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   400
    choiceValue := something.
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   401
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   402
    "Created: / 14.8.1998 / 15:39:26 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   403
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   404
2548
07251b4e7ac9 changed #hierarchicalUUID
fm
parents: 2533
diff changeset
   405
hierarchicalUUID
07251b4e7ac9 changed #hierarchicalUUID
fm
parents: 2533
diff changeset
   406
07251b4e7ac9 changed #hierarchicalUUID
fm
parents: 2533
diff changeset
   407
    ^ self uuid
07251b4e7ac9 changed #hierarchicalUUID
fm
parents: 2533
diff changeset
   408
!
07251b4e7ac9 changed #hierarchicalUUID
fm
parents: 2533
diff changeset
   409
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   410
ignoreMnemonicKeys
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   411
    "if true, mnemonic (access character) in the submenus under the item are ignored;
2938
e9074e9333fa comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
   412
     Set this to speedup accelerator key processing for slow dynamci menus.
e9074e9333fa comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
   413
     The default is set to false"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   414
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   415
    ^ (flags ? 0) bitTest:FLAG_IGNORE_MNEMONIC_KEYS "/ ignoreMnemonicKeys ? false
2938
e9074e9333fa comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
   416
e9074e9333fa comment: #ignoreMnemonicKeys
Claus Gittinger <cg@exept.de>
parents: 2876
diff changeset
   417
    "Modified (comment): / 08-09-2011 / 04:30:19 / cg"
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   418
    "Modified: / 09-08-2018 / 16:41:53 / Claus Gittinger"
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   419
!
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   420
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   421
ignoreMnemonicKeys:aBoolean
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   422
    "if true, mnemonic (access character) in the submenus under the item are ignored;
2939
c04e85910837 comment: #ignoreMnemonicKeys:
Claus Gittinger <cg@exept.de>
parents: 2938
diff changeset
   423
     Set this to speedup accelerator key processing for slow dynamci menus.
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   424
     The default is false"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   425
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   426
    "/ ignoreMnemonicKeys := aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   427
    flags := (flags ? 0) changeMask:FLAG_IGNORE_MNEMONIC_KEYS to:aBoolean.
2939
c04e85910837 comment: #ignoreMnemonicKeys:
Claus Gittinger <cg@exept.de>
parents: 2938
diff changeset
   428
c04e85910837 comment: #ignoreMnemonicKeys:
Claus Gittinger <cg@exept.de>
parents: 2938
diff changeset
   429
    "Modified (comment): / 08-09-2011 / 04:52:23 / cg"
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   430
    "Modified: / 09-08-2018 / 16:43:08 / Claus Gittinger"
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   431
!
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   432
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   433
ignoreShortcutKeys
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   434
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   435
     the default is set to false"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   436
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   437
    ^ (flags ? 0) bitTest:FLAG_IGNORE_SHORTCUTS "/ ignoreShortcutKeys ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   438
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   439
    "Modified: / 09-08-2018 / 16:43:26 / Claus Gittinger"
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   440
!
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   441
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   442
ignoreShortcutKeys:aBoolean
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   443
    "if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   444
     the default is set to false"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   445
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   446
    "/ ignoreShortcutKeys := aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   447
    flags := (flags ? 0) changeMask:FLAG_IGNORE_SHORTCUTS to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   448
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   449
    "Modified: / 09-08-2018 / 16:43:49 / Claus Gittinger"
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   450
!
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
   451
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   452
indication
3178
ced60e8c83fe class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
   453
    "value of the items on/off indicator (CheckToggle).
ced60e8c83fe class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
   454
     Usually a valueHolder"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   455
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   456
    ^ indication
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   457
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   458
    "Created: 25.2.1997 / 20:59:28 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   459
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   460
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   461
indication:someValueHolder
3178
ced60e8c83fe class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
   462
    "value of the items on/off indicator (CheckToggle).
ced60e8c83fe class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
   463
     someValueHolder is usually a value holder"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   464
3178
ced60e8c83fe class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
   465
    indication := someValueHolder.
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   466
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   467
    "Created: 25.2.1997 / 20:59:28 / cg"
1213
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   468
!
a80ce81d2944 auxValue added
tm
parents: 1203
diff changeset
   469
798
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   470
isVisible
3215
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   471
    "a visibility holder; either a block, boolean or value holder.
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   472
     If the menu is permanently visible, it should be a valueHolder,
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   473
     as the value is otherwise only checked for before the menu is opened"
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   474
1663
00afd9631d8c isVisible - default is true
Claus Gittinger <cg@exept.de>
parents: 1658
diff changeset
   475
    ^ isVisible ? true
798
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   476
!
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   477
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   478
isVisible:something
3215
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   479
    "a visibility holder; either a block, boolean or value holder.
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   480
     If the menu is permanently visible, it should be a valueHolder,
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   481
     as the value is otherwise only checked for before the menu is opened"
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   482
798
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   483
    isVisible := something
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   484
!
8a27a879ff23 support of visible/invisible items
ca
parents: 794
diff changeset
   485
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   486
itemValue
3215
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   487
    "the item's action; if it is a block, that is evaluated;
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   488
     if a symbol, that message is sent to the menu's receiver"
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   489
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   490
    ^ itemValue
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   491
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   492
    "Created: 25.2.1997 / 19:50:14 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   493
!
1370
4d2a3cc1d3c7 allow views in subMenus
ca
parents: 1369
diff changeset
   494
3215
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   495
itemValue:aBlockOrSymbol
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   496
    "set the item's action; if it is a block, that is evaluated;
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   497
     if a symbol, that message is sent to the menu's receiver"
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   498
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   499
    itemValue := aBlockOrSymbol
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   500
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   501
    "Created: 25.2.1997 / 19:11:13 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   502
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   503
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   504
itemValue:selectorOrBlock argument:anArgument
3215
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   505
    "set the item's action and an argument; if it is ablock, that is evaluated;
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   506
     if a symbol, that message is sent to the menu's receiver"
0b3ad7144d4f class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   507
3023
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   508
    itemValue := selectorOrBlock.
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   509
    argument := anArgument
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   510
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   511
    "Created: / 09-09-2012 / 13:05:14 / cg"
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   512
!
763ad69e9832 menuitem protocol
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
   513
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   514
label:labelStringOrNil argument:someArgument
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   515
    label := labelStringOrNil.
4216
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   516
    argument := someArgument.
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   517
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   518
    "Created: / 27-12-2018 / 16:19:14 / Claus Gittinger"
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   519
!
91c9929f64e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4168
diff changeset
   520
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   521
label:labelStringOrNil icon:anImage
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   522
    self label:labelStringOrNil.
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   523
    self resourceRetriever: (ResourceRetriever icon:anImage string:'')
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   524
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   525
    "Modified (format): / 27-12-2018 / 16:22:54 / Claus Gittinger"
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   526
!
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   527
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   528
label:labelStringOrNil itemValue:selectorOrBlock
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   529
    label := labelStringOrNil.
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   530
    itemValue := selectorOrBlock.
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   531
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   532
    "Created: / 09-09-2012 / 13:18:34 / cg"
4067
910d95fb5292 #QUALITY by mawalch
mawalch
parents: 4056
diff changeset
   533
    "Modified (comment): / 14-02-2018 / 12:55:40 / mawalch"
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   534
    "Modified (format): / 27-12-2018 / 16:22:38 / Claus Gittinger"
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   535
!
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   536
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   537
label:labelStringOrNil itemValue:selectorOrBlock argument:something
3353
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   538
    "define label, value and an argument to be passed with the action"
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   539
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   540
    self assert:(labelStringOrNil isNil or:[labelStringOrNil isString]).
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   541
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   542
    label := labelStringOrNil.
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   543
    itemValue := selectorOrBlock.
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   544
    argument := something.
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   545
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   546
    "Created: / 09-09-2012 / 13:19:36 / cg"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   547
    "Modified: / 24-01-2018 / 14:34:10 / mawalch"
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   548
    "Modified (format): / 27-12-2018 / 16:23:02 / Claus Gittinger"
3221
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   549
!
fe5d6ca2dfd9 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
   550
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   551
label:labelStringOrNil itemValue:selectorOrBlock enabled:enabledHolder
3353
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   552
    "define label, value
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   553
     and enabled holder, which can be a boolean, a boolean valueHolder,
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   554
     a block or a selector (to be sent to the application)"
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   555
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   556
    self assert:(labelStringOrNil isNil or:[labelStringOrNil isString]).
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   557
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   558
    label := labelStringOrNil.
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   559
    itemValue := selectorOrBlock.
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   560
    enabled := enabledHolder.
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   561
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   562
    "Modified: / 24-01-2018 / 14:34:18 / mawalch"
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   563
    "Modified (format): / 27-12-2018 / 16:23:08 / Claus Gittinger"
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   564
!
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   565
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   566
label:labelStringOrNil itemValue:selectorOrBlock translateLabel:translateLabelBoolean
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   567
    self assert:(labelStringOrNil isNil or:[labelStringOrNil isString]).
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   568
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   569
    label := labelStringOrNil.
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   570
    itemValue := selectorOrBlock.
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   571
    self translateLabel:translateLabelBoolean.
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   572
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   573
    "Modified: / 24-01-2018 / 14:34:24 / mawalch"
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   574
    "Modified: / 09-08-2018 / 17:27:37 / Claus Gittinger"
4217
b08e4ff220d7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4216
diff changeset
   575
    "Modified (format): / 27-12-2018 / 16:23:12 / Claus Gittinger"
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   576
!
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   577
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   578
labelImage
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   579
    ^ labelImage
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   580
!
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   581
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   582
labelImage:something
2125
78bd48d8de76 labelImage: VW7 compat.
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
   583
    labelImage := something.
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   584
2125
78bd48d8de76 labelImage: VW7 compat.
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
   585
    "/ VW compatibility: if I have a label also,
78bd48d8de76 labelImage: VW7 compat.
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
   586
    "/ this will become a LabelAndImage.
4019
054964b89175 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3966
diff changeset
   587
    (something isImage and:[label notNil]) ifTrue:[
054964b89175 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3966
diff changeset
   588
        labelImage := LabelAndIcon icon:labelImage string:label.
2125
78bd48d8de76 labelImage: VW7 compat.
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
   589
    ].
4019
054964b89175 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3966
diff changeset
   590
054964b89175 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3966
diff changeset
   591
    "Modified: / 26-09-2017 / 12:29:32 / stefan"
1370
4d2a3cc1d3c7 allow views in subMenus
ca
parents: 1369
diff changeset
   592
!
4d2a3cc1d3c7 allow views in subMenus
ca
parents: 1369
diff changeset
   593
578
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   594
nameKey
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   595
    ^ nameKey
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   596
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   597
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   598
!
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   599
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   600
nameKey:aNameKey
4067
910d95fb5292 #QUALITY by mawalch
mawalch
parents: 4056
diff changeset
   601
    self assert:(aNameKey isNil or:[aNameKey isString]).
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   602
    nameKey := aNameKey.
578
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   603
4067
910d95fb5292 #QUALITY by mawalch
mawalch
parents: 4056
diff changeset
   604
    "Modified: / 14-02-2018 / 12:24:56 / mawalch"
578
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   605
!
7e0f62d9bc47 access methods ...
ca
parents: 490
diff changeset
   606
490
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   607
rawLabel
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   608
    ^ label
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   609
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   610
    "Created: 25.2.1997 / 19:48:16 / cg"
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   611
!
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   612
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
rawLabel:aString
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   614
    self assert:(aString isNil or:[aString isString]).
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   615
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
    label := aString
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   618
    "Created: / 25-02-1997 / 19:11:02 / cg"
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   619
    "Modified: / 24-01-2018 / 14:34:36 / mawalch"
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   621
1621
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   622
resourceRetriever
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   623
    |retriever|
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   624
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   625
    retriever := labelImage.
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   626
    (retriever notNil and:[retriever isKindOf:ResourceRetriever]) ifTrue:[
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   627
        ^ retriever
1621
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   628
    ].
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   629
    ^ nil
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   630
!
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   631
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   632
resourceRetriever:aRetriever
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   633
    self labelImage:aRetriever
1621
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   634
!
f913c0e7a3a8 access the resourceRetriever
ca
parents: 1595
diff changeset
   635
1655
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   636
shortcutKey
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   637
    "get the key to press to select the menu item from the keyboard"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   638
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   639
    ^ shortcutKey
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   640
!
490
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   641
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   642
shortcutKey:something
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   643
    "set the  key to press to select the menu item from the keyboard"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   644
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   645
    shortcutKey := something.
490
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   646
!
ebe88e50b29a *** empty log message ***
ca
parents: 458
diff changeset
   647
1655
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   648
shortcutKeyCharacter
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   649
    "Backward compatibility; same as #shortcutKey.
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   650
     get the  key to press to select the menu item from the keyboard"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   651
1655
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   652
    ^ self shortcutKey
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   653
!
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   654
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   655
shortcutKeyCharacter:something
1655
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   656
    "Backward compatibility; same as #shortcutKey:.
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   657
     set the  key to press to select the menu item from the keyboard"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   658
1655
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   659
    self shortcutKey:something.
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   660
!
d937610cfe89 shorrtcutKey vs. shortcutKeyCharacter
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   661
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   662
submenu
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   663
    "get the submenu or nil"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   664
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   665
    ^ submenu value
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   666
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   667
    "Created: / 25.2.1997 / 20:59:28 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   668
    "Modified: / 19.6.1998 / 00:33:58 / cg"
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   669
!
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   670
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   671
submenu:aMenu
2112
3c4dd2e9203f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   672
    "set the submenu or nil"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   673
2987
66fad8f6ad33 comment/format in: #submenu:
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   674
    (aMenu isValueModel or:[ aMenu isBlock ]) ifTrue:[
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   675
        submenuChannel notNil ifTrue:[
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   676
            "/ programmers error ?
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   677
            "/ how can I decide which one to use if there is both
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   678
            "/ a channel and a subMenu ...
1649
162e89bf1079 halt -> error
ca
parents: 1648
diff changeset
   679
            self error:'overwriting submenuchannel' mayProceed:true.
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   680
        ].
2987
66fad8f6ad33 comment/format in: #submenu:
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   681
        submenuChannel := aMenu
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   682
    ] ifFalse:[
2987
66fad8f6ad33 comment/format in: #submenu:
Claus Gittinger <cg@exept.de>
parents: 2966
diff changeset
   683
        submenu := aMenu.
1333
423b4b4404c4 avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents: 1329
diff changeset
   684
    ]
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   685
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   686
    "Created: / 25.2.1997 / 20:59:28 / cg"
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   687
    "Modified: / 5.2.2000 / 16:53:28 / cg"
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   688
!
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
   689
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   690
submenuProvider
2866
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   691
    "useful if a sub-menu is plugged in from another application (i.e. when
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   692
     a submenu is fetched via a channel AND the top-menus application cannot provide
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   693
     it"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   694
2866
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   695
    ^ submenuProvider
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   696
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   697
    "Created: / 22-09-2010 / 13:55:55 / cg"
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   698
!
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   699
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   700
submenuProvider:something
2866
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   701
    "useful if a sub-menu is plugged in from another application (i.e. when
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   702
     a submenu is fetched via a channel AND the top-menus application cannot provide
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   703
     it"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   704
2866
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   705
    submenuProvider := something.
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   706
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   707
    "Created: / 22-09-2010 / 13:55:40 / cg"
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   708
!
2d1ab34d1836 +submenuProvider
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
   709
2517
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   710
uuid
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   711
    "automationID
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   712
     return my uuid component to be used for resource-access.
4054
6ddcaca12fee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4045
diff changeset
   713
     This is a unique and once-assigned-never-changed uuid by which
6ddcaca12fee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4045
diff changeset
   714
     UI automators can access the menu item."
2517
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   715
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   716
    ^ uuid
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   717
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   718
    "Modified (comment): / 09-08-2018 / 16:47:39 / Claus Gittinger"
2517
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   719
!
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   720
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   721
uuid:aUUID
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   722
    "automationID
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   723
     set my uuid component to be used for resource-access
4054
6ddcaca12fee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4045
diff changeset
   724
     (called by menuBuilder).
6ddcaca12fee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4045
diff changeset
   725
     This is a unique and once-assigned-never-changed uuid by which
6ddcaca12fee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4045
diff changeset
   726
     UI automators can access the menu item."
2517
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   727
35e21e2e29a6 support uuid's
fm
parents: 2412
diff changeset
   728
    uuid := aUUID
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   729
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   730
    "Modified (comment): / 09-08-2018 / 16:47:34 / Claus Gittinger"
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
! !
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
1333
423b4b4404c4 avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents: 1329
diff changeset
   733
!MenuItem methodsFor:'accessing-behavior'!
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   734
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   735
beOff
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   736
    "set indication off"
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   737
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   738
    self indication:false
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   739
!
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   740
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   741
beOn
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   742
    "set indication on"
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   743
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   744
    self indication:true
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   745
!
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   746
1041
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   747
choice
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   748
    "return the menu items choice indicator (RadioButton)"
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   749
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   750
    ^ choice
1041
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   751
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   752
    "Created: / 14.8.1998 / 14:34:55 / cg"
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   753
    "Modified: / 14.8.1998 / 15:11:57 / cg"
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   754
!
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   755
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   756
disable
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   757
    enabled := false
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   758
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   759
    "Created: 25.2.1997 / 19:39:09 / cg"
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   760
!
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   761
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   762
enable
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   763
    enabled := true
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   764
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   765
    "Created: 25.2.1997 / 19:39:00 / cg"
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   766
!
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   767
581
0080d12b5758 enabled can be something not only a boolean
ca
parents: 580
diff changeset
   768
enabled
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   769
    "returns a boolean, valueHolder or block"
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   770
4147
83f4ab7e5aee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4084
diff changeset
   771
    ^ enabled ? true
83f4ab7e5aee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4084
diff changeset
   772
83f4ab7e5aee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4084
diff changeset
   773
    "Modified: / 12-07-2018 / 22:29:33 / Claus Gittinger"
581
0080d12b5758 enabled can be something not only a boolean
ca
parents: 580
diff changeset
   774
!
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
   775
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   776
enabled:enabledHolder
3353
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   777
    "enabledHolder can be a boolean, a boolean valueHolder,
6a6ab96a3720 class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3352
diff changeset
   778
     a block or a selector (to be sent to the application)"
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   779
3352
244d68f2382e class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3305
diff changeset
   780
    enabled := enabledHolder
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   781
!
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
   782
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   783
hideMenuOnActivated
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   784
    "hide the menu when the item was activated; the default is true"
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   785
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   786
    "/ notice: here the default is true
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   787
    ^ ((flags ? 0) bitTest:FLAG_NOHIDE_ONACTIVATED) not "/ hideMenuOnActivated ? true
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   788
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   789
    "Modified: / 14-08-2018 / 12:28:18 / Claus Gittinger"
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   790
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   791
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   792
hideMenuOnActivated:aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   793
   "hide the menu when the item was activated; the default is true"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   794
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   795
    "/ notice: here the default is true
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   796
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   797
    "/ hideMenuOnActivated := aBool ? true
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   798
    flags := (flags ? 0) changeMask:FLAG_NOHIDE_ONACTIVATED to:aBoolean not.
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   799
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   800
    "Modified: / 14-08-2018 / 12:28:22 / Claus Gittinger"
1566
99ef8f1123c8 menuBuilder: support of horizontal/vertical layout of submenu
ca
parents: 1486
diff changeset
   801
!
99ef8f1123c8 menuBuilder: support of horizontal/vertical layout of submenu
ca
parents: 1486
diff changeset
   802
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   803
keepLinkedMenu
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   804
    "if true, a linked submenu menu is only computed once (slightly faster),
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   805
     but then, the linked menu cannot be dynamic"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   806
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   807
    ^ (flags ? 0) bitTest:FLAG_KEEP_LINKEDMENU "/ keepLinkedMenu ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   808
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   809
    "Modified: / 09-08-2018 / 16:52:56 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   810
!
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   811
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   812
keepLinkedMenu:aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   813
    "if true, a linked submenu menu is only computed once (slightly faster),
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   814
     but then, the linked menu cannot be dynamic"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   815
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   816
    "/ keepLinkedMenu := aBoolean ? false.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   817
    flags := (flags ? 0) changeMask:FLAG_KEEP_LINKEDMENU to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   818
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   819
    "Modified: / 09-08-2018 / 16:53:12 / Claus Gittinger"
1566
99ef8f1123c8 menuBuilder: support of horizontal/vertical layout of submenu
ca
parents: 1486
diff changeset
   820
!
99ef8f1123c8 menuBuilder: support of horizontal/vertical layout of submenu
ca
parents: 1486
diff changeset
   821
1651
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   822
sendToOriginator
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   823
    "if true, the message is sent to the originating widget;
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   824
     otherwise (the default), it it sent to the receiver/application."
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   825
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   826
    ^ (flags ? 0) bitTest:FLAG_SEND_TO_ORIGINATOR "/ sendToOriginator ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   827
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   828
    "Modified: / 09-08-2018 / 16:51:28 / Claus Gittinger"
1651
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   829
!
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   830
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   831
sendToOriginator:aBoolean
1651
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   832
    "if true, the message is sent to the originating widget;
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   833
     otherwise (the default), it it sent to the receiver/application."
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   834
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   835
    "/ sendToOriginator := aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   836
    flags := (flags ? 0) changeMask:FLAG_SEND_TO_ORIGINATOR to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   837
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   838
    "Modified: / 09-08-2018 / 16:51:51 / Claus Gittinger"
1651
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   839
!
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
   840
2533
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   841
showBusyCursorWhilePerforming
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   842
    "get the flag which controls if a busy cursor is to be shown
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   843
     while performing the menu action. Defaults to false."
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   844
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   845
    ^ (flags ? 0) bitTest:FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING "/ showBusyCursorWhilePerforming ? false
2533
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   846
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   847
    "Modified: / 09-08-2018 / 16:52:14 / Claus Gittinger"
2533
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   848
!
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   849
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   850
showBusyCursorWhilePerforming:aBoolean
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   851
    "set/clear the flag which controls if a busy cursor is to be shown
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   852
     while performing the menu action. Defaults to false."
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   853
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   854
    "/ showBusyCursorWhilePerforming := aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   855
    flags := (flags ? 0) changeMask:FLAG_SHOW_BUSYCURSOR_WHILE_PERFORMING to:aBoolean.
2533
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   856
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   857
    "Modified: / 09-08-2018 / 16:52:28 / Claus Gittinger"
2533
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   858
!
569fd3176543 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
   859
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   860
translateLabel
3843
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   861
    "returns true if the label is to be translated.
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   862
     The default is true"
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   863
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   864
    "/ notice: here the default is true
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   865
    ^ ((flags ? 0) bitTest:FLAG_NOTRANSLATE_LABEL) not "/ translateLabel ? true
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   866
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   867
    "Modified: / 14-08-2018 / 12:29:23 / Claus Gittinger"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   868
!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   869
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   870
translateLabel:aBoolean
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   871
    "sets whether label is translated"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   872
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   873
    "/ notice: here the default is true
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   874
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   875
    "/ translateLabel := aBoolean
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   876
    flags := (flags ? 0) changeMask:FLAG_NOTRANSLATE_LABEL to:aBoolean not.
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
   877
4168
0656fd9bc4b2 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4166
diff changeset
   878
    "Modified: / 14-08-2018 / 12:29:12 / Claus Gittinger"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   879
!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   880
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   881
triggerOnDown
3843
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   882
   "returns true if the action is triggered when pressed.
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
   883
    The default is false (trigger when released)"
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   884
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   885
    ^ (flags ? 0) bitTest:FLAG_TRIGGER_ONDOWN "/ triggerOnDown ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   886
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   887
    "Modified: / 09-08-2018 / 16:53:49 / Claus Gittinger"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   888
!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   889
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   890
triggerOnDown:aBoolean
2082
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   891
   "controls if the action is triggered when pressed or released"
cab2f7b1f938 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2060
diff changeset
   892
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   893
    "/ triggerOnDown := aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   894
    flags := (flags ? 0) changeMask:FLAG_TRIGGER_ONDOWN to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   895
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   896
    "Modified: / 09-08-2018 / 16:54:10 / Claus Gittinger"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   897
! !
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   898
4029
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   899
!MenuItem methodsFor:'accessing-channels'!
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   900
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   901
label:labelString submenuChannel:aSymbolOrValueHolder
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   902
    self assert:(labelString isNil or:[labelString isString]).
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   903
4029
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   904
    label := labelString.
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   905
    submenuChannel := aSymbolOrValueHolder.
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   906
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   907
    "Modified: / 24-01-2018 / 14:36:54 / mawalch"
4029
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   908
!
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   909
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   910
submenuChannel
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   911
    "get the submenuChannel or nil"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   912
4029
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   913
    ^ submenuChannel
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   914
!
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   915
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   916
submenuChannel:aMenuHolder
4029
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   917
    "set the submenuChannel or nil"
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
   918
4029
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   919
    submenuChannel := aMenuHolder.
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   920
! !
14e3074dd294 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   921
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   922
!MenuItem methodsFor:'accessing-look'!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   923
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   924
font
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   925
    "get the specific font for an item or nil"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   926
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   927
    ^ font
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   928
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   929
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   930
font:aFont
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   931
    "set a specific font for an item"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   932
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   933
    font := aFont.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   934
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   935
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   936
hasMenuIndicator
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   937
    "returns whether item should always show a menu-indicator (arrow)"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   938
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   939
    ^ (flags ? 0) bitTest:FLAG_FORCE_MENUINDICATOR "/ forceMenuIndicator ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   940
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   941
    "Created: / 09-08-2018 / 16:35:05 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   942
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   943
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   944
hasMenuIndicator:aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   945
    "force the item to always show a menu-indicator (arrow)"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   946
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   947
    flags := (flags ? 0) changeMask:FLAG_FORCE_MENUINDICATOR to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   948
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   949
    "Created: / 09-08-2018 / 16:49:11 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   950
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   951
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   952
horizontalLayout
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   953
    "by default, submenus have a vertical layout;
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   954
     if true, the submenu has a horizontal layout."
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   955
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   956
    ^ (flags ? 0) bitTest:FLAG_HORIZONTAL_LAYOUT "/ horizontalLayout ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   957
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   958
    "Modified: / 09-08-2018 / 16:46:50 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   959
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   960
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   961
horizontalLayout:aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   962
    "by default, submenus have a vertical layout;
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   963
     if true, the submenu has a horizontal layout."
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   964
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   965
    "/ horizontalLayout := aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   966
    flags := (flags ? 0) changeMask:FLAG_HORIZONTAL_LAYOUT to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   967
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   968
    "Modified: / 09-08-2018 / 16:47:05 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   969
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   970
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   971
icon:anImage
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
   972
    self resourceRetriever: (ResourceRetriever icon:anImage)
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   973
!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
   974
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
   975
isButton
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
   976
    "returns whether item looks like a Button
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
   977
    "
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   978
    ^ (flags ? 0) bitTest:FLAG_ISBUTTON "/ isButton ? false
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   979
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   980
    "Modified: / 09-08-2018 / 16:49:32 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   981
!
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   982
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   983
isButton:aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   984
    "sets whether item looks like a Button
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   985
    "
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   986
    "/ isButton := aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   987
    flags := (flags ? 0) changeMask:FLAG_ISBUTTON to:aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   988
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   989
    "Modified: / 09-08-2018 / 16:49:56 / Claus Gittinger"
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
   990
!
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
   991
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   992
isMenuSlice
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   993
    "returns true if the menu is a slice,
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   994
     building its items into its container menu
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
   995
    "
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   996
    ^ submenuChannel notNil 
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   997
    and:[ (flags ? 0) bitTest:FLAG_IS_MENUSLICE "isMenuSlice == true"].
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   998
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
   999
    "Modified: / 09-08-2018 / 16:44:37 / Claus Gittinger"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1000
!
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
  1001
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1002
isMenuSlice:aBoolean
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1003
    "/ isMenuSlice := aBoolean.
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1004
    flags := (flags ? 0) changeMask:FLAG_IS_MENUSLICE to:aBoolean.
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
  1005
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1006
    "Modified: / 09-08-2018 / 16:44:58 / Claus Gittinger"
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
  1007
!
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
  1008
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1009
label
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1010
    ^ self filteredLabel "/ label
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1011
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1012
    "Created: / 25.2.1997 / 19:48:16 / cg"
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1013
    "Modified: / 19.6.1998 / 00:02:55 / cg"
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1014
!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1015
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1016
label:aString
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1017
    label := aString.
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1018
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1019
    "Created: / 25-02-1997 / 19:55:16 / cg"
4067
910d95fb5292 #QUALITY by mawalch
mawalch
parents: 4056
diff changeset
  1020
    "Modified: / 14-02-2018 / 12:23:41 / mawalch"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1021
!
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1022
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1023
startGroup
2264
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1024
    "start group #left #right #conditionalRight ... or nil
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1025
     at the moment only #right and #conditionalRight are implemented"
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1026
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1027
    ^ startGroup ? #left
2264
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1028
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1029
    "Modified: / 16-10-2006 / 13:05:52 / cg"
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1030
!
752
93690dcd1b75 button and label translation support added.
tz
parents: 724
diff changeset
  1031
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1032
startGroup:aSymbol
2264
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1033
    "start group #left #right #conditionalRight ...
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1034
     at the moment only #right and #conditionalRight are implemented.
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1035
     The meanings are:
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1036
        nil                 - default under control of the menu
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1037
        #left               - left align
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1038
        #right              - place at the right far end
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1039
        #conditionalRight   - controlled by a styleSheet variable;
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1040
                              like #right under all non-win32 systems,
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1041
                              ignored on win32.
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1042
                              Use with help-menu, which should be at the far right on some
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1043
                              viewStyles, but not under win32.
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1044
    "
2264
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1045
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1046
    (self class supportedStartGroupValues includes:aSymbol) ifTrue:[
1595
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1047
        startGroup := aSymbol
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1048
    ] ifFalse:[
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1049
        self warn:('unsupported group: ', aSymbol printString ).
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1050
        startGroup := #left
0595db55a829 preps for delayedMenu
Claus Gittinger <cg@exept.de>
parents: 1568
diff changeset
  1051
    ]
2263
30cf468f47ca new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1052
2264
8736ee5ec90e new startGroup value: #conditionalRight
Claus Gittinger <cg@exept.de>
parents: 2263
diff changeset
  1053
    "Modified: / 16-10-2006 / 13:09:45 / cg"
581
0080d12b5758 enabled can be something not only a boolean
ca
parents: 580
diff changeset
  1054
! !
0080d12b5758 enabled can be something not only a boolean
ca
parents: 580
diff changeset
  1055
1333
423b4b4404c4 avoid creating an adornment (when nil adornment values are stored)
Claus Gittinger <cg@exept.de>
parents: 1329
diff changeset
  1056
!MenuItem methodsFor:'accessing-resource'!
581
0080d12b5758 enabled can be something not only a boolean
ca
parents: 580
diff changeset
  1057
584
9a4c30f7586f ST-80 compatible features addded
ca
parents: 581
diff changeset
  1058
findGuiResourcesIn:aResourceContainerOrApplication
4033
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1059
    "resolve national language translations from aResourceContainerOrApplication"
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1060
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1061
    self
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1062
        findGuiResourcesIn:aResourceContainerOrApplication
4033
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1063
        rememberResourcesIn:nil
1401
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1064
!
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1065
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1066
findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil
4033
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1067
    "resolve national language translations from aResourceContainerOrApplication.
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1068
     In addition, expand %(xxx) by asking the application for an xxx aspect."
3305
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1069
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1070
    |retriever m itemFont|
1401
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1071
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1072
    (aResourceContainerOrApplication isNil or:[self isMenuSlice]) ifTrue:[
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1073
        ^ self.
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1074
    ].
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1075
3305
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1076
    "while traversing all the menus, resolve symbolic fonts too"
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1077
    itemFont := self font.
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1078
    itemFont isSymbol ifTrue:[
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1079
        itemFont := aResourceContainerOrApplication resolveFont:itemFont.
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1080
        self font:itemFont.
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1081
    ].
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1082
2412
3f11e716f802 Do not try to translate separators
Stefan Vogel <sv@exept.de>
parents: 2293
diff changeset
  1083
    (self translateLabel and:[label ~= '-']) ifTrue:[
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1084
        label := ResourceRetriever
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1085
                        findResourceLabel:label
1401
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1086
                        in:aResourceContainerOrApplication
2018
5a6446cf5079 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  1087
                        rememberResourcesIn:aValueHolderOrNil.
1401
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1088
    ].
4037
eecd873be684 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 4034
diff changeset
  1089
    (label notNil and:[label includesString:'%(']) ifTrue:[
4033
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1090
        |fetchDict|
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1091
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1092
        fetchDict := VirtualDictionary new.
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1093
        fetchDict
4033
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1094
            fetchBlock:[:key |
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1095
                (aResourceContainerOrApplication labelFor:key asSymbol) value
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1096
            ].
4033
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1097
        label := label bindWithArguments:fetchDict.
87e5649b7dea #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4029
diff changeset
  1098
    ].
1401
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1099
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1100
    (retriever := self resourceRetriever) notNil ifTrue:[
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1101
        retriever findGuiResourcesIn:aResourceContainerOrApplication.
3305
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1102
        retriever labelText notNil ifTrue: [retriever labelText:label].
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1103
    ].
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1104
    (m := self submenu) notNil ifTrue:[
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1105
        m := m value.
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1106
        m notNil ifTrue:[
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1107
            m findGuiResourcesIn:aResourceContainerOrApplication rememberResourcesIn:aValueHolderOrNil
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1108
        ]
1401
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1109
    ]
0fda9891ba4a only ask once for resources (remember locally)
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1110
4037
eecd873be684 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 4034
diff changeset
  1111
    "Modified: / 18-06-1998 / 16:54:25 / cg"
eecd873be684 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 4034
diff changeset
  1112
    "Modified: / 28-12-2017 / 18:36:31 / stefan"
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1113
!
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1114
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1115
receiver:aReceiver perform:aSelector with:anArgument ifNone:aBlock
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1116
    "send the one-arg-message aSelector to the application;
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1117
     the result returned from the send or nil is returned
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1118
    "
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1119
    |result|
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1120
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1121
    MessageNotUnderstood handle:[:ex|
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1122
        ex selector ~~ aSelector ifTrue:[
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1123
            ex reject
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1124
        ].
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1125
        result := aBlock value.
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1126
    ] do:[
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1127
        aSelector numArgs == 0 ifTrue:[
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1128
            result := aReceiver perform:aSelector.
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1129
        ] ifFalse:[
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1130
            result := aReceiver perform:aSelector with:anArgument.
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1131
        ].
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1132
    ].
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1133
    ^ result
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1134
!
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1135
3966
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1136
resolveSliceMenuItemsIn:aReceiver for:originalReceiver rememberResourcesIn:aValueHolderOrNil
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1137
    |menu|
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1138
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1139
    self isMenuSlice ifFalse:[
3305
06a3d26394de class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3225
diff changeset
  1140
        self error:'not a slice menu' mayProceed:true.
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1141
        ^ Array with:self.
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1142
    ].
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1143
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1144
    aReceiver isNil ifTrue:[
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1145
        ^ nil
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1146
    ].
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1147
    menu := self
3966
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1148
                receiver:aReceiver perform:submenuChannel with:argument
4056
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1149
                ifNone:[
a4fafec15105 #QUALITY by mawalch
mawalch
parents: 4054
diff changeset
  1150
                    self
3966
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1151
                        receiver:(aReceiver class) perform:submenuChannel with:argument 
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1152
                        ifNone:[
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1153
                            "/ ('MenuItem [info]: no aspect for slice ',submenuChannel) infoPrintCR.
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1154
                            nil
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1155
                        ].
2036
f8e99bb346e4 *** empty log message ***
penk
parents: 2033
diff changeset
  1156
                ].
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1157
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1158
    menu := menu value.
2033
a9ed3856e834 *** empty log message ***
james
parents: 2018
diff changeset
  1159
    menu isNil ifTrue:[^ nil].
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1160
2292
d7b06b31d72b use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  1161
    menu isCollection ifTrue:[
d7b06b31d72b use decodeFromLiteralArray
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  1162
        menu := Menu decodeFromLiteralArray:menu.
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1163
    ].
3966
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1164
    menu findGuiResourcesIn:originalReceiver rememberResourcesIn:aValueHolderOrNil.
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1165
    ^ menu items
2268
a947e7f7a28f resolveGUIResources no longer sets the receiver recursively
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  1166
3966
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1167
    "Created: / 21-07-2017 / 19:46:54 / cg"
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1168
!
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1169
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1170
resolveSliceMenuItemsIn:aReceiver rememberResourcesIn:aValueHolderOrNil
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1171
    ^ self resolveSliceMenuItemsIn:aReceiver for:aReceiver rememberResourcesIn:aValueHolderOrNil
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1172
be0d53f65bb3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
  1173
    "Modified: / 21-07-2017 / 19:48:45 / cg"
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1174
! !
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1175
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1176
!MenuItem methodsFor:'encoding & decoding'!
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1177
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1178
fromLiteralArrayEncoding:aLiteralEncodedArray
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1179
    "read my contents from a aLiteralEncodedArray"
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1180
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1181
    |selector value retriever|
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1182
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1183
    2 to:aLiteralEncodedArray size by:2 do:[:i |
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1184
        selector := aLiteralEncodedArray at:i.
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1185
        value    := (aLiteralEncodedArray at:i+1).
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1186
        selector == #argument: ifFalse:[
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1187
            value := value decodeAsLiteralArray
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1188
        ].
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1189
        self perform:selector with:value
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1190
    ].
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1191
    "/ kludge in case someone forgets to call findGUIResourcesIn:
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1192
    (retriever := self resourceRetriever) notNil ifTrue:[
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1193
        retriever labelText notNil ifTrue: [retriever labelText: label].
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1194
    ].
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1195
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1196
    "
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1197
     #( #MenuItem #rawLabel: 'left' #nameKey: 'identifier'  #value: #left )
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1198
         decodeAsLiteralArray
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1199
    "
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1200
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1201
    "Modified: / 4.2.2000 / 12:50:28 / cg"
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1202
!
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1204
skippedInLiteralEncoding
4161
a97047ee60f8 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4159
diff changeset
  1205
    "define the inst-slots which are skipped when generating a literalArrayEncoding;
a97047ee60f8 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4159
diff changeset
  1206
     (to skip the ones with default values.)"
a97047ee60f8 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 4159
diff changeset
  1207
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1208
    |coll|
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1209
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1210
    coll := super skippedInLiteralEncoding asOrderedCollection.
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1211
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1212
    coll add:#flags.
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1213
    
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1214
    label isNil ifTrue:[ coll add:#label ].
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1215
    (self translateLabel or:[#('' '-' '=') includes:label]) ifTrue:[ coll add:#translateLabel ].
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1216
    self isButton ifFalse:[ coll add:#isButton ].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1217
    self triggerOnDown ifFalse:[ coll add:#triggerOnDown ].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1218
    self hideMenuOnActivated ifTrue:[ coll add:#hideMenuOnActivated].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1219
    nameKey isNil ifTrue:[ coll add:#nameKey ].
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1220
    (self isVisible == true) ifTrue:[coll add:#isVisible].
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1221
    (startGroup isNil or:[startGroup == #left]) ifTrue:[coll add:#startGroup].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1222
    itemValue isNil ifTrue:[ coll add:#itemValue].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1223
    activeHelpKey isNil ifTrue:[ coll add:#activeHelpKey].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1224
    enabled == true "could be a symbol" ifTrue:[ coll add:#enabled].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1225
    shortcutKey isNil ifTrue:[ coll add:#shortcutKeyCharacter].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1226
    font isNil ifTrue:[ coll add:#font].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1227
    accessCharacterPosition isNil ifTrue:[coll add:#accessCharacterPosition].
1990
dca233a39477 horizontalLayout bug
Claus Gittinger <cg@exept.de>
parents: 1986
diff changeset
  1228
    self horizontalLayout ifFalse:[coll add:#horizontalLayout].
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1229
    self showBusyCursorWhilePerforming ifFalse:[ coll add:#showBusyCursorWhilePerforming ].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1230
    argument isNil ifTrue:[ coll add:#argument].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1231
    self resourceRetriever isNil ifTrue:[ coll add:#resourceRetriever].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1232
    indication isNil ifTrue:[ coll add:#indication].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1233
    choice isNil ifTrue:[coll add:#choice].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1234
    choiceValue isNil ifTrue:[ coll add:#choiceValue].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1235
    auxValue isNil ifTrue:[ coll add:#auxValue ].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1236
    submenuChannel isNil ifTrue:[ coll add:#submenuChannel].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1237
    self keepLinkedMenu ifFalse:[ coll add:#keepLinkedMenu].
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1238
    submenu value isNil ifTrue:[coll add:#submenu ].
1651
429e02e097d9 can now specify if menu action is to be performed by
ca
parents: 1649
diff changeset
  1239
    self sendToOriginator ifFalse:[coll add:#sendToOriginator ].
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1240
1885
860b47f2535f support ignoreShortcutKeys and ignoreMnemonicKeys in Editor
ca
parents: 1884
diff changeset
  1241
    self ignoreShortcutKeys ifFalse:[coll add:#ignoreShortcutKeys ].
860b47f2535f support ignoreShortcutKeys and ignoreMnemonicKeys in Editor
ca
parents: 1884
diff changeset
  1242
    self ignoreMnemonicKeys ifFalse:[coll add:#ignoreMnemonicKeys ].
4163
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1243
    self hasMenuIndicator ifFalse:[coll add:#hasMenuIndicator ].
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
  1244
1986
f819e439d917 *** empty log message ***
ca
parents: 1885
diff changeset
  1245
    self isMenuSlice ifFalse:[coll add:#isMenuSlice].
1884
4b317db4d387 support of ignoreShortcutKeys and ignoreMnemonicKeys
ca
parents: 1763
diff changeset
  1246
1646
da8d044c7c0d value - itemValue
Claus Gittinger <cg@exept.de>
parents: 1643
diff changeset
  1247
    ^ coll
3021
39995ec958eb changed: #skippedInLiteralEncoding
Claus Gittinger <cg@exept.de>
parents: 3003
diff changeset
  1248
39995ec958eb changed: #skippedInLiteralEncoding
Claus Gittinger <cg@exept.de>
parents: 3003
diff changeset
  1249
    "Modified: / 22-08-2012 / 21:22:20 / cg"
4163
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1250
    "Modified: / 09-08-2018 / 17:34:37 / Claus Gittinger"
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1251
!
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1252
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1253
virtualSlotsInLiteralEncoding
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1254
    "defines additional virtual slots in the literalEncoding.
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1255
     These are not instvars, but accessed via getters and setters during
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1256
     store and load.
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1257
     Use this when flags encode values which were previously encoded as boolean instvars,
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1258
     to remain backward compatible"
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1259
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1260
    ^ #( ignoreMnemonicKeys ignoreShortcutKeys hideMenuOnActivated
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1261
         keepLinkedMenu sendToOriginator showBusyCursorWhilePerforming triggerOnDown
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1262
         hasMenuIndicator horizontalLayout isButton isMenuSlice translateLabel)
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1263
4163
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1264
    "
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1265
     self new literalArrayEncoding
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1266
     self new ignoreMnemonicKeys:true; literalArrayEncoding
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1267
     (self new ignoreMnemonicKeys:true; literalArrayEncoding) decodeAsLiteralArray
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1268
    "
54d6a48b4655 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
  1269
4162
26578918c9cf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4161
diff changeset
  1270
    "Created: / 09-08-2018 / 17:24:19 / Claus Gittinger"
1643
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1271
! !
e1148c53ad3c got rid of adornment; ResourceRetriever code cleaned up.
Claus Gittinger <cg@exept.de>
parents: 1625
diff changeset
  1272
1329
b56172875855 nicer displayString
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  1273
!MenuItem methodsFor:'printing & storing'!
b56172875855 nicer displayString
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  1274
2736
4798b0251087 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
  1275
printOn:aStream
4798b0251087 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
  1276
    aStream nextPutAll:self classNameWithArticle.
4798b0251087 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
  1277
    aStream nextPutAll:'('.
4798b0251087 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
  1278
    aStream nextPutAll:label storeString.
4798b0251087 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2548
diff changeset
  1279
    aStream nextPutAll:')'
1329
b56172875855 nicer displayString
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  1280
! !
b56172875855 nicer displayString
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
  1281
1761
18ec27a0300e method category rename
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
  1282
!MenuItem methodsFor:'private-accessing'!
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
  1283
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1284
filteredLabel
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1285
    "return the label without any &-chars"
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1286
3212
a5ee318ee18d class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3178
diff changeset
  1287
    |rawLabel l in out c emp e|
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1288
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1289
    rawLabel := self rawLabel.
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1290
    rawLabel isString ifFalse:[^ rawLabel].
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1291
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1292
    "/ be careful to preserve any emphasis ...
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1293
    "/ bad kludge ...
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1294
    rawLabel isText ifTrue:[
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1295
        emp := RunArray new.
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1296
    ].
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1297
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1298
    out := WriteStream on:''.
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1299
    in := rawLabel readStream.
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1300
    [in atEnd] whileFalse:[
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1301
        emp notNil ifTrue:[
3212
a5ee318ee18d class: MenuItem
Stefan Vogel <sv@exept.de>
parents: 3178
diff changeset
  1302
            e := rawLabel emphasisAt:(in position + 1).
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1303
        ].
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1304
        c := in next.
2040
98d3508fd6e1 care for Unicode-Strings.
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
  1305
        c bitsPerCharacter > out collection bitsPerCharacter ifTrue:[
98d3508fd6e1 care for Unicode-Strings.
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
  1306
            out setCollection:(c stringSpecies fromString:out collection).
98d3508fd6e1 care for Unicode-Strings.
Claus Gittinger <cg@exept.de>
parents: 2036
diff changeset
  1307
        ].
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1308
        c == $& ifTrue:[
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1309
            in peek == $& ifTrue:[
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1310
                out nextPut:c.
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1311
                emp notNil ifTrue:[
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1312
                    emp add:e
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1313
                ]
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1314
            ]
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1315
        ] ifFalse:[
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1316
            out nextPut:c.
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1317
            emp notNil ifTrue:[
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1318
                emp add:e
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1319
            ]
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1320
        ]
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1321
    ].
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1322
    l := out contents.
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1323
    emp notNil ifTrue:[
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1324
        ^ Text string:l emphasisCollection:emp
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1325
    ].
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1326
    ^ l.
973
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1327
cd6b8d08c9c9 submenu item send #value.
Claus Gittinger <cg@exept.de>
parents: 960
diff changeset
  1328
    "Created: / 19.6.1998 / 00:02:10 / cg"
985
5a5b476cfd6b care for Text & images in rawLabel, when filtering.
Claus Gittinger <cg@exept.de>
parents: 973
diff changeset
  1329
    "Modified: / 20.6.1998 / 17:15:18 / cg"
458
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
  1330
! !
729ffdbd2b13 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 455
diff changeset
  1331
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1332
!MenuItem methodsFor:'queries'!
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1333
1041
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1334
hasChoice
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1335
    "test whether choice exists
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1336
    "
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1337
    ^ self choice notNil
1041
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1338
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1339
    "Created: / 14-08-1998 / 14:34:29 / cg"
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1340
    "Modified (format): / 09-08-2018 / 16:50:14 / Claus Gittinger"
1041
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1341
!
d28f0375cd26 added choice type menu items (i.e. radioButton behavior)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  1342
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1343
hasIndication
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1344
    "test whether indication on/off exists
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1345
    "
2875
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1346
    ^ self indication notNil
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1347
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1348
    "Modified: / 28-10-2010 / 23:30:52 / cg"
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1349
!
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1350
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1351
hasSubmenu
584
9a4c30f7586f ST-80 compatible features addded
ca
parents: 581
diff changeset
  1352
    ^ self submenu notNil
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1353
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1354
    "Created: 25.2.1997 / 20:56:20 / cg"
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1355
!
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1356
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1357
isEnabled
581
0080d12b5758 enabled can be something not only a boolean
ca
parents: 580
diff changeset
  1358
    ^ enabled value ? true
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1359
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1360
    "Created: 25.2.1997 / 19:39:17 / cg"
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1361
!
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1362
724
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1363
isHidden
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1364
    "not yet supported"
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1365
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1366
    ^ false
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1367
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1368
    "Created: / 27.10.1997 / 15:13:43 / cg"
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1369
!
898519684261 more VW comaptibility
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
  1370
1648
d49c84402011 add query #isMenuItem
ca
parents: 1647
diff changeset
  1371
isMenuItem
d49c84402011 add query #isMenuItem
ca
parents: 1647
diff changeset
  1372
    ^ true
d49c84402011 add query #isMenuItem
ca
parents: 1647
diff changeset
  1373
!
d49c84402011 add query #isMenuItem
ca
parents: 1647
diff changeset
  1374
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1375
isOff
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1376
    "test whether indication on/off exists and is off
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1377
    "
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1378
    |indication|
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1379
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1380
    indication := self indication.
2875
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1381
    ^ indication value == false
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1382
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1383
    "Modified: / 28-10-2010 / 23:30:57 / cg"
590
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1384
!
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1385
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1386
isOn
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1387
    "test whether indication on/off exists and is on
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1388
    "
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1389
    |indication|
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1390
fb2c55428c52 ST-80 compatibility
ca
parents: 584
diff changeset
  1391
    indication := self indication.
2875
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1392
    ^ indication value == true
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1393
eb6fea74e5e6 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 2866
diff changeset
  1394
    "Modified: / 28-10-2010 / 23:31:02 / cg"
2122
4a0a8af7bd71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1395
!
4a0a8af7bd71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1396
4a0a8af7bd71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1397
isSeparatorItem
4a0a8af7bd71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1398
    ^ #('' '-' '=') includes:label
4a0a8af7bd71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1399
4a0a8af7bd71 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
  1400
    "Created: 25.2.1997 / 19:39:17 / cg"
579
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1401
! !
77f6d490f1ac so far, so good
ca
parents: 578
diff changeset
  1402
2966
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1403
!MenuItem methodsFor:'utilities'!
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1404
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1405
replaceArgument: oldValue with: newValue
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1406
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1407
    "Recusively Replace argument in menu items where
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1408
     current argument is equal to oldValue by newValue"
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1409
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1410
    argument = oldValue ifTrue:[
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1411
        argument := newValue.
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1412
    ].
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1413
    submenu notNil ifTrue:[
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1414
        submenu replaceArgument: oldValue with: newValue
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1415
    ].
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1416
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1417
    "Created: / 12-10-2011 / 20:12:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1418
! !
5f538729ab69 Added #replaceArgument:with:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2939
diff changeset
  1419
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
!MenuItem class methodsFor:'documentation'!
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1421
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1422
version
3843
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
  1423
    ^ '$Header$'
2755
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
  1424
!
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
  1425
Claus Gittinger <cg@exept.de>
parents: 2736
diff changeset
  1426
version_CVS
3843
52c875014c46 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3353
diff changeset
  1427
    ^ '$Header$'
451
95064b26ded1 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
! !
3178
ced60e8c83fe class: MenuItem
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  1429
4159
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1430
4a2fc4aa5730 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 4158
diff changeset
  1431
MenuItem initialize!