OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
control.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 TControl. This defines the basic behavior of all
7/// controls.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_CONTROL_H)
11#define OWL_CONTROL_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/window.h>
19
20namespace owl {
21
22
23#include <owl/preclass.h>
24
25/// \addtogroup ctrl
26/// @{
27//
28//
29/// \class TControl
30// ~~~~~ ~~~~~~~~
31/// TControl unifies its derived control classes, such as TScrollBar,
32/// TControlGadget, and TButton. Control objects of derived classes are used to
33/// represent control interface elements. A control object must be used to create a
34/// control in a parent TWindow object or a derived window. A control object can be
35/// used to facilitate communication between your application and the controls of a
36/// TDialog object. TControl is a streamable class.
37//
38class _OWLCLASS TControl : virtual public TWindow {
39 public:
40 TControl(TWindow* parent,
41 int id,
43 int x, int y, int w, int h,
44 TModule* module = nullptr);
45
46 TControl(TWindow* parent,
47 int id,
48 const tstring& title,
49 int x, int y, int w, int h,
50 TModule* module = nullptr);
51
52 TControl(TWindow* parent, int resourceId, TModule* module = nullptr);
53 TControl(TWindow* parent, int resourceId, const tstring& title, TModule* = nullptr);
54 ~TControl() override;
55
56 protected:
57
58 /// Constructor to alias non-OWL control
59 //
60 TControl(HWND hWnd, TModule* module = nullptr);
61
62 // These methods are called for owner-draw controls (buttons, list boxes,
63 // and combo boxes)
64 //
65 virtual int CompareItem(COMPAREITEMSTRUCT & compareInfo);
66 virtual void DeleteItem(DELETEITEMSTRUCT & deleteInfo);
67 virtual void MeasureItem(MEASUREITEMSTRUCT & measureInfo);
68 virtual void DrawItem(DRAWITEMSTRUCT & drawInfo);
69
70 // Default behavior for DrawItem is to call one of the following based on
71 // the draw type:
72 //
73 virtual void ODADrawEntire(DRAWITEMSTRUCT & drawInfo);
74 virtual void ODAFocus(DRAWITEMSTRUCT & drawInfo);
75 virtual void ODASelect(DRAWITEMSTRUCT & drawInfo);
76
77 // Message response functions
78 //
79 void EvPaint();
80 auto EvEraseBkgnd(HDC) -> bool;
81 int EvCompareItem(uint ctrlId, const COMPAREITEMSTRUCT& comp);
82 void EvDeleteItem(uint ctrlId, const DELETEITEMSTRUCT& del);
83 void EvDrawItem(uint ctrlId, const DRAWITEMSTRUCT& draw);
84 void EvMeasureItem(uint ctrlId, MEASUREITEMSTRUCT & meas);
85
86 private:
87 // Hidden to prevent accidental copying or assignment
88 //
89 TControl(const TControl&);
91
94};
95/// @}
96
98
99#include <owl/posclass.h>
100
101} // OWL namespace
102
103
104#endif // OWL_CONTROL_H
TControl unifies its derived control classes, such as TScrollBar, TControlGadget, and TButton.
Definition control.h:38
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition window.h:414
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
#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
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338
Base window class TWindow definition, including HWND encapsulation.