InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PaletteRefUtils.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Dave Burnard
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __PaletteRefUtils__
25 #define __PaletteRefUtils__
26 
27 #include "PaletteRef.h"
28 #include "IUserInterfacePreferences.h"
29 
31 
45 {
46  // ======== PaletteRef API ========
47  public:
48 
53  {
54  kLeft_DockLocation = 1,
55  kTop_DockLocation,
56  kRight_DockLocation,
57  kBottom_DockLocation,
58  kFloating_DockLocation,
59  kAppContainer_DockLocation
60  };
61 
66  enum DockMode
67  {
68  kExpanded_DockMode = 1,
69  kConcealed_DockMode,
70  kRevealed_DockMode
71  };
72 
79  {
80  kExpanded_TabPaneMode = 1,
81  kIcon_TabPaneMode
82  };
83 
90  {
91  kAutoFlow_TabPaneLayoutMode = 1,
92  kManual_TabPaneLayoutMode
93  };
94 
95 
100  {
101  kVerticalWide_ToolbarSizeVariant = 1,
102  kVerticalNarrow_ToolbarSizeVariant,
103  kHorizontal_ToolbarSizeVariant
104  };
105 
106  //
107  // ----- Methods to test the type of a Palette.
108  //
110  static bool16 IsRootPaletteNode(const PaletteRef& whichPalette);
111 
113  static bool16 IsApplicationContainer(const PaletteRef& whichPalette);
114 
116  static bool16 IsDock(const PaletteRef& whichPalette);
117 
119  //static bool16 IsTabGroupCluster(const PaletteRef& whichPalette);
120 
122  static bool16 IsTabbedPaletteDock(const PaletteRef& whichPalette);
123 
125  static bool16 IsDocumentDock(const PaletteRef& whichPalette);
126 
128  static bool16 IsFloatingTabbedPaletteDock(const PaletteRef& whichPalette);
129 
131  static bool16 IsFloatingDocumentDock(const PaletteRef& whichPalette);
132 
134  static bool16 IsTabPane(const PaletteRef& whichPalette);
135 
137  static bool16 IsControlBarPane(const PaletteRef& whichPalette);
138 
140  static bool16 IsTabGroup(const PaletteRef& whichPalette);
141 
143  static bool16 IsToolbar(const PaletteRef& whichPalette);
144 
146  static bool16 IsControlBar(const PaletteRef& whichPalette);
147 
149  static bool16 IsTabPanelContainer(const PaletteRef& whichPalette);
150 
152  static bool16 IsDocumentPresentation(const PaletteRef& whichPalette);
153 
157  //static bool16 IsTopLevelPalette(const PaletteRef& whichPalette);
158 
160  static bool16 IsPaletteFloating(const PaletteRef& whichPalette);
161 
163  static PaletteRef GetPaletteRefFromOWLPalette(OWLControlRef owlControl);
164 
169 
174 
175  //
176  // ----- Palette hierarchy enumeration methods.
177  // Use these methods to traverse the palette hierarchy.
178  //
181 
184 
186  static void SetApplicationContainer(OWLControlRef owlControl);
187 
192 
194  static uint16 GetChildCountOfPalette(const PaletteRef& parentPalette);
195 
197  static PaletteRef GetNthChildOfPalette(const PaletteRef& parentPalette, uint16 inIndex);
198 
200  static PaletteRef GetParentOfPalette(const PaletteRef& whichPalette);
201 
209  static void ReparentPalette(const PaletteRef& whichPalette, const PaletteRef& newParent, const PaletteRef& beforeSibling);
210 
214  static void FloatPalette(const PaletteRef& whichPalette);
215 
216 #if MACINTOSH
217  //
218  // ----- AppFrame Embedding.
219  //
225  static bool16 IsAppFrameEmbeddingOnMacEnabled();
234  static void SetAppFrameEmbeddingOnMacEnabled(bool16 enabledState = kTrue);
235 #endif
236 
237  //
238  // ----- Finding the TopLevel Palettes (i.e. not contained in another palette type).
239  //
241  static uint16 GetTopLevelPaletteCount();
243  static PaletteRef GetNthTopLevelPalette(uint16 inIndex);
244 
245  //
246  // ----- Finding the Docks.
247  //
249  static uint16 GetDockCount();
253  static PaletteRef GetNthDock(uint16 inIndex);
256  static PaletteRef FindDockByLocation(DockLocation whichLocation);
257 
258  //
259  // ----- Finding Floating TabbedPalette Docks.
260  //
262  static uint16 GetFloatingTabbedPaletteDockCount();
264  static PaletteRef GetNthFloatingTabbedPaletteDock(uint16 inIndex);
265 
266  //
267  // ----- Finding Floating Document Docks.
268  //
270  static uint16 GetFloatingDocumentDockCount();
272  static PaletteRef GetNthFloatingDocumentDock(uint16 inIndex);
275 
276  //
277  // ----- Dock Accessors.
278  //
280  static DockLocation GetDockLocation(const PaletteRef& whichDock);
282  static DockMode GetDockMode(const PaletteRef& whichDock);
284  static void SetDockMode(const PaletteRef& whichDock, DockMode newMode);
286  static SysPoint GetFloatingDockPreferredPosition(const PaletteRef& whichDock);
288  static void SetFloatingDockPreferredPosition(const PaletteRef& whichDock, SysPoint& where);
290  static void SetFloatingDocumentWindowBounds(const PaletteRef& documentRef, SysRect newBounds);
292  static void SetFloatingDocumentBounds(const PaletteRef& documentRef, SysPoint newDimensions);
293 
294  //
295  // ----- Finding the TabPanes.
296  // TabPanes are found by enumerating the children of a dock and testing with IsTabPane
297  //
299  static TabPaneMode GetTabPaneMode(const PaletteRef& whichTabPane);
301  static void SetTabPaneMode(const PaletteRef& whichTabPane, TabPaneMode newMode);
302 
304  static TabPaneLayoutMode GetTabPaneLayoutMode(const PaletteRef& whichTabPane);
306  static void SetTabPaneLayoutMode(const PaletteRef& whichTabPane, TabPaneLayoutMode newLayoutMode);
307 
309  static float GetTabPanePreferredIconicWidth(const PaletteRef& whichTabPane);
311  static void SetTabPanePreferredIconicWidth(const PaletteRef& whichTabPane, float newWidth);
312 
313  //
314  // ----- Finding the Toolbars and ControlBars.
315  // There are a bit trickier to find since they can be either floating or docked.
316  // So enumerate the appropriate parent and check each child with IsToolbar or IsControlBar
317  //
318 
319  //
320  // ----- Toolbar Accessors.
321  //
323  static ToolbarSizeVariant GetToolbarSizeVariant(const PaletteRef& whichToolbar);
325  static void SetToolbarSizeVariant(const PaletteRef& whichToolbar, ToolbarSizeVariant newVariant);
327  static void SetToolbarSizeVariant(const PaletteRef& toolbarRef, IUserInterfacePreferences::ToolboxState newState);
328 
330  static void FixupToolbarContentOrigin(const PaletteRef& toolbarRef);
331 
332  //
333  // ----- Palette Labels.
334  //
336  enum PanelLabel {
337  kTitle_PanelLabel = 0, // Title (e.g. used for tabs)
338  kTooltip_PanelLabel, // Tooltip
339  };
340 
347  static PMString GetPaletteLabel(const PaletteRef& whichPalette, PanelLabel whichLabel = kTitle_PanelLabel);
348  static void SetPaletteLabel(const PaletteRef& whichPalette, const PMString& labelstr, PanelLabel whichLabel = kTitle_PanelLabel);
349 
350  //
351  // ----- Palette Positioning (always global coordinates).
352  //
358  static SysPoint GetPalettePosition (const PaletteRef& whichPalette);
359 
365  static void SetPalettePosition (const PaletteRef& whichPalette, SysCoord left, SysCoord top);
366 
367 
371  static SysRect GetPaletteBounds (const PaletteRef& whichPalette);
372 
378  static void SetPaletteSize (const PaletteRef& whichPalette, SysPoint newDimensions);
379 
383  static SysRect GetOpticalPaletteBounds (const PaletteRef& whichPalette);
384 
385 
386  //
387  // ----- Palette Visibility
388  //
390  static bool16 GetVisibleState (const PaletteRef& whichPalette);
392  static bool16 IsPaletteVisible (const PaletteRef& whichPalette);
393 
395  static bool16 IsPaletteMinimized (const PaletteRef& whichPalette);
397  static void ChangePaletteMinimization (const PaletteRef& whichPalette, bool16 minimize);
398 
400  enum PaletteVisibilityChange { kShowPalette = 0, kHidePalette };
401 
406 
409  static bool16 IsEntirePaletteSystemHidden();
410 
414  static void ForcePaletteSystemToPerformLayout();
415 
416 
422  static void ShowHidePalette (const PaletteRef& whichPalette, PaletteVisibilityChange show);
423 
425  static void BringPaletteToFront(const PaletteRef& whichPalette);
426 
430  static void CenterPaletteOnScreen(const PaletteRef& whichPalette);
431 
432  //
433  // ----- Palette Creation Shortcuts.
434  // @see IPaletteFactory
435  //
437  static PaletteRef NewTabPaneInDock(const PaletteRef& dockParent, TabPaneMode mode, const PaletteRef& beforeOptionalSibling);
438 
440  static PaletteRef NewControlBarPaneInDock(const PaletteRef& dockParent, const PaletteRef& beforeOptionalSibling);
441 
444 
446  static PaletteRef NewTabGroupPalette(const PaletteRef& tabGroupClusterOrTabPaneParent);
447 
449  static PaletteRef NewToolbarPalette();
450 
453 
454  //
455  // ----- Palette Closed state.
456  // The closed state reflects how a palette is marked when the user clicks on the close box of a palette.
457  // It is included in the effective visibility calculation.
458  //
460  static bool16 CanClose(const PaletteRef& paletteRef);
462  static bool16 GetIsClosed(const PaletteRef& paletteRef);
464  static void ChangeIsClosed(const PaletteRef& paletteRef, bool16 close = kTrue);
465 
468  static void AdjustClientAreaToPalettes();
469 
471  static void InvalidateAllPalettes();
472 
473 #ifdef DEBUG
474 
475  static char* GetPaletteTypeString(PaletteRefType palType);
477  static void DumpPaletteHierarchy(const PaletteRef& pal);
479  static void DumpOWLWidgetHierarchy();
480 #endif
481 
488  };
489 
494  static void ShowHidePalettes(ShowHideLevel paletteShowHideLevel = kShowHideAllPalettes);
495 
506  };
507 
511  static bool16 AreTabPanesOpen(WhichTabPanes whichOnes = kAllTabPanes);
516  static void OpenCloseTabPanes(WhichTabPanes whichOnes = kAllTabPanes, bool16 open = kTrue);
517 
518  static IXMLGenerator* QueryXMLGenerator(PaletteRefType paletteType);
519  static IPaletteFactory* QueryPaletteFactory(PaletteRefType paletteType);
520 
526  static void NotifyPaletteIsClosing(PaletteRef owlPalette);
527 
533  static void NotifyPaletteContainerIsClosing(PaletteRef owlPalette);
534 
540  static void PositionPaletteOnScreen(const PaletteRef& whichPalette, PMReal distanceFromLeftOnScreenInPercentage);
541 
542 private:
543 
544  static bool16 fgAllTabPanesOpen;
545  static bool16 fgRHSTabPanesOpen;
546  static bool16 fgLHSTabPanesOpen;
547 
548  static PaletteRef fgApplicationContainer;
549 };
550 
551 #endif // __PaletteRefUtils__