Fred Drake | c817e27 | 1998-08-10 18:40:22 +0000 | [diff] [blame] | 1 | \section{\module{FrameWork} --- |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 2 | Interactive application framework} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 3 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 4 | \declaremodule{standard}{FrameWork} |
| 5 | \platform{Mac} |
Fred Drake | fe7f3bc | 1998-07-23 17:55:31 +0000 | [diff] [blame] | 6 | \modulesynopsis{Interactive application framework.} |
| 7 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 8 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 9 | The \module{FrameWork} module contains classes that together provide a |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 10 | framework for an interactive Macintosh application. The programmer |
| 11 | builds an application by creating subclasses that override various |
| 12 | methods of the bases classes, thereby implementing the functionality |
| 13 | wanted. Overriding functionality can often be done on various |
| 14 | different levels, i.e. to handle clicks in a single dialog window in a |
| 15 | non-standard way it is not necessary to override the complete event |
| 16 | handling. |
| 17 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 18 | The \module{FrameWork} is still very much work-in-progress, and the |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 19 | documentation describes only the most important functionality, and not |
| 20 | in the most logical manner at that. Examine the source or the examples |
| 21 | for more details. |
| 22 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 23 | The \module{FrameWork} module defines the following functions: |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 24 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 25 | |
| 26 | \begin{funcdesc}{Application}{} |
| 27 | An object representing the complete application. See below for a |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 28 | description of the methods. The default \method{__init__()} routine |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 29 | creates an empty window dictionary and a menu bar with an apple menu. |
| 30 | \end{funcdesc} |
| 31 | |
| 32 | \begin{funcdesc}{MenuBar}{} |
| 33 | An object representing the menubar. This object is usually not created |
| 34 | by the user. |
| 35 | \end{funcdesc} |
| 36 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 37 | \begin{funcdesc}{Menu}{bar, title\optional{, after}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 38 | An object representing a menu. Upon creation you pass the |
| 39 | \code{MenuBar} the menu appears in, the \var{title} string and a |
| 40 | position (1-based) \var{after} where the menu should appear (default: |
| 41 | at the end). |
| 42 | \end{funcdesc} |
| 43 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 44 | \begin{funcdesc}{MenuItem}{menu, title\optional{, shortcut, callback}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 45 | Create a menu item object. The arguments are the menu to crate the |
| 46 | item it, the item title string and optionally the keyboard shortcut |
| 47 | and a callback routine. The callback is called with the arguments |
| 48 | menu-id, item number within menu (1-based), current front window and |
| 49 | the event record. |
| 50 | |
| 51 | In stead of a callable object the callback can also be a string. In |
| 52 | this case menu selection causes the lookup of a method in the topmost |
| 53 | window and the application. The method name is the callback string |
| 54 | with \code{'domenu_'} prepended. |
| 55 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 56 | Calling the \code{MenuBar} \method{fixmenudimstate()} method sets the |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 57 | correct dimming for all menu items based on the current front window. |
| 58 | \end{funcdesc} |
| 59 | |
| 60 | \begin{funcdesc}{Separator}{menu} |
| 61 | Add a separator to the end of a menu. |
| 62 | \end{funcdesc} |
| 63 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 64 | \begin{funcdesc}{SubMenu}{menu, label} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 65 | Create a submenu named \var{label} under menu \var{menu}. The menu |
| 66 | object is returned. |
| 67 | \end{funcdesc} |
| 68 | |
| 69 | \begin{funcdesc}{Window}{parent} |
| 70 | Creates a (modeless) window. \var{Parent} is the application object to |
| 71 | which the window belongs. The window is not displayed until later. |
| 72 | \end{funcdesc} |
| 73 | |
| 74 | \begin{funcdesc}{DialogWindow}{parent} |
| 75 | Creates a modeless dialog window. |
| 76 | \end{funcdesc} |
| 77 | |
Fred Drake | cce1090 | 1998-03-17 06:33:25 +0000 | [diff] [blame] | 78 | \begin{funcdesc}{windowbounds}{width, height} |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 79 | Return a \code{(\var{left}, \var{top}, \var{right}, \var{bottom})} |
| 80 | tuple suitable for creation of a window of given width and height. The |
| 81 | window will be staggered with respect to previous windows, and an |
| 82 | attempt is made to keep the whole window on-screen. The window will |
| 83 | however always be exact the size given, so parts may be offscreen. |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 84 | \end{funcdesc} |
| 85 | |
| 86 | \begin{funcdesc}{setwatchcursor}{} |
| 87 | Set the mouse cursor to a watch. |
| 88 | \end{funcdesc} |
| 89 | |
| 90 | \begin{funcdesc}{setarrowcursor}{} |
| 91 | Set the mouse cursor to an arrow. |
| 92 | \end{funcdesc} |
| 93 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 94 | |
| 95 | \subsection{Application Objects \label{application-objects}} |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 96 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 97 | Application objects have the following methods, among others: |
| 98 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 99 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 100 | \begin{methoddesc}[Application]{makeusermenus}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 101 | Override this method if you need menus in your application. Append the |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 102 | menus to the attribute \member{menubar}. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 103 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 104 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 105 | \begin{methoddesc}[Application]{getabouttext}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 106 | Override this method to return a text string describing your |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 107 | application. Alternatively, override the \method{do_about()} method |
| 108 | for more elaborate ``about'' messages. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 109 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 110 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 111 | \begin{methoddesc}[Application]{mainloop}{\optional{mask\optional{, wait}}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 112 | This routine is the main event loop, call it to set your application |
| 113 | rolling. \var{Mask} is the mask of events you want to handle, |
| 114 | \var{wait} is the number of ticks you want to leave to other |
| 115 | concurrent application (default 0, which is probably not a good |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 116 | idea). While raising \var{self} to exit the mainloop is still |
| 117 | supported it is not recommended: call \code{self._quit()} instead. |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 118 | |
| 119 | The event loop is split into many small parts, each of which can be |
| 120 | overridden. The default methods take care of dispatching events to |
| 121 | windows and dialogs, handling drags and resizes, Apple Events, events |
| 122 | for non-FrameWork windows, etc. |
| 123 | |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 124 | In general, all event handlers should return \code{1} if the event is fully |
| 125 | handled and \code{0} otherwise (because the front window was not a FrameWork |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 126 | window, for instance). This is needed so that update events and such |
| 127 | can be passed on to other windows like the Sioux console window. |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 128 | Calling \function{MacOS.HandleEvent()} is not allowed within |
| 129 | \var{our_dispatch} or its callees, since this may result in an |
| 130 | infinite loop if the code is called through the Python inner-loop |
| 131 | event handler. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 132 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 133 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 134 | \begin{methoddesc}[Application]{asyncevents}{onoff} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 135 | Call this method with a nonzero parameter to enable |
| 136 | asynchronous event handling. This will tell the inner interpreter loop |
| 137 | to call the application event handler \var{async_dispatch} whenever events |
| 138 | are available. This will cause FrameWork window updates and the user |
| 139 | interface to remain working during long computations, but will slow the |
| 140 | interpreter down and may cause surprising results in non-reentrant code |
| 141 | (such as FrameWork itself). By default \var{async_dispatch} will immedeately |
| 142 | call \var{our_dispatch} but you may override this to handle only certain |
| 143 | events asynchronously. Events you do not handle will be passed to Sioux |
| 144 | and such. |
| 145 | |
| 146 | The old on/off value is returned. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 147 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 148 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 149 | \begin{methoddesc}[Application]{_quit}{} |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 150 | Terminate the running \method{mainloop()} call at the next convenient |
| 151 | moment. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 152 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 153 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 154 | \begin{methoddesc}[Application]{do_char}{c, event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 155 | The user typed character \var{c}. The complete details of the event |
| 156 | can be found in the \var{event} structure. This method can also be |
| 157 | provided in a \code{Window} object, which overrides the |
| 158 | application-wide handler if the window is frontmost. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 159 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 160 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 161 | \begin{methoddesc}[Application]{do_dialogevent}{event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 162 | Called early in the event loop to handle modeless dialog events. The |
| 163 | default method simply dispatches the event to the relevant dialog (not |
| 164 | through the the \code{DialogWindow} object involved). Override if you |
| 165 | need special handling of dialog events (keyboard shortcuts, etc). |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 166 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 167 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 168 | \begin{methoddesc}[Application]{idle}{event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 169 | Called by the main event loop when no events are available. The |
| 170 | null-event is passed (so you can look at mouse position, etc). |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 171 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 172 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 173 | |
| 174 | \subsection{Window Objects \label{window-objects}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 175 | |
| 176 | Window objects have the following methods, among others: |
| 177 | |
| 178 | \setindexsubitem{(Window method)} |
| 179 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 180 | \begin{methoddesc}[Window]{open}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 181 | Override this method to open a window. Store the MacOS window-id in |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 182 | \member{self.wid} and call the \method{do_postopen()} method to |
| 183 | register the window with the parent application. |
| 184 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 185 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 186 | \begin{methoddesc}[Window]{close}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 187 | Override this method to do any special processing on window |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 188 | close. Call the \method{do_postclose()} method to cleanup the parent |
| 189 | state. |
| 190 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 191 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 192 | \begin{methoddesc}[Window]{do_postresize}{width, height, macoswindowid} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 193 | Called after the window is resized. Override if more needs to be done |
| 194 | than calling \code{InvalRect}. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 195 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 196 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 197 | \begin{methoddesc}[Window]{do_contentclick}{local, modifiers, event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 198 | The user clicked in the content part of a window. The arguments are |
| 199 | the coordinates (window-relative), the key modifiers and the raw |
| 200 | event. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 201 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 202 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 203 | \begin{methoddesc}[Window]{do_update}{macoswindowid, event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 204 | An update event for the window was received. Redraw the window. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 205 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 206 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 207 | \begin{methoddesc}{do_activate}{activate, event} |
| 208 | The window was activated (\code{\var{activate} == 1}) or deactivated |
| 209 | (\code{\var{activate} == 0}). Handle things like focus highlighting, |
| 210 | etc. |
| 211 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 212 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 213 | |
| 214 | \subsection{ControlsWindow Object \label{controlswindow-object}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 215 | |
| 216 | ControlsWindow objects have the following methods besides those of |
| 217 | \code{Window} objects: |
| 218 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 219 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 220 | \begin{methoddesc}[ControlsWindow]{do_controlhit}{window, control, |
| 221 | pcode, event} |
| 222 | Part \var{pcode} of control \var{control} was hit by the |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 223 | user. Tracking and such has already been taken care of. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 224 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 225 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 226 | |
| 227 | \subsection{ScrolledWindow Object \label{scrolledwindow-object}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 228 | |
| 229 | ScrolledWindow objects are ControlsWindow objects with the following |
| 230 | extra methods: |
| 231 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 232 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 233 | \begin{methoddesc}[ScrolledWindow]{scrollbars}{\optional{wantx\optional{, |
| 234 | wanty}}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 235 | Create (or destroy) horizontal and vertical scrollbars. The arguments |
| 236 | specify which you want (default: both). The scrollbars always have |
| 237 | minimum \code{0} and maximum \code{32767}. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 238 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 239 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 240 | \begin{methoddesc}[ScrolledWindow]{getscrollbarvalues}{} |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 241 | You must supply this method. It should return a tuple \code{(\var{x}, |
| 242 | \var{y})} giving the current position of the scrollbars (between |
| 243 | \code{0} and \code{32767}). You can return \code{None} for either to |
| 244 | indicate the whole document is visible in that direction. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 245 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 246 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 247 | \begin{methoddesc}[ScrolledWindow]{updatescrollbars}{} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 248 | Call this method when the document has changed. It will call |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 249 | \method{getscrollbarvalues()} and update the scrollbars. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 250 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 251 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 252 | \begin{methoddesc}[ScrolledWindow]{scrollbar_callback}{which, what, value} |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 253 | Supplied by you and called after user interaction. \var{which} will |
| 254 | be \code{'x'} or \code{'y'}, \var{what} will be \code{'-'}, |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 255 | \code{'--'}, \code{'set'}, \code{'++'} or \code{'+'}. For |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 256 | \code{'set'}, \var{value} will contain the new scrollbar position. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 257 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 258 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 259 | \begin{methoddesc}[ScrolledWindow]{scalebarvalues}{absmin, absmax, |
| 260 | curmin, curmax} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 261 | Auxiliary method to help you calculate values to return from |
Fred Drake | 41788db | 1998-04-04 06:23:02 +0000 | [diff] [blame] | 262 | \method{getscrollbarvalues()}. You pass document minimum and maximum value |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 263 | and topmost (leftmost) and bottommost (rightmost) visible values and |
| 264 | it returns the correct number or \code{None}. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 265 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 266 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 267 | \begin{methoddesc}[ScrolledWindow]{do_activate}{onoff, event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 268 | Takes care of dimming/highlighting scrollbars when a window becomes |
| 269 | frontmost vv. If you override this method call this one at the end of |
| 270 | your method. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 271 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 272 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 273 | \begin{methoddesc}[ScrolledWindow]{do_postresize}{width, height, window} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 274 | Moves scrollbars to the correct position. Call this method initially |
| 275 | if you override it. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 276 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 277 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 278 | \begin{methoddesc}[ScrolledWindow]{do_controlhit}{window, control, |
| 279 | pcode, event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 280 | Handles scrollbar interaction. If you override it call this method |
| 281 | first, a nonzero return value indicates the hit was in the scrollbars |
| 282 | and has been handled. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 283 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 284 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 285 | |
| 286 | \subsection{DialogWindow Objects \label{dialogwindow-objects}} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 287 | |
| 288 | DialogWindow objects have the following methods besides those of |
| 289 | \code{Window} objects: |
| 290 | |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 291 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 292 | \begin{methoddesc}[DialogWindow]{open}{resid} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 293 | Create the dialog window, from the DLOG resource with id |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 294 | \var{resid}. The dialog object is stored in \member{self.wid}. |
| 295 | \end{methoddesc} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 296 | |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 297 | \begin{methoddesc}[DialogWindow]{do_itemhit}{item, event} |
Fred Drake | b4efb6c | 1998-02-18 17:19:11 +0000 | [diff] [blame] | 298 | Item number \var{item} was hit. You are responsible for redrawing |
| 299 | toggle buttons, etc. |
Fred Drake | f6863c1 | 1999-03-02 16:37:17 +0000 | [diff] [blame] | 300 | \end{methoddesc} |