OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
controlg.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Class TControlGadget definition. TControlGadget is a gadget that takes a
7/// TWindow and allows it to be inserted into a gadget window. In effect it is
8/// an adapter that allows arbitrary controls to be used like gadgets in a tool
9/// bar, status bar, etc.
10//----------------------------------------------------------------------------
11
12#if !defined(OWL_CONTROLG_H)
13#define OWL_CONTROLG_H
14
15#include <owl/private/defs.h>
16#if defined(BI_HAS_PRAGMA_ONCE)
17# pragma once
18#endif
19
20#include <owl/gadget.h>
21
22
23namespace owl {
24
25#include <owl/preclass.h>
26
27/// \addtogroup gadgets
28/// @{
29/// \class TControlGadget
30// ~~~~~ ~~~~~~~~~~~~~~
31/// TControlGadget serves as a surrogate for TControl so that you can place TControl
32/// objects such as edit controls, buttons, sliders, gauges, or third-party
33/// controls, into a gadget window. If necessary, TControlGadget sets a parent
34/// window and creates the control gadget. See TGadget for more information about
35/// gadget objects.
36//
38 public:
40 ~TControlGadget() override;
41
42 void SetVisible(bool visible) override;
43
44 protected:
45 void Created() override;
46 void Inserted() override;
47 void Removed() override;
48
49 void InvalidateRect(const TRect& rect, bool erase = true);
50 void Update(); // Paint now if possible
51
52 void SetBounds(const TRect&) override;
53 void GetDesiredSize(TSize&) override;
54
55 public:
56 TWindow* GetControl() const;
57 void SetControl(TWindow* control);
58
60/// Points to the control window that is managed by this TControlGadget.
61 TWindow* Control;
62
63 private:
64 // Hidden to prevent accidental copying or assignment
65 //
67 TControlGadget& operator =(const TControlGadget&);
68};
69/// @}
70
71#include <owl/posclass.h>
72
73//----------------------------------------------------------------------------
74// Inline Implementations
75//
76
77//
78/// Return the control that is simulating a gadget.
79//
81 return Control;
82}
83
84//
85/// Set the control that is simulating a gadget.
86//
87inline void TControlGadget::SetControl(TWindow* control) {
88 Control = control;
89}
90
91} // OWL namespace
92
93
94#endif // OWL_CONTROLG_H
void SetBounds(const TRect &) override
Calls TGadget::SetBounds and passes the dimensions of the control gadget's rectangle.
Definition controlg.cpp:59
TWindow * GetControl() const
Return the control that is simulating a gadget.
Definition controlg.h:80
void Inserted() override
Called when the control gadget is inserted in the parent window.
Definition controlg.cpp:144
void InvalidateRect(const TRect &rect, bool erase=true)
Invalidate a rectangle within this gadget by invalidating the rect in the control window in addition ...
Definition controlg.cpp:196
void Created() override
Virtual called after the window holding a gadget has been created.
Definition controlg.cpp:108
TControlGadget(TWindow &control, TBorderStyle=None)
Creates a TControlGadget object associated with the specified TControl window.
Definition controlg.cpp:22
void Removed() override
Called when the control gadget is removed from the parent window.
Definition controlg.cpp:167
void SetVisible(bool visible) override
Sets the visibility of this gadget and the encapsulated control.
Definition controlg.cpp:45
void Update()
Updates the client area of the specified window by immediately sending a WM_PAINT message.
Definition controlg.cpp:208
void GetDesiredSize(TSize &) override
Calls TGadget::GetDesiredSize and passes the size of the control gadget.
Definition controlg.cpp:80
void SetControl(TWindow *control)
Set the control that is simulating a gadget.
Definition controlg.h:87
TGadget(int id=0, TBorderStyle borderStyle=None)
Construct a gadget with a given id and border style.
Definition gadget.cpp:88
TBorderStyle
Gadget border styles.
Definition gadget.h:127
@ None
No border painted at all.
Definition gadget.h:128
TRect is a mathematical class derived from tagRect.
Definition geometry.h:308
The tagSIZE struct is defined as.
Definition geometry.h:234
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
Base class TGadget and simple derived TSeparatorGadget.
Object Windows Library (OWLNext Core).
Definition animctrl.h:22
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338