MenuItem.st
changeset 4216 91c9929f64e8
parent 4168 0656fd9bc4b2
child 4217 b08e4ff220d7
equal deleted inserted replaced
4215:bc67d59fcf46 4216:91c9929f64e8
    74 !MenuItem class methodsFor:'instance creation'!
    74 !MenuItem class methodsFor:'instance creation'!
    75 
    75 
    76 label:aString
    76 label:aString
    77     "create and return a new menuItem, given a label string"
    77     "create and return a new menuItem, given a label string"
    78 
    78 
    79     ^ self new
    79     ^ (self new)
    80         label:aString;
    80         label:aString;
    81         yourself
    81         yourself
    82 
    82 
    83     "Created: / 14-08-1998 / 19:19:14 / cg"
    83     "Created: / 14-08-1998 / 19:19:14 / cg"
       
    84     "Modified (format): / 27-12-2018 / 16:21:01 / Claus Gittinger"
       
    85 !
       
    86 
       
    87 label:labelString argument:messageArg
       
    88     "create and return a new menuItem, given its label and value
       
    89      and an argument to be passed with the action"
       
    90 
       
    91     ^ (self new)
       
    92         label:labelString argument:messageArg;
       
    93         yourself
       
    94 
       
    95     "Created: / 27-12-2018 / 16:19:35 / Claus Gittinger"
    84 !
    96 !
    85 
    97 
    86 label:labelString choice:choiceAspect choiceValue:selectorOrValue
    98 label:labelString choice:choiceAspect choiceValue:selectorOrValue
    87     "create and return a new menuItem, given its label and choice/value.
    99     "create and return a new menuItem, given its label and choice/value.
    88      This will create a Radio-Button-like item."
   100      This will create a Radio-Button-like item."
   107 label:labelString itemValue:selectorOrValue argument:messageArg
   119 label:labelString itemValue:selectorOrValue argument:messageArg
   108     "create and return a new menuItem, given its label and value
   120     "create and return a new menuItem, given its label and value
   109      and an argument to be passed with the action"
   121      and an argument to be passed with the action"
   110 
   122 
   111     ^ (self new)
   123     ^ (self new)
   112         label:labelString;
   124         label:labelString itemValue:selectorOrValue argument:messageArg;
   113         itemValue:selectorOrValue argument:messageArg;
       
   114         yourself
   125         yourself
   115 
   126 
   116     "Created: / 09-09-2012 / 13:22:31 / cg"
   127     "Created: / 09-09-2012 / 13:22:31 / cg"
       
   128     "Modified: / 27-12-2018 / 16:19:57 / Claus Gittinger"
   117 !
   129 !
   118 
   130 
   119 label:labelString itemValue:selectorOrValue enabled:enabledHolder
   131 label:labelString itemValue:selectorOrValue enabled:enabledHolder
   120     "create and return a new menuItem, given its label, value
   132     "create and return a new menuItem, given its label, value
   121      and enabled holder, which can be a boolean, a boolean valueHolder,
   133      and enabled holder, which can be a boolean, a boolean valueHolder,
   122      a block or a selector (to be sent to the application)"
   134      a block or a selector (to be sent to the application)"
   123 
   135 
   124     ^ (self new)
   136     ^ (self new)
   125         label:labelString itemValue:selectorOrValue enabled:enabledHolder
   137         label:labelString itemValue:selectorOrValue enabled:enabledHolder;
       
   138         yourself
   126 
   139 
   127     "Created: / 09-09-2012 / 13:23:05 / cg"
   140     "Created: / 09-09-2012 / 13:23:05 / cg"
       
   141     "Modified: / 27-12-2018 / 16:20:23 / Claus Gittinger"
   128 !
   142 !
   129 
   143 
   130 label:labelString itemValue:selectorOrValue translateLabel:translateLabel
   144 label:labelString itemValue:selectorOrValue translateLabel:translateLabel
   131     "create and return a new menuItem, given its label, value and translateLabel flag"
   145     "create and return a new menuItem, given its label, value and translateLabel flag"
   132 
   146 
   133     ^ (self new)
   147     ^ (self new)
   134         label:labelString
   148         label:labelString itemValue:selectorOrValue translateLabel:translateLabel;
   135         itemValue:selectorOrValue
   149         yourself
   136         translateLabel:translateLabel
   150 
       
   151     "Modified: / 27-12-2018 / 16:20:34 / Claus Gittinger"
   137 !
   152 !
   138 
   153 
   139 label:labelString submenuChannel:aSymbolOrValueHolder
   154 label:labelString submenuChannel:aSymbolOrValueHolder
   140     "create and return a new menuItem, given its label and value"
   155     "create and return a new menuItem, given its label and value"
   141 
   156 
   203 !
   218 !
   204 
   219 
   205 separator:sepString
   220 separator:sepString
   206     "create and return a new menuItem for a separator"
   221     "create and return a new menuItem for a separator"
   207 
   222 
   208     ^ self new
   223     ^ (self new)
   209         label:sepString; translateLabel:false;
   224         label:sepString; translateLabel:false;
   210         yourself
   225         yourself
   211 
   226 
   212     "Created: / 19-07-2017 / 09:17:21 / cg"
   227     "Created: / 19-07-2017 / 09:17:21 / cg"
       
   228     "Modified (format): / 27-12-2018 / 16:21:13 / Claus Gittinger"
   213 ! !
   229 ! !
   214 
   230 
   215 !MenuItem class methodsFor:'class initialization'!
   231 !MenuItem class methodsFor:'class initialization'!
   216 
   232 
   217 initialize
   233 initialize
   487 
   503 
   488     itemValue := selectorOrBlock.
   504     itemValue := selectorOrBlock.
   489     argument := anArgument
   505     argument := anArgument
   490 
   506 
   491     "Created: / 09-09-2012 / 13:05:14 / cg"
   507     "Created: / 09-09-2012 / 13:05:14 / cg"
       
   508 !
       
   509 
       
   510 label:labelString argument:someArgument
       
   511     label := labelString.
       
   512     argument := someArgument.
       
   513 
       
   514     "Created: / 27-12-2018 / 16:19:14 / Claus Gittinger"
   492 !
   515 !
   493 
   516 
   494 label:aString icon:anImage
   517 label:aString icon:anImage
   495     self label:aString.
   518     self label:aString.
   496     self resourceRetriever: (ResourceRetriever icon:anImage string:'')
   519     self resourceRetriever: (ResourceRetriever icon:anImage string:'')