OWLNext    7.0
Borland's Object Windows Library for the modern age
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
radiobut.cpp
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/// Implementation of class TRadioButton. This defines the basic behavior for
7/// all radio buttons.
8//----------------------------------------------------------------------------
9#include <owl/pch.h>
10#include <owl/radiobut.h>
11#include <owl/groupbox.h>
12#include <owl/applicat.h>
13
14#if defined(OWL_SUPPORT_BWCC)
15# include <owl/private/bwcc.h>
16#endif
17
18namespace owl {
19
21
22
23DEFINE_RESPONSE_TABLE1(TRadioButton, TCheckBox)
26
27//
28/// Constructs a radio button object with the supplied parent window (parent),
29/// control ID (id), associated text (title), position (x, y) relative to the origin
30/// of the parent window's client area, width (w), height (h), and associated group
31/// box (group). Invokes the TCheckBox constructor with similar parameters. The
32/// style is set to WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON.
33//
34TRadioButton::TRadioButton(TWindow* parent, int id, LPCTSTR title, int x, int y, int w, int h, TGroupBox* group, TModule* module)
35:
36 TCheckBox(parent, id, title, x, y, w, h, group, module)
37{
38 Attr.Style = WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON;
39}
40
41//
42/// String-aware overload
43//
44TRadioButton::TRadioButton(TWindow* parent, int id, const tstring& title, int x, int y, int w, int h, TGroupBox* group,
45 TModule* module)
46:
47 TCheckBox(parent, id, title, x, y, w, h, group, module)
48{
49 Attr.Style = WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON;
50}
51
52//
53/// Constructs a TRadioButton object to be associated with a radio button control of
54/// a TDialog object. Invokes the TCheckBox constructor with identical parameters.
55/// The resourceId parameter must correspond to a radio button resource that you
56/// define.
57//
59:
60 TCheckBox(parent, resourceId, group, module)
61{}
62
63//
64/// Constructs a TRadioButton object to encapsulate (alias) an existing control.
65//
70
71//
72/// Returns "BUTTON", the name of the predefined radio button class.
73//
75{
76#if defined(OWL_SUPPORT_BWCC)
77 if (GetApplication()->BWCCEnabled())
79 else
80#endif
81 return TWindowClassName{_T("BUTTON")};
82}
83
84//
85/// Responds to an incoming BN_CLICKED message.
86//
87/// \note Need to see if it's checked because Windows generates two BN_CLICKED
88/// messages on keyboard input such as up arrow(but only one on mouse input),
89/// and we should only handle the one after it's checked
90//
91void
100
101
103
104#if OWL_PERSISTENT_STREAMS
105
106//
107// reads an instance of TRadioButton from the passed ipstream
108//
109void*
110TRadioButton::Streamer::Read(ipstream& is, uint32 /*version*/) const
111{
112 ReadBaseObject((TCheckBox*)GetObject(), is);
113 return GetObject();
114}
115
116//
117// writes the TRadioButton to the passed opstream
118//
119void
120TRadioButton::Streamer::Write(opstream& os) const
121{
122 WriteBaseObject((TCheckBox*)GetObject(), os);
123}
124#endif
125
126} // OWL namespace
127/* ========================================================================== */
128
Definition of class TApplication.
Legacy support for Borland Windows Custom Controls (BWCC)
TCheckBox is a streamable interface class that represents a check box control.
Definition checkbox.h:53
uint GetCheck() const
Returns the state of the check box.
Definition checkbox.h:168
void BNClicked()
Responds to an incoming BN_CLICKED message.
Definition checkbox.cpp:195
An instance of a TGroupBox is an interface object that represents a corresponding group box element.
Definition groupbox.h:50
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
Defines an interface object that represents a corresponding radio button element in Windows.
Definition radiobut.h:42
auto GetWindowClassName() -> TWindowClassName override
Returns "BUTTON", the name of the predefined radio button class.
Definition radiobut.cpp:74
TRadioButton(TWindow *parent, int id, LPCTSTR title, int x, int y, int w, int h, TGroupBox *=0, TModule *=0)
Constructs a radio button object with the supplied parent window (parent), control ID (id),...
Definition radiobut.cpp:34
void BNClicked()
Responds to an incoming BN_CLICKED message.
Definition radiobut.cpp:92
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
TResult DefaultProcessing()
Handles default processing of events, which includes continued processing of menu/accelerators comman...
Definition window.cpp:852
HWND THandle
TWindow encapsulates an HWND.
Definition window.h:418
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Definition objstrm.h:391
#define _T(x)
Definition cygwin.h:51
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
Definition eventhan.h:492
void ReadBaseObject(Base *base, ipstream &in)
Definition objstrm.h:1159
#define IMPLEMENT_STREAMABLE1(cls, base1)
Definition objstrm.h:1725
void WriteBaseObject(Base *base, opstream &out)
Definition objstrm.h:1150
Definition of class TGroupBox.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned long uint32
Definition number.h:34
OWL_DIAGINFO
Definition animctrl.cpp:14
END_RESPONSE_TABLE
Definition button.cpp:26
std::string tstring
Definition defs.h:79
Definition of class TRadioButton.
#define EV_NOTIFY_AT_CHILD(notifyCode, method)
Response table entry for a child ID notification handled at the child.
Definition windowev.h:162