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

#include <IMenuUtils.h>

Inheritance diagram for IMenuUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IMENUUTILS }
 

Public Member Functions

virtual void PlatformStripMenuAccelerator (PMString *inOutString, int16 uiLocale=LocaleSetting::GetLocale().GetUserInterfaceId())=0
 
virtual void StripMenuAccelerator (PMString *inOutString, int16 uiLocale)=0
 
virtual void InsertAmpersandForDisplay (PMString *inOutString, int16 uiLocale=LocaleSetting::GetLocale().GetUserInterfaceId())=0
 
virtual bool16 RemoveLastMenuPart (PMString *inOutString)=0
 
virtual bool16 RemoveAllButLastMenuPart (PMString *inOutString)=0
 
virtual int32 GetNumMenuParts (const PMString &menuPath)=0
 
virtual PMString GetNthMenuPart (const PMString &menuPath, int32 index)=0
 
virtual void DrawMenuString (SysPort port, const PMString &menuString, const SysRect &bounds, int16 alignment, bool16 hilited, bool16 disabled)=0
 
virtual void DrawMenuString (IGraphicsContext *gc, const PMPoint &startPt, const PMString &str, const InterfaceFontInfo &fontInfo, IInterfaceColors::InterfaceColor color=kInterfaceBlack, bool16 convertAmpersandToUnderline=kFalse, bool16 disabled=kFalse)=0
 
virtual void TranslateMenuName (PMString &untranslatedName)=0
 
virtual PMString GetMenuNameFromFileName (const PMString &fileName, int32 position)=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 provides some utility routines commonly used by menu code. i.e. Utils<IMenuUtils>()->PlatformStripMenuAccelerator( ... ) ;

Member Function Documentation

virtual void IMenuUtils::DrawMenuString (SysPort port,
const PMStringmenuString,
const SysRectbounds,
int16 alignment,
bool16 hilited,
bool16 disabled 
)
pure virtual

DEPRECATED: draw the specified string in the the current port, using menu theme. This is mostly intended for use in OwnerDrawn menus

Parameters
portthe port to draw into
menuStringthe menu item string to draw
boundsthe bounds to draw the string into
alignmentthe alignment for the string in the box, i.e. kAlignLeft
hilitedwhether or not the menu item should be drawn hilited
disabledwhether or not the menu item should be drawn disabled
virtual void IMenuUtils::DrawMenuString (IGraphicsContextgc,
const PMPointstartPt,
const PMStringstr,
const InterfaceFontInfofontInfo,
IInterfaceColors::InterfaceColor color = kInterfaceBlack,
bool16 convertAmpersandToUnderline = kFalse,
bool16 disabled = kFalse 
)
pure virtual

draw the specified string in the the current port, using menu theme. This is mostly intended for use in OwnerDrawn menus

Parameters
gcthe graphics context to draw into
startPtwhere to start drawing
strthe menu item string to draw
fontInfothe font to draw with
colorthe color to draw with
convertAmpersandToUnderlinewhether or not to convert '&' to underlines, like windows does
disabledwhether or not the menu item should be drawn disabled
virtual PMString IMenuUtils::GetMenuNameFromFileName (const PMStringfileName,
int32 position 
)
pure virtual

Create the text of recent file. It will

  1. Add the Number and accelerator on Windows
  2. If the fileName is a path and exeeds a fixed number of characters, it will remove path tokens from the middle of the path and replace them with an ellipses.
  3. If the filename exceeds the width, ellipses are added to the end. Width is based on characters, not screen width since we don't know the font information for menus.
    Parameters
    pathor path and filename of the file IN
    menuposition used when adding the Window accelerators.
    Returns
    string that is ready for the menu.
virtual PMString IMenuUtils::GetNthMenuPart (const PMStringmenuPath,
int32 index 
)
pure virtual

get the nth part of a menu path. i.e. if you pass in 'Main:Type:Font:Times' and 2, this would return 'Font'

Parameters
menuPaththe string of menu parts
indexwhich menu part you want
Returns
string with the nth menu part
virtual int32 IMenuUtils::GetNumMenuParts (const PMStringmenuPath)
pure virtual

counts # of menu parts. i.e. if you pass in 'Main:Type:Font:Times', this would return 4. Note: If you pass in 'Main:Type:Font:' this will return 3.

Parameters
menuPaththe string to count the menu parts of
Returns
number of menu parts in the passed in string
virtual void IMenuUtils::InsertAmpersandForDisplay (PMStringinOutString,
int16 uiLocale = LocaleSetting::GetLocale().GetUserInterfaceId() 
)
pure virtual

Inserts extra '&' characters into a string, doubling up each one. This is required for strings that actually contain non-accelerator ampersand characters. e.g. Style names, master names, layer names, swatch names or other user-entered strings. Can be useful before call to ReplaceStringParameters, which is often followed by a call to SetNthActionName, or SetTextControlData. Should only be called on strings that don't contain accelerator ampersands. Safe to call on both platforms.

Parameters
inOutStringThis is a pointer to the string to insert extra ampersands into
uiLocaledescribes what UI this string is for.
virtual void IMenuUtils::PlatformStripMenuAccelerator (PMStringinOutString,
int16 uiLocale = LocaleSetting::GetLocale().GetUserInterfaceId() 
)
pure virtual

Strips the menu accelerator from the string, if this platform doesn't need it. Generally a no-op on windows. On the mac, this strips single '&' characters from the string (for English and most other languages. Some languages like Japanese use different accelerator characters)

Parameters
inOutStringThis is a pointer to the string to remove the accelerator from
uiLocaledescribes what UI this string is for.
virtual bool16 IMenuUtils::RemoveAllButLastMenuPart (PMStringinOutString)
pure virtual

takes a menu path, removes all but the last item (i.e. if you pass in 'Main:Type:Font:Times', the string you passed in is now 'Times')

Parameters
inOutStringThis is a pointer to the string to remove the last part of the menu path from
Returns
kFalse if string has 0 or 1 part, else kTrue
virtual bool16 IMenuUtils::RemoveLastMenuPart (PMStringinOutString)
pure virtual

takes a menu path, removes the last item (i.e. if you pass in 'Main:Type:Font:Times', the string you passed in is now 'Main:Type:Font')

Parameters
inOutStringThis is a pointer to the string to remove the last part of the menu path from
Returns
kFalse if string has 0 or 1 part, else kTrue
virtual void IMenuUtils::StripMenuAccelerator (PMStringinOutString,
int16 uiLocale 
)
pure virtual

Strips the menu accelerator from the string. Generally, this strips single '&' characters from the string (for English and most other languages. Some languages like Japanese use different accelerator characters)

Parameters
inOutStringThis is a pointer to the string to remove the accelerator from
uiLocaledescribes what UI this string is for.
virtual void IMenuUtils::TranslateMenuName (PMStringuntranslatedName)
pure virtual

Translate a menu name. Menu names preceeded by the kDontTranslateChar (

See Also
ActionDefs.h) won't be translated, but the kDontTranslateChar will be stripped.
Parameters
untranslatedNameof the menu IN/OUT