InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IWidgetUtils Class Referenceabstract
Inheritance diagram for IWidgetUtils:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IWIDGETUTILS }
 

Public Member Functions

virtual SysPoint ConvertPointToLocalWindow (const PMPoint &mouseLocationInParentWindowCoords, IControlView *destinationView)=0
 
virtual IPMUnknownQueryRelatedWidget (const IPMUnknown *widget, const WidgetID &widgetId, const PMIID &iid)=0
 
virtual const InterfaceFontInfo GetAppropriateFontForWidget (const IControlView *widget)=0
 
virtual const IUIColorSpecQueryColorSpecForWidget (const IPMUnknown *widget)=0
 
virtual void GrayOutFrameContents (IGraphicsPort *gc, PMRect frame, PMReal transparency)=0
 
virtual void DrawPaletteFill (const IControlView *widget, dvaui::drawbot::Drawbot *pDrawbot, const PMRect *rectToFill=nil)=0
 
virtual void DrawPaletteFill (const IControlView *widget, IGraphicsPort *port, const PMRect *rectToFill=nil)=0
 
virtual void GridPanel_PositionWidgets (IPanelControlData *panel, int32 first, int32 last)=0
 
virtual void DeleteWidgetAndChildren (IControlView *widgetToDelete)=0
 
virtual void StripUserDecimal (PMString *string)=0
 
virtual void FormatUserDecimal (PMString *string)=0
 
virtual void StripAccelerators (PMString &rawString)=0
 
virtual void GetFormattedString (const PMReal &value, const bool16 &bHorizontal, PMString &outString)=0
 
virtual void GetFormattedScalingString (const PMReal &value, PMString &outString, const bool16 bFormatWithParens)=0
 
virtual PMReal GetViewYPosition (IGraphicsContext *gc, const InterfaceFontInfo &fontInfo, const PMReal &height)=0
 
virtual void SimulateClick (IEventHandler *targetEH)=0
 
virtual void CombineRegions (IControlView *widget, SysWireframe &theRgn) const =0
 
virtual void DrawFocusRect (IControlView *view, const PMRect &r, bool16 flushDrawing)=0
 
virtual bool16 DrawHiliteRect (IControlView *view, const PMRect &r, bool16 flushDrawing=kTrue, PMReal hiliteThickness=kDefaultHiliteThickness)=0
 
virtual bool16 DrawHilitePath (IControlView *view, const PMPointList &pts, bool16 flushDrawing=kTrue, PMReal hiliteThickness=kDefaultHiliteThickness)=0
 
virtual bool16 DrawHilitePath (IControlView *view, const PMPointListCollection &subPaths, bool16 flushDrawing=kTrue, PMReal hiliteThickness=kDefaultHiliteThickness)=0
 
virtual bool16 DrawHilitePath (IControlView *view, SysWireframe hilitePath, bool16 flushDrawing=kTrue, PMReal hiliteThickness=kDefaultHiliteThickness)=0
 
virtual bool16 FillHiliteRect (IControlView *view, const PMRect &r, bool16 flushDrawing=kTrue)=0
 
virtual bool16 FillHilitePath (IControlView *view, const PMPointListCollection &subPaths, bool16 flushDrawing=kTrue)=0
 
virtual void SetTextHighlightColor (IGraphicsPort *gPort, const IControlView *view)=0
 
virtual bool16 IsWidgetInPalette (const IControlView *iWidget)=0
 
virtual bool16 CopyBitsToView (IControlView *view, const Int32Rect &dstBounds, IDVPlatformOffscreen *srcOffscreen, const Int32Rect &srcBounds, const PMMatrix &clip2destMatrix=PMMatrix(), const SysRgn clipRgn=nil)=0
 
virtual PMReal GetViewScaleFactorReal (const IControlView *view)=0
 
virtual void DrawRoundedRect (dvaui::drawbot::Drawbot *drawBotP, const RoundedRectAppearance &roundedRectAppearance)=0
 
virtual void DrawLeftRoundedRect (dvaui::drawbot::Drawbot *drawBotP, const RoundedRectAppearance &roundedRectAppearance)=0
 
virtual void DrawRightRoundedRect (dvaui::drawbot::Drawbot *drawBotP, const RoundedRectAppearance &roundedRectAppearance)=0
 
virtual bool16 IsClusterControllableChildWidget (IControlView *widget, bool16 &isSelected, bool16 checkParentToBeCluster=kFalse)=0
 
virtual IPMUnknownQueryDescendentWidgetOfType (IPMUnknown *widget, PMIID interfaceID)=0
 
virtual IDialogCreateContextUI (const RsrcSpec &rSpec, const PMRect &globalAnchorRect, const ClassID &popupWindowClass=kPopupWindowBoss, bool16 preferredtoBeDrawnOnLeft=kFalse, bool16 invokedFromPalette=kFalse, bool16 okToCacheDialog=kFalse, bool16 openImmediately=kTrue)=0
 
virtual IDialogCreateContextUI_Generic (const RsrcSpec &rSpec, const PMRect &globalAnchorRect, const ClassID &popupWindowClass=kPopupWindowBoss, bool16 preferredtoBeDrawnOnLeft=kFalse, bool16 invokedFromPalette=kFalse, bool16 okToCacheDialog=kFalse, bool16 openImmediately=kTrue)=0
 
virtual void RepositionAndShowContextUIPopup (IWindow *popupWindow, bool16 showWindow=kTrue, const PMRect &globalAnchorRect=kZeroRect, bool16 inFront=kTrue)=0
 
virtual RsrcID GetEffectiveIconRsrcID (float uiSCale, RsrcID baseRsrcID)=0
 
virtual IDResource SetIconDimensions (PluginID pluginID, RsrcType rsrcType, RsrcID rscID, RsrcID iconRsrcID, float iconScale, float *loadedIconScale)=0
 
virtual void DrawTopRoundedRect (dvaui::drawbot::Drawbot *drawBotP, const RoundedRectAppearance &roundedRectAppearance)=0
 
virtual DrawStatus CanDrawSampleText (IPMFont *font, PMString &stringToDraw, float fontSize)=0
 
virtual DrawStatus CanTQDrawSampleText (std::string fontName, PMString &stringToDraw, float fontSize)=0
 
virtual std::string GetImageName (PluginID pluginID, RsrcType rsrcType, RsrcID iconRsrcID)=0
 
virtual IDResource LoadIconResource (PluginID pluginID, RsrcID iconRsrcID, RsrcType &outRsrcType, std::string &outImageName, float iconScale, float &loadedIconScale, bool16 isDark=kFalse)=0
 
virtual float GetBoundingBoxScaleFactor ()=0
 
virtual PMReal GetEffectiveScaleFactor (const IControlView *view)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Member Function Documentation

virtual DrawStatus IWidgetUtils::CanDrawSampleText (IPMFontfont,
PMStringstringToDraw,
float fontSize 
)
pure virtual

Check if the font can draw the sample string passed.

Parameters
font- the IPMfont which is to be used to draw the sample string.
stringToDraw- the string to draw.
fontSize- fontSize to be used to draw the string. returns anyone of the four enums present in DrawStatus.
virtual DrawStatus IWidgetUtils::CanTQDrawSampleText (std::string fontName,
PMStringstringToDraw,
float fontSize 
)
pure virtual

Check if the font can draw the sample string passed.

Parameters
font- the psFontName string which is to be used to draw the sample string.
stringToDraw- the string to draw.
fontSize- fontSize to be used to draw the string. returns anyone of the four enums present in DrawStatus.
virtual void IWidgetUtils::CombineRegions (IControlViewwidget,
SysWireframe & theRgn 
) const
pure virtual

Accumulate a widget rect into a region. Useful for creating drag and drop regions of a group of widgets.

Parameters
widgetthe widget for which union its bbox into a region
theRgnIN/OUT pass in a region which will be enlarged by the given widget
See Also
IDragDropSource.h, DoMakeDragOutlineRegion
virtual SysPoint IWidgetUtils::ConvertPointToLocalWindow (const PMPointmouseLocationInParentWindowCoords,
IControlViewdestinationView 
)
pure virtual

Convert a point in parent window coordinates to the window coordinates of the destination view.

Parameters
mouseLocationInParentWindowCoordsthe mouse location in parent window coordinates
destinationViewview whose window coordinate system you want to use.
virtual bool16 IWidgetUtils::CopyBitsToView (IControlViewview,
const Int32RectdstBounds,
IDVPlatformOffscreensrcOffscreen,
const Int32RectsrcBounds,
const PMMatrixclip2destMatrix = PMMatrix(),
const SysRgn clipRgn = nil 
)
pure virtual

Utility to copy bits from an offscreen to view using direct drawing.

Parameters
viewthe control view to copy the bits to
dstBoundsthe area of the view to copy into
srcOffscreenthe source offscreen
srcBoundsthe area of the offscreen to copy
clip2destMatrixclip to destination space matrix
clipRgnclipping to apply
virtual IDialog* IWidgetUtils::CreateContextUI (const RsrcSpecrSpec,
const PMRectglobalAnchorRect,
const ClassIDpopupWindowClass = kPopupWindowBoss,
bool16 preferredtoBeDrawnOnLeft = kFalse,
bool16 invokedFromPalette = kFalse,
bool16 okToCacheDialog = kFalse,
bool16 openImmediately = kTrue 
)
pure virtual

opens up the context UI

Parameters
rSpecThe resource spec for the dialog.
globalAnchorRectThe rect around which the panel is to be opened in global coordinate space.
popupWindowClassThe pop up window class to use.
preferredtoBeDrawnOnLeftFlag to state the preference to be drawn on left.
invokedFromPaletteFlag to specify whether the context UI is being invoked from the panel.
okToCacheDialogFlag to specify whether or not to cache the context dialog ui.
ensurePositionWrtDocLayoutFlag to specify whether popup window should be within document layout bounds or within screen bounds.
openImmediatelyFlag to specify whether popup window should be immediately opened. Defaults to True. if False, user must call IDialog::Open on the returned pointer herself.
Returns
pointer to the requested interface in the descendant widget, or nil.
virtual IDialog* IWidgetUtils::CreateContextUI_Generic (const RsrcSpecrSpec,
const PMRectglobalAnchorRect,
const ClassIDpopupWindowClass = kPopupWindowBoss,
bool16 preferredtoBeDrawnOnLeft = kFalse,
bool16 invokedFromPalette = kFalse,
bool16 okToCacheDialog = kFalse,
bool16 openImmediately = kTrue 
)
pure virtual

opens up the context UI with a generic mechanism

Parameters
rSpecThe resource spec for the dialog.
globalAnchorRectThe rect around which the panel is to be opened in global coordinate space.
popupWindowClassThe pop up window class to use.
preferredtoBeDrawnOnLeftFlag to state the preference to be drawn on left.
invokedFromPaletteFlag to specify whether the context UI is being invoked from the panel.
okToCacheDialogFlag to specify whether or not to cache the context dialog ui.
openImmediatelyFlag to specify whether popup window should be immediately opened. Defaults to True. if False, user must call IDialog::Open on the returned pointer herself.
Returns
pointer to the requested interface in the descendant widget, or nil.
virtual void IWidgetUtils::DrawFocusRect (IControlViewview,
const PMRectr,
bool16 flushDrawing 
)
pure virtual

Utility to draw selection/focus rect using direct drawing.

Parameters
viewthe control view to draw the focus rect for
rrect defined in view's content coordinate space
flushDrawingwhether to force flush the drawing
virtual bool16 IWidgetUtils::DrawHilitePath (IControlViewview,
const PMPointListpts,
bool16 flushDrawing = kTrue,
PMReal hiliteThickness = kDefaultHiliteThickness 
)
pure virtual

Utility to draw hilite/outline path using direct drawing inset within the view bounds (used for DragDrop Target hiliting and more).

Parameters
viewthe control view to draw the hilite path for
ptspath (having a single subpath) defined in view's content coordinate space
flushDrawingwhether to force flush the drawing
hiliteThicknessthickness of the outline in user space (points). On the mac non-integer values can produce different results (0.5 produces a smaller line than 1.0)
Returns
kTrue for success.
virtual bool16 IWidgetUtils::DrawHilitePath (IControlViewview,
const PMPointListCollectionsubPaths,
bool16 flushDrawing = kTrue,
PMReal hiliteThickness = kDefaultHiliteThickness 
)
pure virtual

Utility to draw hilite/outline path using direct drawing inset within the view bounds (used for DragDrop Target hiliting and more).

Parameters
viewthe control view to draw the hilite path for
subPathssubpaths for the path defined in view's content coordinate space
flushDrawingwhether to force flush the drawing
hiliteThicknessthickness of the outline in user space (points). On the mac non-integer values can produce different results (0.5 produces a smaller line than 1.0)
Returns
kTrue for success.
virtual bool16 IWidgetUtils::DrawHilitePath (IControlViewview,
SysWireframe hilitePath,
bool16 flushDrawing = kTrue,
PMReal hiliteThickness = kDefaultHiliteThickness 
)
pure virtual

Utility to draw selection/focus using direct drawing.

Parameters
viewthe control view to draw the focus for
hilitePathdefined in view's content coordinate space
flushDrawingwhether to force flush the drawing
Returns
kTrue for success.
virtual void IWidgetUtils::DrawLeftRoundedRect (dvaui::drawbot::Drawbot * drawBotP,
const RoundedRectAppearanceroundedRectAppearance 
)
pure virtual

Draw rectangles filled with given color and having left rounded corners

Parameters
drawbotPbot where to draw the rectangle
roundedRectAppearanceinstance of class RoundedRectAppearance stating appearance of the required rectangle
virtual void IWidgetUtils::DrawPaletteFill (const IControlViewwidget,
dvaui::drawbot::Drawbot * pDrawbot,
const PMRectrectToFill = nil 
)
pure virtual

Fills the draw region of control view (or rect) with the correct palette background (Grey) using the offscreen Drawbot object. Here the Drawbot object being passed as argument has been setup for offscreen, so the rectToFill area (in drawbot) has to be translated in client coordinates.

Parameters
widget: ControlView for drawing, the widget whose bounds you want to fill(if rectToFill is nil)
pDrawbot: Offscreen Drawbot object, background rect will be drawn on its surface
rectToFill: the rect you want to fill, if not the bounds of the widget
virtual void IWidgetUtils::DrawPaletteFill (const IControlViewwidget,
IGraphicsPortport,
const PMRectrectToFill = nil 
)
pure virtual
Draws the background of control view using the Graphics Port passed as argument

Parameters
widget: ControlView for drawing, widget whose bounds you want to fill(if rectToFill is nil)
port: GraphicsPort which will be used for Making AGM drawing calls, graphics port to draw into
rectToFill: the rect you want to fill, if not the bounds of the widget
virtual void IWidgetUtils::DrawRightRoundedRect (dvaui::drawbot::Drawbot * drawBotP,
const RoundedRectAppearanceroundedRectAppearance 
)
pure virtual

Draw rectangles filled with given color and having right rounded corners

Parameters
drawbotPbot where to draw the rectangle
roundedRectAppearanceinstance of class RoundedRectAppearance stating appearance of the required rectangle
virtual void IWidgetUtils::DrawRoundedRect (dvaui::drawbot::Drawbot * drawBotP,
const RoundedRectAppearanceroundedRectAppearance 
)
pure virtual

Draw rectangles filled with given color and having rounded corners

Parameters
drawbotPbot where to draw the rectangle
roundedRectAppearanceinstance of class RoundedRectAppearance stating appearance of the required rectangle
virtual void IWidgetUtils::DrawTopRoundedRect (dvaui::drawbot::Drawbot * drawBotP,
const RoundedRectAppearanceroundedRectAppearance 
)
pure virtual

Draw rectangles filled with given color and having top rounded corners

Parameters
drawbotPbot where to draw the rectangle
roundedRectAppearanceinstance of class RoundedRectAppearance stating appearance of the required rectangle
virtual bool16 IWidgetUtils::FillHilitePath (IControlViewview,
const PMPointListCollectionsubPaths,
bool16 flushDrawing = kTrue 
)
pure virtual

Utility to draw fill path using direct drawing inset within the view bounds (used for text caret drawing).

Parameters
viewthe control view to draw the hilite path for
subPathssubpaths for the path defined in view's content coordinate space
flushDrawingwhether to force flush the drawing
Returns
kTrue for success.
virtual bool16 IWidgetUtils::FillHiliteRect (IControlViewview,
const PMRectr,
bool16 flushDrawing = kTrue 
)
pure virtual

Utility to fill rect using direct drawing inset within the view bounds (used for block text carets).

Parameters
viewthe control view to draw the hilite rect for
rrect defined in view's content coordinate space
flushDrawingwhether to force flush the drawing
Returns
kTrue for success.
virtual void IWidgetUtils::FormatUserDecimal (PMStringstring)
pure virtual
if the PMString appears to start with a number, this will remove the '.' character and replace it with the OS setting for decimal

which is commonly . or , or space.

Parameters
stringthe string you want to have the '.' character replaced with the user decimal
virtual const InterfaceFontInfo IWidgetUtils::GetAppropriateFontForWidget (const IControlViewwidget)
pure virtual

Given a widget, this method will find the correct fontInfo to use for it. It will query for IUIFontSpec, or go up to the window boss to get the default font for the window.

Parameters
widgetthe widget you want the appropriate font for
Returns
InterfaceFontInfo for the UI font to use.
virtual float IWidgetUtils::GetBoundingBoxScaleFactor ()
pure virtual

Utility function that reads the preferences and returns the Bounding Box/Adornment/Handles scale factor set by the user. returns the bounding box scale factor.

virtual PMReal IWidgetUtils::GetEffectiveScaleFactor (const IControlViewview)
pure virtual

Utility function that returns the current effective scale factor. This function returns the product of OS scale factor and the app scale factor. In case NULL is provided then it returns only the app scale factor in case of MAC.

Parameters
view- the input view for calculating the backing scale factor. returns the effective scale factor.
virtual void IWidgetUtils::GetFormattedScalingString (const PMRealvalue,
PMStringoutString,
const bool16 bFormatWithParens 
)
pure virtual

Convert the value to a PMString representing the scale. e.g. Convert the number 0.85 to "85.0%" or "(85%)"

Parameters
valuethe number to be converted.
outStringthe output
bFormatWithParens,formatthe output with parens if kTrue, without if kFalse
virtual void IWidgetUtils::GetFormattedString (const PMRealvalue,
const bool16 & bHorizontal,
PMStringoutString 
)
pure virtual
convert the value to PMString based on the current measurement system.

Parameters
valuethe number to be converted.
bHorizontalthe flag indicates if we need to use horizontal or vertical measurement system.
stringthe output
virtual std::string IWidgetUtils::GetImageName (PluginID pluginID,
RsrcType rsrcType,
RsrcID iconRsrcID 
)
pure virtual

Returns the image name of the icon as a string by concatenating pluginID, rsrcType and iconRsrcID

Parameters
pluginIDThe plugin of the resource being considered.
rsrcTypeThe type of the resource , whether it is kPNGArtRsrcType etc.
iconRsrcIDThe icon resource id for the icon. returns image name for the icon
virtual PMReal IWidgetUtils::GetViewScaleFactorReal (const IControlViewview)
pure virtual

Get the UI scale factor appropriate for drawing a view (designed to be called at Draw time)

Parameters
viewthe view.
Returns
scale factor HiDPI
virtual void IWidgetUtils::GrayOutFrameContents (IGraphicsPortgc,
PMRect frame,
PMReal transparency 
)
pure virtual

Use AGM transparency to "gray-out" an area of the UI

Parameters
gcthe graphics port
framethe frame you want to gray out
transparencythe transparency amount
virtual bool16 IWidgetUtils::IsClusterControllableChildWidget (IControlViewwidget,
bool16 & isSelected,
bool16 checkParentToBeCluster = kFalse 
)
pure virtual

Checks if the passed widget is controllable by cluster widget

Parameters
widgetinput child widget view
Returns
isSelected returns whether the child view is selected or not
Parameters
checkParentToBeCluster- pass kTrue to force this routine to check this child belongs to cluster.
Returns
kTrue if the the child is controllable by cluster widget.
virtual bool16 IWidgetUtils::IsWidgetInPalette (const IControlViewiWidget)
pure virtual
Parameters
viewof the control/widget
Returns
true if the widget is in a palette
virtual const IUIColorSpec* IWidgetUtils::QueryColorSpecForWidget (const IPMUnknownwidget)
pure virtual

Given a widget, this method will find the correct IUIColorSpec to use for it. It will query up the hierarchy for a IUIColorSpec. It may return nil, if the widget and it's ancestors do not have a IUIColorSpec interface.

Parameters
widgetthe widget you want the appropriate colors for
Returns
IUIColorSpec for the UI colors to use.
virtual IPMUnknown* IWidgetUtils::QueryDescendentWidgetOfType (IPMUnknownwidget,
PMIID interfaceID 
)
pure virtual

query the descendant widgets for interface id

Parameters
widgetinput widget view
interfaceIDthe IID of the descendant widget that you want returned
Returns
pointer to the requested interface in the descendant widget, or nil.
virtual IPMUnknown* IWidgetUtils::QueryRelatedWidget (const IPMUnknownwidget,
const WidgetIDwidgetId,
const PMIIDiid 
)
pure virtual

Given a widget, this method will find a related widget. i.e. child, parent, cousin, etc

Parameters
widgetthe widget to start with
widgetIdthe WidgetID of the related widget that you want
iidthe IID of the related widget that you want returned - i.e. if you specify IID_ICONTROLVIEW you'll get back and IControlView*
Returns
pointer to the requested interface on the requested widget, or nil.
virtual void IWidgetUtils::RepositionAndShowContextUIPopup (IWindowpopupWindow,
bool16 showWindow = kTrue,
const PMRectglobalAnchorRect = kZeroRect,
bool16 inFront = kTrue 
)
pure virtual

Repositions the context UI popup

Parameters
popupWindowPopup window reference.
showWindowFlag to specify whether to show window after repositioning it.
globalAnchorRectRect around which popup should be repositioned, in global coordinate space.
inFrontFlag to specify whether to bring pop up window in front after repositioning it.
Returns
nothing.
virtual void IWidgetUtils::SetTextHighlightColor (IGraphicsPortgPort,
const IControlViewview 
)
pure virtual

Set the graphics port to the current system highlight color

Parameters
gPortthe port to set the highlight color on.
viewthe view selection will draw in.
virtual void IWidgetUtils::SimulateClick (IEventHandlertargetEH)
pure virtual
Helper function to simulate a mouse click event.

Uses the event handler's control view if present to fake location of mouse event.

Parameters
targetEHevent handler to use for posting the event
virtual void IWidgetUtils::StripAccelerators (PMStringrawString)
pure virtual
Strips the Ampersands and any other extra characters corresponding to Accelerators, which do not need to be shown.

Parameters
rawStringthe string in which you want to have the characters corresponding to the accelerators be stripped.
virtual void IWidgetUtils::StripUserDecimal (PMStringstring)
pure virtual

if the PMString appears to start with a number and have a user decimal(as defined by the OS setting) in it it(commonly , or . or space) this will take out that character and replace it with plain old '.'

Parameters
stringthe string you want to have the user decimal replaced with '.'