21#if defined(BI_MULTI_THREAD_RTL)
35#if defined(__BORLANDC__)
58 WARN(!
r,
_T(
"SystemParametersInfo(SPI_GETWHEELSCROLLLINES) failed. LastError: ") << GetLastError());
InUse(
r);
69#define OWL_RTTI_MSGCACHE
70#define TYPE_UNIQUE_ID(t) reinterpret_cast<UINT_PTR>(typeid(t).name())
102#if defined(OWL5_COMPAT)
310 "PLACEMENT=" <<
TRect{
wp.rcNormalPosition} <<
312 " min=" <<
TPoint{
wp.ptMinPosition} <<
313 " max=" <<
TPoint{
wp.ptMaxPosition} <<
314 " showCmd=" <<
wp.showCmd <<
315 " flags=" <<
wp.flags);
405 PerformInit(parent, module);
411 Attr.
X = Attr.
Y = Attr.
W = Attr.
H = 0;
443 PerformInit(parent, module);
477 TransferBuffer =
nullptr;
478 TransferBufferSize = 0;
480 Attr.
Param =
nullptr;
485 ContextPopupMenu =
nullptr;
487 CursorModule =
nullptr;
496 InstanceProc = CreateInstanceProc();
501 Parent->AddChild(
this);
503 SiblingList =
nullptr;
509 Module =
module ? module : Parent->GetModule();
512 Module =
module ? module : nullptr;
519 Module = Application;
525 TRACEX(
OwlWin, 1,
_T(
"TWindow constructed @") << (
void*)
this << *
this);
552 _T(
"Restoring old WndProc after foreign subclass of:") << *
this);
556 InstanceProc =
nullptr;
560 owl::CacheFlush(UniqueId);
584 TRACEX(
OwlWin, 0,
_T(
"~TWindow: Swallowed exception while destroying child: ") << *
w);
595 TRACEX(
OwlWin, 0,
_T(
"~TWindow: Swallowed exception while destroying this: ") << *
this);
611 delete ContextPopupMenu;
615 TRACEX(
OwlWin, 1,
_T(
"TWindow destructed @") << (
void*)
this << *
this);
618#if defined(BI_MULTI_THREAD_RTL)
709 if (
child && ChildList) {
744 SiblingList =
nullptr;
749 Parent->AddChild(
this);
894 id =
static_cast<uint>(
_not.idFrom);
949 equal = wildcardCheck;
986 return receiver->DefaultProcessing();
1001 TRACEX(
OwlCmd, 1,
_T(
"TWindow::EvCommand - id(") <<
id <<
_T(
"), ctl(") <<\
1033 equal = wildcardCheck;
1066 return receiver->DefaultProcessing();
1089 const auto handled = enabler.GetHandled();
1090 WARNX(
OwlWin, !
handled, 1,
_T(
"No command enabler found for TTN_NEEDTEXT (Id: ") << enabler.GetId() <<
_T(
")."));
1110 equal = wildcardCheck;
1126 return receiver->DefaultProcessing();
1257static const int msgCacheSize = 31;
1266 TCacheEntry() : UniqueId(0), Entry(
nullptr), Msg(0), Delta(0) {}
1276 static int Key(TId
id,
TMsgId msg) {
return (
id ^
static_cast<TId
>(
msg)) % msgCacheSize;}
1280struct TCacheEntryStr
1285 TCacheEntryStr():Enabled(
true)
1292 TCacheEntry Cache[msgCacheSize];
1297 bool Check(
int index,
TMsgId, TCacheEntry::TId
id);
1299#if defined(BI_MULTI_THREAD_RTL)
1304TCacheEntry::TId TWindow::LastUniqueId = 0;
1306static TCacheEntryStr& GetCache()
1308#if defined(BI_MULTI_THREAD_RTL)
1325#if defined(BI_MULTI_THREAD_RTL)
1334 for (
int i = 0;
i < msgCacheSize;
i++)
1335 if (Cache[
i].UniqueId ==
id)
1348 return Enabled && Cache[index].Hit(
msg,
id);
1357 GetCache().CacheFlush(
id);
1371TWindow::SetUniqueId()
1373#if defined(OWL_RTTI_MSGCACHE)
1376 if (++LastUniqueId == 0) {
1381 GetCache().Enabled =
false;
1383 UniqueId = LastUniqueId;
1443 <<
hex <<
reinterpret_cast<void*
>(
notify->hwndFrom) <<
_T(
", ")\
1444 <<
_T(
" ! => ") << *
this);
1452#if defined(OWL_RTTI_MSGCACHE)
1456 int key = TCacheEntry::Key(UniqueId,
msg);
1461 TCacheEntryStr&
cache = GetCache();
1462 if(
cache.Check(key,
msg, UniqueId)) {
1466 eventInfo.Object =
reinterpret_cast<TGeneric*
>(((
reinterpret_cast<char*
>(
this)) +
cache.Cache[key].Delta));
1473 else if (this->
Find(eventInfo)) {
1480 cache.Set(key,UniqueId,
msg,
nullptr);
1498#if !defined(BI_COMP_GNUC)
1513 WARNX(
OwlWin,
hwnd != Handle, 0,
"ReceiveMessage: The passed handle does not match this window.");
1539 TRACEX(
OwlWin, 0,
_T(
"TWindow::ReceiveMessage: Suspending unhandled exception for message: ") <<
msg);
1541 GetApplication()->SuspendThrow(std::current_exception());
1547#if !defined(BI_COMP_GNUC)
1693 return static_cast<int>(
r);
2167 w.EnableAutoCreate();
2276 if (BkgndColor.IsSysColor() &&
2322TWindow::MakeMenuOrId()
2358 operator HMENU() {
return m;}
2367 Attr.
X, Attr.
Y, Attr.
W, Attr.
H,
2536#if !defined(OWL5_COMPAT)
2577 TRACEX(
OwlWin, 1,
_T(
"TWindow::SetupWindow() @") << (
void*)
this << *
this);
2613#if defined(OWL5_COMPAT)
2642 TRACEX(
OwlWin, 1,
_T(
"TWindow::CleanupWindow() @") << (
void*)
this << *
this);
2674 p =
static_cast<char*
>(p) +
w.Transfer(p,
direction);
2676 return static_cast<uint>(
reinterpret_cast<char*
>(p) -
reinterpret_cast<char*
>(
buffer));
2693 if (!TransferBuffer)
return;
2696 if (TransferBufferSize > 0 && size != TransferBufferSize)
2698 WARN(TransferBufferSize == 0,
2699 _T(
"TWindow::TransferData: Unsafe transfer is performed! ")
2700 _T(
"Use one of the safe overloads of SetTransferBuffer to enable buffer checks."));
2708inline static bool BelongsToCurrentProcess (
HWND h)
2725 if (!BelongsToCurrentProcess(
GetHandle()))
return;
2753 if (
m.IsRegisteredClass(
c))
return true;
2756 CHECK(
c.GetPointerRepresentation() ==
w.lpszClassName);
2757 return m.IsRegisteredClass(
c) ?
true : ::RegisterClass(&
w);
2798 return all_of(
c.begin(),
c.end(), [](
TWindow&
w) { return !w.GetHandle() || w.CanClose(); });
2933 InstanceProc =
nullptr;
2956 return IndexOf(ChildList) + 1;
2963TWindow::AssignZOrder()
3002 if (
child.GetHandle())
3013 if (!
child.Create())
3019 if (
child.IsIconic())
3029 const auto i =
find_if(
c.begin(),
c.end(), [&top](
TWindow&
w) { return w.ZOrder == top; });
3050 child->SiblingList = ChildList->SiblingList;
3051 ChildList->SiblingList =
child;
3084#if defined(OWL5_COMPAT)
3128 }
while (
curChild != ChildList && ChildList);
3163 }
while (
curChild != ChildList && ChildList);
3190 CHECKX(
nextChild,
_T(
"The child list was corrupted/modified while traversing it"));
3196 }
while (
curChild != ChildList && ChildList);
3218 CHECKX(
nextChild,
_T(
"The child list was corrupted/modified while traversing it"));
3222 }
while (
curChild != ChildList && ChildList);
3234int TWindow::IndexOf(
const TWindow*
child)
const
3277 auto c = GetChildren();
3278 const auto i =
find_if(
c.begin(),
c.end(), [
id](
TWindow&
w) { return w.GetId() == id; });
3279 return (
i !=
c.end()) ? &(*i) :
nullptr;
3360 return ::TrackMouseEvent(&
a) !=
FALSE;
3412 if (Title !=
title) {
3519template <
int GwlStyle, u
int32 TWindowAttr::*StyleMem>
3525template <
int GwlStyle, u
int32 TWindowAttr::*StyleMem>
3537template <u
int32 (TWindow::*GetStyleMemFun)() const, u
int32 (TWindow::*SetStyleMemFun)(u
int32)>
3614 rect.SetWH(Attr.
X, Attr.
Y, Attr.
W, Attr.
H);
3629 rect.Set(0, 0, Attr.
W, Attr.
H);
3666 int x,
int y,
int w,
int h,
3768 if (module == CursorModule &&
resId == CursorResId)
3773 CursorModule =
module;
3774 CursorResId =
resId;
3777 HCursor = CursorModule->
LoadCursor(CursorResId);
3815 const int count = ::GetMenuItemCount(
hPopupMenu);
3861 WARN(!
font.IsHandleOwner(),
_T(
"The given font has (a font handle with) unmanaged lifetime."));
3862 if (!
font.IsHandleOwner())
3881 delete ContextPopupMenu;
3955 if (!
r)
throw TXOwl{
_T(
"TWindow::GetWindowPlacement failed")};
3973 if (!
r)
throw TXOwl{
_T(
"TWindow::SetWindowPlacement failed")};
3976#if defined(OWL5_COMPAT)
3991 catch (
const TXOwl&)
4010 catch (
const TXOwl&)
4027 return ::SetWindowRgn(GetHandle(),
r.Release(),
repaint) != 0;
4333 return ::MessageBoxIndirect(&p);
4349 return MessageBoxIndirect(
4350 GetModule()->GetHandle(),
4374 WARNX(
OwlWin,
r == -1, 0,
_T(
"TWindow::FormatMessageBox: Message was truncated."));
4385 WARNX(
OwlWin,
true, 0,
_T(
"TWindow::FormatMessageBox failed."));
4402struct TWindowGetWindowText
4405 TWindowGetWindowText(
const TWindow&
w) : win(
w) {}
4423struct TWindowGetDlgItemText
4445#if defined(__TRACE) || defined(__WARN)
4453 os <<
'\'' <<
w.GetCaption() <<
'\'' <<
',';
4455 os <<
"id=" <<
w.GetId();
4519GetSuspectDescription(TWindow*
w)
4522 if (!
w)
return _T(
"");
4525 tstring id = ToString(
w->GetWindowAttr().Id);
4530 s +=
_T(
", ID: ") + id;
4531 s +=
_T(
", window ") +
type;
4545MakeTXWindowMessage(TWindow* win,
uint resId)
4550 s +=
_T(
"\n\nSystem error: ") +
m.SysMessage();
Definition of class TAppDictionary.
Definition of class TApplication.
#define WARNX(group, condition, level, message)
#define WARN(condition, message)
#define PRECONDITION(condition)
#define CHECKX(condition, message)
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
void ResumeThrow()
Rethrows the suspended exception stored by a previous call to SuspendThrow.
int MessageBox(HWND wnd, const tstring &text, const tstring &caption=tstring(), uint type=MB_OK) const
int BeginModal(TWindow *window, int flags=MB_APPLMODAL)
Called to begin a modal window's modal message loop.
void Condemn(TWindow *win)
Condemns the given window to be deleted the at the next available safe time.
virtual bool CanClose()
Determine whether the application can be closed.
bool HasSuspendedException() const
TFrameWindow * GetMainWindow()
Return the current main window.
virtual TTooltip * GetTooltip() const
Get Tooltip.
void EndModal(int result)
Cause the current modal message loop to break and have it return a result Re-enable the disabled wind...
void Uncondemn(TWindow *win)
Removes the given window from the list of condemned windows.
The GDI Brush class is derived from TGdiObject.
static const TColor Transparent
a non-painting color
static const TColor None
not-a-color
int Index() const
Return the index of the palette entry.
bool IsSysColor() const
Return true if the color is a system color.
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
virtual void Enable(bool enable=true)
Enables or disables the command sender.
uint Flags
TCommandStatus flags Is TCommandStatus::WasHandled if the command enabler has been handled.
TCommandEnabler(uint id, HWND hWndReceiver=0)
Constructs the TCommandEnabler object with the specified command ID.
@ WasHandled
Command was enabled or disabled.
TDC is the root class for GDI DC wrappers.
bool FillSolidRect(const TRect &r, const TColor &color)
virtual void Measure(MEASUREITEMSTRUCT &)
virtual void Draw(DRAWITEMSTRUCT &)
A nested class, TEventInfo provides specific information about the type of message sent,...
virtual bool Find(TEventInfo &info, TEqualOperator op=0)
Searches the list of response table entries looking for a match.
TResult Dispatch(TEventInfo &info, TParam1, TParam2=0)
Takes the message data from TEventInfo's Msg data member and dispatches it to the correct event-handl...
bool(* TEqualOperator)(const TGenericTableEntry &, const TEventInfo &)
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TNotify is a thin wrapper around the NMHDR structure.
A DC class that wraps begin and end paint calls for use in an WM_PAINT response function.
PAINTSTRUCT Ps
The paint structure associated with this TPaintDC object.
TPoint is a support class, derived from tagPOINT.
TRect is a mathematical class derived from tagRect.
TRegion, derived from TGdiObject, represents GDI abstract shapes or regions.
TPointer GetString() const
Returns the encapsulated string pointer, provided this resource identifier encodes a string pointer.
bool IsString() const
Returns true if this resource identifier encodes a string pointer.
TPointer GetPointerRepresentation() const
Returns the encapsulated pointer.
A template class, TResponseTableEntry lets you define a pattern for entries into a response table.
static void DragAcceptFiles(HWND, BOOL)
Invokes 'DragAcceptFiles' indirectly.
The tagSIZE struct is defined as.
TTooltipText identifies a tool for which text is to be displayed.
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
HWND GetParentH() const
Return the handle of the parent.
HWND SetFocus()
Sets the keyboard focus to current window and activates the window that receives the focus by sending...
bool EvEraseBkgnd(HDC)
Handler for WM_ERASEBKGND.
static LRESULT CALLBACK InitWndProc(HWND, UINT msg, WPARAM, LPARAM)
Callback process for hooking TWindow to native window.
static TPoint GetCursorPos()
bool SetCursor(TModule *module, TResId resId)
Sets the mouse cursor for the window, loading the given resId from the given module.
HMENU LoadMenu(TResId id) const
HWND SetCapture()
Sets the mouse capture to the current window.
int GetScrollTrackPos(int bar) const
Returns the thumb track position in the scroll bar.
virtual THandle PerformCreate()
Called from Create to perform the final step in creating an Windows interface element to be associate...
tstring LoadString(uint id) const
void EvMove(const TPoint &clientOrigin)
Save the normal position of the window.
TCurrentEvent & GetCurrentEvent()
Returns the current event to be processed in the message queue.
void EvEnterIdle(uint source, HWND hWndDlg)
The default message handler for WM_ENTERIDLE.
virtual void SetParent(TWindow *newParent)
Sets the parent for the specified window by setting Parent to the specified new Parent window object.
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
void ChildBroadcastMessage(TMsgId, TParam1=0, TParam2=0)
Sends the specified message to all immediate children using SendMessage.
HACCEL LoadAccelerators(TResId id) const
void AttachHandle(HWND handle)
int EvCompareItem(uint ctrlId, const COMPAREITEMSTRUCT &compareInfo)
Handles WM_COMPAREITEM message (for owner draw controls) by forwarding message to control itself.
virtual ~TWindow() override
Destroys this window (unless this is an alias) and the children.
TWindow()
Protected constructor for use by immediate virtually derived classes.
virtual void EnableTooltip(bool enable=true)
tstring GetWindowText() const
String-aware overload.
void EvPaint()
Response method for an incoming WM_PAINT message.
void TraceWindowPlacement()
void DispatchScroll(uint scrollCode, uint thumbPos, HWND hWndCtrl)
Called by EvHScroll and EvVScroll to dispatch messages from scroll bars.
void GetHWndState(bool forceStyleSync=false)
Copies the style, coordinate, and the resource id (but not the title) from the existing HWnd into the...
void EvClose()
The default response to a WM_CLOSE message is to call CloseWindow() and then have the window deleted ...
void EvContextMenu(HWND childHwnd, int x, int y)
The default message handler for WM_CONTEXTMENU.
virtual void GetWindowClass(WNDCLASS &wndClass)
Redefined by derived classes, GetWindowClass fills the supplied MS-Windows registration class structu...
bool SetWindowPos(HWND hWndInsertAfter, const TRect &rect, uint flags)
Changes the size of the window pointed to by rect.
virtual void EvCommandEnable(TCommandEnabler &ce)
Called by WindowProc to handle WM_COMMAND_ENABLE messages, EvCommandEnable calls the CmXxxx command-h...
virtual int Execute()
Creates the underlying HWND and makes it modal with the help of TApplication's BeginModal support.
virtual bool PreProcessMsg(MSG &msg)
Called from TApplication::ProcessAppMsg() to give the window an opportunity to perform preprocessing ...
HWND GetWindow(uint cmd) const
Returns the handle of the window that has the indicated relationship to this window.
auto GetChildren()
Returns a TWindow::TChildrenRange that can be iterated by standard means.
void AssignContextMenu(TPopupMenu *menu)
Associates a pop-up menu with the window so that it can automatically handle a WM_CONTEXTMENU message...
TWindow * Previous()
Returns a pointer to the TWindow's previous sibling (the window previous to the TWindow in its parent...
HWND GetDlgItem(int childId) const
Retrieves the handle of a control specified by childId.
void EvMouseWheel(uint modKeys, int zDelta, const TPoint &point)
Event handler for WM_MOUSEWHEEL.
virtual void Destroy(int retVal=0)
Destroys an MS-Windows element associated with the TWindow.
void EvDestroy()
Responds to an incoming WM_DESTROY message.
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
void SetAcceleratorTable(TResId resId)
void EvDeleteItem(uint ctrlId, const DELETEITEMSTRUCT &deleteInfo)
Handles WM_DELETEITEM message (for owner draw controls) by forwarding message to control itself.
TWindow * GetParent() const
Retrieves the OWL object of the parent window. If none exists, returns 0.
auto MessageBoxIndirect(HINSTANCE resourceModule, TResId text, TResId caption, uint flags, TResId icon, DWORD_PTR contextHelpId, MSGBOXCALLBACK, DWORD languageId) const -> int
Displays a standard message box.
TWindow * GetWindowPtr(HWND hWnd) const
Calls TApplication:GetWindowPtr on the application associated with this window.
virtual int DoExecute()
Do actual modal execution using the Begin/End Modal support of TApplication.
virtual void RemoveChild(TWindow *child)
Removes a child window.
void SetWindowFont(HFONT font, bool redraw=true)
Sets the font that a control uses to draw text.
void SetTooltip(TTooltip *tooltip)
TRACKMOUSEEVENT QueryMouseEventTracking() const
Returns the current state of mouse event tracking initiated by TrackMouseEvent.
void GetWindowTextTitle()
Updates the TWindow internal caption (Title) from the current window's caption.
void GetScrollRange(int bar, int &minPos, int &maxPos) const
Returns the minimum and maximum positions in the scroll bar.
auto FormatMessageBox(const tstring &formatStr, const tstring &caption, uint flags,...) const -> int
TRect GetWindowRect() const
Gets the screen coordinates of the window's rectangle.
virtual TTooltip * GetTooltip() const
void EvHScroll(uint scrollCode, uint thumbPos, HWND hWndCtl)
Response method for an incoming WM_HSCROLL message.
void DisableAutoCreate()
Disables the feature that allows an associated child window interface element to be created and displ...
void PerformSetupAndTransfer()
Ensures that the window is fully set up; then transfers data into the window.
void SetHandle(THandle)
Sets the window handle in a derived class.
void SetWindowPlacement(const WINDOWPLACEMENT &place)
Wrapper for Windows API.
virtual TResult WindowProc(TMsgId, TParam1, TParam2)
First virtual function called to handling incoming messages to a TWindow.
static void ShutDownWindow(TWindow *win, int retVal=0)
This version of ShutDownWindow unconditionally shuts down a given window, calls Destroy on the interf...
void EvVScroll(uint scrollCode, uint thumbPos, HWND hWndCtl)
Response method for an incoming WM_VSCROLL message.
virtual auto GetWindowClassName() -> TWindowClassName
virtual TResult DefWindowProc(TMsgId, TParam1, TParam2)
Virtual function provides final default processing for an incoming message Calls original window proc...
long GetWindowLong(int index) const
Retrieves information about the window depending on the value stored in index.
virtual uint Transfer(void *buffer, TTransferDirection direction)
Transfers data to or from any window with or without children and returns the total size of the data ...
void Init(TWindow *parent, LPCTSTR title, TModule *module)
Normal initialization of a default constructed TWindow.
void SetFlag(uint mask)
Sets the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
bool EvCreate(CREATESTRUCT &)
Response method for an incoming WM_CREATE message.
auto SetWindowRgn(HRGN, bool repaint=false) -> bool
Sets the area within the window where the system permits drawing.
void SetTextColor(TColor color, bool shouldUpdate=true)
Sets the text color for the window.
WINDOWPLACEMENT GetWindowPlacement() const
Wrapper for Windows API.
static void ReleaseCapture()
Releases the mouse capture from this window.
TModule * GetModule() const
Returns a pointer to the module object.
uint32 SetExStyle(uint32 style)
Sets the extra style bits of the window.
void LoadAcceleratorTable()
Loads a handle to the window's accelerator table specified in the TWindowAttr structure (Attr....
WNDPROC GetWindowProc() const
void RouteCommandEnable(HWND hInitCmdTarget, TCommandEnabler &ce)
Walks the chain of windows from the initial target window to this window.
bool IsIconic() const
Returns true if window is iconic or minimized.
TPopupMenu * GetContextMenu() const
Returns the associated popup menu used by the window.
void ClientToScreen(TPoint &point) const
Converts the client coordinates specified in point to screen coordinates for the new window.
virtual bool SetDocTitle(LPCTSTR docname, int index)
Default behavior for updating document title is to pass it to parent frame.
void EvKillFocus(HWND hWndGetFocus)
Handle WM_KILLFOCUS so that we can have a parent window hold onto our Handle and possibly restore foc...
void SetCaption(LPCTSTR title)
Copies title to an allocated string pointed to by title.
int SetScrollInfo(int bar, SCROLLINFO *scrollInfo, bool redraw=true)
Sets the properties of the given scroll bar.
int GetWindowText(TCHAR *str, int maxCount) const
Copies the window's title into a buffer pointed to by string.
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
uint32 GetExStyle() const
Gets the extra style bits of the window.
virtual void CleanupWindow()
Always called immediately before the HWindow becomes invalid, CleanupWindow gives derived classes an ...
void EvDrawItem(uint ctrlId, const DRAWITEMSTRUCT &drawInfo)
HMENU GetMenu() const
Returns the handle to the menu of the indicated window.
TResult HandleMessage(TMsgId, TParam1=0, TParam2=0)
Dispatches the given message using the response table.
bool TrackMouseEvent(uint flags=TME_HOVER|TME_LEAVE, int hoverTime=HOVER_DEFAULT)
Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount ...
void SetScrollRange(int bar, int minPos, int maxPos, bool redraw=true)
Sets the thumb position in the scroll bar.
void EvLButtonDown(uint modKeys, const TPoint &point)
Response method for an incoming WM_LBUTTONDOWN message.
bool ModifyStyle(uint32 offBits, uint32 onBits, uint swpFlags=0)
Modifies the style bits of the window.
virtual bool IdleAction(long idleCount)
Called when no messages are waiting to be processed, IdleAction performs idle processing as long as t...
int GetUpdateRgn(TRegion &rgn, bool erase=true) const
Copies a window's update region into a region specified by region.
void SetScrollPage(int bar, int page, bool redraw=true)
Sets the page property (SCROLLINFO::nPage) of the given scroll bar.
void SetScroller(TScroller *scroller)
Sets the scroller object for this window.
void SubclassWindowFunction()
Installs the instance thunk as the WindowProc and saves the old window function in DefaultProc.
HCURSOR LoadCursor(TResId id) const
uint32 GetStyle() const
Gets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
TResult ForwardMessage(HWND handle, bool send=true)
Forwards the window's current message.
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
uint GetDlgItemInt(int childId, bool *translated=0, bool isSigned=true) const
Translates the text of a specified control into an integer value and returns it.
TRect GetClientRect() const
Gets the coordinates of the window's client area (the area in a window you can use for drawing).
int GetDlgCtrlID() const
Returns the ID of the control.
void EvMouseHWheel(uint modKeys, int zDelta, const TPoint &point)
Event handler for WM_MOUSEHWHEEL.
void SetWindowText(LPCTSTR str)
Sets the window's text to the given string (by copying).
bool CreateChildren()
Creates the child windows in the child list whose auto-create flags (with wfAutoCreate mask) are set.
void EvNCDestroy()
Responds to an incoming WM_NCDESTROY message, the last message sent to an MS-Windows interface elemen...
bool GetScrollInfo(int bar, SCROLLINFO *scrollInfo) const
Retrieves the properties of the given scroll bar.
virtual TResult EvCommand(uint id, HWND hWndCtl, uint notifyCode)
WindowProc calls EvCommand to handle WM_COMMAND messages.
virtual bool CanClose()
Use this function to determine if it is okay to close a window.
uint32 SetStyle(uint32 style)
Sets the style bits of the underlying window or the 'Style' member of the attribute structure associa...
void ClearFlag(uint mask)
Clears the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
virtual void TransferData(TTransferDirection direction)
Transfers data between the TWindow's data buffer and the child windows in its ChildList (data is not ...
bool IsZoomed() const
Returns true if window is zoomed or maximized.
virtual bool Register()
Registers the Windows registration class of this window, if this window is not already registered.
virtual TResult EvNotify(uint id, TNotify ¬ifyInfo)
Handles WM_NOTIFY and subdispatch messages from child controls.
virtual bool HoldFocusHWnd(HWND hLose, HWND hGain)
Responds to a request by a child window to hold its HWND when it is losing focus.
void EvChildInvalid(HWND hWnd)
Handle message posted to us by a control needing assistance in dealing with invalid inputs.
void ScreenToClient(TPoint &point) const
Uses the screen coordinates specified in point to calculate the client window's coordinates and then ...
TWindow * Next()
Returns a pointer to the next sibling window in the window's sibling list.
int GetDlgItemText(int childId, TCHAR *text, int maxValue) const
Retrieves the text of a control specified by childId.
bool CancelMouseEvent(uint flags=TME_HOVER|TME_LEAVE)
Encapsulates a call to TrackMouseEvent, passing the TME_CANCEL flag.
void EvSysColorChange()
Respond to WM_SYSCOLORCHANGE by broadcasting it to all children.
virtual bool ShowWindow(int cmdShow)
Displays this TWindow in a given state.
int MessageBox(LPCTSTR text, LPCTSTR caption=0, uint flags=MB_OK) const
Creates and displays a message box that contains a message (text), a title (caption),...
int GetScrollPos(int bar) const
Returns the thumb position in the scroll bar.
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
int SetScrollPos(int bar, int pos, bool redraw=true)
Sets the thumb position in the scroll bar.
virtual void SetupWindow()
Performs setup following creation of an associated MS-Windows window.
virtual void Paint(TDC &dc, bool erase, TRect &rect)
Repaints the client area (the area you can use for drawing) of a window.
WNDPROC SetWindowProc(WNDPROC wndProc)
void EvEndSession(bool endSession, uint flags)
Provides default handling for WM_ENDSESSION.
HBRUSH EvCtlColor(HDC hDC, HWND hWndChild, uint ctlType)
Handler for control color messages (WM_CTLCOLOR family).
bool ModifyExStyle(uint32 offBits, uint32 onBits, uint swpFlags=0)
Modifies the style bits of the window.
bool IsFlagSet(uint mask)
Returns the state of the bit flag in Attr.Flags whose mask is supplied.
bool EvQueryEndSession(uint flags)
Respond to Windows attempt to close down.
void DragAcceptFiles(bool accept)
If a window can process dropped files, DragAcceptFiles sets accept to true.
void EvSize(uint sizeType, const TSize &size)
Response method for an incoming WM_SIZE message.
uint NumChildren() const
Returns the number of child windows of the window.
void EvMeasureItem(uint ctrlId, MEASUREITEMSTRUCT &measureInfo)
Handles WM_MEASUREITEM message (for owner draw controls & menus) by forwarding message to control its...
void EnableAutoCreate()
Ensures that an associated child window interface element is created and displayed along with its par...
bool EvSetCursor(HWND hWndCursor, uint codeHitTest, TMsgId mouseMsg)
Response method for an incoming WM_SETCURSOR message.
TWindow * GetFirstChild()
Returns a pointer to the first child window, which is the first window created in the interface objec...
std::pair< int, int > TScrollRange
HWND THandle
TWindow encapsulates an HWND.
void EvInitMenuPopup(HMENU hPopupMenu, uint index, bool isSysMenu)
Handle WM_INITMENUPOPUP while embeded to generate command enable messages for our server menu items.
HWND GetHandle() const
Returns the handle of the window.
virtual void CloseWindow(int retVal=0)
Determines if it is okay to close a window before actually closing the window.
auto ChildWithId(int id) const -> const TWindow *
int GetWindowTextLength() const
Returns the length, in characters, of the specified window's title.
int GetScrollPage(int bar) const
Returns the page property (SCROLLINFO::nPage) of the given scroll bar.
TXEndSession is thrown from TWindow's handler for WM_ENDSESSION.
TXOwl is root class of the ObjectWindows exception hierarchy.
A nested class, TXWindow describes an exception that results from trying to create an invalid window.
static void Raise(TWindow *win=nullptr, uint resourceId=IDS_INVALIDWINDOW)
Creates the TXWindow exception and throws it.
int Unhandled(TModule *app, uint promptResId)
Unhandled exception.
TXWindow(TWindow *win=nullptr, uint resourceId=IDS_INVALIDWINDOW)
Constructs a TXWindow object with a default resource ID of IDS_INVALIDWINDOW.
TWindow * GetWindow() const
TXWindow * Clone()
Clone the exception object for safe-throwing.
void Throw()
Throws the exception object.
Definition of classes for CommonControl encapsulation.
#define WM_COMMAND_ENABLE
#define WM_OWLHELPHIT
Notify Help manager with hit point.
#define DEFINE_RESPONSE_TABLE(cls)
Macro to define a response table for a class with no base response tables.
Definition of class TFrameWindow.
Definition of abstract GDI object class and derived classes.
#define _OBJ_FULLTYPENAME(obj)
TResponseTableEntry< TGeneric > TGenericTableEntry
static tstring MakeMessage(uint resId, const tstring &infoStr, TModule *module=&GetGlobalModule())
virtual int Unhandled(TModule *appModule, uint promptResId)
Per-exception class unhandled-handler, will default to the per-module unhandled-handler.
void CacheFlush(TCacheEntry::TId id)
void Set(int index, TCacheEntry::TId uniqueId, TMsgId, const TGenericTableEntry *entry, int delta=0)
bool Check(int index, TMsgId, TCacheEntry::TId id)
HCURSOR LoadCursor(TResId id) const
Wrapper for the Windows API.
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
@ wfDeleteOnClose
Window is condemned on EvClose.
@ wfAlias
TWindow is an alias to a preexisting HWND.
@ wfModalWindow
Was created via TWindow::Execute.
@ wfPredefinedClass
Window class used belongs to a predefined Windows class and was not defined by OWL.
@ wfFromResource
Handle comes from HWND created from resource.
@ wfMainWindow
This frame window is the main window.
@ wfFullyCreated
Window is fully created & not being destroyed.
@ wfDetached
Window handle has been detached.
@ wfPropagateIdle
Pass down IdleAction.
@ wfTransfer
Participates in the Transfer mechanism.
@ wfAutoCreate
Create the HWND when our parent is created.
@ tdSizeData
Return the size of data transferred by the class.
@ tdSetData
Set data from the buffer into the window.
Declares THelpContext and THelpFileManager.
char * strnewdup(const char *s, size_t minAllocSize=0)
Object Windows Library (OWLNext Core)
UINT TMsgId
Message ID type.
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
TApplication * GetApplicationObject(uint pid=0)
Global function that calls GetApplication() on owl's app-dictionary.
uint16 HiUint16(LRESULT r)
void SetCreationWindow(TWindow *w)
TWindow * GetWindowPtr(HWND, const TApplication *)
Raw function to retrieve a TWindow pointer given an HWND from the a given app, or any app (app==0).
void InUse(const T &arg)
Handy utility to avoid compiler warnings about unused parameters.
LPARAM TParam2
Second parameter type.
tstring CopyText(int size, TGetText get_text)
Copies text from a C-string (null-terminated character array) into a string object,...
uint16 LoUint16(LRESULT r)
TParam1 MkParam1(uint lo, uint hi)
LRESULT TResult
Result type.
const unsigned int IDW_FIRSTMDICHILD
child window IDs, 32 max to 32032
TDrawItem * ItemData2DrawItem(ULONG_PTR data)
Handles WM_DRAWITEM message (for owner draw controls & menus) by forwarding message to control itself...
TWindow * GetCreationWindow()
void DoEnableAutoCreate(TWindow *win, void *)
A TActionFunc defined in window.cpp.
General definitions used by all ObjectWindows programs.
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
#define TYPESAFE_DOWNCAST(object, toClass)
General Registry access & registration implementation TRegKey, TRegValue, TRegKeyIterator,...
Definitions of Win95 Shell Clases: TShellItem, TShellItemIterator, TPidl, TShellMalloc.
Current event structure for windows events.
TResId Menu
Contains the resource ID for the menu associated with this window.
LPVOID Param
Contains a value that is passed to Windows when the window is created.
int X
horizontal position of top left corenr of the window
int H
height of the window
int Y
vertical position of top left corenr of the window
int Id
Contains the identifier of the child window.
uint32 Style
Contains the values that define the style, shape, and size of your window.
uint32 ExStyle
Contains the extended style values of your window.
TResId AccelTable
Holds the resource ID for the window's accelerator table.
#define TYPE_UNIQUE_ID(t)
Base window class TWindow definition, including HWND encapsulation.
#define EV_WM_CTLCOLORLISTBOX(method)
#define EV_WM_CTLCOLORSCROLLBAR(method)
#define EV_WM_CTLCOLORBTN(method)
#define EV_WM_CTLCOLORDLG(method)
#define EV_WM_CTLCOLORSTATIC(method)
#define EV_WM_CTLCOLOREDIT(method)