Class ::tycho::TWidget


Inherits: ::itk::Widget - Related constructs - Source File - Contents: destructor - public methods - public procs - protected methods - protected variables - protected common
This class is the base class for most widgets in Tycho. It provides a set of useful methods and a frame within which to insert other widgets. The frame is an itk component called "childsite".

Destructor

destructor
Destruction will succeed only if we are not within a safeEval call. If we are, then destruction is canceled with a silent error, and scheduled to be attempted again after 1 second.

Public constructs

Public Methods

busy args
Change the cursor in the interior of this widget to the "watch" cursor (to indicate that the object is busy), execute the arguments and then change the cursor back to whatever it was before. In order for the cursor to actually change, the method calls "update", during which time the object may be deleted. If the object is deleted, this method never returns (it unwinds the stack by triggering a silent error). A typical invocation is as follows:
    busy $this methodname arg1 arg2
Notice that, unlike safeEval, this method does not prevent destruction of the object. Instead, if the object is destroyed during the update, the method never returns.
contextmenu cmd args
If there is a context-sensitive popup menu associated with this widget, use the arguments as a command to issue to the PopupMenu widget, Menubar, and return whatever is returned by the command. Otherwise, return an empty string.

The command "create" is treated as a special case: the context menu is created. The second argument, if present. is the widget to add the binding for posting the menu. When the menu is posted, the method configureContextMenu is called.

focusin
Grab the focus and change the Displayer menu, if necessary. This should be redefined in derived classes to give the focus to the appropriate subwindow.
hyperJump file {point {}}
Open a file and go to its internal point identified by name. If the filename is the empty string, just call seeFragment, passing it the second argument. Otherwise, the file is opened with ::tycho::File::openContext, which will choose an editor based on the filename extension. Invoke seeFragment to view the specified point within the file. The format for the point argument depends on the type of file being opened. For HTML files, it will normally be the name of an anchor in the file. For text files, it will normally be either "{line linenumber}" or "{range start end}", where start and end have the form linenumber.characternumber.
raiseWindow
Bring the corresponding top-level window to the foreground, and make sure it is deiconified.
seeFragment point
In derived classes, this method will go to the point in the display identified by the name argument. What this means depends on what type of data being displayed. In this base class, do nothing.
windowName
Return the name of my window.

Public Procs

evalIfExists command args
If the named object exists, evaluate the arguments.
getClipboard
Get the current contents of the local clipboard.
setClipboard text
Set the current contents of the local and Tk clipboards.

Protected constructs

Protected Methods

safeEval args
Prevent destruction of this object while evaluating the arguments. Destruction will be cancelled by invoking a silent error, and will be scheduled for another attempt in the future.

This method is a workaround for a defect in Itcl. If "update", "update idletasks", or "tkwait" is called directly or indirectly from within an Itcl method, and during the update the Itcl object is destroyed, then when update returns, you may get a catastrophic failure of the application (a core dump).

preference mode args
Access the preferences associated with this widget. By default, all widgets access the "global" preference set; many widgets will, however, need to access a different preference set, and they must indicate so by overriding this method.
configureContextMenu
Configure the popup menu according to context. By default, this menu simply contains an entry that offers information about the widget.

Subclasses that create a context menu (by calling "contextmenu create" on themselves) should override this method.

Protected Variables

myContextmenu
Name of my context-sensitive popup menu.
prefix
The prefix is just a shorthand for $itk_component(hull).

Protected Common

clipboard
A local Tycho clipboard that is mirrored in the Tk clipboard.

Index of classes



Author: Edward A. Lee
Version: @(#)TWidget.itcl 1.7 12/05/96
Copyright: (c) 1995-1996 The Regents of the University of California.