20#if defined(__TRACE) || defined(__WARN)
21# if !defined(OWL_PROFILE_H)
57uint TGadgetWindow::FlatStyle = NonFlatNormal;
103 WantTimer(
false),TimerID(0), ThemeBackgroundMode(
false)
121#if defined(BI_COMP_GNUC)
126 ShrinkWrapWidth = (
static_cast<int>(Direction)) !=
Horizontal;
127 ShrinkWrapHeight = (
static_cast<int>(Direction)) !=
Vertical;
151 SharedCels =
nullptr;
307 while (parent && !frame) {
383 if (ShrinkWrapWidth || ShrinkWrapHeight)
389 size.cx =
layout.DesiredSize.cx;
396 if (ShrinkWrapHeight) {
400 size.cy =
layout.DesiredSize.cy;
413 if (ShrinkWrapWidth || ShrinkWrapHeight) {
419 if (ShrinkWrapHeight)
451#if defined(BI_COMP_GNUC)
456 if ((
static_cast<int>(Direction)) !=
direction || DirtyLayout) {
460 if ((
static_cast<int>(Direction)) !=
direction) {
465 int t = Margins.
Left; Margins.
Left = Margins.
Top; Margins.
Top = t;
470 bool sww = ShrinkWrapWidth;
471 ShrinkWrapWidth = ShrinkWrapHeight;
472 ShrinkWrapHeight =
sww;
516 ThemeBackgroundMode =
enable;
525 return ThemeBackgroundMode;
566 int left, right, top, bottom;
567 GetMargins(Margins, left, right, top, bottom);
571 rect.right = Attr.W - right;
581 rect.bottom = Attr.H - bottom;
643TGadgetWindow::LayoutHorizontally(TLayoutInfo&
layout)
660 if (WideAsPossible) {
663 if (!
gadget->WideAsPossible) {
717 if (
gadget->WideAsPossible)
744TGadgetWindow::LayoutVertically(TLayoutInfo&
layout)
752 layout.DesiredSize = TSize(0,0);
753 layout.GadgetBounds =
new TRect[NumGadgets];
805 layout.DesiredSize.cx =
static_cast<int>(std::max(
int(
bounds.right+
rightM),
static_cast<int>(
layout.DesiredSize.cx)));
845TGadgetWindow::LayoutRectangularly(TLayoutInfo&
layout)
850 layout.DesiredSize = TSize(0,0);
851 layout.GadgetBounds =
new TRect[NumGadgets];
861 int right = RowWidth -
rightM;
889 gadget->SetEndOfRow(
false);
945 if (
gadget->IsVisible()) {
976 static_cast<int>(std::max(
int(
layout.GadgetBounds[
iend].right+
rightM),
static_cast<int>(
layout.DesiredSize.cx)));
992 LayoutHorizontally(
layout);
1000 LayoutRectangularly(
layout);
1074 if (
gadget.WideAsPossible)
1088 if (
gadget.Window !=
this)
1104 if (
gadget.WideAsPossible)
1182 if ((ShrinkWrapWidth && Attr.W != size.cx) || (ShrinkWrapHeight && Attr.H != size.cy))
1184 if (ShrinkWrapWidth)
1186 if (ShrinkWrapHeight)
1233 if (Tooltip && Tooltip->
IsWindow()) {
1261 for (
TGadget*
g = Gadgets;
g;
g =
g->NextGadget())
1289 if (DirtyLayout || WideAsPossible)
1295 if (ShrinkWrapWidth)
1297 if (ShrinkWrapHeight)
1350 part.DrawBackground(dc,
r,
r);
1369#if defined(__TRACE) || defined(__WARN)
1498 p -=
g->GetBounds().TopLeft();
1597 TRACEX(
OwlCmd, 1,
"TGadgetWindow::EvCommand - id(" <<
id <<
"), ctl("
1632 if (frame || !
target->GetParentO())
1671 if (
target &&
ce.IsReceiver(*
this)) {
1675 if(
ce.GetHandled() )
Definition of a bitmap Cel array class.
#define PRECONDITION(condition)
#define DIAG_DECLARE_GROUP(group)
#define TRACEX(group, level, message)
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
TCelArray is a horizontal array of cels (a unit of animation) created by slicing a portion of or an e...
Class wrapper for management of color values.
static const TColor Sys3dFace
The symbolic system color value for the face color of 3-dimensional display elements.
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
TDC is the root class for GDI DC wrappers.
virtual bool SetViewportOrg(const TPoint &origin, TPoint *oldOrg=nullptr)
Sets this DC's viewport origin to the given origin value, and saves the previous origin in oldOrg.
bool MoveTo(int x, int y)
Moves the current position of this DC to the given x- and y-coordinates or to the given point.
virtual int GetDeviceCaps(int index) const
Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.
bool GetViewportOrg(TPoint &point) const
The first version sets in the point argument the x- and y-extents (in device-units) of this DC's view...
void SelectObject(const TBrush &brush)
Selects the given GDI brush object into this DC.
void RestorePen()
Restores the original GDI pen object to this DC.
int IntersectClipRect(const TRect &rect)
Creates a new clipping region for this DC's window by forming the intersection of the current region ...
int SelectClipRgn(const TRegion ®ion)
Selects the given region as the current clipping region for this DC.
int GetClipRgn(TRegion ®ion) const
Retrieves this DC's current clip-region and, if successful, places a copy of it in the region argumen...
bool LineTo(int x, int y)
Draws a line on this DC using the current pen object.
TDecoratedFrame automatically positions its client window (you must supply a client window) so that i...
Encapsulates the system font used for a specific GUI element, e.g. icon, caption, menu,...
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...
TFont derived from TGdiObject provides constructors for creating font objects from explicit informati...
LOGFONT GetObject() const
Returns information about this font object.
TEXTMETRIC GetTextMetrics(TDC &dc) const
Retrieves information about this font when selected in the specified dc.
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
virtual HWND GetCommandTarget()
Locates and returns the child window that is the target of the command and command enable messages.
TGadgetControl(TWindow *parent=nullptr, TGadget *soleGadget=nullptr, TFont *font=nullptr, TModule *module=nullptr)
Constructs a control out of a gadget.
TGadget is the base class for the following derived gadget classes:
virtual void MouseMove(uint modKeys, const TPoint &point)
Mouse is moving over this gadget.
virtual void MouseEnter(uint modKeys, const TPoint &point)
Mouse is entering this gadget.
virtual void MouseLeave(uint modKeys, const TPoint &point)
Mouse is leaving this gadget.
@ Plain
Plain window frame.
TGadgetList is a list of gadgets with management functions.
TPlacement
Enumerates the placement of a gadget.
TGadget * GadgetFromPoint(const TPoint &point) const
Returns the gadget that a given window-relative point is in, or 0 if none is found.
virtual void Insert(TGadget &gadget, TPlacement=After, TGadget *sibling=nullptr)
Inserts a Gadget.
virtual void InsertFrom(TGadgetList &list, TPlacement=After, TGadget *sibling=nullptr)
Inserts a list of gadgets.
virtual TGadget * Remove(TGadget &gadget)
Removes (unlinks) a gadget.
Gadget layout information used during the layout process.
Derived from TFont, TGadgetWindowFont is the default font used by TGadgetWindow.
TGadgetWindowFont()
Constructs a font based on TDefaultGuiFont.
Derived from TWindow, TGadgetWindow maintains a list of tiled gadgets for a window and lets you dynam...
auto IdleAction(long idleCount) -> bool override
During idle time, iterates over the Gadgets invoking their CommandEnable() member function.
void EnableThemeBackground(bool enable=true)
virtual void PaintGadgets(TDC &dc, bool erase, TRect &rect)
Called by Paint to repaint all of the gadgets, PaintGadgets iterates through the list of gadgets,...
bool IsBackgroundThemed() const
~TGadgetWindow() override
Destructs this gadget window.
void Insert(TGadget &, TPlacement=After, TGadget *sibling=nullptr) override
Inserts a gadget before or after a sibling gadget (TPlacement).
void EnableTooltip(bool enable=true) override
int LayoutUnitsToPixels(int units)
Converts layout units to pixels.
void SetHintCommand(int id)
(id <= 0) to clear
void EvMouseMove(uint modKeys, const TPoint &point)
Forward mouse moves to the gadget that has captured the mouse, if any.
void SetupWindow() override
Overrides TWindow::SetupWindow to create tooltips for the gadget window.
auto Create() -> bool override
Overrides TWindow member function and chooses the initial size of the gadget if shrink-wrapping was r...
bool EvWindowPosChanging(WINDOWPOS &windowPos)
Intercepts window size changes to make sure that this gadget window follows its own sizing rules.
bool EnableTimer()
Inform GadgetWindow to start a Timer notification.
@ FlatDefault
System automatically select apropriated style.
@ FlatXPTheme
Windows XP theme styles.
@ FlatGrayButtons
Adds Gray buttons effect to FlatStandard.
@ FlatSingleDiv
Adds single divider ala IE 4.01.
@ FlatHotText
Adds hot text effect like.
@ FlatStandard
Flat style IE 3.0 - base style.
void EvRButtonUp(uint modKeys, const TPoint &point)
Pass RButton messages to the gadget at the mouse location or the one with capture.
void Inserted(TGadget &) override
A gadget has been inserted into this gadget window.
void CleanupWindow() override
virtual TRect TileGadgets()
Tiles the Gadgets in the current direction.
void EvSysColorChange()
Responds to WM_SYSCOLORCHANGE to let the gadgets update their UI colors, and to let this gadget windo...
void SetMargins(const TMargins &margins)
Sets or changes the margins for the gadget window and calls LayoutSession().
void EvLButtonDown(uint modKeys, const TPoint &point)
Responds to a left button-down mouse message by forwarding the event to the gadget (if it is enabled)...
void UseDesiredSize()
Updates the Size in Attr.W and Attr.H to match that obtained using GetDesiredSize() for each dimensio...
virtual void SetCelArray(TCelArray *sharedCels)
Sets a new Shared CelArray for this gadget window.
void EvCommandEnable(TCommandEnabler &) override
When the gadget window receives a WM_COMMAND_ENABLE message, it is likely from a gadget or control wi...
auto EvCommand(uint id, HWND hWndCtl, uint notifyCode) -> TResult override
When the gadget window receives a WM_COMMAND message, it is likely from a gadget or control within a ...
void SetTooltip(TTooltip *tooltip)
Sets the Tooltip data member equal to tooltip.
void EvLButtonUp(uint modKeys, const TPoint &point)
Responds to a left button-up mouse message by forwarding the event to the gadget that has the capture...
void GadgetChangedSize(TGadget &gadget)
Used to notify the gadget window that a gadget has changed its size, GadgetChangedSize calls LayoutSe...
auto Remove(TGadget &) -> TGadget *override
Removes a gadget from the gadget window.
bool GadgetSetCapture(TGadget &gadget)
Called by a gadget that wants to capture the mouse.
virtual void GetDesiredSize(TSize &size)
Get the desired size for this gadget window by performing a trial layout of the gadgets without touch...
static void EnableFlatStyle(uint style=FlatDefault)
Set flat style options, or disable it.
virtual void GetInnerRect(TRect &rect)
GetInnerRect computes the rectangle inside of the borders and margins of the gadget.
void SetRectangularDimensions(int width, int height, int rowMargin=-1)
Sets the maximum width for each row used for rectangular layout.
void SetShrinkWrap(bool shrinkWrapWidth, bool shrinkWrapHeight)
Sets the width and height of the data members.
bool IsThemeBackgroundEnabled() const
void InsertFrom(TGadgetList &, TPlacement=After, TGadget *sibling=nullptr) override
Inserts a list of Gadgets.
void Removed(TGadget &) override
This indicates that a gadget has been removed from this gadget window.
void EvRButtonDown(uint modKeys, const TPoint &point)
Pass RButton messages to the gadget at the mouse location or the one with Capture.
void EvLButtonDblClk(uint modKeys, const TPoint &point)
Passes double clicks through as if they were just a second click; finishes the first click,...
virtual TCelArray & GetCelArray(int minX=0, int minY=0)
Gets the Shared CelArray for this gadget window.
TGadgetWindow(TWindow *parent=nullptr, TTileDirection direction=Horizontal, TFont *font=nullptr, TModule *module=nullptr)
Creates a TGadgetWindow interface object with the default tile direction and font and passes module w...
bool PreProcessMsg(MSG &msg) override
Relays 'interesting' messages to the tooltip window.
virtual void PositionGadget(TGadget *previous, TGadget *next, TPoint &point)
Virtual called by TileGadgets() for each gadget in order to give derived classes a chance to modify t...
virtual void SetDirection(TTileDirection direction)
Sets the horizontal or vertical orientation of the gadgets.
virtual void LayoutSession()
LayoutSession is typically called when a change occurs in the size of the margins or gadgets,...
TTileDirection
Enumeration describing how gadgets should be laid out within the gadget window.
@ Vertical
Arrange gadgets in a column.
@ Rectangular
Arrange gadgets in rows and columns (2-D grid)
@ Horizontal
Arrange gadgets in a row.
void GadgetReleaseCapture(TGadget &gadget)
Releases the capture so that other windows can receive mouse messages.
@ PressHints
Hints when a button is pressed.
virtual void LayoutGadgets(TTileDirection dir, TLayoutInfo &layout)
Calculate the layout of the Gadgets in a given direction.
void Paint(TDC &, bool erase, TRect &) override
Puts the font into the device context and calls PaintGadgets.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPen is derived from TGdiObject.
TPoint is a support class, derived from tagPOINT.
An instance of TProfile encapsulates a setting within a system file, often referred to as a profile o...
TRect is a mathematical class derived from tagRect.
TRegion, derived from TGdiObject, represents GDI abstract shapes or regions.
Derived from TWindowDC, TScreenDC is a DC class that provides direct access to the screen bitmap.
The tagSIZE struct is defined as.
int Y() const
Returns the height.
int X() const
Returns the width.
static TThemeModule & GetInstance()
Returns the module instance.
Encapsulates a themed part.
static const TUIMetric CyBorder
static const TUIMetric CxBorder
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
bool EvEraseBkgnd(HDC)
Handler for WM_ERASEBKGND.
static TPoint GetCursorPos()
HWND SetCapture()
Sets the mouse capture to the current window.
void EvLButtonUp(uint modKeys, const TPoint &point)
The default message handler for WM_LBUTTONUP.
bool KillTimer(UINT_PTR timerId)
Gets rid of the timer and removes any WM_TIMER messages from the message queue.
bool EvWindowPosChanging(WINDOWPOS &)
The default message handler for WM_WINDOWPOSCHANGING.
void SetBkgndColor(TColor color, bool shouldUpdate=true)
Sets the background color for the window.
void EvRButtonDown(uint modKeys, const TPoint &point)
The default message handler for WM_RBUTTONDOWN.
static HWND WindowFromPoint(const TPoint &point)
Returns the handle of the window in which the specified point (point) lies.
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 bool PreProcessMsg(MSG &msg)
Called from TApplication::ProcessAppMsg() to give the window an opportunity to perform preprocessing ...
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
virtual void InvalidateRect(const TRect &rect, bool erase=true)
Invalidates a specified client area.
void Init(TWindow *parent, LPCTSTR title, TModule *module)
Normal initialization of a default constructed TWindow.
void EvRButtonUp(uint modKeys, const TPoint &point)
The default message handler for WM_RBUTTONUP.
TWindow * GetParentO() const
Return the OWL's parent for this window.
static void ReleaseCapture()
Releases the mouse capture from this window.
bool IsWindow() const
Returns true if an HWND is being used.
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
virtual void CleanupWindow()
Always called immediately before the HWindow becomes invalid, CleanupWindow gives derived classes an ...
TResult HandleMessage(TMsgId, TParam1=0, TParam2=0)
Dispatches the given message using the response table.
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...
TRect GetClientRect() const
Gets the coordinates of the window's client area (the area in a window you can use for drawing).
UINT_PTR SetTimer(UINT_PTR timerId, uint timeout, TIMERPROC proc=0)
Creates a timer object associated with this window.
virtual TResult EvCommand(uint id, HWND hWndCtl, uint notifyCode)
WindowProc calls EvCommand to handle WM_COMMAND messages.
bool PostMessage(TMsgId, TParam1=0, TParam2=0)
Posts a message (msg) to the window in the application's message queue.
void EvMouseMove(uint modKeys, const TPoint &point)
The default message handler for WM_MOUSEMOVE.
TResult SendMessage(TMsgId, TParam1=0, TParam2=0) const
Sends a message (msg) to a specified window or windows.
virtual void SetupWindow()
Performs setup following creation of an associated MS-Windows window.
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.
Definition of classes for CommonControl encapsulation.
Definition of class TDecoratedFrame, a TFrameWindow that can manage decorations around the client win...
#define WM_COMMAND_ENABLE
#define WM_OWLCREATETTIP
Notify gadget window to create tooltips.
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition of class TFrameWindow.
Base class TGadget and simple derived TSeparatorGadget.
Definition of TGadgetList, TGadgetWindow & TGadgetWindowFont A list holding gadgets,...
@ wfMainWindow
This frame window is the main window.
Object Windows Library (OWLNext Core)
const uint GadgetWindowTimerID
LPARAM TParam2
Second parameter type.
auto GetCommCtrlVersion() -> DWORD
Returns the version number of the Common Control library (ComCtl32.dll).
TParam2 MkParam2(const T1 &lo, const T2 &hi)
LRESULT TResult
Result type.
const uint GadgetWindowTimeOut
#define TYPESAFE_DOWNCAST(object, toClass)
Definition of TProfile class.
Used by the TGadgetWindow and TGadget classes, TMargins contains the measurements of the margins for ...
Microsoft UxTheme Library Encapsulation.
Definition of TUIMetric, a UI metrics provider class.