home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _d01e77f3c0a577e6bcde4e8e205eb4ef < prev    next >
Encoding:
Text File  |  2004-06-01  |  3.8 KB  |  121 lines

  1.  
  2. =head1 NAME
  3.  
  4. Tk::ColorEditor - a general purpose Tk widget Color Editor
  5.  
  6. =for pm Tk/ColorEditor.pm
  7.  
  8. =for category Popups and Dialogs
  9.  
  10. =head1 SYNOPSIS
  11.  
  12.    use Tk::ColorEditor;
  13.  
  14.    $cref = $mw->ColorEditor(-title => $title, -cursor => @cursor);
  15.  
  16.    $cref->Show;
  17.  
  18. =head1 DESCRIPTION
  19.  
  20. ColorEditor is implemented as an object with various methods, described
  21. below.  First, create your ColorEditor object during program initialization
  22. (one should be sufficient), and then configure it by specifying a list of Tk
  23. widgets to colorize. When it's time to use the editor, invoke the Show()
  24. method.
  25.  
  26. ColorEditor allows some customization: you may alter the color attribute
  27. menu by adding and/or deleting menu items and/or separators, turn the status
  28. window on or off, alter the configurator's list of color widgets, or even
  29. supply your own custom color configurator callback.
  30.  
  31. =over 4
  32.  
  33. =item 1.
  34.  
  35. Call the constructor to create the editor object, which in turn returns a
  36. blessed reference to the new object:
  37.  
  38.    use Tk::ColorEditor;
  39.  
  40.    $cref = $mw->ColorEditor(
  41.        -title  => $title,
  42.        -cursor => @cursor,
  43.    );
  44.  
  45.       mw     - a window reference, usually the result of a MainWindow->new
  46.                call.  As the default root of a widget tree, $mw and all
  47.                descendant widgets at object-creation-time are configured
  48.                by the default color configurator procedure.  (You probably
  49.                want to change this though or you might end up colorizing
  50.                ColorEditor!)
  51.       title  - Toplevel title, default = ' '.
  52.       cursor - a valid Tk '-cursor' specification (default is
  53.                'top_left_arrow').  This cursor is used over all ColorEditor
  54.                "hot spots".
  55.  
  56. =item 2.
  57.  
  58. Invoke the configure() method to change editor characteristics:
  59.  
  60.    $cref->configure(-option => value, ..., -option-n => value-n);
  61.  
  62.       options:
  63.         -command             : a callback to a  `set_colors' replacement.
  64.         -widgets             : a reference to a list of widget references
  65.                                for the color configurator.
  66.         -display_status      : TRUE IFF display the ColorEditor status
  67.                                window when applying colors.
  68.         -add_menu_item       : 'SEP', or a color attribute menu item.
  69.         -delete_menu_item    : 'SEP', a color attribute menu item, or color
  70.                                attribute menu ordinal.
  71.  
  72.    For example:
  73.  
  74.       $cref->configure(-delete_menu_item   => 3,
  75.           -delete_menu_item   => 'disabledforeground',
  76.           -add_menu_item      => 'SEP',
  77.           -add_menu_item      => 'New color attribute',
  78.           -widgets            => [$ce, $qu, $f2b2],
  79.           -widgets            => [$f2->Descendants],
  80.           -command            => [\&my_special_configurator, some, args ]
  81.       );
  82.  
  83. =item 3.
  84.  
  85. Invoke the Show() method on the editor object, say, by a button or menu press:
  86.  
  87.    $cref->Show;
  88.  
  89. =item 4.
  90.  
  91. The cget(-widgets) method returns a reference to a list of widgets that
  92. are colorized by the configurator.  Typically, you add new widgets to
  93. this list and then use it in a subsequent configure() call to expand your
  94. color list.
  95.  
  96.    $cref->configure(
  97.        -widgets => [
  98.            @{$Filesystem_ref->cget(-widgets)}, @{$cref->cget(-widgets)},
  99.        ]
  100.    );
  101.  
  102. =item 5.
  103.  
  104. The delete_widgets() method expects a reference to a list of widgets which are
  105. then removed from the current color list.
  106.  
  107.    $cref->delete_widgets($OBJTABLE{$objname}->{'-widgets'})
  108.  
  109. =back
  110.  
  111. =head1 AUTHORS
  112.  
  113. Stephen O. Lidie, Lehigh University Computing Center.  95/03/05
  114. lusol@Lehigh.EDU
  115.  
  116. Many thanks to Guy Decoux (decoux@moulon.inra.fr) for doing the initial
  117. translation of tcolor.tcl to TkPerl, from which this code has been derived.
  118.  
  119. =cut
  120.  
  121.