Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

tk::coloreditor(3pm) [debian man page]

ColorEditor(3pm)					User Contributed Perl Documentation					  ColorEditor(3pm)

NAME
Tk::ColorEditor - a general purpose Tk widget Color Editor SYNOPSIS
use Tk::ColorEditor; $cref = $mw->ColorEditor(-title => $title, -cursor => @cursor); $cref->Show; DESCRIPTION
ColorEditor is implemented as an object with various methods, described below. First, create your ColorEditor object during program initialization (one should be sufficient), and then configure it by specifying a list of Tk widgets to colorize. When it's time to use the editor, invoke the Show() method. ColorEditor allows some customization: you may alter the color attribute menu by adding and/or deleting menu items and/or separators, turn the status window on or off, alter the configurator's list of color widgets, or even supply your own custom color configurator callback. 1. Call the constructor to create the editor object, which in turn returns a blessed reference to the new object: use Tk::ColorEditor; $cref = $mw->ColorEditor( -title => $title, -cursor => @cursor, ); mw - a window reference, usually the result of a MainWindow->new call. As the default root of a widget tree, $mw and all descendant widgets at object-creation-time are configured by the default color configurator procedure. (You probably want to change this though or you might end up colorizing ColorEditor!) title - Toplevel title, default = ' '. cursor - a valid Tk '-cursor' specification (default is 'top_left_arrow'). This cursor is used over all ColorEditor "hot spots". 2. Invoke the configure() method to change editor characteristics: $cref->configure(-option => value, ..., -option-n => value-n); options: -command : a callback to a `set_colors' replacement. -widgets : a reference to a list of widget references for the color configurator. -display_status : TRUE IFF display the ColorEditor status window when applying colors. -add_menu_item : 'SEP', or a color attribute menu item. -delete_menu_item : 'SEP', a color attribute menu item, or color attribute menu ordinal. For example: $cref->configure(-delete_menu_item => 3, -delete_menu_item => 'disabledforeground', -add_menu_item => 'SEP', -add_menu_item => 'New color attribute', -widgets => [$ce, $qu, $f2b2], -widgets => [$f2->Descendants], -command => [&my_special_configurator, some, args ] ); 3. Invoke the Show() method on the editor object, say, by a button or menu press: $cref->Show; 4. The cget(-widgets) method returns a reference to a list of widgets that are colorized by the configurator. Typically, you add new widgets to this list and then use it in a subsequent configure() call to expand your color list. $cref->configure( -widgets => [ @{$Filesystem_ref->cget(-widgets)}, @{$cref->cget(-widgets)}, ] ); 5. The delete_widgets() method expects a reference to a list of widgets which are then removed from the current color list. $cref->delete_widgets($OBJTABLE{$objname}->{'-widgets'}) AUTHORS
Stephen O. Lidie, Lehigh University Computing Center. 95/03/05 lusol@Lehigh.EDU Many thanks to Guy Decoux (decoux@moulon.inra.fr) for doing the initial translation of tcolor.tcl to TkPerl, from which this code has been derived. perl v5.14.2 2010-05-29 ColorEditor(3pm)

Check Out this Related Man Page

palette(3pm)						User Contributed Perl Documentation					      palette(3pm)

NAME
setPalette, bisque - Modify the Tk color palette SYNOPSIS
$widget->setPalette(background) $widget->setPalette(name=>value?,name=>value ...?) $widget->bisque DESCRIPTION
The setPalette method changes the color scheme for Tk. It does this by modifying the colors of existing widgets and by changing the option database so that future widgets will use the new color scheme. If setPalette is invoked with a single argument, the argument is the name of a color to use as the normal background color; setPalette will compute a complete color palette from this background color. Alternatively, the arguments to setPalette may consist of any number of name-value pairs, where the first argument of the pair is the name of an option in the Tk option database and the second argument is the new value to use for that option. The following database names are currently supported: activeBackground foreground selectColor activeForeground highlightBackground selectBackground background highlightColor selectForeground disabledForeground insertBackground troughColor setPalette tries to compute reasonable defaults for any options that you don't specify. You can specify options other than the above ones and Tk will change those options on widgets as well. This feature may be useful if you are using custom widgets with additional color options. Once it has computed the new value to use for each of the color options, setPalette scans the widget hierarchy to modify the options of all existing widgets. For each widget, it checks to see if any of the above options is defined for the widget. If so, and if the option's current value is the default, then the value is changed; if the option has a value other than the default, setPalette will not change it. The default for an option is the one provided by the widget (($w->configure('option'))[3]) unless setPalette has been run previously, in which case it is the value specified in the previous invocation of setPalette. After modifying all the widgets in the application, setPalette adds options to the option database to change the defaults for widgets created in the future. The new options are added at priority widgetDefault, so they will be overridden by options from the .Xdefaults file or options specified on the command-line that creates a widget. The method bisque is provided for backward compatibility: it restores the application's colors to the light brown (``bisque'') color scheme used in Tk 3.6 and earlier versions. BUGS
The use of option database names rather than the configure names is understandable given the mechanism (copied from Tcl/Tk), but is potentially confusing. The interpolation of different 'shades' of color used for 3D effects in 'RGB' space can lead to undesirable changes in 'hue'. Interpolation in 'HSV' (as used in Tk::ColorEditor) would be more robust and X11R5's color support probably even more so. SEE ALSO
Tk::options KEYWORDS
bisque, color, palette perl v5.14.2 2010-05-29 palette(3pm)
Man Page