Lines Matching full:code
6 In this document we use the <CODE>FrameWork</CODE> and <CODE>TextEdit</CODE>
20 <dt> <CODE>Application</CODE>
23 the main event handling code. Normal use is to override the <code>__init__</code> routine
24 to do your own initializations and override <code>makeusermenus</code> to create your menus
26 The event handling code can be overridden at various levels, from very low-level (the
27 <code>dispatch</code> method) to intermediate level (<code>do_keyDown</code>, for instance)
28 to high-level (<code>do_key</code>). The application class knows about the <code>Window</code>
30 would have a <code>do_key</code> method in your window object, not your application object).
32 <dt> <CODE>MenuBar</CODE>, <CODE>Menu</CODE> and <CODE>MenuItem</CODE>
34 These classes (and a few friends like <CODE>SubMenu</CODE>) handle your menus. You would not
36 see the test code at the bottom of FrameWork for sample use. The apple menu is handled for you
37 by <CODE>MenuBar</CODE> and <CODE>Application</CODE>.
39 <dt> <CODE>Window</CODE>
43 structure but actually opening the window is delayed until you call <code>open</code>. Your
44 open method should call <code>do_postopen</code> to let the base class handle linking in to
45 the application object. Similarly with <code>close</code> and <code>do_postclose</code>. The
46 rest of the code is mainly event-oriented: you override <code>do_postresize</code>,
47 <code>do_contentclick</code>, <code>do_update</code>, <code>do_activate</code>
48 and <code>do_key</code> to "do your thing". When these methods are called the relevant environment
49 has been setup (like <code>BeginDrawing</code> has been called for updates, etc).
51 <dt> <CODE>windowbounds</CODE>
58 <dt> <CODE>ControlsWindow</CODE>
62 <code>do_controlhit</code>.
64 <dt> <CODE>ScrolledWindow</CODE>
66 …lass of ControlsWindow, a window with optional scrollbars. If you override <code>do_activate</code>
67 or <code>do_postresize</code> you must call the ScrolledWindow methods at the end of your override.
68 You call <code>scrollbars</code> to enable/disable scrollbars and <code>updatescrollbars</code> to
69 update them. You provide <code>getscrollbarvalues</code> to return the current x/y values (a helper
70 method <code>scalebarvalues</code> is available) and <code>scrollbarcallback</code> to update your
73 <dt> <CODE>DialogWindow</CODE>
85 Ped creates two classes, <code>TEWindow</code> and <code>Ped</code>. Let us start with the latter o…
86 which is a subclass of <code>FrameWork.Application</code> and our main application. The init functi…
88 and sets things up for menu disable to work. Remember, the <code>makeusermenus</code> is called
91 <code>Makeusermenus</code> creates the <code>File</code> and <code>Edit</code> menus. It also initi…
96 <code>Updatemenubar</code> handles greying out (and re-enabling) of menu items depending on whether…
101 … case!) and call the appropriate window method. Only the <code>_open</code> method (the common code
102 for <code>Open</code> and <code>New</code>) deserves some mention. It instantiates a <code>TEWindow…
108 Oh yes: the <code>quit</code> callback does a little magic too. It closes all windows, and only if …
112 Lastly, there is the <code>idle</code> method, called by the Application base class when no event
115 The <code>TEWindow</code> object handles a single window. Due to this structuring it is absolutely …
117 two windows refer to the same document). TEWindow uses the standard init code inherited from
118 <code>ScrolledWindow</code>, and sets itself up at the time of the <code>open</code> call. It obtai…
119 …s, opens the window, creates rectangles for TextEdit to work in (the magical number <code>15</code>
122 initial values will be obtained automatically through <code>getscrollbarvalues</code>) and we activ…
123 ourselves (this is unfortunately not done automatically by the MacOS event handling code). <p>
125 <code>Do_idle</code> simply calls the TextEdit routine that blinks the cursor. <code>Getscrollbarva…
126 …the current X and Y scrollbar values, scaled to <code>0..32767</code>. For X we return <code>None<…
127 which means "no scrollbar, please", for Y we use the scaler provided by <code>ScrolledWindow</code>…
129 <code>Scrollbar_callback</code> is called when the user uses the scrollbar. It is passed a string <…
130 or <code>'y'</code>, one of <code>'set', '-', '--', '+', '++'</code> and (for <code>set</code>) an …
131 value. Note that the sign of the value passed to <code>TEPinScroll</code> is counter-intuitive. <p>
133 <code>do_activate</code> (de)activates the scrollbars and calls the relevant TextEdit routine. More…
135 are update and menu callbacks, and pretty straightforward. Note that <code>do_close</code> can
137 Also note the "magic" in <code>menu_save_as</code>
142 back and forth. <code>Have_selection</code> is called by the menubar update code to determine wheth…