From: George H. <geo...@us...> - 2006-01-25 11:11:11
|
Update of /cvsroot/win32forth/win32forth/doc/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15558/win32forth/doc/classes Modified Files: Window.htm Log Message: gah: Some optimizations and documenting Index: Window.htm =================================================================== RCS file: /cvsroot/win32forth/win32forth/doc/classes/Window.htm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Window.htm 8 Jan 2006 09:28:07 -0000 1.5 --- Window.htm 25 Jan 2006 11:10:52 -0000 1.6 *************** *** 19,26 **** </h1><hr /><h2>Glossary </h2><pre><b><a name="0">:CLASS Window <SUPER Generic-Window ! </a></b></pre><p>Class for window objects. </p><pre><b><a name="0">:M ClassInit: ( -- ) ! </a></b></pre><p>Init the class ! </p><h3>Window sizeing </h3><pre><b><a name="0">:M GetSize: ( -- w h ) </a></b></pre><p>Get the size (width and height) of the window. --- 19,26 ---- </h1><hr /><h2>Glossary </h2><pre><b><a name="0">:CLASS Window <SUPER Generic-Window ! </a></b></pre><p>Base class for window objects. </p><pre><b><a name="0">:M ClassInit: ( -- ) ! </a></b></pre><p>Initialise the class. ! </p><h3>Window sizing </h3><pre><b><a name="0">:M GetSize: ( -- w h ) </a></b></pre><p>Get the size (width and height) of the window. *************** *** 35,43 **** </a></b></pre><p>User windows should override the On_Size: method. When this method is called, the variables Width and Height will have already been set. <br /> ! default does nothing </p><pre><b><a name="0">:M MinSize: ( -- width height ) ! </a></b></pre><p>To change the minimum window size, override the MinSize: method. </p><pre><b><a name="0">:M MaxSize: ( -- width height ) ! </a></b></pre><p>To change the maximum window size, override the MaxSize: method. </p><pre><b><a name="0">:M StartSize: ( -- width height ) </a></b></pre><p>To change the size of the window when it's created, override the StartSize: method --- 35,43 ---- </a></b></pre><p>User windows should override the On_Size: method. When this method is called, the variables Width and Height will have already been set. <br /> ! Default does nothing </p><pre><b><a name="0">:M MinSize: ( -- width height ) ! </a></b></pre><p>To change the minimum window size, override the MinSize: method. Default is 10 by 10. </p><pre><b><a name="0">:M MaxSize: ( -- width height ) ! </a></b></pre><p>To change the maximum window size, override the MaxSize: method. Default is 8192 by 8192. </p><pre><b><a name="0">:M StartSize: ( -- width height ) </a></b></pre><p>To change the size of the window when it's created, override the StartSize: method *************** *** 51,57 **** </p><h3>Window creation </h3><pre><b><a name="0">:M On_Init: ( -- ) ! </a></b></pre><p>Thing's to do during creation of the window. </p><pre><b><a name="0">:M On_Done: ( -- ) ! </a></b></pre><p>Thing's to do when the window will be destroyed. </p><pre>Your On_Init: and On_Done: methods should look like this: --- 51,57 ---- </p><h3>Window creation </h3><pre><b><a name="0">:M On_Init: ( -- ) ! </a></b></pre><p>Thing's to do during creation of the window. Default does nothing. </p><pre><b><a name="0">:M On_Done: ( -- ) ! </a></b></pre><p>Thing's to do when the window will be destroyed. Default does nothing. </p><pre>Your On_Init: and On_Done: methods should look like this: *************** *** 66,73 **** ;M ! An application window will need the following methods, which cause the program to terminate when the user closes the main application window. ! Don't un-comment these out here, copy them into your application window ! Object or Class, and them un-comment them out. :M WM_CLOSE ( h m w l -- res ) --- 66,74 ---- ;M ! ! The main application window will need the following methods, which cause the program to terminate when the user closes the main application window. ! Don't uncomment these out here, copy them into your application window ! Object or Class, and then uncomment them out. :M WM_CLOSE ( h m w l -- res ) *************** *** 79,106 **** On_Done: super \ cleanup the super class 0 ;M </pre><pre><b><a name="0">:M SetClassName: ( adr len -- ) </a></b></pre><p>User windows should override the SetClassName: method to set the window class name. </p><pre><b><a name="0">:M GetClassName: ( -- adr len ) ! </a></b></pre><p>Get the window class name </p><pre><b><a name="0">:M SetParent: ( hwndParent -- ) ! </a></b></pre><p>Set owner window (0 if no parent) </p><pre><b><a name="0">:M ParentWindow: ( -- hwndparent | 0 if no parent ) ! </a></b></pre><p>Get owner window </p><pre><b><a name="0">:M DefaultCursor: ( -- cursor-id ) </a></b></pre><p>User windows should override the DefaultCursor: method to ! set the default cursor for window </p><pre><b><a name="0">:M DefaultIcon: ( -- hIcon ) </a></b></pre><p>User windows should override the WindowStyle: method to ! set the default icon handle for window. </p><pre><b><a name="0">:M WindowStyle: ( -- style ) </a></b></pre><p>User windows should override the WindowStyle: method to ! set the window style. </p><pre><b><a name="0">:M ExWindowStyle: ( -- extended_style ) </a></b></pre><p>User windows should override the ExWindowStyle: method to ! set the extended window style. </p><pre><b><a name="0">:M WindowTitle: ( -- Zstring ) </a></b></pre><p>User windows should override the WindowTitle: method to ! set the window caption. </p><h3>Painting </h3><pre><b><a name="0">WinDC dc --- 80,115 ---- On_Done: super \ cleanup the super class 0 ;M + + For multi-tasking applications the main window of each task should define + the following method, to quit the message loop and exit the task. + + :M On_Done: ( h m w l -- res ) + 0 call PostQuitMessage drop \ terminate application + On_Done: super \ cleanup the super class + 0 ;M </pre><pre><b><a name="0">:M SetClassName: ( adr len -- ) </a></b></pre><p>User windows should override the SetClassName: method to set the window class name. </p><pre><b><a name="0">:M GetClassName: ( -- adr len ) ! </a></b></pre><p>Get the window class name. </p><pre><b><a name="0">:M SetParent: ( hwndParent -- ) ! </a></b></pre><p>Set owner window (0 if no parent). </p><pre><b><a name="0">:M ParentWindow: ( -- hwndparent | 0 if no parent ) ! </a></b></pre><p>Get owner window. </p><pre><b><a name="0">:M DefaultCursor: ( -- cursor-id ) </a></b></pre><p>User windows should override the DefaultCursor: method to ! set the default cursor for window. Default is IDC_ARROW. </p><pre><b><a name="0">:M DefaultIcon: ( -- hIcon ) </a></b></pre><p>User windows should override the WindowStyle: method to ! set the default icon handle for window. Default is the W32F icon. </p><pre><b><a name="0">:M WindowStyle: ( -- style ) </a></b></pre><p>User windows should override the WindowStyle: method to ! set the window style. Default is WS_OVERLAPPEDWINDOW. </p><pre><b><a name="0">:M ExWindowStyle: ( -- extended_style ) </a></b></pre><p>User windows should override the ExWindowStyle: method to ! set the extended window style. Default is null. </p><pre><b><a name="0">:M WindowTitle: ( -- Zstring ) </a></b></pre><p>User windows should override the WindowTitle: method to ! set the window caption. Default is Window. </p><h3>Painting </h3><pre><b><a name="0">WinDC dc *************** *** 115,119 **** </a></b></pre><p>User windows should override the On_EraseBackground: method to handle WM_ERASEBKGND messages. <br /> ! Default does nothing </p><pre><b><a name="0">:M On_Paint: ( -- ) </a></b></pre><p>User windows should override the On_Paint: method to handle WM_PAINT messages. <br /> --- 124,128 ---- </a></b></pre><p>User windows should override the On_EraseBackground: method to handle WM_ERASEBKGND messages. <br /> ! Default does nothing. </p><pre><b><a name="0">:M On_Paint: ( -- ) </a></b></pre><p>User windows should override the On_Paint: method to handle WM_PAINT messages. <br /> *************** *** 123,141 **** be drawn and use ps_left, ps_top, ps_right and ps_bottom to see whitch part of the window should be painted. <br /> ! Default does nothing </p><h3>Menu support </h3><pre><b><a name="0">:M WindowHasMenu: ( -- flag ) ! </a></b></pre><p>Override this method if your window has a menu </p><h3>Cursor (caret) support </h3><pre><b><a name="0">:M MoveCursor: ( gx gy -- ) ! </a></b></pre><p>Move the caret </p><pre><b><a name="0">:M MakeCursor: ( gx gy width height -- ) ! </a></b></pre><p>Create the caret </p><pre><b><a name="0">:M DestroyCursor: ( -- ) ! </a></b></pre><p>Destroy the caret </p><pre><b><a name="0">:M ShowCursor: ( -- ) ! </a></b></pre><p>Show the caret </p><pre><b><a name="0">:M HideCursor: ( -- ) ! </a></b></pre><p>Hide the caret </p><pre><b><a name="0">:M On_SetFocus: ( h m w l -- ) </a></b></pre><p>Override the method to handle the WM_SETFOCUS message. <br /> --- 132,151 ---- be drawn and use ps_left, ps_top, ps_right and ps_bottom to see whitch part of the window should be painted. <br /> ! Default does nothing. </p><h3>Menu support </h3><pre><b><a name="0">:M WindowHasMenu: ( -- flag ) ! </a></b></pre><p>Flag is true if the window has a menu. Override this method if your window has a ! menu. Default is false. </p><h3>Cursor (caret) support </h3><pre><b><a name="0">:M MoveCursor: ( gx gy -- ) ! </a></b></pre><p>Move the caret. </p><pre><b><a name="0">:M MakeCursor: ( gx gy width height -- ) ! </a></b></pre><p>Create the caret. </p><pre><b><a name="0">:M DestroyCursor: ( -- ) ! </a></b></pre><p>Destroy the caret. </p><pre><b><a name="0">:M ShowCursor: ( -- ) ! </a></b></pre><p>Show the caret. </p><pre><b><a name="0">:M HideCursor: ( -- ) ! </a></b></pre><p>Hide the caret. </p><pre><b><a name="0">:M On_SetFocus: ( h m w l -- ) </a></b></pre><p>Override the method to handle the WM_SETFOCUS message. <br /> *************** *** 151,155 **** </pre><h3>Keyboard and mouse handling </h3><pre><b><a name="0">:M PushKey: ( c1 -- ) ! </a></b></pre><p>override to process keys yoruself </p><h3>Message handling </h3><pre><b><a name="0">:M Win32Forth: ( h m w l -- ) --- 161,165 ---- </pre><h3>Keyboard and mouse handling </h3><pre><b><a name="0">:M PushKey: ( c1 -- ) ! </a></b></pre><p>override to process keys yoruself. </p><h3>Message handling </h3><pre><b><a name="0">:M Win32Forth: ( h m w l -- ) *************** *** 162,167 **** </p><h3>everything else... </h3><pre><b><a name="0">:M CenterWindow: ( -- x y ) ! </a></b></pre><p>Calc the position of the window to center it in the middle of it's parent window. ! Whe the windows has no parent it will be placed in the middle of the primary display monitor. </p><pre><b><a name="0">:M Enable: ( f1 -- ) --- 172,177 ---- </p><h3>everything else... </h3><pre><b><a name="0">:M CenterWindow: ( -- x y ) ! </a></b></pre><p>Calculate the position of the window to center it in the middle of it's parent window. ! When the windows has no parent it will be placed in the middle of the primary display monitor. </p><pre><b><a name="0">:M Enable: ( f1 -- ) *************** *** 171,183 **** The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. </p><pre><b><a name="0">:M SetTitle: { adr len \ temp$ -- } ! </a></b></pre><p>Set the window title </p><pre><b><a name="0">;CLASS ! </a></b></pre><p>End of window class </p><pre><b><a name="0">: find-window ( z"a1 -- hWnd ) \ w32f ! </a></b></pre><p>Find a window </p><pre><b><a name="0">: send-window ( lParam wParam Message_ID hWnd -- ) \ w32f ! </a></b></pre><p>Send a message to a window </p><pre><b><a name="0">: LoadIconFile ( adr len -- hIcon ) \ w32f ! </a></b></pre><p>load an icon from a icon file </p><hr><p>Document $Id$</p> </body></html> --- 181,193 ---- The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. </p><pre><b><a name="0">:M SetTitle: { adr len \ temp$ -- } ! </a></b></pre><p>Set the window title. </p><pre><b><a name="0">;CLASS ! </a></b></pre><p>End of window class. </p><pre><b><a name="0">: find-window ( z"a1 -- hWnd ) \ w32f ! </a></b></pre><p>Find a window. </p><pre><b><a name="0">: send-window ( lParam wParam Message_ID hWnd -- ) \ w32f ! </a></b></pre><p>Send a message to a window. </p><pre><b><a name="0">: LoadIconFile ( adr len -- hIcon ) \ w32f ! </a></b></pre><p>Load an icon from a icon file. </p><hr><p>Document $Id$</p> </body></html> |