MenuItem.st
changeset 2112 3c4dd2e9203f
parent 2082 cab2f7b1f938
child 2122 4a0a8af7bd71
equal deleted inserted replaced
2111:c3aee5cae2fe 2112:3c4dd2e9203f
   119 ! !
   119 ! !
   120 
   120 
   121 !MenuItem methodsFor:'accessing'!
   121 !MenuItem methodsFor:'accessing'!
   122 
   122 
   123 accessCharacterPosition
   123 accessCharacterPosition
   124     "get the index of the access character in the label text or string, or nil if none
   124     "get the index of the access character in the label text or string, or nil if none"
   125     "
   125     
   126     ^ accessCharacterPosition
   126     ^ accessCharacterPosition
   127 !
   127 !
   128 
   128 
   129 accessCharacterPosition:index
   129 accessCharacterPosition:index 
   130     "set the index of the access character in the label text or string, or nil if none
   130     "set the index of the access character in the label text or string, or nil if none"
   131     "
   131     
   132     accessCharacterPosition := index
   132     accessCharacterPosition := index
   133 !
   133 !
   134 
   134 
   135 activeHelpKey
   135 activeHelpKey
   136     ^ activeHelpKey
   136     ^ activeHelpKey
   139 activeHelpKey:aKey
   139 activeHelpKey:aKey
   140     activeHelpKey := aKey
   140     activeHelpKey := aKey
   141 !
   141 !
   142 
   142 
   143 argument
   143 argument
   144     "get argument given to the value (selector)
   144     "get argument given to the value (selector)"
   145     "
   145     
   146     ^ argument
   146     ^ argument
   147 !
   147 !
   148 
   148 
   149 argument:something
   149 argument:something 
   150     "set argument given to the value (selector)
   150     "set argument given to the value (selector)"
   151     "
   151     
   152     |arg|
   152     |arg|
   153 
   153 
   154     (arg := something) notNil ifTrue:[
   154     (arg := something) notNil ifTrue:[
   155         arg isString ifTrue:[
   155         arg isString ifTrue:[
   156             (arg size == 0 or:[(arg indexOfNonSeparatorStartingAt:1) == 0]) ifTrue:[
   156             (arg size == 0 or:[ (arg indexOfNonSeparatorStartingAt:1) == 0 ]) ifTrue:[
   157                 arg := nil
   157                 arg := nil
   158             ]
   158             ]
   159         ]
   159         ]
   160     ].
   160     ].
   161 
       
   162     argument := arg
   161     argument := arg
   163 !
   162 !
   164 
   163 
   165 auxValue
   164 auxValue
   166     "an additional, arbitrary value"
   165     "an additional, arbitrary value"
   167 
   166 
   168     ^ auxValue
   167     ^ auxValue
   169 !
   168 !
   170 
   169 
   171 auxValue:something
   170 auxValue:something 
   172     "set the auxValue - an arbitrary user value
   171     "set the auxValue - an arbitrary user value"
   173     "
   172     
   174     auxValue := something
   173     auxValue := something
   175 !
   174 !
   176 
   175 
   177 choice:something
   176 choice:something
   178     "set the value of the instance variable 'choice' (automatically generated)"
   177     "set the value of the instance variable 'choice' (automatically generated)"
   197 
   196 
   198     "Created: / 14.8.1998 / 15:39:26 / cg"
   197     "Created: / 14.8.1998 / 15:39:26 / cg"
   199 !
   198 !
   200 
   199 
   201 font
   200 font
   202     "get the specific font for an item or nil
   201     "get the specific font for an item or nil"
   203     "
   202     
   204     ^ font
   203     ^ font
   205 !
   204 !
   206 
   205 
   207 font:aFont
   206 font:aFont 
   208     "set a specific font for an item
   207     "set a specific font for an item"
   209     "
   208     
   210     font := aFont.
   209     font := aFont.
   211 !
   210 !
   212 
   211 
   213 horizontalLayout
   212 horizontalLayout
   214     "by default, submenus have a vertical layout;
   213     "by default, submenus have a vertical layout;
   215      if true, the submenu has a horizontal layout.
   214      if true, the submenu has a horizontal layout."
   216     "
   215     
   217     ^ horizontalLayout ? false
   216     ^ horizontalLayout ? false
   218 !
   217 !
   219 
   218 
   220 horizontalLayout:aBoolean
   219 horizontalLayout:aBoolean 
   221     "by default, submenus have a vertical layout;
   220     "by default, submenus have a vertical layout;
   222      if true, the submenu has a horizontal layout.
   221      if true, the submenu has a horizontal layout."
   223     "
   222     
   224     horizontalLayout := aBoolean.
   223     horizontalLayout := aBoolean.
   225 !
   224 !
   226 
   225 
   227 ignoreMnemonicKeys
   226 ignoreMnemonicKeys
   228     "if true, mnemonic (access character) in the submenus under the item are ignored;
   227     "if true, mnemonic (access character) in the submenus under the item are ignored;
   229      the default is set to false
   228      the default is set to false"
   230     "
   229     
   231     ^ ignoreMnemonicKeys ? false
   230     ^ ignoreMnemonicKeys ? false
   232 !
   231 !
   233 
   232 
   234 ignoreMnemonicKeys:aBoolean
   233 ignoreMnemonicKeys:aBoolean 
   235     "if true, mnemonic (access character) in the submenus under the item are ignored;
   234     "if true, mnemonic (access character) in the submenus under the item are ignored;
   236      the default is set to false
   235      the default is set to false"
   237     "
   236     
   238     ignoreMnemonicKeys := aBoolean.
   237     ignoreMnemonicKeys := aBoolean.
   239 !
   238 !
   240 
   239 
   241 ignoreShortcutKeys
   240 ignoreShortcutKeys
   242     "if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
   241     "if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
   243      the default is set to false
   242      the default is set to false"
   244     "
   243     
   245     ^ ignoreShortcutKeys ? false
   244     ^ ignoreShortcutKeys ? false
   246 !
   245 !
   247 
   246 
   248 ignoreShortcutKeys:aBoolean
   247 ignoreShortcutKeys:aBoolean 
   249     "if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
   248     "if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
   250      the default is set to false
   249      the default is set to false"
   251     "
   250     
   252     ignoreShortcutKeys := aBoolean.
   251     ignoreShortcutKeys := aBoolean.
   253 !
   252 !
   254 
   253 
   255 indication
   254 indication
   256     "test whether the menu item has an on/off indicator (CheckToggle)
   255     "test whether the menu item has an on/off indicator (CheckToggle)"
   257     "
   256     
   258     ^ indication
   257     ^ indication
   259 
   258 
   260     "Created: 25.2.1997 / 20:59:28 / cg"
   259     "Created: 25.2.1997 / 20:59:28 / cg"
   261 !
   260 !
   262 
   261 
   263 indication:something
   262 indication:something 
   264     "test whether the menu item has an on/off indicator (CheckToggle)
   263     "test whether the menu item has an on/off indicator (CheckToggle)"
   265     "
   264     
   266     indication := something.
   265     indication := something.
   267 
   266 
   268     "Created: 25.2.1997 / 20:59:28 / cg"
   267     "Created: 25.2.1997 / 20:59:28 / cg"
   269 !
   268 !
   270 
   269 
   353 resourceRetriever:aRetriever
   352 resourceRetriever:aRetriever
   354     self labelImage:aRetriever
   353     self labelImage:aRetriever
   355 !
   354 !
   356 
   355 
   357 shortcutKey
   356 shortcutKey
   358     "get the key to press to select the menu item from the keyboard
   357     "get the key to press to select the menu item from the keyboard"
   359     "
   358     
   360     ^ shortcutKey
   359     ^ shortcutKey
   361 !
   360 !
   362 
   361 
   363 shortcutKey:something
   362 shortcutKey:something 
   364     "set the  key to press to select the menu item from the keyboard
   363     "set the  key to press to select the menu item from the keyboard"
   365     "
   364     
   366     shortcutKey := something.
   365     shortcutKey := something.
   367 !
   366 !
   368 
   367 
   369 shortcutKeyCharacter
   368 shortcutKeyCharacter
   370     "Backward compatibility; same as #shortcutKey.
   369     "Backward compatibility; same as #shortcutKey.
   371      get the  key to press to select the menu item from the keyboard
   370      get the  key to press to select the menu item from the keyboard"
   372     "
   371     
   373     ^ self shortcutKey
   372     ^ self shortcutKey
   374 !
   373 !
   375 
   374 
   376 shortcutKeyCharacter:something
   375 shortcutKeyCharacter:something 
   377     "Backward compatibility; same as #shortcutKey:.
   376     "Backward compatibility; same as #shortcutKey:.
   378      set the  key to press to select the menu item from the keyboard
   377      set the  key to press to select the menu item from the keyboard"
   379     "
   378     
   380     self shortcutKey:something.
   379     self shortcutKey:something.
   381 !
   380 !
   382 
   381 
   383 showBusyCursorWhilePerforming
   382 showBusyCursorWhilePerforming
   384     "get the flag which controls if a busy cursor is to be shown
   383     "get the flag which controls if a busy cursor is to be shown
   395     showBusyCursorWhilePerforming := aBoolean
   394     showBusyCursorWhilePerforming := aBoolean
   396 
   395 
   397 !
   396 !
   398 
   397 
   399 submenu
   398 submenu
   400     "get the submenu or nil
   399     "get the submenu or nil"
   401     "
   400     
   402     ^ submenu value
   401     ^ submenu value
   403 
   402 
   404     "Created: / 25.2.1997 / 20:59:28 / cg"
   403     "Created: / 25.2.1997 / 20:59:28 / cg"
   405     "Modified: / 19.6.1998 / 00:33:58 / cg"
   404     "Modified: / 19.6.1998 / 00:33:58 / cg"
   406 !
   405 !
   407 
   406 
   408 submenu:something
   407 submenu:something 
   409     "set the submenu or nil
   408     "set the submenu or nil"
   410     "
   409     
   411     (something isValueModel or:[something isBlock]) ifTrue:[
   410     (something isValueModel or:[ something isBlock ]) ifTrue:[
   412         submenuChannel notNil ifTrue:[
   411         submenuChannel notNil ifTrue:[
   413             "/ programmers error ?
   412             "/ programmers error ?
   414             "/ how can I decide which one to use if there is both
   413             "/ how can I decide which one to use if there is both
   415             "/ a channel and a subMenu ...
   414             "/ a channel and a subMenu ...
   416             self error:'overwriting submenuchannel' mayProceed:true.
   415             self error:'overwriting submenuchannel' mayProceed:true.
   423     "Created: / 25.2.1997 / 20:59:28 / cg"
   422     "Created: / 25.2.1997 / 20:59:28 / cg"
   424     "Modified: / 5.2.2000 / 16:53:28 / cg"
   423     "Modified: / 5.2.2000 / 16:53:28 / cg"
   425 !
   424 !
   426 
   425 
   427 submenuChannel
   426 submenuChannel
   428     "get the submenuChannel or nil
   427     "get the submenuChannel or nil"
   429     "
   428     
   430     ^ submenuChannel
   429     ^ submenuChannel
   431 !
   430 !
   432 
   431 
   433 submenuChannel:something
   432 submenuChannel:something 
   434     "set the submenuChannel or nil
   433     "set the submenuChannel or nil"
   435     "
   434     
   436     submenuChannel := something.
   435     submenuChannel := something.
   437 ! !
   436 ! !
   438 
   437 
   439 !MenuItem methodsFor:'accessing-behavior'!
   438 !MenuItem methodsFor:'accessing-behavior'!
   440 
   439 
   873 ! !
   872 ! !
   874 
   873 
   875 !MenuItem class methodsFor:'documentation'!
   874 !MenuItem class methodsFor:'documentation'!
   876 
   875 
   877 version
   876 version
   878     ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.74 2006-01-11 14:48:14 cg Exp $'
   877     ^ '$Header: /cvs/stx/stx/libview2/MenuItem.st,v 1.75 2006-02-23 21:03:19 cg Exp $'
   879 ! !
   878 ! !