From: Dirk B. <db...@us...> - 2005-12-17 15:18:09
|
Update of /cvsroot/win32forth/win32forth/doc/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7804/doc/classes Added Files: Generic.htm Window.htm gdiBase.htm gdiPen.htm Log Message: Started documentation of the classes defined in w32f. --- NEW FILE: Generic.htm --- <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta name="GENERATOR" content="dexh00"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> </title><style><!-- h1 { font-family: Tahoma; font-size: 24pt; font-weight: bold } h2 { font-family: Tahoma; font-size: 18pt; font-weight: bold } --> </style> </head> <body><h1 align="center"> <a href="mailto:win...@ya...?subject=DOC:Doc error in $Id: Generic.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $"> <img border="0" src="../TELLUS.gif" align="left" width="32" height="32"></a> <img border="0" src="../FORTHPRO.gif" width="32" height="32"> Win32Forth</h1> <hr /><h1>Generic-Window -- Base class for all window objects. </h1><hr /><p>Generic-Window is the base class for all window objects. This class contains a single ivar, hWnd, that is the (MS Windows) handle for the window. This class encapsulates all the Win32 API calls that specify a window handle. There will be 3 subclasses of Generic-Window: </p><pre> Window Adds a device context and the ablility to display text and graphics output. Control Adds support for the standard Win32 controls with subclassing. Dialog Support for dialog boxes </pre><p>Since Generic-Window is a generic class it should not be used to create any instances. <br /> The Global Rectangle objects wRect and WndRect ( originally defined in Window.f ) have been replaced by a Rectangle IVAR WinRect so that Windows in different threads don't interfere with each other's drawing operations. <br /> For backwards compatibility wRect is defined as an int which is set to the address of WinRect by the ClassInit: method ( and WndRect is defined as an alias of wRect in Window.f. Also ) however WinRect should be used in new code since it uses early binding. ClientRect in class EditControl ( in Controls.f ) is also defined as an alias of wRect for compatibility. <br /> We also provide wRect as an alias of TempRect for compatibility. <br /> Temporarily added new generic class Dialog&Control and moved some code into it and duplicated the same code in Class Window so that Ivar offsets in Class Window are the same for temporary compatibility. </p><h2>Glossary </h2><pre><b><a name="0">:CLASS Generic-Window <Super Object </a></b></pre><p>Base class for all window objects. </p><h3>Instance Variables </h3><pre><b><a name="0">int hWnd </a></b></pre><p>handle to Win32 window object </p><h3>Methods </h3><pre><b><a name="0">:M Classinit: ( -- ) </a></b></pre><p>Init the class </p><pre><b><a name="0">:M GetHandle: ( -- hWnd ) </a></b></pre><p>Get the window handle </p><pre><b><a name="0">:M PutHandle: ( hWnd -- ) </a></b></pre><p>Set the window handle </p><pre><b><a name="0">:M ZeroWindow: ( -- ) </a></b></pre><p>Clear the window handle </p><pre><b><a name="0">:M DestroyWindow: ( -- ) </a></b></pre><p>Destroy the window </p><pre><b><a name="0">:M Close: ( -- ) </a></b></pre><p>Close the window </p><pre><b><a name="0">:M Paint: ( -- ) </a></b></pre><p>force window repaint </p><pre><b><a name="0">:M SetAlign: ( flag id -- ) \ hold over from the past </a></b></pre><p>Obsolescent Method use SetDlgItemAlign: instead </p><pre><b><a name="0">;CLASS </a></b></pre><p>End of generic-window class </p><hr><p>Document $Id: Generic.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $</p> </body></html> --- NEW FILE: gdiBase.htm --- <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta name="GENERATOR" content="dexh00"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> </title><style><!-- h1 { font-family: Tahoma; font-size: 24pt; font-weight: bold } h2 { font-family: Tahoma; font-size: 18pt; font-weight: bold } --> </style> </head> <body><h1 align="center"> <a href="mailto:win...@ya...?subject=DOC:Doc error in $Id: gdiBase.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $"> <img border="0" src="../TELLUS.gif" align="left" width="32" height="32"></a> <img border="0" src="../FORTHPRO.gif" width="32" height="32"> Win32Forth</h1> <hr /><h1>GdiObject -- Base class for GDI objects </h1><hr /><h3><i>Version 1.0 </i></h3><p>This GDI class library was written and placed in the Public Domain in 2005 by Dirk Busch </p><p>GdiObject is the base class for all GDI objects. This class contains a single ivar, hObject, that is the (MS Windows) handle for the GDI object. <br /> There will be the following subclasses of GdiObject: </p><pre>gdiPen Class for cosmetic pen's gdiGeometricPen Class for geometric pen's gdiSolidBrush Solid brush class gdiHatchBrush Hatch brush class gdiPatternBrush Pattern brush class gdiDIBPatternBrush DIBPattern brush class GdiFont Class for windows fonts gdiBitmap Class for bitmaps gdiMetafile Class for enhanced metafiles gdiDC Base device context class gdiWindowDC Device context class for windows gdiMetafileDC Device context class for enhanced metafiles </pre><p>Since GdiObject is a generic class it should not be used to create any instances. <br /> </p><h2>Glossary </h2><pre><b><a name="0">:class GdiObject <super object </a></b></pre><p>GdiObject is the base class for all GDI Object classes. </p><pre><b><a name="0">:M ZeroHandle: ( -- ) </a></b></pre><p>Clear the handle of the object. <br /> If the current handle of the object is valid it will not be destroyed. </p><pre><b><a name="0">:M GetType: ( -- n ) </a></b></pre><p>Get the type of the object. <br /> Possible return values are: </p><table border="1"><tr><td>OBJ_BRUSH </td> <td>Brush </td> </tr> <tr><td>OBJ_COLORSPACE </td> <td>Color space </td> </tr> <tr><td>OBJ_DC </td> <td>Device context </td> </tr> <tr><td>OBJ_ENHMETADC </td> <td>Enhanced metafile DC </td> </tr> <tr><td>OBJ_ENHMETAFILE </td> <td>Enhanced metafile </td> </tr> <tr><td>OBJ_EXTPEN </td> <td>Extended pen </td> </tr> <tr><td>OBJ_FONT </td> <td>Font </td> </tr> <tr><td>OBJ_MEMDC </td> <td>Memory DC </td> </tr> <tr><td>OBJ_METAFILE </td> <td>Metafile </td> </tr> <tr><td>OBJ_METADC </td> <td>Metafile DC </td> </tr> <tr><td>OBJ_PAL </td> <td>Palette </td> </tr> <tr><td>OBJ_PEN </td> <td>Pen </td> </tr> <tr><td>OBJ_REGION </td> <td>Region </td> </tr> </table><pre><b><a name="0">:M GetObject: ( cbBuffer lpvObject -- n ) </a></b></pre><p>Get information for the object. <br /> If the function succeeds, and lpvObject is a valid pointer, the return value is the number of bytes stored into the buffer. <br /> If the function succeeds, and lpvObject is NULL, the return value is the number of bytes required to hold the information the function would store into the buffer. If the function fails, the return value is zero. </p><pre><b><a name="0">:M Destroy: ( -- ) </a></b></pre><p>Destroy the object. </p><pre><b><a name="0">:M GetHandle: ( -- hObject ) </a></b></pre><p>Get the handle of the object. </p><pre><b><a name="0">:M SetHandle: ( hObject -- ) </a></b></pre><p>Set the handle of the object. <br /> If the current handle of the object is valid it will be destroyed. </p><pre><b><a name="0">:M Valid?: ( -- f ) </a></b></pre><p>Check if this object is valid. </p><pre><b><a name="0">;class </a></b></pre><p>End of class </p><pre><b><a name="0">: .gdi-objects ( -- ) \ w32f sys </a></b></pre><p>Display GDI objects whitch are currently defined. </p><pre><b><a name="0">: ?IsGdiObject ( a1 -- f ) \ w32f </a></b></pre><p>Check if a1 is the address of a GdiObject. </p><pre><b><a name="0">: GetGdiObjectHandle { GdiObject -- handle } \ w32f </a></b></pre><p>Check if GdiObject is the address of a valid GdiObject. If so return the handle of the object. </p><pre><b><a name="0">: ?GdiCheck ( a1 -- a1 ) \ w32f </a></b></pre><p>Verify if a1 is the address of a GdiObject. If a1 isn't the address of a GdiObject and the error checking is enabled the application will be aborted. <br /> Use it for debugging only. </p><hr><p>Document $Id: gdiBase.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $</p> </body></html> --- NEW FILE: gdiPen.htm --- <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta name="GENERATOR" content="dexh00"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> </title><style><!-- h1 { font-family: Tahoma; font-size: 24pt; font-weight: bold } h2 { font-family: Tahoma; font-size: 18pt; font-weight: bold } --> </style> </head> <body><h1 align="center"> <a href="mailto:win...@ya...?subject=DOC:Doc error in $Id: gdiPen.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $"> <img border="0" src="../TELLUS.gif" align="left" width="32" height="32"></a> <img border="0" src="../FORTHPRO.gif" width="32" height="32"> Win32Forth</h1> <hr /><h1>GdiPen -- Class for GDI Pens </h1><hr /><h3><i>Version 1.0 </i></h3><p>This GDI class library was written and placed in the Public Domain in 2005 by Dirk Busch </p><h2>Glossary </h2><a name="gdiPen"></a> <pre><b><a name="0">:class gdiPen <super gdiObject </a></b></pre><p>Class for cosmetic pen's </p><pre><b><a name="0">:M ClassInit: ( -- ) </a></b></pre><p>Init the class </p><pre><b><a name="0">:M SetStyle: ( style -- ) </a></b></pre><p>Set Syle of the pen. Possible values are: </p><table border="1"><tr><td>PS_DASH </td> <td>The pen is dashed. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_DOT </td> <td>The pen is dotted. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_DASHDOT </td> <td>The pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_DASHDOTDOT </td> <td>The pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_NULL </td> <td>The pen is invisible. </td> </tr> <tr><td>PS_INSIDEFRAME </td> <td>The pen is solid. When this pen is used in any GDI drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens. </td> </tr> </table><pre><b><a name="0">:M SetWidth: ( width -- ) </a></b></pre><p>Set the width of the pen in logical units. If Width is zero, the pen is a single pixel wide, regardless of the current transformation. </p><pre><b><a name="0">:M SetRValue: ( r -- ) </a></b></pre><p>Set the red component of the pen color. </p><pre><b><a name="0">:M SetGValue: ( g -- ) </a></b></pre><p>Set the green component of the pen color. </p><pre><b><a name="0">:M SetBValue: ( b -- ) </a></b></pre><p>Set the blue component of the pen color. </p><pre><b><a name="0">:M SetRGB: ( r g b -- ) </a></b></pre><p>Set the red, green and blue component of the pen color. </p><pre><b><a name="0">:M SetColor: ( colorref -- ) </a></b></pre><p>Set color of the pen. </p><pre><b><a name="0">:M SetSysColor: ( n -- ) </a></b></pre><p>Set the color of the pen to a system color. </p><pre><b><a name="0">:M ChooseColor: ( hWnd -- f ) </a></b></pre><p>Open a dialog to choose the color of the pen. </p><pre><b><a name="0">:M GetStyle: ( -- style ) </a></b></pre><p>Get Syle of the pen. Possible values are: </p><table border="1"><tr><td>PS_DASH </td> <td>The pen is dashed. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_DOT </td> <td>The pen is dotted. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_DASHDOT </td> <td>The pen has alternating dashes and dots. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_DASHDOTDOT </td> <td>The pen has alternating dashes and double dots. This style is valid only when the pen width is one or less in device units. </td> </tr> <tr><td>PS_NULL </td> <td>The pen is invisible. </td> </tr> <tr><td>PS_INSIDEFRAME </td> <td>The pen is solid. When this pen is used in any GDI drawing function that takes a bounding rectangle, the dimensions of the figure are shrunk so that it fits entirely in the bounding rectangle, taking into account the width of the pen. This applies only to geometric pens. </td> </tr> </table><pre><b><a name="0">:M GetWidth: ( -- width ) </a></b></pre><p>Get the width of the pen in logical units. If the width is zero, the pen is a single pixel wide, regardless of the current transformation. </p><pre><b><a name="0">:M GetRValue: ( -- r ) </a></b></pre><p>Get the red component of the pen color. </p><pre><b><a name="0">:M GetGValue: ( -- g ) </a></b></pre><p>Get the green component of the pen color. </p><pre><b><a name="0">:M GetBValue: ( -- b ) </a></b></pre><p>Get the blue component of the pen color. </p><pre><b><a name="0">:M GetColor: ( -- colorref ) </a></b></pre><p>Get the color of the pen as a windows COLORREF value. </p><pre><b><a name="0">:M Create: ( -- f ) </a></b></pre><p>Create the pen with the current style, color and width. </p><pre><b><a name="0">:M CreateIndirect: ( pLogpen -- f ) </a></b></pre><p>The CreateIndirect function creates a logical cosmetic pen that has the style, width, and color specified in a structure. </p><pre><b><a name="0">;class </a></b></pre><p>End of class </p><a name="gdiGeometricPen"></a> <pre><b><a name="0">:class gdiGeometricPen <super gdiObject </a></b></pre><p>Class for geometric pen's <br /> Note: this class isn't implemented yet </p><pre><b><a name="0">:M ClassInit: ( -- ) </a></b></pre><p>Init the class </p><pre><b><a name="0">;class </a></b></pre><p>End of class </p><hr><p>Document $Id: gdiPen.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $</p> </body></html> --- NEW FILE: Window.htm --- <html> <head> <meta http-equiv="Content-Language" content="en-gb"> <meta name="GENERATOR" content="dexh00"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title> </title><style><!-- h1 { font-family: Tahoma; font-size: 24pt; font-weight: bold } h2 { font-family: Tahoma; font-size: 18pt; font-weight: bold } --> </style> </head> <body><h1 align="center"> <a href="mailto:win...@ya...?subject=DOC:Doc error in $Id: Window.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $"> <img border="0" src="../TELLUS.gif" align="left" width="32" height="32"></a> <img border="0" src="../FORTHPRO.gif" width="32" height="32"> Win32Forth</h1> <hr /><h1>Window -- Class for window objects. </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. </p><pre><b><a name="0">:M Width: ( -- width ) </a></b></pre><p>Get the width of the window. </p><pre><b><a name="0">:M Height: ( -- height ) </a></b></pre><p>Get the height of the window. </p><pre><b><a name="0">:M SetSize: ( w h -- ) </a></b></pre><p>Set the size (width and height) of the window. <br /> Note: The window itself will not be resized. </p><pre><b><a name="0">:M On_Size: ( -- ) </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 or call the SetSize: method before you create the window. </p><pre><b><a name="0">:M SetOrigin: ( x y -- ) </a></b></pre><p>To set the upper left corner of the window when it's created call the SetOrigin: method before you create the window. </p><pre><b><a name="0">:M StartPos: ( -- left top ) </a></b></pre><p>User windows should override the StartPos: method to set the upper left corner of the window when it's created. </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: :M On_Init: ( -- ) On_Init: super ... other initialization ... ;M :M On_Done: ( -- ) ... other cleanup ... On_Done: super ;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 ) bye 0 ;M :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 </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 </a></b></pre><p>The window's device context. <br /> It will be valid only when handling the WM_PAINT message (see On_Paint: method) </p><pre><b><a name="0">Record: &ps </a></b></pre><p>The PAINTSTRUCT for Begin- and EndPaint <br /> It will be valid only when handling the WM_PAINT message (see On_Paint: method) </p><pre><b><a name="0">:M On_EraseBackground: ( hwnd msg wparam lparam -- res ) </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 /> Before this method is called BeginPaint will be called so that the PAINTSTRUCT (&PS ivar) and the window device context (DC ivar) are initialized. <br /> Check ps_fErase in your method to see if the background of the window should 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 /> Example: When cursor is used, you will need something like the following to control the position of the cursor in the window: </p><pre> cursor-col char-width * cursor-row char-height * char-width char-height MakeCursor: self </pre><pre><b><a name="0">:M On_KillFocus: ( h m w l -- ) </a></b></pre><p>Override the method to handle the WM_KILLFOCUS message. <br /> Example: Use only when you are displaying a cursor in the window: </p><pre> DestroyCursor: self </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 -- ) </a></b></pre><p>If you define an application specific window class or window object that redefines the method Win32Forth: to perform its own function rather than just doing a beep, then your window will be able to handle interprocess messages. </p><pre><b><a name="0">:M DefWindowProc: ( h m w l -- res ) </a></b></pre><p>Call the DefaultWindowProc for the window. </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 -- ) </a></b></pre><p>Enable or disable the window. </p><pre><b><a name="0">:M GetWindowRect: ( -- left top right bottom ) </a></b></pre><p>The GetWindowRect method retrieves the dimensions of the bounding rectangle of the window. 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: Window.htm,v 1.1 2005/12/17 15:18:00 dbu_de Exp $</p> </body></html> |