OWLNext
7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
popupgad.h
Go to the documentation of this file.
1
//----------------------------------------------------------------------------//
2
// ObjectWindows 1998 Copyright by Yura Bidus //
3
// //
4
// Used code and ideas from Dieter Windau and Joseph Parrello //
5
// //
6
// EMail: dieter.windau@usa.net //
7
// Web: http://members.aol.com/softengage/index.htm //
8
// EMail: joparrello@geocities.com, joparrel@tin.it //
9
// Web: http://space.tin.it/computer/giparrel //
10
// //
11
// Revision 1.0 //
12
// Edited by Bidus Yura //
13
// Date 11/10/98 //
14
// //
15
// THIS CLASS AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF //
16
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO //
17
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A //
18
// PARTICULAR PURPOSE. //
19
/// \file //
20
/// Definition of classes TPopupButtonGadget and TPopupMenuGadget. //
21
//----------------------------------------------------------------------------//
22
23
#if !defined(OWL_POPUPGAD_H)
// Sentry, use file only if it's not already included.
24
#define OWL_POPUPGAD_H
25
26
#include <
owl/private/defs.h
>
27
#if defined(BI_HAS_PRAGMA_ONCE)
28
# pragma once
29
#endif
30
31
#include <
owl/btntextg.h
>
32
33
34
namespace
owl
{
35
36
37
//
38
#include <
owl/preclass.h
>
39
40
/// \addtogroup newctrl
41
/// @{
42
/// \class TPopupButtonGadget
43
// ~~~~~ ~~~~~~~~~~~~~~~~~~
44
//
45
class
_OWLCLASS
TPopupButtonGadget
:
public
TButtonTextGadget
{
46
public
:
47
enum
TPopupType
{
48
Normal,
///< Normal button style
49
///< - press button -> PopupActionStart()
50
DownArrow,
///< Normal button style and additional a down arrow
51
///< - press button -> PopupActionStart()
52
DownArrowAction,
///< Separator between left area and down arrow
53
///< - press left button area -> Activate()
54
///< - press down arrow area -> PopupActionStart()
55
};
56
57
TPopupButtonGadget
(
int
id
,
58
TResId
glyphResIdOrIndex
,
59
TStyle style = sBitmapText,
60
TPopupType
poptype
= DownArrowAction,
61
TType
type
= Command,
62
bool
enabled
=
false
,
63
TState state = Up,
64
bool
sharedGlyph
=
false
,
65
uint
numChars
= 4);
66
67
// Default arrow width = 8
68
//
69
void
SetArrowWidth(
uint
width);
70
uint
GetArrowWidth();
71
72
// TGadget overrides
73
//
74
void
GetDesiredSize(
TSize
& size)
override
;
75
void
SetBounds(
const
TRect
&
rect
)
override
;
76
77
protected
:
78
79
// TGadget overrides
80
//
81
void
Paint(
TDC
& dc)
override
;
82
void
LButtonDown(
uint
modKeys
,
const
TPoint
&
point
)
override
;
83
void
LButtonUp(
uint
modKeys
,
const
TPoint
&
point
)
override
;
84
void
RButtonDown(
uint
modKeys
,
const
TPoint
&)
override
;
85
86
// TButtonGadget overrides
87
//
88
void
BeginPressed(
const
TPoint
& p)
override
;
89
void
CancelPressed(
const
TPoint
& p,
bool
mstate
=
false
)
override
;
90
91
// New virtuals
92
//
93
virtual
void
PaintArrowButton(
TDC
& dc);
94
virtual
void
PaintArrow(
TDC
& dc,
const
TRect
&
rect
);
95
96
/// Start the PopupAction if the user click
97
/// - 1) into the button if PopupType != DownArrowAction
98
/// - 2) into the arrow if PopupType == DownArrowAction
99
/// This function only restore button state, overwrite
100
/// them with functionality, but don't forget to
101
/// call inherited one
102
//
103
virtual
void
PopupAction();
104
105
protected
:
106
enum
TPopFlags
{
107
ArrowPressed = 0x001,
108
HasCapture = 0x002,
109
};
110
TPopupType
PopupType
;
111
uint
PopFlags
;
112
uint
ArrowWidth
;
113
};
114
115
116
//
117
// class TPopupMenuGadget
118
// ~~~~~ ~~~~~~~~~~~~~~~~
119
//
120
class
_OWLCLASS
TPopupMenuGadget
:
public
TPopupButtonGadget
{
121
public
:
122
TPopupMenuGadget
(
TMenu
& menu,
123
TWindow
* window,
124
int
id
,
125
TResId
glyphResIdOrIndex
,
126
TStyle
style = sBitmapText,
127
TPopupType
poptype
= DownArrowAction,
128
TType
type
= Command,
129
bool
enabled
=
false
,
130
TState
state = Up,
131
bool
sharedGlyph
=
false
,
132
uint
numChars
= 4);
133
~TPopupMenuGadget
();
134
135
// Set the flags. Default: TPM_LEFTALIGN | TPM_LEFTBUTTON
136
//
137
static
void
SetFlags
(
uint
flags) { Flags = flags; }
138
139
virtual
void
PopupAction();
140
141
protected
:
142
TPopupMenu
*
PopupMenu
;
143
TWindow
*
CmdTarget
;
144
static
uint
Flags
;
145
};
146
/// @}
147
148
#include <
owl/posclass.h
>
149
150
151
//
152
// inlines
153
//
154
155
//
156
inline
void
157
TPopupButtonGadget::SetArrowWidth
(
uint
width)
158
{
159
ArrowWidth
= width;
160
}
161
162
//
163
inline
uint
164
TPopupButtonGadget::GetArrowWidth
()
165
{
166
return
ArrowWidth
;
167
}
168
169
170
}
// OWL namespace
171
172
#endif
// OWL_POPUPGAD_H
btntextg.h
Definition of classes TButtonTextGadget.
VarType
Definition
safearray.h:14
owl::TButtonGadget::TState
TState
TState enumerates the three button positions during which the button can be pressed: up (0),...
Definition
buttonga.h:80
owl::TButtonGadget::TType
TType
Enumerates the types of button gadgets.
Definition
buttonga.h:69
owl::TButtonTextGadget
Derived from TButtonGadget, TButtonTextGadget represents buttons with bitmap and text,...
Definition
btntextg.h:45
owl::TButtonTextGadget::TStyle
TStyle
TStyle contains values that defines how gadget will be displayed:
Definition
btntextg.h:62
owl::TDC
TDC is the root class for GDI DC wrappers.
Definition
dc.h:64
owl::TMenu
The TMenu class encapsulates window menus.
Definition
menu.h:77
owl::TPoint
TPoint is a support class, derived from tagPOINT.
Definition
geometry.h:87
owl::TPopupButtonGadget
Definition
popupgad.h:45
owl::TPopupButtonGadget::TPopupType
TPopupType
Definition
popupgad.h:47
owl::TPopupButtonGadget::SetArrowWidth
void SetArrowWidth(uint width)
Definition
popupgad.h:157
owl::TPopupButtonGadget::PopFlags
uint PopFlags
Definition
popupgad.h:111
owl::TPopupButtonGadget::PopupType
TPopupType PopupType
Definition
popupgad.h:110
owl::TPopupButtonGadget::GetArrowWidth
uint GetArrowWidth()
Definition
popupgad.h:164
owl::TPopupButtonGadget::TPopFlags
TPopFlags
Definition
popupgad.h:106
owl::TPopupButtonGadget::ArrowWidth
uint ArrowWidth
Definition
popupgad.h:112
owl::TPopupMenuGadget
Definition
popupgad.h:120
owl::TPopupMenuGadget::PopupMenu
TPopupMenu * PopupMenu
Definition
popupgad.h:142
owl::TPopupMenuGadget::SetFlags
static void SetFlags(uint flags)
Definition
popupgad.h:137
owl::TPopupMenuGadget::Flags
static uint Flags
Definition
popupgad.h:144
owl::TPopupMenuGadget::CmdTarget
TWindow * CmdTarget
Definition
popupgad.h:143
owl::TPopupMenu
TPopupMenu creates an empty pop-up menu to add to an existing window or pop-up menu.
Definition
menu.h:189
owl::TRect
TRect is a mathematical class derived from tagRect.
Definition
geometry.h:308
owl::TResId
Definition
wsyscls.h:206
owl::TSize
The tagSIZE struct is defined as.
Definition
geometry.h:234
owl::TWindow
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
Definition
window.h:414
owl
Object Windows Library (OWLNext Core)
Definition
animctrl.h:22
owl::uint
unsigned int uint
Definition
number.h:25
defs.h
_OWLCLASS
#define _OWLCLASS
Definition
defs.h:338
posclass.h
preclass.h
include
owl
popupgad.h
Generated by
1.10.0