InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDVOwnerDrawMenu Class Referenceabstract

#include <IDVOwnerDrawMenu.h>

Inheritance diagram for IDVOwnerDrawMenu:
IPMUnknownCPMUnknown< IDVOwnerDrawMenu >DVOwnerDrawMenu

Public Types

enum  { kDefaultIID = IID_IDVOWNERDRAWMENU }
 

Public Member Functions

Callbacks to manage Drawing of OwnerDraw menus
virtual void DrawMenuItem (IGraphicsContext *oc, ActionID menuActionID, const SysRect &itemRect, bool16 isCurrentlySelectedItem, int16 actionState)=0
 
virtual void MeasureItem (ActionID menuActionID, uint16 *outItemWidth, uint16 *outItemHeight)=0
 
Adding and removing widgets for associated ActionIDs. Typically, widgets are added to the OwnerDraw menu using these methods and when DrawMenu is called,

it will draw the widget that was added for the requested ActionID

virtual void AddMenuWidget (ActionID menuActionID, IControlView *widget)=0
 
virtual void RemoveMenuWidget (ActionID menuActionID, bool16 deleteUID=kTrue)=0
 
virtual void RemoveAllMenuWidgets (bool16 deleteUID=kTrue)=0
 
virtual bool16 IsValidActionID (ActionID actionID)=0
 
virtual PMReal GetMenuViewScale ()=0
 
virtual void SetMenuViewScale (PMReal scale)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

This interface is necessary for OwnerDraw menus. When an ownerdraw menu is shown, this interface is called to draw the menu. It should be placed on the same boss as the IActionComponent for the menu

Member Function Documentation

virtual void IDVOwnerDrawMenu::AddMenuWidget (ActionID menuActionID,
IControlViewwidget 
)
pure virtual

Add a widget for a given ActionID. This is the preferred method for using OwnerDraw Menus. Widgets are added with AddMenuWidget and associated with an ActionID.

Parameters
TheActionID of the specific menu item that you are associating with the given widget.
Thewidget that is being added to the OwnerDraw menus list of widgets and associated actions

Implemented in DVOwnerDrawMenu.

virtual void IDVOwnerDrawMenu::DrawMenuItem (IGraphicsContextoc,
ActionID menuActionID,
const SysRectitemRect,
bool16 isCurrentlySelectedItem,
int16 actionState 
)
pure virtual

This method is called by the Menu Manager code to draw an OwnerDraw menu item. When called, client should draw into the specified port and rectangle

Parameters
TheIViewPort that you should draw into
TheActionID of the specific menu that is being asked to be drawn. Only 1 menu item at a time is drawn. This identifies which menu item to draw.
Therect in which to draw you menu item
kTrueif this menu item has the mouse over it and should be drawn hilited to indicate that it is the curren target menu item. kFalse otherwise
actionstate of the menu item. This is the same as the action states in IActionStateList.h and should be used to determine whether to draw disabled, with a checkmark, etc. Options are (kDisabled_Unselected, kEnabledAction, kSelectedAction, kMultiSelectedAction, kAltSelectedAction)

Implemented in DVOwnerDrawMenu.

virtual PMReal IDVOwnerDrawMenu::GetMenuViewScale ()
pure virtual

A way to find out what scale the owner drawn view should be drawn at. If using a HIDPI screen this may be greater than 1.

Returns
scale to display

Implemented in DVOwnerDrawMenu.

virtual bool16 IDVOwnerDrawMenu::IsValidActionID (ActionID actionID)
pure virtual

Test the Action ID to see if it is one of the actions that this class can render. Override this for components that have a mix of ownerdraw menus and regular menus. If you don't do this, your owner draw code will be called when your regular menu is colorized in the Menus dialog.

Parameters
actionIDthe action id you want to test
Returns
true if this owner draw class can render the actionID menu.

Implemented in DVOwnerDrawMenu.

virtual void IDVOwnerDrawMenu::MeasureItem (ActionID menuActionID,
uint16 * outItemWidth,
uint16 * outItemHeight 
)
pure virtual

This method is called by the Menu Manager code to determine the size of the given menu manager. The height and width returned here will match the height and width of the rectangle given in DrawMenuItem

Parameters
TheActionID of the specific menu that is being asked to be measured. Only 1 menu item at a time is measured. This identifies which menu item to measure.
thisan out only parameter. You should set it to the width of your menu. This may be nil, so check before setting it
thisan out only parameter. You should set it to the height of your menu. This may be nil, so check before setting it

Implemented in DVOwnerDrawMenu.

virtual void IDVOwnerDrawMenu::RemoveAllMenuWidgets (bool16 deleteUID = kTrue)
pure virtual

Remove all the widgets that have been added.

Parameters
Whenthe widgets are removed, do you want the UIDs of the widgets deleted? Typically, you've created the widgets for this purpose, so you want to delete the UIDs when they go away.

Implemented in DVOwnerDrawMenu.

virtual void IDVOwnerDrawMenu::RemoveMenuWidget (ActionID menuActionID,
bool16 deleteUID = kTrue 
)
pure virtual

Remove the widget that is associated with the specified action.

Parameters
TheActionID of the specific menu item whose widget you wish to remove.
Whenthe widget is removed, do you want the UID of the widget deleted? Typically, you've created the widget for this purpose, so you want to delete the UID when it goes away.

Implemented in DVOwnerDrawMenu.

virtual void IDVOwnerDrawMenu::SetMenuViewScale (PMReal scale)
pure virtual

This is set in the menu manager before calling the owner drawn menu to draw.

Parameters
scaleview is drawn at.

Implemented in DVOwnerDrawMenu.