eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ColorMenu':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ColorMenu


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--MenuPanel
                  |
                  +--ColorMenu

Package:
stx:libwidg2
Category:
Interface-UIPainter
Version:
rev: 1.87 date: 2018/12/27 15:33:47
user: cg
file: ColorMenu.st directory: libwidg2
module: stx stc-classLibrary: libwidg2
Author:
Claus Atzkern

Description:


A simple ColorMenu used by the UIPainter


Related information:

    UIPainter
    ColorMenuSpec

Class protocol:

adding & removing user defined items
o  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.
    ].

o  removeAllUserDefinedColors
flush user defined colors

o  userDefinedSubmenu
answer the menu entry under which the userdefined color entries are placed

history
o  rememberRecentlyUsedColor: aColor

instance creation
o  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
o  colorMenuSpec
color definitions used to build a color menu

private
o  colorMenu
ColorMenuSpec := nil

o  resolveMenuItem: aMenuItem value: aValue labelsAreColored: labelsAreColored


Instance protocol:

accepting
o  accept: anItem isUserAction: isUserAction
accept the current selected item (called from my pulldown menus)

o  chooseColor: aColor
accept the current selected item

accessing
o  acceptAction: something

o  allowNilColor

o  allowNilColor: aBoolean

o  allowSymbolicColors

o  allowSymbolicColors: aBoolean

o  color
get current color

o  color: aColor
set current color

o  colorHolder
returns the item which keeps the selected color in its label

o  contents

o  hasNilColorHolder

o  labelsAreColored
controls if labels or their backgrounds will be colored

o  labelsAreColored: aBoolean
sets whether labels or their backgrounds will be colored

o  useDefaultColorToggleVisibleHolder

accessing-channels
o  enableChannel: aValueHolder
(comment from inherited method)
set my enableChannel

o  enabledChannel
^ enabledChannel

o  model: aValueHolder
set my color channel

o  overwriteDefaultToggleChannel

change & update
o  hasNilColorHolderChanged

o  updateFromModel

help
o  helpSpec
This resource specification was automatically generated
by the UIHelpTool of ST/X.

initialization
o  colorHistorySubmenu

o  destroy
release color channel dependency

o  initialize
enabledChannel := ValueHolder with:false.

o  setupMenu
menu addItem:(MenuItem label:'') beforeIndex:1.

o  updateEnableChannel
anItem enabled:enabledChannel.

user actions
o  copyColor

o  keepColorHolderIndicationAlwaysEnabled

o  openColorEditDialog

o  pasteColor

o  pickColorFromScreen


Examples:


very simple example
  |tool top channel|

  top := StandardSystemView new.
  top extent:250@30.

  channel := (Color red) asValue.
  tool := self origin:0.0@0.0 corner:1.0@1.0 in:top.
  tool model:channel.

  top open.


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 26 Apr 2024 14:18:37 GMT