OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TLayoutMetrics Class Reference

When specifying the layout metrics for a window, four layout constraints are needed. More...

#include <owl/layoutwi.h>

Public Member Functions

 TLayoutMetrics ()
 Defaults each co: RelWin=0, MyEdge=(1st from above), Relationship=AsIs.
 
void SetMeasurementUnits (TMeasurementUnits units)
 

Public Attributes

TEdgeConstraint X
 X contains the X (left, center, right) edge constraint of the window.
 
TEdgeConstraint Y
 Y contains the Y (top, center, bottom) edge constraint of the window.
 
TEdgeOrWidthConstraint Width
 Contains the width size constraint, center edge constraint, or right edge (lmRight) constraint of the window.
 
TEdgeOrHeightConstraint Height
 Contains the height size constraint, center edge constraint, or bottom edge constraint of the window.
 

Detailed Description

When specifying the layout metrics for a window, four layout constraints are needed.

TLayoutMetrics contains the four layout constraints used to define the layout metrics for a window. The following table lists the constraints you can use for the X, Y, Height, and Width fields.

  • X lmLeft, lmCenter, lmRight
  • Y lmTop, lmCenter, lmBottom
  • Height lmCenter, lmRight, lmWidth
  • Width lmCenter, lmBottom, lmHeight

If the metrics for the child window are relative to the parent window, the relation window pointer needs to be lmParent (not the actual parent window pointer). For example,

TWindow* child = new TWindow(this, "");
SetChildLayoutMetrics(*child, metrics);
When specifying the layout metrics for a window, four layout constraints are needed.
Definition layoutwi.h:54
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
#define lmParent
Use to represent the parent in layout metrics.
Definition layoutco.h:31
@ lmCenter
The center of the window.
Definition layoutco.h:41
@ lmSameAs
Definition layoutco.h:73

The parent window pointer (this) should not be used as the relation window pointer of the child window.

Definition at line 54 of file layoutwi.h.

Constructor & Destructor Documentation

◆ TLayoutMetrics()

owl::TLayoutMetrics::TLayoutMetrics ( )

Defaults each co: RelWin=0, MyEdge=(1st from above), Relationship=AsIs.

Creates a TLayoutMetrics object and initializes the object.

It sets the units for the child and parent window to the specified layout units, and the relationship between the two windows to what is defined in ImAsIs (of TRelationship). TLayoutMetrics sets the following default values:

X.RelWin = 0;
X.Value = 0;
Y.RelWin = 0;
Y.Value = 0;
TEdgeConstraint Y
Y contains the Y (top, center, bottom) edge constraint of the window.
Definition layoutwi.h:60
TEdgeOrWidthConstraint Width
Contains the width size constraint, center edge constraint, or right edge (lmRight) constraint of the...
Definition layoutwi.h:64
TEdgeOrHeightConstraint Height
Contains the height size constraint, center edge constraint, or bottom edge constraint of the window.
Definition layoutwi.h:68
TEdgeConstraint X
X contains the X (left, center, right) edge constraint of the window.
Definition layoutwi.h:57
@ lmTop
The top edge of the window.
Definition layoutco.h:38
@ lmLeft
The left edge of the window.
Definition layoutco.h:37
@ lmLayoutUnits
Definition layoutco.h:58
@ lmAsIs
Definition layoutco.h:69
@ lmWidth
Definition layoutco.h:48
@ lmHeight
Definition layoutco.h:48
int Value
used for "lmSameAs" and "lmAbsolute"
Definition layoutco.h:155
TWindow * RelWin
RelWin is a pointer to the sibling windows or lmParent if the child is a proportion of the parent's d...
Definition layoutco.h:126
uint MyEdge
MyEdge contains the name of the edge or size constraint (lmTop, lmBottom, lmLeft, lmRight,...
Definition layoutco.h:130
TRelationship Relationship
Relationship specifies the type of relationship that exists between the two windows (that is,...
Definition layoutco.h:136
TMeasurementUnits Units
Units enumerates the units of measurement (either pixels or layout units) used to measure the height ...
Definition layoutco.h:142

The following program creates two child windows and a frame into which you can add layout constraints.

#include <owl/owl.h>
#include <owl/framewin.h>
#include <owl/applicat.h>
#include <owl/layoutwi.h>
#include <owl/decorate.h>
#include <owl/decmdifr.h>
#include <owl/layoutco.h>
#pragma hdrstop
// Create a derived class. //
public:
TMyDecoratedFrame(TWindow* parent, const char far* title,
void SetupWindow();
{
TDecoratedFrame::SetupWindow();
MyChildWindow->ShowWindow(SW_NORMAL);
MyChildWindow->BringWindowToTop();
}
};
// Setup a frame window. //
TMyDecoratedFrame::TMyDecoratedFrame(TWindow * parent,
const char far * title,
TWindow& clientWnd)
: TDecoratedFrame(parent, title, clientWnd),
TFrameWindow(parent, title, &clientWnd),
TWindow(parent, title)
{
// Create a new TMyChildWindow. //
MyChildWindow = new TWindow(this, "");
MyChildwindow->SetBkgndColor(RGB(0,100,0));
// Establish metrics for the child window. //
TLayoutMetrics layoutMetrics;
layoutMetrics.X.Absolute(lmLeft, 10);
layoutMetrics.Y.Absolute(lmTop, 10);
layoutMetrics.Width.Absolute( 80 );
layoutMetrics.Height.Absolute( 80 );
}
SetChildLayoutMetrics(*MyChildWindow, layoutMetrics);
class TMyApp : public TApplication {
public:
virtual void InitMainWindow()
{
TWindow* client = new TWindow(0, "title");
MainWindow = new TMyDecoratedFrame(0,
"Layout Window Ex",
*client);
}
};
int OwlMain(int, char**) {
return TMyApp.Run();
}
Definition of class TApplication.
TDecoratedFrame automatically positions its client window (you must supply a client window) so that i...
Definition decframe.h:74
Definition of TDecoratedMDIFrame class.
Definition of class TFrameWindow.
Definition of class TLayoutConstraint.
Definition of classes TLayoutMetrics & TLayoutWindow.
STDAPI_(owl::TDocTemplate **) GetDocTemplateHead(owl STDAPI_(owl::TModule **) GetModulePtr(owl in OwlMain)(int argc, TCHAR *argv[])
Main entry point for an Owl application.
Definition module.h:391

Definition at line 1591 of file layoutwi.cpp.

References owl::lmAsIs, owl::lmHeight, owl::lmLayoutUnits, owl::lmLeft, owl::lmTop, and owl::lmWidth.

Member Function Documentation

◆ SetMeasurementUnits()

void owl::TLayoutMetrics::SetMeasurementUnits ( TMeasurementUnits units)

Definition at line 1622 of file layoutwi.cpp.

Member Data Documentation

◆ Height

TEdgeOrHeightConstraint owl::TLayoutMetrics::Height

Contains the height size constraint, center edge constraint, or bottom edge constraint of the window.

Vert2 can be lmHeight, lmCenter, lmBottom

Definition at line 68 of file layoutwi.h.

◆ Width

TEdgeOrWidthConstraint owl::TLayoutMetrics::Width

Contains the width size constraint, center edge constraint, or right edge (lmRight) constraint of the window.

Horz2 can be lmWidth, lmCenter, lmRight

Definition at line 64 of file layoutwi.h.

◆ X

TEdgeConstraint owl::TLayoutMetrics::X

X contains the X (left, center, right) edge constraint of the window.

Horz1 can be lmLeft, lmCenter, lmRight

Definition at line 57 of file layoutwi.h.

◆ Y

TEdgeConstraint owl::TLayoutMetrics::Y

Y contains the Y (top, center, bottom) edge constraint of the window.

Vert1 can be lmTop, lmCenter, lmBottom

Definition at line 60 of file layoutwi.h.


The documentation for this class was generated from the following files: