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

TControlGadget serves as a surrogate for TControl so that you can place TControl objects such as edit controls, buttons, sliders, gauges, or third-party controls, into a gadget window. More...

#include <owl/controlg.h>

Inheritance diagram for owl::TControlGadget:
owl::TGadget

Public Member Functions

 TControlGadget (TWindow &control, TBorderStyle=None)
 Creates a TControlGadget object associated with the specified TControl window.
 
 ~TControlGadget () override
 Destroys a TControlGadget object and removes it from the associated window.
 
void SetVisible (bool visible) override
 Sets the visibility of this gadget and the encapsulated control.
 
TWindowGetControl () const
 Return the control that is simulating a gadget.
 
void SetControl (TWindow *control)
 Set the control that is simulating a gadget.
 
- Public Member Functions inherited from owl::TGadget
 TGadget (int id=0, TBorderStyle borderStyle=None)
 Construct a gadget with a given id and border style.
 
virtual ~TGadget ()
 Destroys a TGadget interface object and removes it from its associated window.
 
int GetId () const
 Gets the ID for the gadget.
 
TRectGetBounds ()
 Returns the boundary rectangle for the gadget.
 
const TRectGetBounds () const
 Returns the boundary rectangle for the gadget.
 
virtual void SetEnabled (bool enabled)
 Enables or disables keyboard and mouse input for the gadget.
 
bool GetEnabled () const
 Determines whether keyboard and mouse input have been enabled for the specified gadget.
 
bool IsVisible () const
 Returns true if the gadget is visible.
 
bool IsWindowVisible () const
 check to see if the button's created
 
void SetEndOfRow (bool eor)
 Sets the end of row property for the gadget.
 
bool IsEndOfRow () const
 Returns true if this gadget is at the end of a row.
 
bool IsWideAsPossible () const
 Indicates whether the gadget width will be adjusted by the gadget window to be as wide as possible in the remaining space.
 
void SetWideAsPossible (bool wide=true)
 Sets the flag that indicates whether the gadget width will be adjusted by the gadget window to be as wide as possible in the remaining space.
 
void SetShrinkWrap (bool shrinkWrapWidth, bool shrinkWrapHeight)
 Simple set accessor to set whether shrinkwrapping is performed horizontally and/or vertically.
 
void SetSize (const TSize &size)
 Alters the size of the gadget and then calls TGadgetWindow::GadgetChangedSize() for the size change to take effect.
 
void GetOuterSizes (int &left, int &right, int &top, int &bottom)
 Get the four total outer sizes in pixels which consists of the margins plus the borders.
 
void GetInnerRect (TRect &rect)
 Computes the area of the gadget's rectangle excluding the borders and margins.
 
virtual bool IdleAction (long idleCount)
 Called during idle time to allow the gadget to perform any idle actions.
 
virtual void CommandEnable ()
 Provided so that the gadget can perform command enabling (so it can handle an incoming message if it's appropriate to do so).
 
virtual void SysColorChange ()
 Called when the system colors have been changed so that gadgets can rebuild and repaint, if necessary.
 
TGadgetNextGadget ()
 Returns the next gadget in the list of gadgets.
 
void SetBorders (const TBorders &borders)
 Sets the borders for the gadget.
 
TBordersGetBorders ()
 Gets the gadget's borders measured in border units that are based on SM_CXBORDER and SM_CYBORDER.
 
void SetMargins (const TMargins &margins)
 Sets the margins of the gadget.
 
TMarginsGetMargins ()
 Gets the margin dimensions.
 
void SetBorderStyle (TBorderStyle bs)
 Set the border style used by this gadget.
 
TBorderStyle GetBorderStyle () const
 Gets the style for the gadget's borders.
 

Protected Member Functions

void Created () override
 Virtual called after the window holding a gadget has been created.
 
void Inserted () override
 Called when the control gadget is inserted in the parent window.
 
void Removed () override
 Called when the control gadget is removed from the parent window.
 
void InvalidateRect (const TRect &rect, bool erase=true)
 Invalidate a rectangle within this gadget by invalidating the rect in the control window in addition to the owning Window.
 
void Update ()
 Updates the client area of the specified window by immediately sending a WM_PAINT message.
 
void SetBounds (const TRect &) override
 Calls TGadget::SetBounds and passes the dimensions of the control gadget's rectangle.
 
void GetDesiredSize (TSize &) override
 Calls TGadget::GetDesiredSize and passes the size of the control gadget.
 
- Protected Member Functions inherited from owl::TGadget
TGadgetWindowGetGadgetWindow ()
 Return a pointer to the owning or parent window for the gadget.
 
const TGadgetWindowGetGadgetWindow () const
 Return a pointer to the owning or parent window for the gadget.
 
virtual void Moved ()
 This is the virtual called when a gadget is relocated.
 
bool IsHaveMouse () const
 Return true if mouse inside gadget.
 
void SetInMouse (bool state)
 Sets if mouse inside gadget or not.
 
bool GetTrackMouse () const
 
void SetTrackMouse (bool track)
 
void Invalidate (bool erase=true)
 Used to invalidate the active (usually nonborder) portion of the gadget, Invalidate calls InvalidateRect and passes the boundary width and height of the area to erase.
 
void InvalidateRect (const TRect &rect, bool erase=true)
 Invalidate a rectangle in our containing window.
 
void Update ()
 Paint now if possible.
 
virtual bool PtIn (const TPoint &point)
 Default behavior returns true if the point is within the receiver's bounding rect.
 
virtual void Paint (TDC &dc)
 Calls PaintBorder() to paint the indicated device context.
 
virtual void PaintBorder (TDC &dc)
 Self sent by method Paint().
 
virtual void MouseEnter (uint modKeys, const TPoint &point)
 Mouse is entering this gadget.
 
virtual void MouseMove (uint modKeys, const TPoint &point)
 Mouse is moving over this gadget.
 
virtual void MouseLeave (uint modKeys, const TPoint &point)
 Mouse is leaving this gadget.
 
virtual void LButtonDown (uint modKeys, const TPoint &point)
 Captures the mouse if TrackMouse is set.
 
virtual void RButtonDown (uint modKeys, const TPoint &point)
 
virtual void LButtonUp (uint modKeys, const TPoint &point)
 Releases the mouse capture if TrackMouse is set.
 
virtual void RButtonUp (uint modKeys, const TPoint &point)
 
void ChangeBorderStyle (TBorderStyle bs)
 Simply changes the border style without recalculating the gadget size.
 

Additional Inherited Members

- Public Types inherited from owl::TGadget
enum  TBorderStyle {
  None , Plain , Raised , Recessed , Embossed , Grooved , ButtonUp , ButtonDn , WndRaised , WndRecessed ,
  WellSet
}
 Gadget border styles. More...
 

Detailed Description

TControlGadget serves as a surrogate for TControl so that you can place TControl objects such as edit controls, buttons, sliders, gauges, or third-party controls, into a gadget window.

If necessary, TControlGadget sets a parent window and creates the control gadget. See TGadget for more information about gadget objects.

Definition at line 37 of file controlg.h.

Constructor & Destructor Documentation

◆ TControlGadget()

owl::TControlGadget::TControlGadget ( TWindow & control,
TBorderStyle border = None )

Creates a TControlGadget object associated with the specified TControl window.

Definition at line 22 of file controlg.cpp.

References owl::TWindow::ModifyStyle(), OWL_CDLEVEL, and TRACEX.

◆ ~TControlGadget()

owl::TControlGadget::~TControlGadget ( )
override

Destroys a TControlGadget object and removes it from the associated window.

Definition at line 34 of file controlg.cpp.

References owl::TWindow::Destroy(), OWL_CDLEVEL, and TRACEX.

Member Function Documentation

◆ Created()

void owl::TControlGadget::Created ( )
overrideprotectedvirtual

Virtual called after the window holding a gadget has been created.

Reimplemented from owl::TGadget.

Definition at line 108 of file controlg.cpp.

References CHECK, owl::TWindow::Create(), owl::TGadget::GetGadgetWindow(), owl::TWindow::GetHandle(), owl::TGadgetWindow::GetTooltip(), PRECONDITION, owl::TWindow::SetParent(), and owl::TWindow::ShowWindow().

◆ GetControl()

TWindow * owl::TControlGadget::GetControl ( ) const
inline

Return the control that is simulating a gadget.

Definition at line 80 of file controlg.h.

◆ GetDesiredSize()

void owl::TControlGadget::GetDesiredSize ( TSize & size)
overrideprotectedvirtual

Calls TGadget::GetDesiredSize and passes the size of the control gadget.

Use GetDesiredSize to find the size the control gadget needs to be in order to accommodate the borders and margins as well as the highest and widest control gadget.

Reimplemented from owl::TGadget.

Definition at line 80 of file controlg.cpp.

References owl::TGadget::GetDesiredSize(), owl::TWindow::GetHandle(), owl::TWindow::GetWindowAttr(), owl::TWindow::GetWindowRect(), owl::TWindowAttr::H, TRACEX, and owl::TWindowAttr::W.

◆ Inserted()

void owl::TControlGadget::Inserted ( )
overrideprotectedvirtual

Called when the control gadget is inserted in the parent window.

Displays the window in its current size and position. Override the Inserted() virtual to take the oportunity to make sure that the control window has been created and shown

Reimplemented from owl::TGadget.

Definition at line 144 of file controlg.cpp.

References owl::TWindow::Create(), owl::TGadget::GetGadgetWindow(), owl::TWindow::GetHandle(), owl::TWindow::SetParent(), owl::TWindow::ShowWindow(), and TRACEX.

◆ InvalidateRect()

void owl::TControlGadget::InvalidateRect ( const TRect & rect,
bool erase = true )
protected

Invalidate a rectangle within this gadget by invalidating the rect in the control window in addition to the owning Window.

Definition at line 196 of file controlg.cpp.

References owl::TWindow::GetHandle(), owl::TGadget::InvalidateRect(), and owl::TWindow::InvalidateRect().

◆ Removed()

void owl::TControlGadget::Removed ( )
overrideprotectedvirtual

Called when the control gadget is removed from the parent window.

Override the Remove() virtual to take the oportunity to unparent the control window from the owning Window

Reimplemented from owl::TGadget.

Definition at line 167 of file controlg.cpp.

References CHECK, owl::TGadget::GetGadgetWindow(), owl::TWindow::GetHandle(), owl::TGadgetWindow::GetTooltip(), owl::TWindow::SetParent(), owl::TWindow::ShowWindow(), and TRACEX.

◆ SetBounds()

void owl::TControlGadget::SetBounds ( const TRect & bounds)
overrideprotectedvirtual

Calls TGadget::SetBounds and passes the dimensions of the control gadget's rectangle.

SetBounds informs the control gadget of a change in its bounding rectangle.

Reimplemented from owl::TGadget.

Definition at line 59 of file controlg.cpp.

References owl::TGadget::SetBounds(), owl::TWindow::SetWindowPos(), and TRACEX.

◆ SetControl()

void owl::TControlGadget::SetControl ( TWindow * control)
inline

Set the control that is simulating a gadget.

Definition at line 87 of file controlg.h.

◆ SetVisible()

void owl::TControlGadget::SetVisible ( bool visible)
overridevirtual

Sets the visibility of this gadget and the encapsulated control.

Reimplemented from owl::TGadget.

Definition at line 45 of file controlg.cpp.

References GetControl(), and owl::TGadget::SetVisible().

◆ Update()

void owl::TControlGadget::Update ( )
protected

Updates the client area of the specified window by immediately sending a WM_PAINT message.

Definition at line 208 of file controlg.cpp.

References owl::TWindow::GetHandle(), and owl::TWindow::UpdateWindow().


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