31 NumColumns = numColumns;
36 Margins.Left = Margins.Right = 0;
37 Margins.Top = Margins.Bottom = 0;
39 ShrinkWrapWidth =
true;
68 if (dir != direction) {
82TToolBox::ComputeNumRowsColumns(
int& numRows,
int& numColumns)
86 (NumGadgets + NumColumns - 1) / NumColumns :
89 (NumGadgets + NumRows - 1) / NumRows :
98TToolBox::ComputeCellSize(TSize& cellSize)
100 cellSize.cx = cellSize.cy = 0;
102 for (
TGadget* g = Gadgets; g; g = g->NextGadget()) {
103 TSize desiredSize(0, 0);
105 g->GetDesiredSize(desiredSize);
107 if (desiredSize.cx > cellSize.cx)
108 cellSize.cx = desiredSize.cx;
110 if (desiredSize.cy > cellSize.cy)
111 cellSize.cy = desiredSize.cy;
127 int left, right, top, bottom;
128 GetMargins(Margins, left, right, top, bottom);
129 size.cx = left + right;
130 size.cy = top + bottom;
134 if (Attr.Style & WS_BORDER) {
140 ComputeCellSize(cellSize);
142 int numRows, numColumns;
143 ComputeNumRowsColumns(numRows, numColumns);
145 size.cx += numColumns * cellSize.cx;
146 size.cy += numRows * cellSize.cy;
150 size.cx -= (numColumns - 1) * cxBorder;
151 size.cy -= (numRows - 1) * cyBorder;
165 ComputeCellSize(cellSize);
167 int numRows, numColumns;
168 ComputeNumRowsColumns(numRows, numColumns);
179 int y = innerRect.top;
182 for (
int r = 0; r < numRows; r++) {
183 int x = innerRect.left;
185 for (
int c = 0; c < numColumns && g; c++) {
187 TRect originalBounds(g->GetBounds());
189 if (bounds != g->GetBounds()) {
190 g->SetBounds(bounds);
193 invalidRect = bounds;
195 invalidRect |= bounds;
198 invalidRect |= originalBounds;
211 int x = innerRect.left;
214 for (
int c = 0; c < numColumns; c++) {
215 int y = innerRect.top;
217 for (
int r = 0; r < numRows && g; r++) {
219 TRect originalBounds(g->GetBounds());
221 if (bounds != originalBounds) {
222 g->SetBounds(bounds);
225 invalidRect = bounds;
227 invalidRect |= bounds;
230 invalidRect |= originalBounds;
258 SetWindowPos(
nullptr, 0,0, sz.cx, sz.cy, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
TPlacement
Enumerates the placement of a gadget.
Derived from TFont, TGadgetWindowFont is the default font used by TGadgetWindow.
void Insert(TGadget &, TPlacement=After, TGadget *sibling=nullptr) override
Inserts a gadget before or after a sibling gadget (TPlacement).
virtual void GetInnerRect(TRect &rect)
GetInnerRect computes the rectangle inside of the borders and margins of the gadget.
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...
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.
@ Horizontal
Arrange gadgets in a row.
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
TPoint is a support class, derived from tagPOINT.
TPoint()
Constructs an uninitialized point.
TRect is a mathematical class derived from tagRect.
bool IsNull() const
Returns true if left, right, top, and bottom are all 0; otherwise, returns false.
void SetEmpty()
Empties this rectangle by setting left, top, right, and bottom to 0.
const TPoint & TopLeft() const
Returns the upperleft point.
The tagSIZE struct is defined as.
static const TUIMetric CyBorder
static const TUIMetric CxBorder
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
bool SetWindowPos(HWND hWndInsertAfter, const TRect &rect, uint flags)
Changes the size of the window pointed to by rect.
const int AS_MANY_AS_NEEDED
Arranges its gadgets in a matrix.
Object Windows Library (OWLNext Core).
#define TYPESAFE_DOWNCAST(object, toClass)
Definition of TUIMetric, a UI metrics provider class.