OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
decframe.h
Go to the documentation of this file.
1//----------------------------------------------------------------------------
2// ObjectWindows
3// Copyright (c) 1992, 1996 by Borland International, All Rights Reserved
4//
5/// \file
6/// Definition of class TDecoratedFrame, a TFrameWindow that can manage
7/// decorations around the client window.
8//----------------------------------------------------------------------------
9
10#if !defined(OWL_DECFRAME_H)
11#define OWL_DECFRAME_H
12
13#include <owl/private/defs.h>
14#if defined(BI_HAS_PRAGMA_ONCE)
15# pragma once
16#endif
17
18#include <owl/framewin.h>
19#include <owl/layoutwi.h>
20#include <owl/bardescr.h>
21
22namespace owl {
23
24const int IDW_TOOLBAR = 32041; // Standard toolbar child window ID
25
28
29template <class R, class T1> class TFunctor1;
30// TGadgetWndFunctor is a ptr to a fn taking nothing and returning a TGadgetWindow*
32
33#define TGadgetWnd_FUNCTOR(func) TFunctionTranslator1<TGadgetWindow*,TWindow*, TGadgetWindow* (*)(TWindow*)>(func)
34#define TGadgetWnd_MFUNCTOR(obj,memberFunc) TMemberTranslator1<TGadgetWindow*,TWindow*, TGadgetWindow* (obj::*)(TWindow*)>(obj, memberFunc);
35
36//
37// Funct = TGadgetWnd_MFUNCTOR(myWndPtr,&TMyWindow::MyHandle)
38// Funct = TGadgetWnd_MFUNCTOR(this,&TMyWindow::MyHandle)
39//
40
41template <class R, class T1, class T2, class T3> class TFunctor3;
43
44#define TBarInsert_FUNCTOR(func) TFunctionTranslator3<bool, TDecoratedFrame&, TGadgetWindow&, TAbsLocation, bool (*)(TDecoratedFrame&, TGadgetWindow&, TAbsLocation)>(func)
45#define TBarInsert_MFUNCTOR(obj,memberFunc) TMemberTranslator3<bool, TDecoratedFrame&, TGadgetWindow&, TAbsLocation, bool (obj::*)(TDecoratedFrame&, TGadgetWindow&, TAbsLocation)>(obj, memberFunc);
46
47/// \addtogroup decor
48/// @{
49/// \enum THintText
50// ~~~~~~~~~~~~~~
52 htStatus = 0x0001, ///< Text displayed on status bar
53 htTooltip = 0x0002, ///< Shorter text displayed in a tooltip
54 htUserDefined ///< Can be used when enhancing 'GetHintText'
55}; ///< to support balloon text etc..
56
57#include <owl/preclass.h>
58
59//
60/// \class TDecoratedFrame
61// ~~~~~ ~~~~~~~~~~~~~~~
62/// TDecoratedFrame automatically positions its client window (you must supply a
63/// client window) so that it is the same size as the client rectangle. You can add
64/// additional decorations like toolbars and status lines to a window.You can create
65/// a TDecoratedFrame without a caption bar by clearing all of the bits in the style
66/// data member of the TWindowAttr structure. TDecoratedFrame is a streamable class.
67/// It is virtually derived from TFrameWindow and from TLayoutWindow.
68///
69/// For OLE-enabled applications, use TOleFrame, which creates a decorated frame and
70/// manages decorations such as toolbars for the main window of an SDI (Single
71/// Document Interface) OLE application.
72//
73class _OWLCLASS TDecoratedFrame : virtual public TFrameWindow,
74 public TLayoutWindow {
75 public:
79 bool trackMenuSelection = false,
80 TModule* module = 0);
81 TDecoratedFrame(TWindow* parent, const tstring& title, TWindow* client, bool trackMenuSelection = false, TModule* = 0);
82 ~TDecoratedFrame() override;
83
84 /// Enumeration describing the possible locations of a Gadgetwindow
85 /// [Used mainly for location of Toolbar and Statusbar standalone
86 /// and in the context of docking windows]
87 //
88 enum TLocation {
89 None = alNone, ///< No location specified
90 Top = alTop, ///< Refers to top edge of frame
91 Bottom = alBottom, ///< Refers to bottom edge of frame
92 Left = alLeft, ///< Refers to left edge of frame
93 Right = alRight, ///< Refers to right edge of frame
94 };
95// typedef TAbsLocation TLocation;
96
97 virtual void Insert(TWindow& decoration, TLocation location = Top);
98
99 // Hint/Status/Tip text
100 //
101 virtual tstring GetHintText(uint id, THintText hintType) const;
102
103 /// Override TFrameWindow member function to give decorations an opportunity
104 /// to do pre-processing (e.g. mnemonic access)
105 //
106 auto PreProcessMsg(MSG&) -> bool override;
107 auto SetClientWindow(TWindow*) ->TWindow* override;
108 using TFrameWindow::SetClientWindow; // Reveal overloads.
109
110 // Virtuals from TFrameWindow
111 virtual TGadgetWindow* GetControlBar();
112
113 void SetBarCreator(const TGadgetWndFunctor& funct);
114 void SetBarInserter(const TBarInsertFunctor& funct);
115
116 TGadgetWndFunctor* GetBarCreator();
117 TBarInsertFunctor* GetBarInserter();
118
119 protected:
120
121 void Init(TWindow* parent, LPCTSTR title, TWindow* client, bool trackMenuSelection, TModule*);
122
123 // Virtuals from TFrameWindow
124 auto MergeBar(const TBarDescr&) -> bool override;
125 auto RestoreBar() -> bool override;
126 virtual bool CreateBar();
127
128 bool GetTrackMenuSelection() const;
129 void SetTrackMenuSelection(bool tr=true);
130
131 uint GetMenuItemId() const;
132 void SetMenuItemId(uint menuitemid);
133
134 // Override TWindow virtuals
135 //
136 void SetupWindow() override;
137 void CleanupWindow() override;
138 void RemoveChild(TWindow*) override;
139
140 // Automatic showing/hiding of tool bars and status bars
141 //
142 auto EvCommand(uint id, HWND hWndCtl, uint notifyCode) -> TResult override;
143 void EvCommandEnable(TCommandEnabler&) override;
144
145 // Message response functions
146 //
147 void EvMenuSelect(uint menuItemId, uint flags, HMENU hMenu);
148 void EvEnterIdle(uint source, HWND hWndDlg);
149 void EvSize(uint sizeType, const TSize& size);
150
152 bool TrackMenuSelection; ///< track menu select for status hints?
153 uint MenuItemId; ///< id of current menu selection
154
155 private:
156 void InsertAtTop(TWindow& decoration, TWindow* insertAbove);
157 void InsertAtBottom(TWindow& decoration, TWindow* insertBelow);
158 void InsertAtLeft(TWindow& decoration, TWindow* insertLeftOf);
159 void InsertAtRight(TWindow& decoration, TWindow* insertRightOf);
160
161 bool SettingClient;
162
163 TGadgetWndFunctor* BarCreatorFunct;
164 TBarInsertFunctor* BarInserterFunct;
165
166 // Hidden to prevent accidental copying or assignment
167 //
170
173};
174/// @}
175
177
178#include <owl/posclass.h>
179
180
181//----------------------------------------------------------------------------
182// Inline implementations
183//
184
185//
186/// Returns true if the decorated frame is tracking the menu selections.
187/// Sends a message to the status bar to display the hint text.
188//
189inline bool
191 return TrackMenuSelection;
192}
193
194//
195/// Set the flag for tracking menu selection.
196//
197inline void
199 TrackMenuSelection = tr;
200}
201
202//
203/// Return cached id of the current menu item.
204//
205inline uint
207 return MenuItemId;
208}
209
210//
211/// Set the cached id of the current menu item.
212//
213inline void
217
218//
219//
220//
221inline TGadgetWndFunctor*
223 return BarCreatorFunct;
224}
225//
226//
227//
228inline TBarInsertFunctor*
230 return BarInserterFunct;
231}
232//
233
234} // OWL namespace
235
236
237#endif // OWL_DECFRAME_H
Class definition for TBarDescr.
Descriptor of Bar Implementation.
Definition bardescr.h:71
Base class for an extensible interface for auto enabling/disabling of commands (menu items,...
Definition window.h:209
TDecoratedFrame automatically positions its client window (you must supply a client window) so that i...
Definition decframe.h:74
void SetMenuItemId(uint menuitemid)
Set the cached id of the current menu item.
Definition decframe.h:214
TBarInsertFunctor * GetBarInserter()
Definition decframe.h:229
TGadgetWndFunctor * GetBarCreator()
Definition decframe.h:222
uint GetMenuItemId() const
Return cached id of the current menu item.
Definition decframe.h:206
bool GetTrackMenuSelection() const
Returns true if the decorated frame is tracking the menu selections.
Definition decframe.h:190
void SetTrackMenuSelection(bool tr=true)
Set the flag for tracking menu selection.
Definition decframe.h:198
TLocation
Enumeration describing the possible locations of a Gadgetwindow [Used mainly for location of Toolbar ...
Definition decframe.h:88
Derived from TWindow, TFrameWindow controls such window-specific behavior as keyboard navigation and ...
Definition framewin.h:96
Functor with 1 parameter, return R.
Definition functor.h:294
Functor with 3 parameters, return R.
Definition functor.h:589
Derived from TWindow, TGadgetWindow maintains a list of tiled gadgets for a window and lets you dynam...
Definition gadgetwi.h:122
Derived from TWindow, TLayoutWindow provides functionality for defining the layout metrics for a wind...
Definition layoutwi.h:122
ObjectWindows dynamic-link libraries (DLLs) construct an instance of TModule, which acts as an object...
Definition module.h:75
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
#define DECLARE_RESPONSE_TABLE(cls)
Definition eventhan.h:436
Definition of class TFrameWindow.
#define DECLARE_STREAMABLE_OWL(cls, ver)
Definition objstrm.h:1529
#define DECLARE_STREAMABLE_INLINES(cls)
Definition objstrm.h:1538
THintText
Definition decframe.h:51
@ htUserDefined
Can be used when enhancing 'GetHintText'.
Definition decframe.h:54
@ htStatus
Text displayed on status bar.
Definition decframe.h:52
@ htTooltip
Shorter text displayed in a tooltip.
Definition decframe.h:53
@ alTop
Refers to top edge of frame.
Definition geometry.h:64
@ alRight
Refers to right edge of frame.
Definition geometry.h:67
@ alBottom
Refers to bottom edge of frame.
Definition geometry.h:65
@ alLeft
Refers to left edge of frame.
Definition geometry.h:66
@ alNone
No location specified.
Definition geometry.h:63
Definition of classes TLayoutMetrics & TLayoutWindow.
Object Windows Library (OWLNext Core)
Definition animctrl.h:22
const int IDW_TOOLBAR
Definition decframe.h:24
TFunctor3< bool, TDecoratedFrame &, TGadgetWindow &, TAbsLocation > TBarInsertFunctor
Definition decframe.h:42
LRESULT TResult
Result type.
Definition dispatch.h:52
std::string tstring
Definition defs.h:79
unsigned int uint
Definition number.h:25
TFunctor1< TGadgetWindow *, TWindow * > TGadgetWndFunctor
Definition decframe.h:31
#define protected_data
Definition defs.h:208
#define _OWLCLASS
Definition defs.h:338