Reference » Window classes » MWindow

Elgrint::MWindow class

Declared in MWindow.h

Description

The base class of all the window classes (also serves as a container window).
Read more...

MWindow

Properties:

Name Description
BackColor Specifies the default filling color for drawing.
CursorImage Changes the icon, which indicates the position of the primary cursor in this window.
Font Specifies the default font for text drawing with drawText.
ForeColor Specifies the default line and text drawing color.
HighQuality Specifies the quality of the painting functions. Inherited property.
HotCapture Turns the hot state capturing capability on and off.
OS Returns the identifier of the overall style (aka operating system), associated with this window. Inherited property.
RTL Marks the window as having a Right-To-Left layout. Inherited property.

Initializers:

Name Description
MWindow(parent,rect) Standard-form init constructor. Creates a new window using the specified parent, size, and position.
~MWindow() Destructor. Closes the window (if still open) and releases all the allocated resources.

Mutators:

Name Description
appendTabStop(wnd) Inserts wnd to the end of the tab-stop chain, which starts with this.
bringForward() Maximizes the z-order of the window without changing its floating/embedded state.
cancelPropagation(mc,ps) Cancels the preceding requestPropagation with the same mc and ps.
close() Closes the window as soon as possible.
disable() Disables the window from receiving KeysEntered and StringEntered messages.
drawArc(center,rad,startAngle,endAngle) Draws an elliptical arc outline using the specified parameters.
drawImage(img,rect,stretch,angle,rotCen) Draws a raster image in the window.
drawPoly(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9) Calls drawPoly(MPoints) with all the specified valid points.
drawPoly(points) Draws a "poly" (lines connected by Bezier curves).
drawRect(rect) Draws a rectangular outline of the specified rect (integral coordinates only).
drawText(text,bBox,tj) Draws the specified text at the coordinates specified by bBox.
enable() Enables the window to receive KeysEntered and StringEntered messages.
fillArc(center,rad,startAngle,endAngle) Fills a closed elliptical shape or an elliptical pie-slice.
fillPoly(p0,p1,p2,p3,p4,p5,p6,p7,p8,p9) Calls fillPoly(MPoints) with all the specified valid points. Needed only for convenience.
fillPoly(points) Fills the interior of a "poly" (lines connected by Bezier curves).
fillRect(rect) Fills rectangular shape bound by the specified rect (integral coordinates only).
genNotice(noticeName) Generates Notice message with the specified name and associated ID (as returned by getNoticeID).
propagateMsgTo(dest) Propagates the current message to the specified window.
repaint(rect) Invalidates a portion of the window and/or its descendants, and generates Paint messages as needed.
requestPropagation(mc,ps) Automatically propagates mc to this window from a window determined by ps.
runMessageLoop(disableParent) Executes the message loop, which brings all windows "to life".
sendBackward() Minimizes the z-order of the window without changing the sign of z.
setDrawSettings(lineColor,lineThickness,ls) Configures parameters for drawing lines and curves.
setDrawTextSettings(font,tc) Configures the font and text color parameters for the drawText function.
setDrawTransform(tr) Specifies a transformation for all subsequent painting functions.
setFillSettings(c1,c2,angle) Configures solid or 2-color linear gradient filling for all subsequent filling functions.
setFocus() Makes this window the new input focus, if possible.
setNoticeID(noticeName,noticeID) Associates the specified numeric code with the specified notice name.
setPos(newPos,duration) Changes the position of the window in parent's coordinates to newPos.
setRect(newRect,duration) Changes the size and/or position of the window in its parent's coordinates.
setSize(newSize,duration) Changes the size of the window to newSize.
setTimer(timerID,delay) Schedules a TimerExpired message after delay milliseconds.

Revealers:

Name Description
as<WC>() Converts this object into a reference of type WC.
calcDrawTextSize(text,maxWidth) Returns the width and height of the bounding rectangle of text, if it would have been drawn with the current settings.
convScreenToWindow(p) Converts p from screen coordinates to this window coordinates.
convScreenToWindow(r) Converts r from screen coordinates to this window coordinates.
convWindowToScreen(p) Converts p from this window's coordinates to screen's coordinates.
convWindowToScreen(r) Converts r from this window coordinates to screen coordinates.
digClipRect() Provides message-specific information for Paint.
digDir() Provides message-specific information for DirectoryChanging and DirectoryChanged.
digKeys() Provides message-specific information for KeysEntered.
digMessageCode() Returns the identifier of the message being currently processed.
digNID() Provides message-specific information for Notice and RemoteNotice.
digNN() Provides message-specific information for Notice and RemoteNotice.
digOrigin() Returns the origin window of the message being processed.
digRectRef() Provides message-specific information for RectChanging.
digStringRef() Provides message-specific information for StringEntered.
digTimerID() Provides message-specific information for TimerExpired.
getChild(index) Returns the child window of this with the specified index in the child list.
getChildCount() Returns the current number of open child windows of this window (0 if the window is closed).
getCursorPos(index) Returns the last recorded position of the specified cursor (in window coordinates).
getEnabling() Returns the current enabling state of this (see EnablingChanged).
getImage(rect) Converts the graphical content of this window (or a portion of it) into an image.
getNextTabStop() Determines the window to which the focus should be switched by the Tab key.
getNoticeID(noticeName) Returns the numeric notice ID, associated with the specified notice name.
getParent() Returns a reference to the parent window of this window.
getPos() Returns the current position of the window in parent window's coordinates, including floating/embedded state.
getPrevTabStop() Determines the window to which the focus should be switched by Shift+Tab.
getRect() Returns the current size and position of the window, including floating/embedded state.
getSize() Returns the current size of the window.
getTimerDelay(timerID) Returns the delay (in milliseconds) of timerID as defined by setTimer.
is<WC>() Returns true iff this object is compatible with the specified WC type.
isAncestorOf(wnd) Returns true iff this window is a proper ancestor of wnd.
isEnabled() Returns true if the window is enabled (see EnablingChanged).
isFocused() Returns true iff this is the current focus window (see FocusChanged).
isHot() Returns true iff this is the current hot window (see HotChanged).
isOpen() Returns true iff the object corresponds to an open window.
isPropagationRequested(mc,ps) Returns true if the specified propagation was requested for this window via a previous call to requestPropagation.
operator!=(wnd) Returns true iff this and wnd are not the same object.
operator==(wnd) Returns true iff this and wnd refer to one and the same window object.

Global functions:

Name Description
GetName(wnd) Returns the string representation (name) of the class to which wnd belongs.
GetName<WC>() Returns the string representation (name) of the WC class.
operator>>(firstTabStop,lastTabStop) Appends lastTabStop to the end of a tab-stop chain that starts from firstTabStop.

Handlers:

Name Description
OnChildListChanged

Does nothing. Needed as the base virtual function for overloading.

OnCursorMoved

Does nothing. Needed as the base virtual function for overloading.

OnDirectoryChanged

Does nothing. Needed as the base virtual function for overloading.

OnDirectoryChanging

Does nothing. Needed as the base virtual function for overloading.

OnEnablingChanged

Repaints the entire window.

OnFocusChanged

Passes the focus to the parent (prevents having a focused empty window).

OnHotChanged

Does nothing. Needed as the base virtual function for overloading.

OnKeysEntered

Focus shifts and propagation.

Details:

  • On kbEsc passes the focus to the closest focusable ancestor (i.e. until this is no longer focused)
  • On kbTab passes the focus to the next tab-stop as returned by getNextTabStop, but skips disabled tab-stops
  • On SHIFT(kbTab) passes the focus to the previous tab-stop as returned by getPrevTabStop, but skips disabled tab-stops
On any other key, or if this window is still focused after the above operations, the key is propagated to the parent via propagateMsgTo.

OnMoved

Does nothing. Needed as the base virtual function for overloading.

OnNotice

Propagates inherited property changes to children, and everything else - to the parent.

Details: If the notice is original (not propagated) and the notice name is OSChanged, then the new OS value is propagated recursively to all descendants of this window by calling child.setOS(getOS()) for every child window.
If the notice is original (not propagated) and the notice name is RTLChanged, then the new RTL value is propagated recursively to all descendants of this window by calling child.setRTL(isRTL()) for every child window.
If the notice is original (not propagated) and the notice name is HighQualityChanged, then the new HighQuality value is propagated recursively to all descendants of this window by calling child.setHighQuality(isHighQuality()) for every child window.
Otherwise, the notice itself is propagated to the parent using propagateMsgTo, even if the notice itself is not original.

OnPaint

Fills the entire window with a solid opaque color.

Details: The filling color is specified by the latest setFillSettings, or by BackColor if there were no setFillSettings calls during this message processing. The function is similar to fillRect(MaxRect), except that here the filling color is solid (the second gradient color is ignored) and opaque (the alpha channel is ignored). Also, this handler is generally faster than fillRect.

OnRectChanging

Does nothing. Needed as the base virtual function for overloading.

OnRemoteNotice

Does nothing. Needed as the base virtual function for overloading.

OnResized

Repaints the entire window.

OnStringEntered

Propagates the message to the parent using propagateMsgTo.

OnSystemResumed

Does nothing. Needed as the base virtual function for overloading.

OnSystemSuspending

Does nothing. Needed as the base virtual function for overloading.

OnTimerExpired

Does nothing. Needed as the base virtual function for overloading.

Details

MWindow is by far the largest and the most important class in Elgrint. It defines all the common functionality for all window classes, which are derived from it.

'MWindow' is a window class itself, and it can be instantiated into a window object like any other window class (except for MScreen). The window object, created by MWindow, opens an empty window, which shows a solid background and nothing more. Still, even such a window is useful - it can be used as a simple static container for other windows. But the main purpose of MWindow is to serve as the base class for other window classes.

Instantiating the MWindow class (whether directly, or as part of a derived class) opens a window on the screen (if the construction was successful). Destroying the instance closes this window automatically. The window can also be closed explicitly with close, but in any case, once the window is closed, it cannot be reopened in the lifetime of this object - a different object must be constructed to open another window. This apparent limitation allows to simplify the interface in many ways, and the limitation itself is lifted using the window pointers.

Example

Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.