## Description

Include file: xfrmwnd.h

Parent class: XWindow

### Overview

XFrameWindow is a window class which has a child and a frame. It supports menus and toolbars.

### Functions

#### SetBackgroundColor

#### Parameters

XColor * theNewColor

#### Remarks

With this function you set the color wich is used to fill the background in XFrameWindow::FillBackground(). Default color is black. If you change background color, you should do this before you start to insert client-windows.

#### XFrameWindow

#### Parameters

XResource * resource | a XResource contains two informations, an ID and a pointer to a XResourceLibrary. If you want to create a window out of a resourcefile you must specify the ID (otherwise it can be zero) and the XResourceLibrary which contains the window-resource. The window which is created always belongs to the process who owns the resource library, so if you work with multiple processes every process must have its own resource library.
char * theTitle | The title of the window which is displayed in the titlebar
ULONG style | You can specify the style of the window with the following defines, which can be or-ed:
FRM_TITLEBAR | the window gets a titlebar
FRM_SYSMENU | the window gets the system menu
FRM_MINBUTTON | the titlebar get a button to minimize the window
FRM_MAXBUTTON | the titlebar get a button to maximize the window
FRM_CENTER | the window is created in the midle of the workplace
FRM_SIZEBORDER | the windowsize can be changed by the user
FRM_DIALOGBORDER | the window gets a thick border
FRM_BORDER | the window gets a thin border
FRM_TASKLIST | the window is displayed in the tasklist
FRM_NOMOVEWITHOWNER | the window dontīt move when the parent is moved
FRM_ICON | the window get an icon wich is identified by theResourceID, if the icon is not found in the resource-library, an error ocurses
FRM_ACCELTABLE | an acceltable will be loaded from the resources with the windows id.
FRM_SYSMODAL | the window is displayed system-modal
FRM_SCREENALIGN |
FRM_MOUSEALIGN |
FRM_HIDEBUTTON |
FRM_HIDEMAX |
FRM_AUTOICON |
there are three static member-variables for default styles
defaultStyle | default setting for a framewindow
defaultClientStyle | default setting for windows wich are displayed as a clientwindow of a framewindow
defaultDialogStyle | default setting for windows wich are displayed as a dialog
Default is defaultStyle.
XRect * theRectangle | On default a window is created with length and hight of zero. Windows which are created with an resource template get the size of the template. Default is NULL. If theRectangle is specified, the window gets the size of it.
XFrameWindow * parent | If parent is specified the window is a client of the parent. The behavior depends on the styles you have set. Default is NULL.
BOOL buildFromResource | If this variable is set OOL try to build the window with a resource template which is identified by theResourceID. If the template is not found, an error ocurses. Default is FALSE.
BOOL animate | Enable/disable animation on window creation. Default is FALSE

#### Remarks

Construct a frame-window Note that destructors of windows are called automaticaly when a window is closed! (see ~XFrameWindow)

#### Exceptions

If the method fails an exception of the type XException is thrown.

#### ~XFrameWindow

#### Remarks

Destructors of windows are called automaticaly when the window is closed. The destructor of XFrameWindow calles the destructor of every client window, menus and toolbars. Also the destructors of handlers (derived classes of XHandler) which are attached with it are called. If the last XFrameWindow of a process is closed, the process will terminate.
If you want to close a window yourself, destruct the window with delete.

#### Activate

#### Remarks

Activate the window

#### Enable

#### Parameters

BOOL enable enables/disables the window (default is TRUE)

#### Remarks

Enables/disables a window for user-input

#### InitMenu

#### Parameters

XMenu * theMenu

#### Remarks

If a menu must be initialized this function is called. If you want to setup the menu dynamicaly, override this function.

#### ShowModal

#### Parameters

XFrameWindow * theOwnerWindow the window which is disabled until this window is closed

#### Remarks

ShowModal displays a window modal for another window which is specified in the first parameter, that means that the user cannot perform any input with the specified window. WARNING: you should only use this function for windows which are constructed with a resource template! If you do so the operating system stops with executing the calling code until the window is closed, otherwise the calling code is executed while the window is displayed.

#### Draw

#### Remarks

This function is called if a window or a part of it must be redrawn. If you use a window which is not created from a resource template or you dontīt have set a client with SetClient(), you must override this function and call FillBackground().

#### EnableWindowUpdate

#### Parameters

BOOL enable enable/disable window drawing (default is TRUE)

#### Remarks

This function can stop drawing the window contents until you allow drawing. For complex windows there can be some performance-advantages.
WARNING: If you disable drawing of a window and attach a XToolBar to it, the position and size of the toolbar can not set correctly.

#### FillBackground

#### Remarks

FillBackground fills the background in the color you have set with SetBackgroundColor (default is black). Usualy you call this function when you have overridden XFrameWindow::Draw(). You donīt have to call this function if a resource defined window is displayed or a window is set as client with XFrameWindow::SetClient().

#### GetHandle

#### Return-Value

OOL_WINDOWHANDLE theSystemHandle

#### Remarks

GetHandle returns the window-handle defined by the operating system. The handle is different from the ID of the window and the pointers used by the OOL. In XFrameWindow the function returns:

1. if you have set a client window with function XFrameWindow::SetClient() the handle of the client
2. if the XFrameWindow displays a resource-defined window, the resource window handle is returned
3. on default, the handle of the client-rect is returned

#### GetProcess

#### Return-Value

XProcess * onwer process

#### Remarks

Returns a pointer to the owning process (XApplication or XThread or derived class) of this window.

#### GetWindow

#### Parameters

ULONG theWindowID the ID of the client window

#### Return-Value

XWindow * thePointer the pointer to the window you have asked for. If you know the type of the window, you can make a typcast to the needed class.

#### Remarks

With GetWindow you can get a pointer of a child-window of XFrameWindow. Usualy it is used if the XFrameWindow is created with a resource template.
Also you can get a pointer to windows which are created dynamicaly if you have specified an ID in the constructors of these windows. In this case you donīt need to store the pointers in your program.

#### QueryForClose

#### Return-Value

BOOL canBeClosed return TRUE if the window can be closed, otherwise return FALSE

#### Remarks

If the user trys to close a XFrameWindow this function is called. If you want to check if the window can be closed or not or to perform a security-check (for example with XMessageBox), override this function. This function is not called if you destroy the window with delete.

#### SetClient

#### Parameters

XWindow * theNewClient

#### Remarks

SetClient is used to set a window, for example a control like a XMultiLineEdit, as a clientwindow of the XFrameWindow so sizing, moving and painting is automaticaly done. Moving/Sizing automaticaly may fail if the client is a frame-window.

#### SetIcon

#### Parameters

OOL_ICONHANDLE theNewIcon

#### Remarks

Set the icon which is displayed in the button of the system menu.

#### GetClientSize

#### Parameters

XRect * rect buffer to hold the data

#### Remarks

Query the size of the client area

#### GetSize

#### Parameters

XRect * buffer to hold data

#### Remarks

Get the size and position of a window

#### SetBottom

#### Remarks

Set the window to the bottom (in z-order)

#### SetSize

#### Parameters

XRect * theNewSize

#### Remarks

Set the size and/or position of a window

#### SetTop

#### Remarks

Set the window to the top (in z-order)

#### Show

#### Parameters

BOOL show TRUE=show, FALSE=hide

#### Remarks

Displayes a window. The window wil be activated an be shown at the topmost position (in z-order). If the window is minimized the old position and size will be restored.

#### GetText

#### Parameters

XString * theBuffer theBuffer will contain the title of the window

#### Remarks

Query the title of the window

#### SetText

#### Parameters

char * theNewText

#### Remarks

Set the Text which is displayed in the titlebar

#### DoCommand

#### Parameters

LONG theCommandID the ID of the menuitem/toolbar-button

#### Return-Value

BOOL handled

#### Remarks

If the user selected a menuitem (from XMenuBar or XPopupMenu) if the user pressed a button of a toolbar which is attached to it the framewindow, this function is called. To get the ID of the action the user requested, override this function. Return TRUE if you have handled the command, otherwise return FALSE.

This document was generated by Jens von Pilgrim's Autodoc