InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MenuNodeID.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Matt Joss
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 __MENUNODEID__
25 #define __MENUNODEID__
26 
27 #include "NodeID.h"
28 #include "IPMStream.h"
29 #include "SuppressedUIPanelID.h"
30 
31 // The MenuNodeID contains the full menu path(including the menu item name) and the ActionID. There could be 2 menus with the same menu path,
32 // so we need actionID too to make sure they are unique. Full menu path is something like Main:File:Print
33 
34 extern const char* kUICustomizationPopupPrefixString;
35 extern const char* kSuppressedUIPanelPopupPrefixString;
36 
37 class MenuNodeID : public NodeIDClass
38 {
39  public:
40  enum { kNodeType = kMenuNodeID };
41 
42 
43  static NodeID_rv Create() { return new MenuNodeID(); }
44  static NodeID_rv Create(const PMString& fullMenuPath, ActionID action) { return new MenuNodeID(fullMenuPath, action); }
45  static NodeID_rv Create(const PMString& fullMenuPath) { return new MenuNodeID(fullMenuPath); }
46 
47  virtual ~MenuNodeID() {}
48 
49  virtual NodeType GetNodeType() const { return kNodeType; }
50  virtual int32 Compare(const NodeIDClass* NodeID) const;
51  virtual NodeIDClass* Clone() const;
52  virtual void Read(IPMStream* stream);
53  virtual void Write(IPMStream* stream) const;
54  virtual PMString GetDescription() const;
55 
56  // returns the full path of the menu, e.g. Main:File:Print..., or Tag_PanelPopup:Load Tags...
57  // This must be used when calling menu methods in ISuppressedUIWithXMLFileData
58  PMString GetRealMenuPath() const;
59 
60  // returns the path defined in the panel. Contains prefixes, etc. i.e. Popups:Tag_PanelPopup:Load Tags...
61  const PMString& GetBBPanelMenuPath() const { return fBBPanelMenuPath; }
62 
63  // just returns the menu item name, e.g. Print...
64  PMString GetMenuName() const;
65  PMString GetMenuAcceleratorFromPath(PMString menuPath) const;
66  ActionID GetActionID() const { return fActionID; }
67 
68  bool16 CanSuppress() const;
69  bool16 CanCustomize() const;
70  bool16 CanHide() const;
71 
72  // Accelerators
73  PMString GetOriginalAccelerator() const { return GetMenuAcceleratorFromPath(fBBPanelMenuPath); }
74 
75  PMString GetAccelerator() const { return fAccelerator; }
76  void SetAccelerator(PMString accelerator){ fAccelerator = accelerator; }
77 
78  bool16 GetAcceleratorLock() const { return fAcceleratorLocked; }
79  void SetAcceleratorLock(bool16 lock) { fAcceleratorLocked = lock; }
80 
81  private:
82  MenuNodeID(): fAcceleratorLocked(kFalse){}
83  MenuNodeID(const PMString& fullMenuPath, ActionID action, bool16 lock):fBBPanelMenuPath(fullMenuPath), fActionID(action), fAcceleratorLocked(lock){}
84  MenuNodeID(const PMString& fullMenuPath, ActionID action):fBBPanelMenuPath(fullMenuPath), fActionID(action), fAcceleratorLocked(kFalse){}
85  MenuNodeID(const PMString& fullMenuPath):fBBPanelMenuPath(fullMenuPath), fActionID(kInvalidActionID), fAcceleratorLocked(kFalse){}
86 
87  PMString fBBPanelMenuPath;
88  ActionID fActionID;
89  bool16 fAcceleratorLocked;
90  PMString fOriginalAccelerator;
91  PMString fAccelerator;
92 };
93 
94 #endif //__STRINGNODEID__