InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DVHostedWidgetView.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Dave Burnard
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // ADOBE CONFIDENTIAL
16 //
17 // Copyright 1997-2008 Adobe Systems Incorporated. All rights reserved.
18 //
19 // NOTICE: All information contained herein is, and remains
20 // the property of Adobe Systems Incorporated and its suppliers,
21 // if any. The intellectual and technical concepts contained
22 // herein are proprietary to Adobe Systems Incorporated and its
23 // suppliers and may be covered by U.S. and Foreign Patents,
24 // patents in process, and are protected by trade secret or copyright law.
25 // Dissemination of this information or reproduction of this material
26 // is strictly forbidden unless prior written permission is obtained
27 // from Adobe Systems Incorporated.
28 //
29 //========================================================================================
30 
31 #ifndef __DVHostedWidgetView__
32 #define __DVHostedWidgetView__
33 
34 #include "AbstractControlView.h"
35 
36 #include "DVAForwardDeclarations.h"
37 
38 #ifdef DV_WIDGET_BUILD
39 #endif
40 
45 {
46 
48 
49 public:
50 
52  virtual ~DVHostedWidgetView();
53 
54  virtual void DoPostCreate();
55  virtual void ReadWrite(IPMStream *s, ImplementationID prop);
56 
58  virtual void SetFrame(const PMRect& newFrame, bool16 invalidate = kTrue);
59 
61  virtual const PMRect& GetFrame() const;
62 
64  virtual const PMRect GetLocalFrame() const;
65 
67  virtual PMRect GetInnerContentFrame() const;
68 
72  virtual void Resize(const PMPoint& newDimensions, bool16 invalidate = kTrue);
73 
77  virtual void MoveTo(const PMPoint& where, bool16 invalidate = kTrue);
78 
80  virtual void SetFrameBinding(const FrameBinding& binding);
81  virtual FrameBinding GetFrameBinding() const;
82 
84  virtual void AdaptToParentsSize(const PMPoint& dimensions);
85 
87  virtual void AdaptToChildsGeometry(const PMPoint& delta, const FrameBinding& childsBinding, bool16 invalidate = kFalse);
88 
90  virtual SysRgn GetDrawRegion();
91 
95  virtual bool16 DrawRegionEncompassesChildRegions() const;
96 
98  virtual void DeleteDrawRegion();
99 
101  virtual int32 HitTest(const SysPoint& where);
102 
104  virtual void Draw(IViewPort* viewPort, SysRgn updateRgn);
105 
107  virtual void DV_Draw(dvaui::drawbot::Drawbot* drawbotP) const {};
108 
111  virtual void ForceRedraw(SysRgn invalidRgn, bool16 forceRedraw);
112 
114  virtual void Invalidate(PMRect *bbox = nil);
115 
117  virtual void Validate(PMRect *bbox = nil);
118 
120  virtual void Hilite(bool16 doHilite = kTrue);
121 
123  virtual void Unhilite();
124 
126  virtual bool16 IsHilited() const;
127 
129  virtual bool16 IsRolledOver() const;
130 
132  virtual void Show(bool16 doShow);
133 
135  virtual void Hide();
136 
138  virtual bool16 GetVisibleState() const;
139 
141  virtual bool16 IsVisible(bool16 requireVisibleWindow = kFalse) const;
142 
144  virtual void Enable(bool16 doEnable, bool16 invalidate);
145 
147  virtual void Disable(bool16 invalidate);
148 
150  virtual bool16 GetEnableState() const;
151 
153  virtual bool16 IsEnabled() const;
154 
156  virtual void ParentsEnableStateChanged(bool16 enable, bool16 invalidate);
157 
159  virtual void Init(const WidgetID& widgetId = kDefaultWidgetId,
160  const PMRect& bbox = kZeroRect,
161  RsrcID rsrcID = 0);
162 
163  virtual void DoAutoDetach();
164 
165  // GlobalToLocal(window or view) transformations (replaces similar methods in IWindowPort)
166  virtual PMRect GlobalToView(const PMRect& convertRect) const;
167  virtual PMPoint GlobalToView(const PMPoint& convertPoint) const;
168  virtual PMRect GlobalToWindow(const PMRect& convertRect) const;
169  virtual PMPoint GlobalToWindow(const PMPoint& convertPoint) const;
170 
171  virtual PMRect ViewToGlobal(const PMRect& convertRect) const;
172  virtual PMPoint ViewToGlobal(const PMPoint& convertPoint) const;
173  virtual PMRect WindowToGlobal(const PMRect& convertRect) const;
174  virtual PMPoint WindowToGlobal(const PMPoint& convertPoint) const;
175 
176  virtual void SetClipToSelfEnabled(bool16 clipChildren) const;
177 
178 protected:
180  virtual void SetVisibleState(bool16 isVisible = kTrue);
181  virtual void SetEnableState(bool16 isVisible = kTrue);
182 
184  virtual bool16 AncestorsAreVisible(bool16 requireVisibleWindow) const;
185 
188 
194  virtual void CreateDrawRegion(SysRgn& drawRgn);
195 
197  virtual bool16 IsAutoAttached() const;
198  virtual void SetIsAutoAttached(bool16 flag = kTrue);
199 
200  void Set_UI_Node(dvaui::ui::UI_Node* node);
201  dvaui::ui::UI_Node* Get_UI_Node() const;
202 
206  void Release_UI_Node();
207 
208  virtual void BoundsChangedCallback();
209  virtual void ParentEnableStateChangedCallback();
210 
212  virtual void ResizeChildren(const PMPoint& delta, bool16 invalidate);
213  virtual void AdaptLayoutToFrameBindings(const PMPoint& delta, bool16 invalidate = kTrue);
214 
220  unsigned int fGeometryBusy : 1;
221  class AcquireGeometry;
222 
223 private:
224  /* If this view can display multiple tips while moving on the same widget, depending on the context.
225  Then following function should be called after setting the UI_Node in the view.
226  Normally, drover asks for new tool tip when the ui_node/widget under the mouse point changes.
227  In Indesign we have some widgets which are bigger controls that contain multiple sub-items which
228  are individual drawable entities but under the same widget.
229  So, to enable that drover asks tool tip text for these kind of controls on a bit frequent basis,
230  clients need to call this function to enable it.
231  For example, layout view is a single view for drover and it asks for new tool tip text only on ui node changes
232  changes. So we call this function from DVLayoutControlView constructor.
233  This function is also used for grid of glyphs in bullets and numbering and glyphs panel
234  */
235  void UpdateToolTipOnMouseMove();
236 
237  void CommonInit();
238 
240  void ConnectCursorProviderToRegion();
241 
242  // Non-persistent data
243  bool16 fAutoAttached;
244  bool16 fHilited;
245  mutable SysRgn fDrawRegion;
246 
247  // Private implementation class
248  class PrivateImpl;
249  PrivateImpl* Impl() const {return fImpl;}
250  PrivateImpl* fImpl;
251 
252 public:
253 
257  bool16 IsWidgetConstructionFinished() const;
258  void WidgetConstructionFinished(const bool16 bFlag);
259 
264  void MarkDisabledByNonSuppressedUIIfRequired(const bool16 bFlag);
265 
270  void MarkHiddenByNonSuppressedUIIfRequired(const bool16 bFlag);
271 
275  bool16 IsDisabledBySuppressedUI() const;
276  void DisableBySuppressedUI(const bool16 bFlag);
277 
281  bool16 IsHiddenBySuppressedUI() const;
282  void HideBySuppressedUI(const bool16 bFlag);
283 
284 private:
285 
288  bool16 IsEnableOrDisableFuncCalledFromSuppressedUI() const;
289  void EnableOrDisableFuncCalledFromSuppressedUI(const bool16 bFlag);
290 
293  bool16 IsDisabledByNonSuppressedUI() const;
294  void DisableByNonSuppressedUI(const bool16 bFlag);
295 
298  bool16 IsMarkedDisabled();
299 
302  bool16 IsShowOrHideFuncCalledFromSuppressedUI() const;
303  void ShowOrHideFuncCalledFromSuppressedUI(const bool16 bFlag);
304 
307  bool16 IsHiddenByNonSuppressedUI() const;
308  void HideByNonSuppressedUI(const bool16 bFlag);
309 
313  bool16 IsMarkedHidden();
314 };
315 
316 //========================================================================================
317 // DVHostedWidgetView::AcquireGeometry
318 //========================================================================================
323 {
324 public:
326  ~AcquireGeometry();
327 private:
328  DVHostedWidgetView* fView;
329 };
330 
331 inline DVHostedWidgetView::AcquireGeometry::AcquireGeometry(DVHostedWidgetView* view)
332  :
333  fView(view)
334 {
335  ASSERT_MSG(fView->fGeometryBusy == 0,"AcquireGeometry - fGeometryBusy is already set, and it's a 1 bit bitfield. Not good.");
336  fView->fGeometryBusy++;
337 }
338 
339 inline DVHostedWidgetView::AcquireGeometry::~AcquireGeometry()
340 {
341  ASSERT_MSG(fView->fGeometryBusy == 1,"~AcquireGeometry - fGeometryBusy is already unset, and it's a 1 bit bitfield. Not good.");
342  fView->fGeometryBusy--;
343 }
344 
345 
346 #endif
347