home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <LI><A HREF="#contents">CONTENTS</A></LI>
- <LI><A HREF="#class hierarchy">CLASS HIERARCHY</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P><STRONG>Tk</STRONG> - An overview of an Object Oriented Tk8.0 extension for perl5</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P>use Tk;</P>
- <P>$main = MainWindow->new();</P>
- <P>$widget = $main-><EM>Widget</EM>(...);</P>
- <P>$widget->pack(...);</P>
- <P>...</P>
- <P>MainLoop;</P>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>In writing the perl Tk extension, the goals were to provide a complete
- interface to the latest production version of John Ousterhout's Tk, while providing
- an Object Oriented interface to perl code.</P>
- <P>
- <HR>
- <H1><A NAME="contents">CONTENTS</A></H1>
- <P>The package is composed of three loosely connected parts:</P>
- <DL>
- <DT><STRONG><A NAME="item_pTk_%2D_Converted_Tk_source"><EM>pTk</EM> - Converted Tk source</A></STRONG><BR>
- <DD>
- The <EM>pTk</EM> sub-directory is a copy of the C code of Tk4.0, modified
- to allow use by languages other than the original Tcl.
- (The pTk can be read as 'perl' Tk or 'portable' Tk, depending on
- your sensibilities.)
- <P></P>
- <DT><STRONG><A NAME="item_Tk_to_Perl_%27Glue%27"><STRONG>Tk</STRONG> to Perl 'Glue'</A></STRONG><BR>
- <DD>
- The top level directory provides <EM>Tk.xs</EM> and <EM>tkGlue.c</EM>
- which provide the perl-callable interfaces to pTk
- <P></P>
- <DT><STRONG><A NAME="item_Perl_code_for_%27Widget%27_Classes">Perl code for 'Widget' Classes</A></STRONG><BR>
- <DD>
- The <EM>Tk/Tk</EM> sub-directory contains the various perl modules that comprise
- the ``Classes'' that are visible to Tk applications.
- <P>The ``major'' widgets such as <STRONG>Tk::Text</STRONG> are actually in separate directories
- at the top level (e.g. <EM>Text/*</EM> for <STRONG>Tk::Text</STRONG>) and are dynamically
- loaded as needed on platforms which support perl5's <STRONG>DynaLoader</STRONG>.</P>
- <P></P></DL>
- <P>
- <HR>
- <H1><A NAME="class hierarchy">CLASS HIERARCHY</A></H1>
- <DL>
- <DT><STRONG><A NAME="item_package_Tk%3B_%2D_the_%27base_class%27"><STRONG>package Tk;</STRONG> - the 'base class'</A></STRONG><BR>
- <DD>
- All the ``command names'' documented in Tcl/Tk are made to look like perl
- sub's and reside in the Tk package. Their names are all lower case.
- Typically there are very few commands at this level which are called
- directly by applications.
- <P></P>
- <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>
- <DD>
- There are no actual objects of the <STRONG>Tk::Widget</STRONG> class; however all
- the various Tk window ``widgets'' inherit from it, and it in turn
- inherits all the core Tk functions from Tk.
- <P><STRONG>Tk::Widget</STRONG> provides various functions and interfaces which are
- common to all Widgets.</P>
- <P>A widget is represented to perl as a blessed reference to a hash. There are some
- members of the hash which are private to Tk and its tkGlue code. Keys
- starting with <STRONG>'.'</STRONG> and of the form <STRONG>/_[A-Z][A-Za-z_]+_/</STRONG>
- (i.e. starting and ending in _ and with first char after _ being upper case) should be
- considered reserved to <STRONG>Tk</STRONG>.</P>
- <P></P>
- <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>
- <DD>
- There is one class for each of the ``Tk'' widget item types.
- Some of them like <STRONG>Tk::Frame</STRONG> do very little indeed, and really
- only exist so that they can be derived from or so that focus or menu
- traversal can discover the ``kind'' of window being processed.
- <P>Other classes, <STRONG>Tk::Text</STRONG> for example, provide a lot of methods
- used with Tk's ``bind'' to provide a rich keyboard/mouse interface
- to the widgets' data.</P>
- <P>These widget classes also include conversions of the Tcl code for
- event bindings, keyboard focus traversal, menu bars, and menu keyboard
- traversal. All the Tcl functions have been converted, but the names have
- changed (systematically) and they have been split up between the various
- classes in what I hope is an appropriate manner.
- Name changes are normally: dropping initial tk_ as the Tk-ness is implicit
- in the <STRONG>Tk::</STRONG> prefix, and similarly dropping say Menu from the name if it
- has been moved the Tk::Menu class.
- Thus 'proc tkMenuNextEntry' becomes 'sub NextEntry' in the Tk::Menu package.</P>
- <P></P>
- <DT><STRONG><A NAME="item_Tk%3A%3AImage"><STRONG>Tk::Image</STRONG></A></STRONG><BR>
- <DD>
- This does for Tk4.0's ``images'' what <STRONG>Tk::Widget</STRONG> does for widgets.
- Images are new to Tk4.0 and the class structure is not mature either.
- <P>There are three sub-classes <STRONG>Tk::Bitmap</STRONG>, <STRONG>Tk::Pixmap</STRONG> and <STRONG>Tk::Photo</STRONG>.</P>
- <P>It is expected that <STRONG>Tk::Image</STRONG> hierarchy will evolve during the ``beta''
- phase of Tk to allow dynamic or auto-loaded image types or photo formats
- (e.g. support for JPEG format for photos).</P>
- <P></P>
- <DT><STRONG><A NAME="item_Composite_Widgets">Composite Widgets</A></STRONG><BR>
- <DD>
- A composite is some kind of 'frame' with subwidgets which give it useful behaviour.
- <STRONG>Tk::Dialog</STRONG> is an example of
- a composite widget classes built from the basic <STRONG>Tk</STRONG> ones.
- It is intended that user code should not need to be aware that a particular
- class is a composite, and create and configure such widgets in the same manner
- as any other kind. The <STRONG>configure</STRONG> mechanism and the methods of the
- class manipulate the subwidgets as required.
- <P>Composite widgets are implemented via <STRONG>Tk::Frame</STRONG> and multiple inheritance.
- The two 'frame' base classes <STRONG>Tk::Frame</STRONG> and
- <STRONG>Tk::Toplevel</STRONG> include the additional class <STRONG>Tk::Derived</STRONG>
- in their inheritance. <STRONG>Tk::Derived</STRONG> provides methods to allow additional
- <STRONG>configure</STRONG> options to be defined for a widget.</P>
- <P>A Composite widget is typically defined as derived
- from <STRONG>Tk::Frame</STRONG> or <STRONG>Tk::Toplevel</STRONG>
- (e.g. <STRONG>Tk::Dialog</STRONG>).</P>
- <P></P></DL>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> B<Tk> - An overview of an Object Oriented Tk8.0 extension for perl5</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-