Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / mac / module-FrameWork.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="mac.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="mac.html" title='Macintosh Library Modules' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-autoGIL.html" />
<link rel="prev" href="module-EasyDialogs.html" />
<link rel="parent" href="macpython-modules.html" />
<link rel="next" href="application-objects.html" />
<meta name='aesop' content='information' />
<title>2.8 FrameWork -- Interactive application framework</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.7.1 ProgressBar Objects"
href="progressbar-objects.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="2. MacPython Modules"
href="macpython-modules.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="2.8.1 Application Objects"
href="application-objects.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Macintosh Library Modules</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="progressbar-objects.html">2.7.1 ProgressBar Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="macpython-modules.html">2. MacPython Modules</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="application-objects.html">2.8.1 Application Objects</A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION004800000000000000000">
2.8 <tt class="module">FrameWork</tt> --
Interactive application framework</A>
</H1>
<P>
<A NAME="module-FrameWork"></A>
<p class="availability">Availability: <span
class="platform">Macintosh</span>.</p>
<P>
The <tt class="module">FrameWork</tt> module contains classes that together provide a
framework for an interactive Macintosh application. The programmer
builds an application by creating subclasses that override various
methods of the bases classes, thereby implementing the functionality
wanted. Overriding functionality can often be done on various
different levels, i.e. to handle clicks in a single dialog window in a
non-standard way it is not necessary to override the complete event
handling.
<P>
Work on the <tt class="module">FrameWork</tt> has pretty much stopped, now that
<tt class="module">PyObjC</tt> is available for full Cocoa access from Python, and the
documentation describes only the most important functionality, and not
in the most logical manner at that. Examine the source or the examples
for more details. The following are some comments posted on the
MacPython newsgroup about the strengths and limitations of
<tt class="module">FrameWork</tt>:
<P>
<BLOCKQUOTE>
The strong point of <tt class="module">FrameWork</tt> is that it allows you to break
into the control-flow at many different places. <tt class="module"><a href="module-W.html">W</a></tt>, for
instance, uses a different way to enable/disable menus and that plugs
right in leaving the rest intact. The weak points of
<tt class="module">FrameWork</tt> are that it has no abstract command interface (but
that shouldn't be difficult), that it's dialog support is minimal and
that it's control/toolbar support is non-existent.
</BLOCKQUOTE>
<P>
The <tt class="module">FrameWork</tt> module defines the following functions:
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-98' xml:id='l2h-98' class="function">Application</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
An object representing the complete application. See below for a
description of the methods. The default <tt class="method">__init__()</tt> routine
creates an empty window dictionary and a menu bar with an apple menu.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-99' xml:id='l2h-99' class="function">MenuBar</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
An object representing the menubar. This object is usually not created
by the user.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-100' xml:id='l2h-100' class="function">Menu</tt></b>(</nobr></td>
<td><var>bar, title</var><big>[</big><var>, after</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
An object representing a menu. Upon creation you pass the
<code>MenuBar</code> the menu appears in, the <var>title</var> string and a
position (1-based) <var>after</var> where the menu should appear (default:
at the end).
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-101' xml:id='l2h-101' class="function">MenuItem</tt></b>(</nobr></td>
<td><var>menu, title</var><big>[</big><var>, shortcut, callback</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Create a menu item object. The arguments are the menu to create, the
item title string and optionally the keyboard shortcut
and a callback routine. The callback is called with the arguments
menu-id, item number within menu (1-based), current front window and
the event record.
<P>
Instead of a callable object the callback can also be a string. In
this case menu selection causes the lookup of a method in the topmost
window and the application. The method name is the callback string
with <code>'domenu_'</code> prepended.
<P>
Calling the <code>MenuBar</code> <tt class="method">fixmenudimstate()</tt> method sets the
correct dimming for all menu items based on the current front window.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-102' xml:id='l2h-102' class="function">Separator</tt></b>(</nobr></td>
<td><var>menu</var>)</td></tr></table></dt>
<dd>
Add a separator to the end of a menu.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-103' xml:id='l2h-103' class="function">SubMenu</tt></b>(</nobr></td>
<td><var>menu, label</var>)</td></tr></table></dt>
<dd>
Create a submenu named <var>label</var> under menu <var>menu</var>. The menu
object is returned.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-104' xml:id='l2h-104' class="function">Window</tt></b>(</nobr></td>
<td><var>parent</var>)</td></tr></table></dt>
<dd>
Creates a (modeless) window. <var>Parent</var> is the application object to
which the window belongs. The window is not displayed until later.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-105' xml:id='l2h-105' class="function">DialogWindow</tt></b>(</nobr></td>
<td><var>parent</var>)</td></tr></table></dt>
<dd>
Creates a modeless dialog window.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-106' xml:id='l2h-106' class="function">windowbounds</tt></b>(</nobr></td>
<td><var>width, height</var>)</td></tr></table></dt>
<dd>
Return a <code>(<var>left</var>, <var>top</var>, <var>right</var>, <var>bottom</var>)</code>
tuple suitable for creation of a window of given width and height. The
window will be staggered with respect to previous windows, and an
attempt is made to keep the whole window on-screen. However, the window will
however always be the exact size given, so parts may be offscreen.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-107' xml:id='l2h-107' class="function">setwatchcursor</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Set the mouse cursor to a watch.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-108' xml:id='l2h-108' class="function">setarrowcursor</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Set the mouse cursor to an arrow.
</dl>
<P>
<p><br /></p><hr class='online-navigation' />
<div class='online-navigation'>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>
<UL CLASS="ChildLinks">
<LI><A href="application-objects.html">2.8.1 Application Objects</a>
<LI><A href="window-objects.html">2.8.2 Window Objects</a>
<LI><A href="controlswindow-object.html">2.8.3 ControlsWindow Object</a>
<LI><A href="scrolledwindow-object.html">2.8.4 ScrolledWindow Object</a>
<LI><A href="dialogwindow-objects.html">2.8.5 DialogWindow Objects</a>
</ul>
<!--End of Table of Child-Links-->
</div>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="2.7.1 ProgressBar Objects"
href="progressbar-objects.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="2. MacPython Modules"
href="macpython-modules.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="2.8.1 Application Objects"
href="application-objects.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Macintosh Library Modules</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="progressbar-objects.html">2.7.1 ProgressBar Objects</A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="macpython-modules.html">2. MacPython Modules</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="application-objects.html">2.8.1 Application Objects</A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>