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.98 date: 2024/03/19 09:06:35
user: cg
file: ColorMenu.st directory: libwidg2
module: stx stc-classLibrary: libwidg2

Description:


A simple ColorMenu used by the UIPainter

copyright

COPYRIGHT (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.

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
(comment from inherited method)
to be redefined in subclasses

help specs
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: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.


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 17:01:51 GMT