[Home] [Prev] [Next] [Up]


XGWindow class

The base window class.

Usage:

#include <XWindow.h>

class XGWindow;

Description

This is the root of the YAAF window handling class.

Inheritance

The Window class inherits from the XGView class, which means that the window itself can be overridden to provide custom drawing, mouse click, and other functionality.

The Window class also inherits from the XGDispatch class, and overriding the XGDispatch::ReceiveDispatch() method can be used to provide window-specific menu commands.

Todo:

On the WinOS environment, iconic windows aren't being handled very well. Specifically, when the window is iconified, the correct icon needs to be associated with the window. And under Win95 and WinNT v4.0, some form of association to the small icon in the upper-left corner needs to be provided.

Construction/Destruction

XGWindow::XGWindow(XGSWindowInitRecord &init)
XGWindow::XGWindow(XGArgStream &init)

This creates the specified window. Normally you would create a window using the static XGWindow::Create() method instead.

XGWindow::~XGWindow

This deletes the window from the display and releases all the resources associated with this window.

Window Orderly Creation and Destruction

XGWindow *XGWindow:Create(short id)

This creates the window from the 'VRes' resource. This is the normal way you would create a window.

XGWindow *XGWindow:Create(XGSWindowInitRecord &init)

This initializes an empty window based on the initialization parameters provided. These parameters are similar to those in the VRes resource. Those parameters are:

fViewType The view type of the view (or window). Normally used by the construction factory to determine what type of window to construct.
fWindowType

A constant which determines the type of window to create. The types defined are:

KWinTypeDocument

Standard document type

KWinTypeModal

A modal window

KWinTypeMovableModal

A movable modal dialog window.

KWinTypeFloating

A floating window.

NOTE: These types need to be checked and tested in the MacOS and WinOS creation code. I don't think they work quite right, and I know I haven't tested it yet.

windowID This is the viewID for this window.
fVisible true if the window should be constructed visible
screenLeft The left side of the screen where this window should appear. If -1, uses default values.
screenTop The top side of this window. If -1, use default values.
screenRight The right side; if -1, use defaults
screenBottom The bottom; if -1, use defaults
minx The minimum size this window can get. If -1, use default setting
miny The minimum size of this window; if -1, use default setting
maxx The maximum allowable size of this window; if -1, use default setting
maxy The maximum allowable size;; if -1, use default setting
initx The initial size of this window, if not specified in the screen size parameters. If -1, use defaults
inity The initial size of this window, if not specified in the size parameters. If -1, use defaults
zoomx The size this window should be zoomed to. If -1, use defaults. This doesn't work on WinOS right now.
zoomy The size of this window when zoomed; if -1, used efaults. This doesn't work on WinOS right now.
windowName The newly created name of this window.

bool XGWindow::CloseWindow(void)

This attempts to close this window, and if successful, returns true. This attempts to save the file associated with this window, if a document is associated with this winodw.

void XGWindow::SetDocument(XGDocument *doc)

This sets the document associated with this window. This should be called immediately after the window is created if a document is to be associated with this window.

Window initialization parameters

Point XGWindow::MinWindowSize(void)
Point XGWindow::MaxWindowSize(void)
Point XGWindow::InitWindowSize(void)
Point XGWindow::ZoomWindowSize(void)

These routines provide a programmatic way to override the corrisponding fields that were supplied during this window's initialization.

Todo: check to make sure that this is in fact what's happening.

Document Support

bool XGWindow::IsDirty(void)
bool XGWindow::DoSave(void)

These two routines are used to provide document support. By default they call the document's IsDirty and DoSave methods. If you want to use a different document mechanism than the one in YAAF, you can override these two methods, and they will hook into the CloseWindow method to optionally save and close a window.

Window Attributes

void XGWindow::GetWindowName(char *name)

This gets the name of this window.

void XGWindow::SetWindowName(char *name)

This sets the name of this window.

short XGWindow::GetMenuBarID(void)

This returns the resource ID of the menu bar that is to be associated with this window when it comes active. On an SDI or an MDI application on WinOS, this will put up and/or change the menu bar to a different menu.

short XGWindow::GetWindowType(void)

This gets the type of this window. The type is the type provided in the initialization parameters.

Window Support

bool XGWindow::IsShowWindow(void)
void XGWindow::ShowWindow(void)
void XGWindow::HideWindow(void)

These routines are used to show and hide a window. Todo: hook these into the view's visibility attributes instead.

XGWindow *XGWindow::GetFrontWidnow(void)

This global method gets the frontmost window in this application.

void XGWindow::SelectWindow(void)

This brings the specified window frontmost in this application framework.

void XGWindow::GetSreenSize(Rect *r)

This global returns the size of the window display area.

Window Sizing

The following size routines need some serious tweaking.

Point XGWindow::GetWindowSize(void)

This gets the window's size. The window's size is the size of the frame of the window as well as the content area (which differs from the Macintosh in tha ta window is normallly specified by it's content area).

Point XGWindow::GetWindowPos(void)

This gets the position of the window on the display (or relative to the MDI parent window).

void XGWindow::SetWindowSize(Point size)

This sets the size of the window

void XGWindow::SetWindowPos(Point loc)

This changes the location of the window to the location specified.

void XGWindow::SetWindowLocation(Rect loc)

This changes both the size and position of this window to the area on the screen specified.


[Home] [Prev] [Next] [Up]