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
34namespace owl {
35
36
37//
38#include <owl/preclass.h>
39
40/// \addtogroup newctrl
41/// @{
42/// \class TPopupButtonGadget
43// ~~~~~ ~~~~~~~~~~~~~~~~~~
44//
46 public:
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,
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:
107 ArrowPressed = 0x001,
108 HasCapture = 0x002,
109 };
113};
114
115
116//
117// class TPopupMenuGadget
118// ~~~~~ ~~~~~~~~~~~~~~~~
119//
121 public:
122 TPopupMenuGadget( TMenu& menu,
123 TWindow* window,
124 int id,
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);
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:
144 static uint Flags;
145};
146/// @}
147
148#include <owl/posclass.h>
149
150
151//
152// inlines
153//
154
155//
156inline void
161
162//
163inline uint
168
169
170} // OWL namespace
171
172#endif // OWL_POPUPGAD_H
Definition of classes TButtonTextGadget.
TState
TState enumerates the three button positions during which the button can be pressed: up (0),...
Definition buttonga.h:80
TType
Enumerates the types of button gadgets.
Definition buttonga.h:69
Derived from TButtonGadget, TButtonTextGadget represents buttons with bitmap and text,...
Definition btntextg.h:45
TStyle
TStyle contains values that defines how gadget will be displayed:
Definition btntextg.h:62
TDC is the root class for GDI DC wrappers.
Definition dc.h:64
The TMenu class encapsulates window menus.
Definition menu.h:77
TPoint is a support class, derived from tagPOINT.
Definition geometry.h:87
void SetArrowWidth(uint width)
Definition popupgad.h:157
TPopupMenu * PopupMenu
Definition popupgad.h:142
static void SetFlags(uint flags)
Definition popupgad.h:137
static uint Flags
Definition popupgad.h:144
TPopupMenu creates an empty pop-up menu to add to an existing window or pop-up menu.
Definition menu.h:189
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
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
unsigned int uint
Definition number.h:25
#define _OWLCLASS
Definition defs.h:338