|
Class: ColorMenu
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--MenuPanel
|
+--ColorMenu
- Package:
- stx:libwidg2
- Category:
- Interface-UIPainter
- Version:
- rev:
1.98
date: 2024/03/19 09:06:35
- user: cg
- file: ColorMenu.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
A simple ColorMenu used by the UIPainter
copyrightCOPYRIGHT (c) 1995 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
adding & removing user defined items
-
addUserDefinedColors: aColors labels: labelsOrNil title: aTitle
-
add user colors to ALL colormenus
Usage example(s):
ColorMenu removeAllUserDefinedColors.
#(
#( Black 16r000000 )
#( Red 16rff0000 )
nil
#( Rust 16rff6600 16rff8533 16rffa366 16rffc299 16rffe0cc )
#( Tangerine 16rff9933 16rffad5c 16rffc285 16rffd6ad 16rffebd6 )
#( Sunflower 16rffcc00 16rfed633 16rfee066 16rffeb99 16rfff5cc )
#( Mango 16rffcc99 16rffd6ad 16rffe0c2 16rffebd6 16rfff5eb )
#( Buttercup 16rffff66 16rffff85 16rffffa3 16rffffc2 16rffffe0 )
#( Lemon 16rffffcc 16rffffd6 16rffffe0 16rffffeb 16rfffff5 )
) do:[:aDef| |colors title labels percentage|
aDef isEmptyOrNil ifTrue:[
colors := labels := title := nil.
] ifFalse:[
title := aDef first.
colors := OrderedCollection new.
labels := OrderedCollection new.
percentage := 100.
aDef from:2 do:[:rgb|
colors add:(Color rgbValue:rgb).
labels add:('%1 %2 %%' bindWith:title with:percentage).
percentage := percentage - 20.
].
].
ColorMenu addUserDefinedColors:colors labels:labels title:title.
].
|
-
removeAllUserDefinedColors
-
flush user defined colors
-
userDefinedSubmenu
-
answer the menu entry under which the userdefined color entries are placed
history
-
rememberRecentlyUsedColor: aColor
-
instance creation
-
colorMenu: labelsAreColored value: aValue
-
returns a color menu
Usage example(s):
(ColorMenu colorMenu:true value:nil) startUp
(ColorMenu colorMenu:false value:#aSelector:) startUp
|
menu specs
-
colorMenuSpec
-
color definitions used to build a color menu
private
-
colorMenu
-
ColorMenuSpec := nil
-
resolveMenuItem: aMenuItem value: aValue labelsAreColored: labelsAreColored
-
accepting
-
accept: anItem isUserAction: isUserAction
-
accept the current selected item (called from my pulldown menus)
-
chooseColor: aColor
-
accept the current selected item
accessing
-
acceptAction: something
-
-
allowNilColor
-
-
allowNilColor: aBoolean
-
-
allowSymbolicColors
-
-
allowSymbolicColors: aBoolean
-
-
color
-
get current color
-
color: aColor
-
set current color
-
colorHolder
-
returns the item which keeps the selected color in its label
-
contents
-
-
hasNilColorHolder
-
-
labelsAreColored
-
controls if labels or their backgrounds will be colored
-
labelsAreColored: aBoolean
-
sets whether labels or their backgrounds will be colored
-
useDefaultColorToggleVisibleHolder
-
accessing-channels
-
enableChannel: aValueHolder
-
(comment from inherited method)
set my enableChannel
-
enabledChannel
-
^ enabledChannel
-
model: aValueHolder
-
set my color channel
-
overwriteDefaultToggleChannel
-
change & update
-
hasNilColorHolderChanged
-
-
updateFromModel
-
(comment from inherited method)
to be redefined in subclasses
help specs
-
helpSpec
-
This resource specification was automatically generated
by the UIHelpTool of ST/X.
initialization
-
colorHistorySubmenu
-
-
destroy
-
release color channel dependency
-
initialize
-
enabledChannel := ValueHolder with:false.
-
setupMenu
-
menu addItem:(MenuItem label:'') beforeIndex:1.
-
updateEnableChannel
-
anItem enabled:enabledChannel.
user actions
-
copyColor
-
-
keepColorHolderIndicationAlwaysEnabled
-
-
openColorEditDialog
-
-
pasteColor
-
-
pickColorFromScreen
-
very simple example
|tool top channel|
top := StandardSystemView new.
top extent:400@30.
channel := (Color red) asValue.
tool := self origin:0.0@0.0 corner:1.0@1.0 in:top.
tool model:channel.
top open.
|
|