ColorMenu.st
changeset 3294 da0fdfe54c4e
parent 3293 1ae2428ad1e5
child 3304 f589791dd24c
equal deleted inserted replaced
3293:1ae2428ad1e5 3294:da0fdfe54c4e
    88                             ifFalse:[ fgColor := Color black ].
    88                             ifFalse:[ fgColor := Color black ].
    89 
    89 
    90     aTitle isEmptyOrNil ifTrue:[ label := labels at:1 ifAbsent:defLabel ]
    90     aTitle isEmptyOrNil ifTrue:[ label := labels at:1 ifAbsent:defLabel ]
    91                        ifFalse:[ label := aTitle ].
    91                        ifFalse:[ label := aTitle ].
    92 
    92 
    93     label := Text string:label foregroundColor:fgColor backgroundColor:bgColor.
    93     label := Text string:(' ', label, ' ') foregroundColor:fgColor backgroundColor:bgColor.
    94     item  := MenuItem labeled:label.
    94     item  := MenuItem labeled:label.
    95     submenu addItem:item.
    95     submenu addItem:item.
    96 
    96 
    97     size == 1 ifTrue:[
    97     size == 1 ifTrue:[
    98         item argument:bgColor.
    98         item argument:bgColor.
   102         aColors keysAndValuesDo:[:idx :aBgColor|
   102         aColors keysAndValuesDo:[:idx :aBgColor|
   103             aBgColor brightness < 0.5 ifTrue:[ fgColor := Color white ]
   103             aBgColor brightness < 0.5 ifTrue:[ fgColor := Color white ]
   104                                      ifFalse:[ fgColor := Color black ].
   104                                      ifFalse:[ fgColor := Color black ].
   105 
   105 
   106             label := labels at:idx ifAbsent:defLabel.
   106             label := labels at:idx ifAbsent:defLabel.
   107             label := Text string:label foregroundColor:fgColor backgroundColor:aBgColor.
   107             label := Text string:(' ', label, ' ') foregroundColor:fgColor backgroundColor:aBgColor.
   108             item  := MenuItem labeled:label.
   108             item  := MenuItem labeled:label.
   109             item argument:aBgColor.
   109             item argument:aBgColor.
   110             
   110             
   111             submenu addItem:item.
   111             submenu addItem:item.
   112         ].
   112         ].
   205                 ].
   205                 ].
   206                 color notNil ifTrue:[
   206                 color notNil ifTrue:[
   207                     label isNil ifTrue:[
   207                     label isNil ifTrue:[
   208                         label := getColSel, ' ', el printString.
   208                         label := getColSel, ' ', el printString.
   209                     ].
   209                     ].
   210                     subItem := MenuItem label:'Color ', label.
   210                     subItem := MenuItem label:' Color ', label, ' '.
   211                     subItem argument:color.
   211                     subItem argument:color.
   212                     submenu addItem:subItem.
   212                     submenu addItem:subItem.
   213                 ].
   213                 ].
   214             ]
   214             ]
   215         ].
   215         ].
   475 ! !
   475 ! !
   476 
   476 
   477 !ColorMenu class methodsFor:'documentation'!
   477 !ColorMenu class methodsFor:'documentation'!
   478 
   478 
   479 version
   479 version
   480     ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.39 2007-12-04 08:23:13 ca Exp $'
   480     ^ '$Header: /cvs/stx/stx/libwidg2/ColorMenu.st,v 1.40 2007-12-05 09:21:03 ca Exp $'
   481 ! !
   481 ! !