Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 82a8be034ef45778a36e24db776f17cb > files > 69

polyml-doc-5.4.1-1.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<title>Windows Interface Reference: Window structure</title>
</head>

<body>

<h1>Window </h1>

<p>The Window structure contains functions and structures to create and operate on
windows. Many other operations are available by sending messages to windows.</p>

<pre>structure Window :
sig
    type HWND and HINSTANCE and HMENU
    type POINT = { x: int, y: int }
    type RECT =  { left: int, top: int, right: int, bottom: int }

    structure Style:
    sig
        include BIT_FLAGS
        val WS_OVERLAPPED: flags and WS_POPUP: flags and WS_CHILD: flags and WS_MINIMIZE: flags
        and WS_VISIBLE: flags and WS_DISABLED:flags and WS_CLIPSIBLINGS:flags
        and WS_CLIPCHILDREN:flags and WS_MAXIMIZE:flags and WS_CAPTION:flags
        and WS_BORDER:flags and WS_DLGFRAME:flags and WS_VSCROLL:flags and WS_HSCROLL:flags
        and WS_SYSMENU:flags and WS_THICKFRAME:flags and WS_GROUP:flags and WS_TABSTOP:flags
        and WS_MINIMIZEBOX:flags and WS_MAXIMIZEBOX:flags and WS_TILED:flags and WS_ICONIC:flags
        and WS_SIZEBOX:flags and WS_OVERLAPPEDWINDOW:flags and WS_TILEDWINDOW:flags
        and WS_POPUPWINDOW:flags and WS_CHILDWINDOW:flags
    end

    datatype WindowPositionStyle =
            SWP_ASYNCWINDOWPOS
        |    SWP_DEFERERASE
        |    SWP_FRAMECHANGED
        |    SWP_HIDEWINDOW
        |    SWP_NOACTIVATE
        |    SWP_NOCOPYBITS
        |    SWP_NOMOVE
        |    SWP_NOOWNERZORDER
        |    SWP_NOREDRAW
        |    SWP_NOSENDCHANGING
        |    SWP_NOSIZE
        |    SWP_NOZORDER
        |    SWP_SHOWWINDOW
        |    SWP_OTHER of int

    datatype ShowWindowOptions =
        SW_HIDE
    |    SW_MAXIMIZE
    |    SW_MINIMIZE
    |    SW_RESTORE
    |    SW_SHOW
    |    SW_SHOWDEFAULT
    |    SW_SHOWMAXIMIZED
    |    SW_SHOWMINIMIZED
    |    SW_SHOWMINNOACTIVE
    |    SW_SHOWNA
    |    SW_SHOWNOACTIVATE
    |    SW_SHOWNORMAL

    val SW_NORMAL: ShowWindowOptions
    val SW_MAX: ShowWindowOptions

    val ShowWindow: HWND * ShowWindowOptions -&gt; bool

    datatype GetWindowFlags =
        GW_CHILD
    |    GW_HWNDFIRST
    |    GW_HWNDLAST
    |    GW_HWNDNEXT
    |    GW_HWNDPREV
    |    GW_OWNER

    datatype <a
href="#ParentType">ParentType</a> =
          ChildWindow of {id: int, parent: HWND}
        | PopupWindow of HMENU
        | PopupWithClassMenu

    val GWL_EXSTYLE : int
    val GWL_HINSTANCE : int
    val GWL_HWNDPARENT : int
    val GWL_ID : int
    val GWL_STYLE : int
    val GWL_USERDATA : int

    val AdjustWindowRect : RECT * Style.flags * bool -&gt; RECT
    val AdjustWindowRectEx :  RECT * Style.flags * bool * int -&gt; RECT
    val ArrangeIconicWindows : HWND -&gt; int
    val BringWindowToTop : HWND -&gt; unit
    val CW_USEDEFAULT : int
    val ChildWindowFromPoint : HWND * POINT -&gt; HWND option
    val CloseWindow : HWND -&gt; unit
    <a
name="CreateWindow">val CreateWindow</a> :
       {x: int, y: int, init: 'a, name: string, class: 'a Class.ATOM,
         style: Style.flags, width: int, height: int,
         instance: HINSTANCE, relation: ParentType} -&gt; HWND
    <a
name="DestroyWindow">val DestroyWindow</a>: HWND -&gt; unit
    val FindWindow: string * string option -&gt; HWND
    val FindWindowEx: HWND option * HWND option * string * string option -&gt; HWND
    val GetClassName : HWND -&gt; string
    val GetClientRect : HWND -&gt; RECT
    val GetDesktopWindow : unit -&gt; HWND
    val GetForegroundWindow : unit -&gt; HWND
    val GetLastActivePopup : HWND -&gt; HWND
    val GetNextWindow : HWND * GetWindowFlags -&gt; HWND
    val GetParent : HWND -&gt; HWND option
    val GetTopWindow : HWND option-&gt; HWND option
    val GetWindow : HWND * GetWindowFlags -&gt; HWND option
    val GetWindowContextHelpId : HWND -&gt; int
    val GetWindowLong : HWND * int -&gt; int
    val GetWindowRect : HWND -&gt; RECT
    val <a
name="GetWindowText">GetWindowText</a> : HWND -&gt; string
    val GetWindowTextLength : HWND -&gt; int
    val IsChild : HWND * HWND -&gt; bool
    val IsIconic : HWND -&gt; bool
    val IsWindow : HWND -&gt; bool
    val IsWindowVisible : HWND -&gt; bool
    val IsZoomed : HWND -&gt; bool
    <a
name="MoveWindow">val MoveWindow</a> : {x: int, y: int, hWnd: HWND, width: int, height: int, repaint: bool} -&gt; unit
    val OpenIcon : HWND -&gt; unit
    val SetForegroundWindow : HWND -&gt; bool
    val <a
name="SetParent">SetParent</a> : HWND * HWND option -&gt; HWND
    val SetWindowContextHelpId : HWND * int -&gt; unit
    val SetWindowLong : HWND * int * int -&gt; int
    val SetWindowPos : HWND * HWND * int * int * int * int * WindowPositionStyle list -&gt; unit
    val SetWindowText : HWND * string -&gt; unit
    val SubclassWindow :
       HWND *
       (HWND * Message.Message * 'a -&gt; Message.LRESULT option * 'a) * 'a -&gt; unit
    val WindowFromPoint : POINT -&gt; HWND option
end</pre>

<p><tt>datatype <a name="ParentType">ParentType</a> = ChildWindow of {id: int, parent:
HWND} | PopupWindow of HMENU &nbsp; |&nbsp; PopupWithClassMenu</tt><br>
The ParentType datatype is used as one of the arguments to CreateWindow.&nbsp;
PopupWithClassMenu and PopupWindow both create top-level windows.&nbsp; PopupWindow
provides a menu to be used whereas PopupWithClassMenu uses the menu, if any, given when
the class was created.&nbsp; ChildWindow creates a child of the given parent window and
provides an id for the child.&nbsp; All children must have different identifiers. &nbsp;
The identifier is used in <a href="Message.html#WM_NOTIFY">WM_NOTIFY</a> messages to
notify the parent about changes in the child and can be used to find a child window from
the parent using <a href="Dialog.html#GetDlgItem">GetDlgItem</a>. </p>

<p>&nbsp;</p>

<h4>Subclassing</h4>

<p>It is possible to replace a window procedure for a window by <em>subclassing</em> the
window.&nbsp; This is useful where a window is required which is almost the same as, say
an Edit window, but it needs to process a few messages in a special way.&nbsp; A new
window procedure is installed which process the particular messages but calls the original
window procedure for any of the others.</p>

<p>(The terminology is, in my opinion confusing: subclassing a window does not create a
new class of window but changes only a single window).&nbsp; In C this is done using the
SetWindowLong function: in ML there is a SubclassWindow function which does this and
automatically calls the window procedure of the base class for any messages which are not
otherwise processed.</p>
</body>
</html>