home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd1.bin / zkuste / Perl / ActivePerl-5.6.0.613.msi / 䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥 / _4f90541c468ae0e9305e1f443a4085b5 < prev    next >
Text File  |  2000-03-23  |  6KB  |  149 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Tk::ColorEditor - a general purpose Tk widget Color Editor</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> Tk::ColorEditor - a general purpose Tk widget Color Editor</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <LI><A HREF="#authors">AUTHORS</A></LI>
  26. </UL>
  27. <!-- INDEX END -->
  28.  
  29. <HR>
  30. <P>
  31. <H1><A NAME="name">NAME</A></H1>
  32. <P>Tk::ColorEditor - a general purpose Tk widget Color Editor</P>
  33. <P>
  34. <HR>
  35. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  36. <UL>
  37. <LI>Linux</LI>
  38. <LI>Solaris</LI>
  39. <LI>Windows</LI>
  40. </UL>
  41. <HR>
  42. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  43. <PRE>
  44.    use Tk::ColorEditor;</PRE>
  45. <PRE>
  46.    $cref = $mw->ColorEditor(-title => $title, -cursor => @cursor);</PRE>
  47. <PRE>
  48.    $cref->Show;</PRE>
  49. <P>
  50. <HR>
  51. <H1><A NAME="description">DESCRIPTION</A></H1>
  52. <P>ColorEditor is implemented as an object with various methods, described
  53. below.  First, create your ColorEditor object during program initialization
  54. (one should be sufficient), and then configure it by specifying a list of Tk
  55. widgets to colorize. When it's time to use the editor, invoke the <CODE>Show()</CODE>
  56. method.</P>
  57. <P>ColorEditor allows some customization: you may alter the color attribute
  58. menu by adding and/or deleting menu items and/or separators, turn the status
  59. window on or off, alter the configurator's list of color widgets, or even
  60. supply your own custom color configurator callback.</P>
  61. <OL>
  62. <LI>
  63. Call the constructor to create the editor object, which in turn returns a
  64. blessed reference to the new object:
  65. <PRE>
  66.    use Tk::ColorEditor;</PRE>
  67. <PRE>
  68.    $cref = $mw->ColorEditor(
  69.        -title  => $title,
  70.        -cursor => @cursor,
  71.    );</PRE>
  72. <PRE>
  73.       mw     - a window reference, usually the result of a MainWindow->new
  74.                call.  As the default root of a widget tree, $mw and all
  75.                descendant widgets at object-creation-time are configured
  76.                by the default color configurator procedure.  (You probably
  77.                want to change this though or you might end up colorizing
  78.                ColorEditor!)
  79.       title  - Toplevel title, default = ' '.
  80.       cursor - a valid Tk '-cursor' specification (default is
  81.                'top_left_arrow').  This cursor is used over all ColorEditor
  82.                "hot spots".</PRE>
  83. <P></P>
  84. <LI>
  85. Invoke the <CODE>configure()</CODE> method to change editor characteristics:
  86. <PRE>
  87.    $cref->configure(-option => value, ..., -option-n => value-n);</PRE>
  88. <PRE>
  89.       options:
  90.         -command             : a callback to a  `set_colors' replacement.
  91.         -widgets             : a reference to a list of widget references
  92.                                for the color configurator.
  93.         -display_status      : TRUE IFF display the ColorEditor status
  94.                                window when applying colors.
  95.         -add_menu_item       : 'SEP', or a color attribute menu item.
  96.         -delete_menu_item    : 'SEP', a color attribute menu item, or color
  97.                                attribute menu ordinal.</PRE>
  98. <PRE>
  99.    For example:</PRE>
  100. <PRE>
  101.       $cref->configure(-delete_menu_item   => 3,
  102.           -delete_menu_item   => 'disabledforeground',
  103.           -add_menu_item      => 'SEP',
  104.           -add_menu_item      => 'New color attribute',
  105.           -widgets            => [$ce, $qu, $f2b2],
  106.           -widgets            => [$f2->Descendants],
  107.           -command            => [\&my_special_configurator, some, args ]
  108.       );</PRE>
  109. <P></P>
  110. <LI>
  111. Invoke the <CODE>Show()</CODE> method on the editor object, say, by a button or menu press:
  112. <PRE>
  113.    $cref->Show;</PRE>
  114. <P></P>
  115. <LI>
  116. The <CODE>cget(-widgets)</CODE> method returns a reference to a list of widgets that
  117. are colorized by the configurator.  Typically, you add new widgets to
  118. this list and then use it in a subsequent <CODE>configure()</CODE> call to expand your
  119. color list.
  120. <PRE>
  121.    $cref->configure(
  122.        -widgets => [
  123.            @{$Filesystem_ref->cget(-widgets)}, @{$cref->cget(-widgets)},
  124.        ]
  125.    );</PRE>
  126. <P></P>
  127. <LI>
  128. The <CODE>delete_widgets()</CODE> method expects a reference to a list of widgets which are
  129. then removed from the current color list.
  130. <PRE>
  131.    $cref->delete_widgets($OBJTABLE{$objname}->{'-widgets'})</PRE>
  132. <P></P></OL>
  133. <P>
  134. <HR>
  135. <H1><A NAME="authors">AUTHORS</A></H1>
  136. <P>Stephen O. Lidie, Lehigh University Computing Center.  95/03/05
  137. <A HREF="mailto:lusol@Lehigh.EDU">lusol@Lehigh.EDU</A></P>
  138. <P>Many thanks to Guy Decoux (<A HREF="mailto:decoux@moulon.inra.fr">decoux@moulon.inra.fr</A>) for doing the initial
  139. translation of tcolor.tcl to TkPerl, from which this code has been derived.</P>
  140. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  141. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  142. <STRONG><P CLASS=block> Tk::ColorEditor - a general purpose Tk widget Color Editor</P></STRONG>
  143. </TD></TR>
  144. </TABLE>
  145.  
  146. </BODY>
  147.  
  148. </HTML>
  149.