TopWindow
class TopWindow : public Ctrl
Derived from Ctrl
TopWindow represents top-level independent window of host OS, usually decorated with caption, close/zoom/restore buttons etc.
Important fact to note is that window-rectangle (as defined by Ctrl::SetRect and Ctrl::GetRect methods) does not include any host GUI specific decorations (caption, thick border for resizing), just the area that is "controlled" by U++.
When TopWindow is opened, it is by default centered w.r.t. to its owner (if there is any). This behaviour can be altered by NoCenter or CenterScreen methods.
virtual void Reject()
This virtual method is overloaded to perform Restore operation if there was any previous call to Backup method.
virtual void Close()
This virtual method is implemented in TopWindow so that it breaks modal loop if TopWindow runs it. If there is Breaker with IDCANCEL defined, performs RejectBreak(IDCANCEL). Otherwise, if there is Breaker with IDYES (as assigned to exit Ctrl by CtrlLayoutExit), performs AcceptBreak(IDYES). If none if that is true, AcceptBreak(IDOK) is performed.
If ToWindow does not run modal loop, it is closed - in this case, any state backup created by Backup method is scratched.
Callback WhenClose
This callback is by default invoked when Close button of host GUI window is pushed. Default assigned action is to perform Close virtual method.
void Backup()
Serializes the content of all contained Ctrls (using Serialize virtual method) into internal storage of TopWindow. Useful when implementing Cancel buttons.
void Restore()
Restores content of all contained Ctrls from internal storage. If internal storage is empty, does nothing.
void Break(int ID = IDEXIT)
If TopWindow is running its loop (see Run or RunAppModal methods), breaks the loop with specified exit code.
bool AcceptBreak(int ID)
Tries to accept all contained Ctrls by calling Accept for all child Ctrls, until some returns false - in such case this method returns false. If all child Ctrls return true, calls Break with specified ID and returns true.
|
Return value |
True if all child Ctrls were accepted and Break(ID) was invoked. |
void RejectBreak(int ID)
Rejects all contained widgets by calling Reject for all child Ctrls, then calls Break with specified ID.
void WorkAreaTrim()
Adjusts window position so that it does not exceeds desktop workspace. Exceeding parts are trimmed (decreasing window size).
Callback Breaker(int ID = IDEXIT)
Returns Callback that, when invoked, invokes Break with the specified exit code.
|
ID |
Message loop exit code. |
Callback Acceptor(int ID)
Returns Callback that, when invoked, invokes AcceptBreak with the specified exit code.
|
ID |
Message loop exit code. |
Callback Rejector(int ID)
Returns Callback that, when invoked, invokes RejectBreak with the specified exit code.
|
ID |
Message loop exit code. |
TopWindow& Breaker(Ctrl& m, int ID = -1)
Same as m <<= Breaker(ID) - assigns Breaker callback to WhenAction method of specified Ctrl.
|
ID |
Message loop exit code. |
TopWindow& Acceptor(Ctrl& m, int ID)
Same as m <<= Acceptor(ID) - assigns Acceptor callback to WhenAction method of specified Ctrl.
|
ID |
Message loop exit code. |
TopWindow& Rejector(Ctrl& m, int ID)
Same as m <<= Rejector(ID) - assigns Rejector callback to WhenAction method of specified Ctrl.
|
ID |
Message loop exit code. |
TopWindow& NoCenter()
Sets TopWindow not to be centered when opening.
TopWindow& CenterOwner()
Sets TopWindow to be centered w.r.t. its owner. This is default.
TopWindow& CenterScreen()
Sets TopWindow to be desktop centered.
void SetMinSize(Size sz)
Sets the minimal size for window. This size is then returned by GetMinSize virtual method. If window is resizable, it cannot be made smaller than this size.
|
sz |
Minimal size of window. |
void Open(HWND ownerhwnd)
Opens window with owner specified as Win32 handle.
Win32 specific.
|
ownerhwnd |
Owner window handle. |
TopWindow& Style(dword _style)
Sets Win32 window style.
Win32 specific.
dword GetStyle() const
Sets Win32 window extended style.
Win32 specific.
TopWindow& ExStyle(dword _exstyle)
Win32 specific.
dword GetExStyle() const
void Open(Ctrl *owner)
Opens TopWindow as window in host GUI with specified owner.
|
owner |
Owner of window. If NULL, window has no owner. |
void Open()
Opens TopWindow with owner equal to current active window if it is owned by the process.
void OpenMain()
Opens window without owner.
int Run(bool appmodal = false)
Execute modal loop for TopWindow. If TopWindow is not open, it calls Open before starting loop, but it does not close it.
|
appmodal |
If true, all application window are disabled while performing loop. If false, only TopWindow's relative windows (with the same "super"-owner) are disabled. |
|
Return value |
Result code of modal loop. |
int RunAppModal()
Same as Run(true).
|
Return value |
Result code of modal loop. |
int Execute()
Similar to Run, but closes TopWindow when loop exits.
|
Return value |
Result code of modal loop. |
bool ExecuteOK()
Same as Execute but return true if button OK was pressed.
|
Return value |
Result true if OK otherwise false. |
bool ExecuteCancel()
Same as Execute but return true if button Cancel was pressed.
|
Return value |
Result true if Cancel otherwise false. |
void Minimize(bool effect = false)
Minimize window.
|
effect |
Do platform specific GUI effects. |
void Maximize(bool effect = false)
Maximize window.
|
effect |
Do platform specific GUI effects. |
void Overlap(bool effect = false)
Put window to normal overlapped state.
|
effect |
Do platform specific GUI effects. |
bool IsMaximized() const
|
Return value |
True if TopWindow is maximized. |
bool IsMinimized() const
|
Return value |
True if TopWindow is minimized. |
bool IsOverlapped() const
|
Return value |
True if TopWindow is in normal (overlapped) state. |
TopWindow& ActiveFocus(Ctrl& ctrl)
Sets the ActiveFocus Ctrl. This Ctrl gets focus when TopWindow is activated. If there is no Ctrl with active focus, first Ctrl is activated. When TopWindow is deactivated, Ctrl that has focus is stored as new ActiveFocus Ctrl and gets focus once TopWindow is activated again (unless this method changes ActiveFocus meanwhile). When this, method is called while TopWindow is active, it is equivalent to ctrl.SetFocus().
TopWindow& Title(const WString& _title)
Sets the title of the window.
TopWindow& Title(const char *s)
Sets the title of the window.
const WString& GetTitle() const
|
Return value |
Current title of window. |
TopWindow& Sizeable(bool b = true)
Indicates whether TopWindow should be resizeable by user.
TopWindow& NoSizeable()
Same as Sizeable(false).
bool IsSizeable() const
TopWindow& MinimizeBox(bool b = true)
Sets TopWindow to have a minimize box.
TopWindow& MaximizeBox(bool b = true)
Sets TopWindow to have a maximize box.
TopWindow& Zoomable(bool b = true)
Sets TopWindow to be Zoomable - to have maximize/minimize flags, if supported by host platform. Same as MinimizeBox(b).MaximizeBox(b).
TopWindow& NoZoomable()
Same as Zoomable(false).
bool IsZoomable() const
|
Return value |
Value of Zoomable flag. |
TopWindow& Background(const PaintRect& prect)
Sets PaintRect that will be used to paint TopWindow background. Default PaintRect paints background with SColorFace.
const PaintRect& GetBackground() const
Returns active PaintRect used to paint TopWindow background.
TopWindow& ToolWindow(bool b = true)
Makes TopWindow appear with thin caption, of supported by host platform. Must be set before opening.
TopWindow& NoToolWindow()
Same as ToolWindow(false).
bool IsToolWindow() const
|
Return value |
Value of ToolWindow flag. |
TopWindow & TopMost(bool b = true)
Makes window stay over any other window. Returns *this.
TopWindow & NoTopMost()
Same as TopMost(false).
bool IsTopMost() const
Value of TopMost flag.
TopWindow& NoAccessKeysDistribution()
Disables distribution of access keys. Normally, TopWindow tries to assign access-keys (also known as "hot-keys") to all of its child windows before opening. This method disables this behaviour.
TopWindow& Icon(const Image& m)
Defines icon for TopWindow that is usually displayed in window caption (platform specif).
TopWindow& LargeIcon(const Image& m)
Defines "large" icon for TopWindow. It can be displayed e.g. in task switcher and other places (platform specific).
TopWindow& Icon(const Image& smallicon, const Image& largeicon)
Defines both "small" and "large" icons for TopWindow.
void SerializePlacement(Stream& s, bool reminimize = false)
Serializes current placement of TopWindow. It is platform specific, however information can include screen position in "normal" state and current status (maximized, minimized, normal).
|
reminimize |
If false and loading the information from the stream, minimized state is not restored. |
TopWindow()
Constructor.
~TopWindow()
Destructor.
|