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

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5</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> B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5</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="#contents">CONTENTS</A></LI>
  26.     <LI><A HREF="#class hierarchy">CLASS HIERARCHY</A></LI>
  27. </UL>
  28. <!-- INDEX END -->
  29.  
  30. <HR>
  31. <P>
  32. <H1><A NAME="name">NAME</A></H1>
  33. <P><STRONG>Tk</STRONG> - An overview of an Object Oriented Tk8.0 extension for perl5</P>
  34. <P>
  35. <HR>
  36. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  37. <UL>
  38. <LI>Linux</LI>
  39. <LI>Solaris</LI>
  40. <LI>Windows</LI>
  41. </UL>
  42. <HR>
  43. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  44. <P>use Tk;</P>
  45. <P>$main = MainWindow->new();</P>
  46. <P>$widget = $main-><EM>Widget</EM>(...);</P>
  47. <P>$widget->pack(...);</P>
  48. <P>...</P>
  49. <P>MainLoop;</P>
  50. <P>
  51. <HR>
  52. <H1><A NAME="description">DESCRIPTION</A></H1>
  53. <P>In writing the perl Tk extension, the goals were to provide a complete
  54. interface to the latest production version of John Ousterhout's Tk, while providing
  55. an Object Oriented interface to perl code.</P>
  56. <P>
  57. <HR>
  58. <H1><A NAME="contents">CONTENTS</A></H1>
  59. <P>The package is composed of three loosely connected parts:</P>
  60. <DL>
  61. <DT><STRONG><A NAME="item_pTk_%2D_Converted_Tk_source"><EM>pTk</EM> - Converted Tk source</A></STRONG><BR>
  62. <DD>
  63. The <EM>pTk</EM> sub-directory is a copy of the C code of Tk4.0, modified
  64. to allow use by languages other than the original Tcl.
  65. (The pTk can be read as 'perl' Tk or 'portable' Tk, depending on
  66. your sensibilities.)
  67. <P></P>
  68. <DT><STRONG><A NAME="item_Tk_to_Perl_%27Glue%27"><STRONG>Tk</STRONG> to Perl 'Glue'</A></STRONG><BR>
  69. <DD>
  70. The top level directory provides <EM>Tk.xs</EM> and <EM>tkGlue.c</EM>
  71. which provide the perl-callable interfaces to pTk
  72. <P></P>
  73. <DT><STRONG><A NAME="item_Perl_code_for_%27Widget%27_Classes">Perl code for 'Widget' Classes</A></STRONG><BR>
  74. <DD>
  75. The <EM>Tk/Tk</EM> sub-directory contains the various perl modules that comprise
  76. the ``Classes'' that are visible to Tk applications.
  77. <P>The ``major'' widgets such as <STRONG>Tk::Text</STRONG> are actually in separate directories
  78. at the top level (e.g. <EM>Text/*</EM> for <STRONG>Tk::Text</STRONG>) and are dynamically
  79. loaded as needed on platforms which support perl5's <STRONG>DynaLoader</STRONG>.</P>
  80. <P></P></DL>
  81. <P>
  82. <HR>
  83. <H1><A NAME="class hierarchy">CLASS HIERARCHY</A></H1>
  84. <DL>
  85. <DT><STRONG><A NAME="item_package_Tk%3B_%2D_the_%27base_class%27"><STRONG>package Tk;</STRONG> - the 'base class'</A></STRONG><BR>
  86. <DD>
  87. All the ``command names'' documented in Tcl/Tk are made to look like perl
  88. sub's and reside in the Tk package. Their names are all lower case.
  89. Typically there are very few commands at this level which are called
  90. directly by applications.
  91. <P></P>
  92. <DT><STRONG><A NAME="item_package_Tk%3A%3AWidget%3B_%2D_the_%27Widget_class%"><STRONG>package Tk::Widget;</STRONG> - the 'Widget class'</A></STRONG><BR>
  93. <DD>
  94. There are no actual objects of the <STRONG>Tk::Widget</STRONG> class; however all
  95. the various Tk window ``widgets'' inherit from it, and it in turn
  96. inherits all the core Tk functions from Tk.
  97. <P><STRONG>Tk::Widget</STRONG> provides various functions and interfaces which are
  98. common to all Widgets.</P>
  99. <P>A widget is represented to perl as a blessed reference to a hash. There are some
  100. members of the hash which are private to Tk and its tkGlue code.  Keys
  101. starting with <STRONG>'.'</STRONG> and of the form  <STRONG>/_[A-Z][A-Za-z_]+_/</STRONG>
  102. (i.e. starting and ending in _ and with  first char after _ being upper case) should be
  103. considered reserved to <STRONG>Tk</STRONG>.</P>
  104. <P></P>
  105. <DT><STRONG><A NAME="item_Tk%3A%3AButton%2C_Tk%3A%3AEntry%2C_Tk%3A%3AText_%2"><STRONG>Tk::Button</STRONG>, <STRONG>Tk::Entry</STRONG>, <STRONG>Tk::Text</STRONG> ...</A></STRONG><BR>
  106. <DD>
  107. There is one class for each of the ``Tk'' widget item types.
  108. Some of them like <STRONG>Tk::Frame</STRONG> do very little indeed, and really
  109. only exist so that they can be derived from or so that focus or menu
  110. traversal can discover the ``kind'' of window being processed.
  111. <P>Other classes, <STRONG>Tk::Text</STRONG> for example, provide a lot of methods
  112. used with Tk's ``bind'' to provide a rich keyboard/mouse interface
  113. to the widgets' data.</P>
  114. <P>These widget classes also include conversions of the Tcl code for
  115. event bindings, keyboard focus traversal, menu bars, and menu keyboard
  116. traversal. All the Tcl functions have been converted, but the names have
  117. changed (systematically) and they have been split up between the various
  118. classes in what I hope is an appropriate manner.
  119. Name changes are normally: dropping initial tk_ as the Tk-ness is implicit
  120. in the <STRONG>Tk::</STRONG> prefix, and similarly dropping say Menu from the name if it
  121. has been moved the Tk::Menu class.
  122. Thus 'proc tkMenuNextEntry' becomes 'sub NextEntry' in the Tk::Menu package.</P>
  123. <P></P>
  124. <DT><STRONG><A NAME="item_Tk%3A%3AImage"><STRONG>Tk::Image</STRONG></A></STRONG><BR>
  125. <DD>
  126. This does for Tk4.0's ``images'' what <STRONG>Tk::Widget</STRONG> does for widgets.
  127. Images are new to Tk4.0 and the class structure is not mature either.
  128. <P>There are three sub-classes <STRONG>Tk::Bitmap</STRONG>, <STRONG>Tk::Pixmap</STRONG> and <STRONG>Tk::Photo</STRONG>.</P>
  129. <P>It is expected that <STRONG>Tk::Image</STRONG> hierarchy will evolve during the ``beta''
  130. phase of Tk to allow dynamic or auto-loaded image types or photo formats
  131. (e.g. support for JPEG format for photos).</P>
  132. <P></P>
  133. <DT><STRONG><A NAME="item_Composite_Widgets">Composite Widgets</A></STRONG><BR>
  134. <DD>
  135. A composite is some kind of 'frame' with subwidgets which give it useful behaviour.
  136. <STRONG>Tk::Dialog</STRONG> is an example of
  137. a composite widget classes built from the basic <STRONG>Tk</STRONG> ones.
  138. It is intended that user code should not need to be aware that a particular
  139. class is a composite, and create and configure such widgets in the same manner
  140. as any other kind. The <STRONG>configure</STRONG> mechanism and the methods of the
  141. class manipulate the subwidgets as required.
  142. <P>Composite widgets are implemented via <STRONG>Tk::Frame</STRONG> and multiple inheritance.
  143. The two 'frame' base classes <STRONG>Tk::Frame</STRONG> and
  144. <STRONG>Tk::Toplevel</STRONG> include the additional class <STRONG>Tk::Derived</STRONG>
  145. in their inheritance. <STRONG>Tk::Derived</STRONG> provides methods to allow additional
  146. <STRONG>configure</STRONG> options to be defined for a widget.</P>
  147. <P>A Composite widget is typically defined as derived
  148. from <STRONG>Tk::Frame</STRONG> or <STRONG>Tk::Toplevel</STRONG>
  149. (e.g. <STRONG>Tk::Dialog</STRONG>).</P>
  150. <P></P></DL>
  151. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  152. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  153. <STRONG><P CLASS=block> B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5</P></STRONG>
  154. </TD></TR>
  155. </TABLE>
  156.  
  157. </BODY>
  158.  
  159. </HTML>
  160.