OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
groupbox.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1991, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TGroupBox. This defines the basic behavior for all
7/// group boxes.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_GROUPBOX_H)
11#define OWL_GROUPBOX_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/control.h>
19
20
21namespace owl {
22
23#include <owl/preclass.h>
24
25/// \addtogroup ctrl
26/// @{
27/// \class TGroupBox
28// ~~~~~ ~~~~~~~~~
29/// An instance of a TGroupBox is an interface object that represents a
30/// corresponding group box element. Generally, TGroupBox objects are not used in
31/// dialog boxes or dialog windows (TDialog), but are used when you want to create a
32/// group box in a window.
33///
34/// Although group boxes do not serve an active purpose onscreen, they visually
35/// unify a group of selection boxes such as check boxes and radio buttons or other
36/// controls. Behind the scenes, however, they can take an important role in
37/// handling state changes for their group of controls (normally check boxes or
38/// radio buttons).
39///
40/// For example, you might want to respond to a selection change in any one of a
41/// group of radio buttons in a similar manner. You can do this by deriving a class
42/// from TGroupBox that redefines the member function SelectionChanged.
43///
44/// Alternatively, you could respond to selection changes in the group of radio
45/// buttons by defining a response for the group box's parent. To do so, define a
46/// child-ID-based response member function using the ID of the group box. The group
47/// box will automatically send a child-ID-based message to its parent whenever the
48/// radio button selection state changes. This class is streamable.
49//
51 public:
52 TGroupBox(TWindow* parent,
53 int id,
55 int X, int Y, int W, int H,
56 TModule* module = 0);
57 TGroupBox(TWindow* parent,
58 int id,
59 const tstring& text,
60 int X, int Y, int W, int H,
61 TModule* module = 0);
62
63 TGroupBox(TWindow* parent, int resourceId, TModule* module = 0);
64
65 /// Returns the length of the control's text
66 //
67 int GetTextLen();
68
69 /// Fills the given string with the text of the control. Returns the
70 /// number of characters copied.
71 int GetText(LPTSTR str, int maxChars);
72 tstring GetText();
73 /// Sets the contents of the associated static text control to the given string.
74 void SetText(LPCTSTR str);
75 void SetText(const tstring& str) {SetText(str.c_str());}
76
77 virtual void SelectionChanged(int controlId);
78
79 bool GetNotifyParent() const;
80 void SetNotifyParent(bool notifyparent);
81
82 protected:
83 virtual auto GetWindowClassName() -> TWindowClassName;
84
86/// Flag that indicates whether parent is to be notified when the state of the group
87/// box's selection boxes has changed. NotifyParent is true by default.
88 bool NotifyParent;
89
90 private:
91 // Hidden to prevent accidental copying or assignment
92 //
93 TGroupBox(const TGroupBox&);
95
97};
98/// @}
99
101
102#include <owl/posclass.h>
103
104//----------------------------------------------------------------------------
105// Inline implementations
106//
107
108//
110 return ::GetWindowTextLength(GetHandle());
111}
112
113//
114inline int TGroupBox::GetText(LPTSTR str, int maxChars) {
115 return ::GetWindowText(GetHandle(), str, maxChars);
116}
117
118//
119inline void TGroupBox::SetText(LPCTSTR str) {
121}
122
123//
124/// Returns the flag that indicates whether or not the parent is notified.
125//
126inline bool TGroupBox::GetNotifyParent() const
127{
128 return NotifyParent;
129}
130
131//
132/// Sets the flag that indicates whether or not the parent is notified.
133//
135{
136 NotifyParent = notifyparent;
137}
138
139} // OWL namespace
140
141
142#endif // OWL_GROUPBOX_H
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
An instance of a TGroupBox is an interface object that represents a corresponding group box element.
Definition groupbox.h:50
void SetText(const tstring &str)
Definition groupbox.h:75
bool GetNotifyParent() const
Returns the flag that indicates whether or not the parent is notified.
Definition groupbox.h:126
void SetText(LPCTSTR str)
Sets the contents of the associated static text control to the given string.
Definition groupbox.h:119
tstring GetText()
String-aware overload.
Definition groupbox.cpp:123
int GetTextLen()
Returns the length of the control's text.
Definition groupbox.h:109
void SetNotifyParent(bool notifyparent)
Sets the flag that indicates whether or not the parent is notified.
Definition groupbox.h:134
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
Type-safe encapsulation of a Windows class name, a union between ATOM and LPCTSTR.
Definition module.h:47
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
void SetWindowText(LPCTSTR str)
Sets the window's text to the given string (by copying).
Definition window.h:2669
HWND GetHandle() const
Returns the handle of the window.
Definition window.h:2020
Definition of class TControl.
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
std::string tstring
Definition defs.h:79
#define public_data
Definition defs.h:207
#define _OWLCLASS
Definition defs.h:338