9#if !defined(OWL_WINDOW_H)
13#if defined(BI_HAS_PRAGMA_ONCE)
28#include <owl/window.rh>
115#define NoColor TColor::None
116#define NoErase TColor::Transparent
122#if defined(GetFirstChild)
126#if defined(MapWindowRect)
130#if defined(GetWindowFont)
134#if defined(SetWindowFont)
140#if defined(OWL5_COMPAT)
215 virtual void Enable(
bool enable =
true);
241 {SetCheck(
isChecked ? Checked : Unchecked);}
243 bool SendsCommand()
const;
248 HWND GetReceiver()
const;
421 void TraceWindowPlacement();
434#if defined(OWL5_COMPAT)
461 CurrentChild{parent.GetFirstChild()},
462 NextChild{CurrentChild ? CurrentChild->Next() :
nullptr}
479 const auto last = Parent->GetLastChild();
480 CurrentChild = (
last !=
nullptr && CurrentChild !=
last) ? NextChild :
nullptr;
481 NextChild = CurrentChild ? CurrentChild->Next() :
nullptr;
491 pointer CurrentChild;
524 auto cend()
const {
return end(); }
565 uint NumChildren()
const;
581 void EnableAutoCreate();
582 void DisableAutoCreate();
587 virtual TTooltip* GetTooltip()
const;
588 virtual void EnableTooltip(
bool enable=
true);
595 void EnableTransfer();
596 void DisableTransfer();
603 void SetModule(
TModule* module);
618 virtual bool Register();
625 virtual bool Create();
626 bool CreateChildren();
627 virtual void Destroy(
int retVal = 0);
632 virtual int Execute();
633 virtual int DoExecute();
638 virtual void CloseWindow(
int retVal = 0);
646 void ShutDownWindow(
int retVal = 0);
656#if defined(BI_MULTI_THREAD_RTL)
667 virtual bool PreProcessMsg(
MSG&
msg);
682 auto ChildWithId(
int id) ->
TWindow*;
683 HWND GetParentH()
const;
698 auto GetBkgndColor() const ->
TColor;
730#if defined(OWL5_COMPAT)
735 {
return ReceiveMessage(Handle,
msg,
p1,
p2);}
739 TResult HandleMessage(TMsgId, TParam1 = 0, TParam2 = 0);
745 virtual TResult WindowProc(TMsgId, TParam1, TParam2);
746 virtual TResult DefWindowProc(TMsgId, TParam1, TParam2);
755 virtual TResult EvNotify(uint
id, TNotify &
notifyInfo);
759 virtual void EvCommandEnable(TCommandEnabler&
ce);
765 TResult DefaultProcessing();
769 virtual void Paint(TDC& dc,
bool erase, TRect&
rect);
773#if defined(OWL5_COMPAT)
779 template <
class TBuffer>
782 template <
class TElement, u
int Count>
795 void SubclassWindowFunction();
803 HWND GetHandle()
const;
804 operator HWND()
const;
805 bool IsWindow()
const;
813 static HWND GetCapture();
815 static void ReleaseCapture();
816 static HWND GetFocus();
818 bool IsWindowEnabled()
const;
819 virtual bool EnableWindow(
bool enable);
820 void SetRedraw(
bool redraw);
839 {
TPoint q = p; ClientToScreen(
q);
return q;}
845 {::MapWindowPoints(GetHandle(),
HWND_DESKTOP, p, count);}
851 template <
size_t Count>
853 {MapClientToScreen(&p[0], Count);}
860 {
TRect q =
r; MapClientToScreen(
q, 2);
return q;}
871 {
TPoint q = p; ScreenToClient(
q);
return q;}
877 {::MapWindowPoints(
HWND_DESKTOP, GetHandle(), p, count);}
883 template <
size_t Count>
885 {MapScreenToClient(&p[0], Count);}
892 {
TRect q =
r; MapScreenToClient(
q, 2);
return q;}
904 {MapWindowPoints(
wndTo.GetHandle(), p,
n);}
910 template <
size_t Count>
912 {MapWindowPoints(
hWndTo, &p[0], Count);}
918 template <
size_t Count>
920 {MapWindowPoints(
wndTo, &p[0], Count);}
934 {
return MapWindowPoints(
wndTo.GetHandle(), p);}
948 {
return MapWindowPoints(
wndTo.GetHandle(),
r);}
961 {
return MapWindowRect(
wndTo.GetHandle());}
967 {
TRect r = GetClientRect(); MapWindowPoints(
hWndTo,
r, 2);
return r;}
974 {
return MapClientRect(
wndTo.GetHandle());}
977 TRect GetClientRect()
const;
981 TRect GetWindowRect()
const;
991 ::GetWindowRect(
hWnd, &
r);
1001 {
return GetChildRect(
wnd.GetHandle());}
1008 long GetClassLong(
int index)
const;
1009 long SetClassLong(
int index,
long newLong);
1010 uint16 GetClassWord(
int index)
const;
1012 LONG_PTR GetWindowLongPtr(
int index)
const;
1014 long GetWindowLong(
int index)
const;
1015 long SetWindowLong(
int index,
long newLong);
1016 uint16 GetWindowWord(
int index)
const;
1018 WNDPROC GetWindowProc()
const;
1037 uint32 GetExStyle()
const;
1047 bool MoveWindow(
int x,
int y,
int w,
int h,
bool repaint =
false);
1049 virtual bool ShowWindow(
int cmdShow);
1050 void ShowOwnedPopups(
bool show);
1051 bool IsWindowVisible()
const;
1052 bool IsZoomed()
const;
1053 bool IsIconic()
const;
1054 int GetWindowTextLength()
const;
1056 tstring GetWindowText()
const;
1057 void SetWindowText(
LPCTSTR str);
1063#if defined(OWL5_COMPAT)
1074 void BringWindowToTop();
1075 static HWND GetActiveWindow();
1076 HWND SetActiveWindow();
1077 static HWND GetDesktopWindow();
1078 HWND GetLastActivePopup()
const;
1080 HWND GetTopWindow()
const;
1086 int x,
int y,
int w,
int h,
1092 virtual void Invalidate(
bool erase =
true);
1093 virtual void InvalidateRect(
const TRect&
rect,
bool erase =
true);
1098 void UpdateWindow();
1099 bool FlashWindow(
bool invert);
1102 bool LockWindowUpdate(
bool lock=
true);
1119 int GetScrollPos(
int bar)
const;
1120 int SetScrollPos(
int bar,
int pos,
bool redraw =
true);
1121 int GetScrollTrackPos(
int bar)
const;
1127 int GetScrollPage(
int bar)
const;
1131 void ShowScrollBar(
int bar,
bool show =
true);
1133 void ScrollWindowEx(
1145 int GetDlgCtrlID()
const;
1150 void SetDlgItemInt(
int childId,
1179 {
return GetChildRect(GetDlgItem(
childId));}
1185 HMENU GetMenu()
const;
1201 void CreateCaret(
bool isGray,
int width,
int height);
1202 static uint GetCaretBlinkTime();
1207 static void SetCaretPos(
int x,
int y);
1208 static void SetCaretPos(
const TPoint&
pos);
1210 static void DestroyCaret();
1216 HFONT GetWindowFont();
1223 bool UnregisterHotKey(
int idHotKey);
1243 HTASK GetWindowTask() const;
1244 void DragAcceptFiles(
bool accept);
1264 bool EvQueryEndSession(
uint flags);
1267 bool EvEraseBkgnd(
HDC);
1269 void EvSysColorChange();
1283 void EvFontChange();
1285 void EvTimeChange();
1289#if defined(OWL5_COMPAT)
1303 void EvCancelMode();
1306#if defined(OWL5_COMPAT)
1309 uint EvGetTextLength();
1314 int EvGetTextLength();
1325#if defined(OWL5_COMPAT)
1339 HICON EvQueryDragIcon();
1346 void EvSetRedraw(
bool redraw);
1348 void EvShowWindow(
bool show,
uint status);
1410 void EvDrawClipboard();
1411 void EvDestroyClipboard();
1414 void EvRenderAllFormats();
1424 bool EvQueryNewPalette();
1440 bool EvNCActivate(
bool active);
1451 void EvNCPaint(
HRGN);
1477 virtual THandle PerformCreate();
1479 void SetHandle(THandle);
1484 void GetWindowTextTitle();
1489 void PerformSetupAndTransfer();
1490 virtual void SetupWindow();
1491 virtual void CleanupWindow();
1495 void LoadAcceleratorTable();
1562#if defined(OWL5_COMPAT)
1571 void* TransferBuffer;
1574 uint TransferBufferSize;
1587 std::unique_ptr<TFont> Font;
1594 WNDPROC GetInstanceProc()
const;
1595 void InitInstanceProc();
1596 void FreeInstanceProc();
1600 HMENU MakeMenuOrId();
1602 void AssignZOrder();
1609 TResult ReceiveMessage(
HWND, TMsgId, TParam1 = 0, TParam2 = 0)
noexcept;
1610 friend void* GetMessageReceiverMemberFunctionAddress();
1622 TWindow(const TWindow&);
1623 TWindow&
operator =(const TWindow&);
1632 class TDummy_GetClassNameHasBeenReplacedByGetWindowClassName_ {};
1633 virtual auto GetClassName() -> TDummy_GetClassNameHasBeenReplacedByGetWindowClassName_ {
return {};}
1684#if defined(__TRACE) || defined(__WARN)
1730 return HWndReceiver;
1771 return ChildList ? ChildList->SiblingList :
nullptr;
1798 return (Flags &
mask) ?
true :
false;
1860inline WNDPROC TWindow::GetInstanceProc()
const{
1861 return InstanceProc;
1927 if (
color == BkgndColor)
return;
1954 if (
color == TextColor)
return;
1960#if defined(OWL5_COMPAT)
1965 TransferBufferSize = 0;
1973 TransferBufferSize = size;
1979template <
class TBuffer>
1987template <
class TElement, u
int Count>
2027inline TWindow::operator
HWND()
const{
2113 return ::GetCapture();
2140 return ::GetFocus();
2228 return ::WindowFromPoint(
point);
2328 return ::GetClassLong(
GetHandle(), index);
2353 return ::GetClassWord(
GetHandle(), index);
2391 return ::GetWindowLong(
GetHandle(), index);
2421 return ::GetWindowLongPtr(
GetHandle(), index);
2445 return ::GetWindowWord(
GetHandle(), index);
2644 return ::GetWindowTextLength(
GetHandle());
2704 return ::GetActiveWindow();
2725 return ::GetDesktopWindow();
2752 return ::GetLastActivePopup(
GetHandle());
3001 return ::GetWindowRgn(GetHandle(),
r.GetHandle());
3014 return ::SetWindowRgn(GetHandle(),
r,
repaint) != 0;
3268 return ContextPopupMenu;
3388 return ::GetCaretBlinkTime();
3717#if defined(OWL5_COMPAT)
4102 if (Font && f != Font->GetHandle())
4183#if defined(OWL5_COMPAT)
4187inline void TWindow::EvWinIniChange(
LPCTSTR )
Definition of class TApplication.
#define PRECONDITION(condition)
Derived from TModule and TMsgThread and virtually derived from TEventHandler, TApplication acts as an...
TCurrentEvent & GetCurrentEvent()
Return the current event from the message queue.
Class wrapper for management of color values.
static const TColor Transparent
a non-painting color
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
uint GetId() const
Retrieves the id of the command.
uint Flags
TCommandStatus flags Is TCommandStatus::WasHandled if the command enabler has been handled.
virtual void SetCheck(int check)=0
Changes the check state of the command sender to either unchecked, checked, or indeterminate.
bool GetHandled()
Return true if the command enabler has been handled.
bool IsReceiver(HWND hReceiver)
Returns true if receiver is the same as the message responder originally set up in the constructor.
virtual void SetText(LPCTSTR text)=0
Changes the text associated with a command sender; for example, text associated with a menu item or t...
void SetReceiver(HWND hReceiver)
Sets the receiver for the enabler.
TCommandState
Enumeration describing the 3-states or availability of a command.
@ Unchecked
Command is not enabled.
@ Checked
Command is enabled.
void SetHandled()
Marks that the enabler has been handled.
bool SendsCommand() const
Returns true if this command enabler sends a command message.
void SetText(const tstring &s)
void SetCheck(bool isChecked)
Overload; allows you to pass a bool safely.
HWND GetReceiver() const
Returns the handle of the window that this enabler was destined for.
TCommandStatus
Enumeration describing whether the associated command has been enabled or disabled,...
@ WasHandled
Command was enabled or disabled.
@ NonSender
Command does not generate WM_COMMAND messages.
Class will be base class for owner draw items: ListBox,ComboBox,Menu atc.
virtual void Measure(MEASUREITEMSTRUCT &)
virtual void Draw(DRAWITEMSTRUCT &)
virtual int Compare(COMPAREITEMSTRUCT &)
TDropInfo is a simple class that supports file-name drag-and-drop operations using the WM_DROPFILES m...
TEventHandler is a base class from which you can derive classes that handle messages.
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...
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.
The tagSIZE struct is defined as.
Classes that inherit from TStreamableBase are known as streamable classes (their objects can be writt...
Utility class template used as an iterator type template for TChildrenRangeTemplate.
std::forward_iterator_tag iterator_category
TChildrenIteratorTemplate()=default
TChildrenIteratorTemplate(reference parent)
Utility class template used as a return type for TWindow::GetChildren.
TChildrenRangeTemplate(reference parent)
TChildrenRangeTemplate()=default
const T & const_reference
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...
TPoint MapWindowPoints(const TWindow &wndTo, const TPoint &p) const
Overload for TWindow and TPoint See MapWindowPoints(HWND, const TPoint&).
void EvShowWindow(bool show, uint status)
The default message handler for WM_SHOWWINDOW.
void CreateCaret(HBITMAP hBitmap)
Creates a new caret for the system.
int EvVKeyToItem(uint key, HWND hWndListBox, int caretIndex)
The default message handler for WM_VKEYTOITEM.
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...
void EvEnable(bool enabled)
The default message handler for WM_ENABLE.
uint16 SetWindowWord(int index, uint16 newWord)
Changes information about the window.
static TPoint GetCursorPos()
static HWND GetActiveWindow()
Retrieves the handle of the active window.
static void AdjustWindowRectEx(TRect &rect, uint32 style, bool menu, uint32 exStyle)
Calculates the size of a window rectangle that has an extended style.
void ShowScrollBar(int bar, bool show=true)
Displays or hides the scroll bar.
void SetCaption(const tstring &title)
HMENU LoadMenu(TResId id) const
HWND SetCapture()
Sets the mouse capture to the current window.
static uint GetCaretBlinkTime()
Retrieves the caret blink rate in milliseconds.
TRect MapScreenToClient(const TRect &r) const
Functional-style overload for TRect; converts the given rectangle coordinates and returns the result.
HWND ChildWindowFromPoint(const TPoint &point) const
Determines which of the child windows contains the point specified in TPoint.
void EvNCLButtonDown(uint codeHitTest, const TPoint &)
The default message handler for WM_NCLBUTTONDOWN.
static HWND GetDesktopWindow()
Returns a handle to the desktop window.
void SetNext(TWindow *next)
Sets the next window in the sibling list.
void EvLButtonUp(uint modKeys, const TPoint &point)
The default message handler for WM_LBUTTONUP.
void MapWindowPoints(HWND hWndTo, TPoint(&p)[Count]) const
Overload for array See MapWindowPoints(HWND, TPoint*, int).
tstring LoadString(uint id) const
uint IsDlgButtonChecked(int buttonId) const
Indicates if the child button specified in the integer parameter, buttonId, is checked,...
void SetDlgItemFont(int childId, HFONT f, bool redraw=false) const
static HWND GetCapture()
Returns the handle of the window that has captured the mouse.
void MapScreenToClient(TPoint(&p)[Count]) const
Overload for array See MapScreenToClient(TPoint*, int).
bool KillTimer(UINT_PTR timerId)
Gets rid of the timer and removes any WM_TIMER messages from the message queue.
bool SetProp(const tstring &str, HANDLE data) const
bool EvWindowPosChanging(WINDOWPOS &)
The default message handler for WM_WINDOWPOSCHANGING.
auto GetChildren() const
Const overload of TWindow::GetChildren.
auto SetWindowRgn(const TRegion &, bool repaint=false) -> bool=delete
TCurrentEvent & GetCurrentEvent()
Returns the current event to be processed in the message queue.
bool SetMenu(HMENU hMenu)
Sets the specified window's menu to the menu indicated by hMenu.
void SetDlgItemText(int childId, LPCTSTR text) const
Sets the title or text of a control in a dialog box.
void EvKeyDown(uint key, uint repeatCount, uint flags)
The default message handler for WM_KEYDOWN.
TRect MapWindowPoints(HWND hWndTo, const TRect &r) const
Functional-style overload for TRect; converts the given rectangle coordinates and returns the result.
void EvQueueSync()
The default message handler for WM_QUEUESYNC.
HANDLE GetProp(const tstring &str) const
TApplication * GetApplication() const
Gets a pointer to the TApplication object associated with this.
static void SetCaretBlinkTime(uint16 milliSecs)
Sets the caret blink rate in milliseconds.
HACCEL LoadAccelerators(TResId id) const
void Init(TWindow *parent, const tstring &title, TModule *module)
void EvMButtonDown(uint modKeys, const TPoint &point)
The default message handler for WM_MBUTTONDOWN.
static void DestroyCaret()
DestroyCaret first checks the ownership of the caret.
void CheckRadioButton(int firstButtonId, int lastButtonId, int checkButtonId)
Checks the radio button specified by checkButtonId and removes the check mark from the other radio bu...
HANDLE GetProp(uint16 atom) const
Returns a handle to the property list of the specified window.
void SetBkgndColor(TColor color, bool shouldUpdate=true)
Sets the background color for the window.
void EvPaletteIsChanging(HWND hWndPalChg)
The default message handler for WM_PALETTEISCHANGING.
static TPoint GetCaretPos()
void EvRButtonDown(uint modKeys, const TPoint &point)
The default message handler for WM_RBUTTONDOWN.
void EvSysKeyDown(uint key, uint repeatCount, uint flags)
The default message handler for WM_SYSKEYDOWN.
bool EnableScrollBar(uint sbFlags=SB_BOTH, uint arrowFlags=ESB_ENABLE_BOTH)
Disables or enables one or both of the scroll bar arrows on the scroll bars associated with this wind...
TPoint MapWindowPoints(HWND hWndTo, const TPoint &p) const
Functional-style overload for TPoint; converts the given point coordinates and returns the result.
tstring GetWindowText() const
String-aware overload.
TRect GetDlgItemRect(int childId) const
Returns the window rectangle of the given child, specified in this window's client coordinates.
virtual bool EnableWindow(bool enable)
Allows the given window to receive input from the keyboard of mouse.
static HWND WindowFromPoint(const TPoint &point)
Returns the handle of the window in which the specified point (point) lies.
HICON EvGetIcon(bool isBigIcon)
uint EvMouseActivate(HWND hTopLevel, uint hitCode, TMsgId)
The default message handler for WM_MOUSEACTIVATE.
TWindow * GetLastChild()
Returns a pointer to the last child window in the interface object's child list.
auto GetLastChild() const -> const TWindow *
HTASK GetWindowTask() const
Returns a handle to the task that created the specified window.
void EvNCRButtonDown(uint codeHitTest, const TPoint &)
The default message handler for WM_NCRBUTTONDOWN.
void DrawMenuBar()
DrawMenuBar redraws the menu bar.
void EvAskCBFormatName(uint bufLen, TCHAR *buffer)
The default message handler for WM_ASKCBFORMATNAME.
void EvRButtonDblClk(uint modKeys, const TPoint &point)
The default message handler for WM_RBUTTONDBLCLK.
bool SetWindowPos(HWND hWndInsertAfter, const TRect &rect, uint flags)
Changes the size of the window pointed to by rect.
TRect GetChildRect(HWND hWnd) const
Returns the window rectangle of the given window, specified in this window's client coordinates.
void EvSysChar(uint key, uint repeatCount, uint flags)
The default message handler for WM_SYSCHAR.
void EvSpoolerStatus(uint jobStatus, uint jobsLeft)
The default message handler for WM_SPOOLERSTATUS.
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 BringWindowToTop()
Brings a pop-up or child window to the top of the stack of overlapping windows and activates it.
void MapScreenToClient(TPoint *p, int count) const
Maps the given points, specified in screen coordinates, to client coordinates in this window.
HWND GetDlgItem(int childId) const
Retrieves the handle of a control specified by childId.
void EvRenderFormat(uint dataFormat)
The default message handler for WM_RENDERFORMAT.
bool LockWindowUpdate(bool lock=true)
Prevents or enables window drawing for one window at a time.
void EvSysKeyUp(uint key, uint repeatCount, uint flags)
The default message handler for WM_SYSKEYUP.
auto Next() const -> const TWindow *
HANDLE RemoveProp(uint16 atom) const
Removes the property specified by atom from the application's property list.
bool GetUpdateRect(TRect &rect, bool erase=true) const
Retrieves the screen coordinates of the rectangle that encloses the updated region of the specified w...
void EvActivateApp(bool active, DWORD threadId)
The default message handler for WM_ACTIVATEAPP.
void SetDlgItemText(int childId, uint resourceStringId) const
int GetId() const
Returns Attr.Id, the ID used to find the window in a specified parent's child list.
TWindow * GetParent() const
Retrieves the OWL object of the parent window. If none exists, returns 0.
auto GetBkgndColor() const -> TColor
Returns the overriding background color set for the window.
bool UnregisterHotKey(int idHotKey)
Unregisters a hotkey ID with the current application.
auto GetWindowRgn(TRegion &) const -> int
Obtains a copy of the region of the window within which the system permits drawing.
void EvInitMenu(HMENU hMenu)
The default message handler for WM_INITMENU.
void EvPaintClipboard(HWND hWnd, const PAINTSTRUCT &)
The default message handler for WM_PAINTCLIPBOARD.
TWindow * GetWindowPtr(HWND hWnd) const
Calls TApplication:GetWindowPtr on the application associated with this window.
bool IsWindowEnabled() const
Returns true if the window is enabled.
HBITMAP LoadBitmap(TResId id) const
void SetWindowFont(HFONT font, bool redraw=true)
Sets the font that a control uses to draw text.
LONG_PTR GetWindowLongPtr(int index) const
Retrieves information about the window depending on the value stored in index.
TRect GetWindowRect() const
Gets the screen coordinates of the window's rectangle.
bool SetDocTitle(const tstring &docname, int index)
virtual TTooltip * GetTooltip() const
void DisableAutoCreate()
Disables the feature that allows an associated child window interface element to be created and displ...
bool RedrawWindow(TRect *update, HRGN hUpdateRgn, uint redrawFlags=RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE)
Redraws the rectangle specified by update and the region specified by hUpdateRgn.
void SetHandle(THandle)
Sets the window handle in a derived class.
long GetClassLong(int index) const
Retrieves the 32-bit value containing information about the window class.
void SetTransferBuffer(void *transferBuffer, uint size)
Sets TransferBuffer and TransferBufferSize.
static void ShutDownWindow(TWindow *win, int retVal=0)
This version of ShutDownWindow unconditionally shuts down a given window, calls Destroy on the interf...
void ValidateRect(const TRect &rect)
Validates a portion of the client area indicated by rect.
int EnumProps(PROPENUMPROC proc)
Enumerates all the items in the property list of the current window and passes them one by one to the...
void Validate()
Calls the function ValidateRect to validate (that is, remove from the area to be updated) the entire ...
HICON EvQueryDragIcon()
The default message handler for WM_QUERYDRAGICON.
virtual void InvalidateRect(const TRect &rect, bool erase=true)
Invalidates a specified client area.
void EvNextDlgCtl(TParam1 handleOrDirectionFlag, bool isHandle)
TPoint MapClientToScreen(const TPoint &p) const
Function-style version of ClientToScreen.
long GetWindowLong(int index) const
Retrieves information about the window depending on the value stored in index.
void EvDestroyClipboard()
The default message handler for WM_DESTROYCLIPBOARD.
void SetFlag(uint mask)
Sets the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
LONG_PTR SetWindowLongPtr(int index, LONG_PTR newLong)
Changes information about the window. For a list of constants, see GetWindowLongPtr()
auto SetWindowRgn(HRGN, bool repaint=false) -> bool
Sets the area within the window where the system permits drawing.
int32 EvMenuChar(uint nChar, uint menuType, HMENU hMenu)
The default message handler for WM_MENUCHAR.
void EvRButtonUp(uint modKeys, const TPoint &point)
The default message handler for WM_RBUTTONUP.
bool HiliteMenuItem(HMENU hMenu, uint idItem, uint hilite)
Either highlights or removes highlighting from a top-level item in the menu.
void SetTextColor(TColor color, bool shouldUpdate=true)
Sets the text color for the window.
TWindow * GetParentO() const
Return the OWL's parent for this window.
static void SetCaretPos(int x, int y)
Sets the position of the caret in the coordinates of the client window.
void ShowCaret()
Displays the caret in the specified shape in the active window at the current position.
void EvTimeChange()
The default message handler for WM_TIMECHANGE.
void MapClientToScreen(TPoint(&p)[Count]) const
Overload for array See MapClientToScreen(TPoint*, int).
static void ReleaseCapture()
Releases the mouse capture from this window.
TModule * GetModule() const
Returns a pointer to the module object.
static TPoint GetMessagePos()
TWindowAttr & GetWindowAttr()
Returns the TWindowAttr structure, which contains the window's creation attributes.
void MapWindowPoints(HWND hWndTo, TPoint *pts, int count) const
Maps a set of points in one window to a relative set of points in another window.
uint16 GetWindowWord(int index) const
Retrieves information about this window depending on the value of index.
HWND GetTopWindow() const
Returns a handle to the top window currently owned by this parent window.
void ResetWindowRgn(bool repaint=false)
Calls SetWindowRgn(nullptr, repaint).
bool EvQueryNewPalette()
The default message handler for WM_QUERYNEWPALETTE.
void InvalidateRgn(HRGN hRgn, bool erase=true)
Invalidates a client area within a region specified by the hRgn parameter when the application receiv...
void ScrollWindowEx(int dx, int dy, const TRect *scroll=0, const TRect *clip=0, HRGN hUpdateRgn=nullptr, TRect *update=0, uint flags=0)
Scrolls a window in the vertical (dx) and horizontal (dy) directions.
WNDPROC GetWindowProc() const
uint EvGetDlgCode(const MSG *msg)
The default message handler for WM_GETDLGCODE.
TRect MapWindowPoints(const TWindow &wndTo, const TRect &r) const
Overload for TWindow and TRect See MapWindowPoints(HWND, const TRect&).
void EnableTransfer()
Enables the transfer mechanism, which allows state data to be transferred between the window and a tr...
bool EvCopyData(HWND hwnd, const COPYDATASTRUCT &)
HICON EvSetIcon(bool isBigIcon, HICON)
void SetRedraw(bool redraw)
Sends a WM_SETREDRAW message to a window so that changes can be redrawn (redraw = true) or to prevent...
void MapWindowPoints(const TWindow &wndTo, TPoint(&p)[Count]) const
Overload for TWindow and array See MapWindowPoints(HWND, TPoint*, int).
TRect MapClientRect(const TWindow &wndTo) const
Overload for TWindow See MapClientRect(HWND).
int EvGetText(int bufSize, TCHAR *buf)
The default message handler for WM_GETTEXT.
bool IsIconic() const
Returns true if window is iconic or minimized.
bool IsWindow() const
Returns true if an HWND is being used.
TPopupMenu * GetContextMenu() const
Returns the associated popup menu used by the window.
void EvFontChange()
The default message handler for WM_FONTCHANGE.
void ClientToScreen(TPoint &point) const
Converts the client coordinates specified in point to screen coordinates for the new window.
void ShowOwnedPopups(bool show)
Shows or hides all owned pop-up windows according to the value of show.
void EvActivate(uint active, bool minimized, HWND hWndOther)
Default message handler for WM_ACTIVATE.
void EvNCLButtonDblClk(uint codeHitTest, const TPoint &)
The default message handler for WM_NCLBUTTONDBLCLK.
void EvHotKey(int idHotKey, uint modifiers, uint vk)
HWND GetLastActivePopup() const
Returns the last active pop-up window in the list.
TRect MapClientToScreen(const TRect &r) const
Functional-style overload for TRect; converts the given rectangle coordinates and returns the result.
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
HWND SetActiveWindow()
Activates a top-level window.
void EvParentNotify(const TParentNotify &)
The default message handler for WM_PARENTNOTIFY.
TPoint MapScreenToClient(const TPoint &p) const
Functional-style version of ScreenToClient.
HMENU GetMenu() const
Returns the handle to the menu of the indicated window.
void EvSizeClipboard(HWND hWndViewer, const TRect &)
The default message handler for WM_SIZECLIPBOARD.
bool EvNCCreate(CREATESTRUCT &)
The default message handler for WM_NCCREATE.
auto Previous() const -> const TWindow *
void * GetTransferBuffer() const
void EvNCPaint(HRGN)
The default message handler for WM_NCPAINT.
bool MoveWindow(int x, int y, int w, int h, bool repaint=false)
Repositions the specified window.
bool SetProp(uint16 atom, HANDLE data) const
Adds an item to the property list of the specified window.
void EvWindowPosChanged(const WINDOWPOS &windowPos)
The default message handler for WM_WINDOWPOSCHANGED.
TResult SendDlgItemMessage(int childId, TMsgId, TParam1=0, TParam2=0)
Sends a message (msg) to the control specified in childId.
void EvRenderAllFormats()
The default message handler for WM_RENDERALLFORMATS.
void DisableTransfer()
Disables (for the interface object) the transfer mechanism, which allows state data to be transferred...
uint16 SetClassWord(int index, uint16 newWord)
Sets the word value at the specified offset (index).
HCURSOR LoadCursor(TResId id) const
LPCTSTR GetCaption() const
Returns the Title member of TWindow.
void EvDevModeChange(LPCTSTR devName)
The default message handler for WM_DEVMODECHANGE.
bool EvNCActivate(bool active)
The default message handler for WM_NCACTIVATE.
uint EvNCHitTest(const TPoint &)
The default message handler for WM_NCHITTEST.
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
TRect GetClientRect() const
Gets the coordinates of the window's client area (the area in a window you can use for drawing).
auto GetFirstChild() const -> const TWindow *
void EvHScrollClipboard(HWND hCBViewer, uint scrollCode, uint pos)
The default message handler for WM_HSCROLLCLIPBOARD.
void ScrollWindow(int dx, int dy, const TRect *scroll=nullptr, const TRect *clip=nullptr)
Scrolls a window in the vertical (dx) and horizontal (dy) directions.
UINT_PTR SetTimer(UINT_PTR timerId, uint timeout, TIMERPROC proc=0)
Creates a timer object associated with this window.
int GetDlgCtrlID() const
Returns the ID of the control.
void EvVScrollClipboard(HWND hCBViewer, uint scrollCode, uint pos)
The default message handler for WM_VSCROLLCLIPBOARD.
long SetClassLong(int index, long newLong)
Sets the long value at the specified offset (index).
void SetWindowText(LPCTSTR str)
Sets the window's text to the given string (by copying).
void EvSysCommand(uint cmdType, const TPoint &point)
Responds to a user-selected command from the System menu or when the user selects the maximize or min...
void UpdateWindow()
Updates the client area of the specified window by immediately sending a WM_PAINT message.
std::string LoadHtml(TResId id) const
bool WinHelp(LPCTSTR helpFile, uint command, ULONG_PTR data) const
Invokes a specified help system.
void SetDlgItemText(int childId, const tstring &text) const
void EvMButtonDblClk(uint modKeys, const TPoint &point)
The default message handler for WM_MBUTTONDBLCLK.
void HideCaret()
Removes the caret from the specified display screen.
auto GetTextColor() const -> TColor
Returns the overriding text color set for the window.
void SetModule(TModule *module)
Sets the default module for this window.
void EvSetFocus(HWND hWndLostFocus)
The default message handler for WM_SETFOCUS.
void ClearFlag(uint mask)
Clears the specified TWindow wfXxxx constant flags (for example wfAlias, wfTransfer,...
void EvDropFiles(TDropInfo dropInfo)
The default message handler for WM_DROPFILES.
bool IsZoomed() const
Returns true if window is zoomed or maximized.
HMENU GetSystemMenu(bool revert=false) const
Returns a handle to the system menu so that an application can access the system menu.
void SendNotification(int id, int notifyCode, HWND hCtl, TMsgId=WM_COMMAND)
Repacks a command message (msg) so that a child window (hCtl) can send a message to its parent regard...
bool WinHelp(const tstring &helpFile, uint command, ULONG_PTR data) const
HWND GetNextWindow(uint dirFlag) const
Finds the handle associated with either the next or previous window in the window manager's list.
void EvNCMouseMove(uint codeHitTest, const TPoint &)
The default message handler for WM_NCMOUSEMOVE.
bool PostMessage(TMsgId, TParam1=0, TParam2=0)
Posts a message (msg) to the window in the application's message queue.
void EvNCRButtonDblClk(uint codeHitTest, const TPoint &)
The default message handler for WM_NCRBUTTONDBLCLK.
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.
bool IsWindowVisible() const
Returns true if the window is visible.
int GetDlgItemText(int childId, TCHAR *text, int maxValue) const
Retrieves the text of a control specified by childId.
void CheckDlgButton(int buttonId, uint check)
Places a check mark in (or removes a check mark from) the button specified in buttonId.
HANDLE RemoveProp(const tstring &str) const
static void AdjustWindowRect(TRect &rect, uint32 style, bool menu)
Calculates the size of the window rectangle according to the indicated client-rectangle size.
void MapClientToScreen(TPoint *p, int count) const
Maps the given points, specified in client coordinates in this window, to screen coordinates.
void EvMouseMove(uint modKeys, const TPoint &point)
The default message handler for WM_MOUSEMOVE.
HFONT GetWindowFont()
Gets the font the control uses to draw text.
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),...
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
long SetWindowLong(int index, long newLong)
Changes information about the window.
void EvTimer(uint timerId)
The default message handler for WM_TIMER.
WNDPROC SetWindowProc(WNDPROC wndProc)
void EvChangeCBChain(HWND hWndRemoved, HWND hWndNext)
The default message handler for WM_CHANGECBCHAIN.
void EvChar(uint key, uint repeatCount, uint flags)
The default message handler for WM_CHAR.
void EvKeyUp(uint key, uint repeatCount, uint flags)
The default message handler for WM_KEYUP.
void MapWindowPoints(const TWindow &wndTo, TPoint *p, int n) const
Overload for TWindow See MapWindowPoints(HWND, TPoint*, int).
void EvLButtonDblClk(uint modKeys, const TPoint &point)
The default message handler for WM_LBUTTONDBLCLK.
uint GetTransferBufferSize() const
bool IsFlagSet(uint mask)
Returns the state of the bit flag in Attr.Flags whose mask is supplied.
static HWND GetFocus()
Gets a handle to the window that has the focus.
int EvGetTextLength()
The default message handler for WM_GETTEXTLENGTH.
uint16 GetClassWord(int index) const
Gets a 16-bit value containing information about the class or style of the window.
void EvCompacting(uint compactRatio)
The default message handler for WM_COMPACTING.
void EvMenuSelect(uint menuItemId, uint flags, HMENU hMenu)
The default message handler for WM_MENUSELECT.
void EvNCMButtonDown(uint codeHitTest, const TPoint &)
The default message handler for WM_NCMBUTTONDOWN.
TRect MapWindowRect(const TWindow &wndTo) const
Overload for TWindow See MapWindowRect(HWND).
bool FlashWindow(bool invert)
Changes the window from active to inactive or vice versa.
void EvCancelMode()
The default message handler for WM_CANCELMODE.
HFONT EvGetFont()
The default message handler for WM_GETFONT.
uint EvNCCalcSize(bool calcValidRects, NCCALCSIZE_PARAMS &)
The default message handler for WM_NCCALCSIZE.
bool EvQueryOpen()
The default message handler for WM_QUERYOPEN.
void EvSetText(LPCTSTR text)
The default message handler for WM_SETTEXT.
void EvSetRedraw(bool redraw)
The default message handler for WM_SETREDRAW.
TRect MapClientRect(HWND hWndTo) const
Maps the window's client rectangle (GetClientRect) to client coordinates in the given destination win...
void EvMButtonUp(uint modKeys, const TPoint &point)
The default message handler for WM_MBUTTONUP.
void EvNCRButtonUp(uint codeHitTest, const TPoint &)
The default message handler for WM_NCRBUTTONUP.
void EvGetMinMaxInfo(MINMAXINFO &minmaxinfo)
The default message handler for WM_GETMINMAXINFO.
TRect MapWindowRect(HWND hWndTo) const
Maps the window's rectangle (GetWindowRect) to client coordinates in the given destination window.
void EvDrawClipboard()
The default message handler for WM_DRAWCLIPBOARD.
void EnableAutoCreate()
Ensures that an associated child window interface element is created and displayed along with its par...
void EvSetFont(HFONT hFont, bool redraw)
The default message handler for WM_SETFONT.
HICON LoadIcon(TResId id) const
HWND GetNextDlgTabItem(HWND hWndCtrl, bool previous=false) const
Returns the handle of the first control that lets the user press the Tab key to move to the next cont...
HFONT GetDlgItemFont(int childId) const
HWND GetNextDlgGroupItem(HWND hWndCtrl, bool previous=false) const
Returns either the next or the previous control in the dialog box.
void EvSysDeadChar(uint key, uint repeatCount, uint flags)
The default message handler for WM_SYSDEADCHAR.
void EvPaletteChanged(HWND hWndPalChg)
The default message handler for WM_PALETTECHANGED.
TWindow * GetFirstChild()
Returns a pointer to the first child window, which is the first window created in the interface objec...
TRect GetChildRect(const TWindow &wnd) const
Overload for TWindow See GetChildRect(HWND).
std::pair< int, int > TScrollRange
HWND THandle
TWindow encapsulates an HWND.
void SetWindowText(const tstring &str)
bool RegisterHotKey(int idHotKey, uint modifiers, uint virtKey)
Registers a hotkey ID with the current application.
int EvCharToItem(uint ch, HWND hWndListBox, int caretIndex)
The default message handler for WM_CHARTOITEM.
void EvNCMButtonDblClk(uint codeHitTest, const TPoint &)
The default message handler for WM_NCMBUTTONDBLCLK.
virtual void Invalidate(bool erase=true)
Invalidates (mark for painting) the entire client area of a window.
HWND GetHandle() const
Returns the handle of the window.
void EvNCMButtonUp(uint codeHitTest, const TPoint &)
The default message handler for WM_NCMBUTTONUP.
auto ChildWithId(int id) const -> const TWindow *
void SetDlgItemInt(int childId, uint value, bool isSigned=true) const
Sets the child window with the Id (childId) in the window to the integer value specified in value.
void EvDeadChar(uint deadKey, uint repeatCount, uint flags)
The default message handler for WM_DEADCHAR.
TScroller * GetScroller()
Returns the associated scroller object for this window.
void ValidateRgn(HRGN hRgn)
Validates the client area within a region of the current window.
int GetWindowTextLength() const
Returns the length, in characters, of the specified window's title.
void EvNCLButtonUp(uint codeHitTest, const TPoint &)
The default message handler for WM_NCLBUTTONUP.
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.
Definition of classes for clipboard Encapsulation.
Definition of windowing system color classes.
#define DECLARE_RESPONSE_TABLE(cls)
#define DECLARE_STREAMABLE_OWL(cls, ver)
#define DECLARE_STREAMABLE_INLINES(cls)
HACCEL LoadAccelerators(TResId id) const
Wrapper for the Windows API.
HCURSOR LoadCursor(TResId id) const
Wrapper for the Windows API.
HICON LoadIcon(TResId name) const
Wrapper for the Windows API.
int LoadString(uint id, TCHAR *buf, int maxChars) const
Loads a string resource identified by id into the buffer pointed to by buff.
HMENU LoadMenu(TResId id) const
Wrapper for the Windows API.
std::string LoadHtml(TResId) const
Loads the given HTML resource and returns it as a narrow string.
HBITMAP LoadBitmap(TResId id) const
Wrapper for the Windows API.
TEventStatus
Mixin window event implementation return status.
TWindowFlag
Define bit masks for the internally used flag attributes of TWindow.
TTransferDirection
The TTransferDirection enum describes the constants that the transfer function uses to determine how ...
@ esPartial
Additional handlers may be invoked.
@ esComplete
No additional handlers are needed.
@ wfDeleteOnClose
Window is condemned on EvClose.
@ wfUnDisabled
Used temporarily when destroying MDI child.
@ wfUnHidden
Used temporarily when destroying MDI child.
@ 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.
@ wfInsertAtEdge
(Decoration) Window to be inserted against frame's edge
@ wfFullyCreated
Window is fully created & not being destroyed.
@ wfDetached
Window handle has been detached.
@ wfStreamTop
This window is the topmost one to stream.
@ wfPropagateIdle
Pass down IdleAction.
@ wfShrinkToClient
Shrink a frame window to its client's size.
@ 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.
@ tdGetData
Get data from the window into the buffer.
Object Windows Library (OWLNext Core)
UINT TMsgId
Message ID type.
void SetDlgItemText(HWND ctrl, const tstring &text)
String overload.
owl::opstream & operator<<(owl::opstream &os, const TColor &c)
Insert the color value into a persistent output stream.
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.
WPARAM TParam1
First parameter type.
TDispatch< WM_PARENTNOTIFY >::TArgs TParentNotify
Alias for convenience.
TParam1 MkParam1(uint lo, uint hi)
LRESULT TResult
Result type.
void CheckDlgButton(HWND ctrl, bool checked=true)
Sets the state of the given control to BST_CHECKED (or BST_UNCHECKED).
tstring GetDlgItemText(HWND ctrl)
String overload.
void DoEnableAutoCreate(TWindow *win, void *)
A TActionFunc defined in window.cpp.
General definitions used by all ObjectWindows programs.
#define OWL_DISABLE_WARNING_POP
#define OWL_DISABLE_WARNING_ZERO_AS_NULL_POINTER
#define OWL_DISABLE_WARNING_PUSH
Current event structure for windows events.
Holds TWindow attributes set during construction of a window.
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.
Event response table macros for windows messages.
Classes for window system structure and type encapsulation.