InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CTreeViewWidgetMgr Class Reference

#include <CTreeViewWidgetMgr.h>

Inheritance diagram for CTreeViewWidgetMgr:
ITreeViewWidgetMgrIPMUnknownBscSlDlgTreeViewWidgetMgrCusCondTxtTreeViewWidgetMgrCusDtLnkUITreeTVWidgetMgrDataUpdaterUITVWidgetMgrDCLSizTreeViewWidgetMgrLnkWtchTreeViewWidgetMgrPnlTrvTVWidgetMgrPstLstUITVWidgetMgrStringListBoxWidgetMgrTKITreeViewWidgetMgrViewListBoxTreeViewWidgetMgrWLBCmpTVWidgetMgr

Public Member Functions

 CTreeViewWidgetMgr (IPMUnknown *boss)
 
 CTreeViewWidgetMgr (IPMUnknown *boss, int32 optionFlags)
 
virtual ~CTreeViewWidgetMgr ()
 
virtual bool16 ApplyNodeIDToWidget (const NodeID &node, IControlView *widget, int32 message=0) const
 
virtual PMReal GetNodeWidgetHeight (const NodeID &node) const
 
virtual PMReal GetNodeWidgetWidth (const NodeID &node) const
 
virtual PMReal GetIndentForNode (const NodeID &node) const
 
virtual IControlViewCreateWidgetForNode (const NodeID &node) const
 
virtual void SetStyle (int32 styleIdentifier)
 
virtual int32 GetStyle () const
 
virtual WidgetID GetWidgetTypeForNode (const NodeID &node) const
 
virtual void PreDeleteWidget (IControlView *widget)
 
Widget Factory and reuse
Widget placement
Widget Style - The tree view may have different looks, i.e. Large vs. Small palette rows
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Protected Types

enum  Options { kList = 0, kHierarchical = 1 }
 

Protected Member Functions

virtual bool16 ApplyDataToWidget (const NodeID &node, IPanelControlData *widgetList, int32 message=0) const
 
virtual void RegisterStyles ()
 
virtual void ApplyIndentToWidget (const NodeID &node, IPanelControlData *widgetList, int32 message=0) const
 
virtual PMReal GetBaseIndentOffset (IControlView *styleWidget) const
 
virtual PMReal GetTreeViewWidth () const
 
virtual void ApplyHighlightToWidget (const NodeID &node, IControlView *widget, int32 message=0) const
 
virtual PMReal GetIndent (const NodeID &node) const
 
virtual void RegisterStyleWidget (int32 style, RsrcID widgetRsrcID, PluginID pluginID)
 
virtual void HideExpanderIfNotExpandable (const NodeID &node, IPanelControlData *widgetList, int32 message=0) const
 
virtual void SetNodeName (IPanelControlData *widgetList, const PMString &name, WidgetID nameWidget=kTreeNodeNameWidgetID) const
 
virtual void SetNodeIcon (IPanelControlData *widgetList, RsrcID iconRsrc, PluginID pluginID=0, WidgetID iconWidget=kTreeNodeIconWidgetID) const
 
virtual bool16 IsOptionSet (Options option) const
 
virtual void SetSelectableDlgDrawNodeSeparatorOff (IControlView *widget) const
 

Additional Inherited Members

- Public Types inherited from ITreeViewWidgetMgr
enum  { kDefaultIID = IID_ITREEVIEWWIDGETMGR }
 

Detailed Description

Base class for clients implementing ITreeViewwidgetMgr interfaces. This base class handles a lot of the work for you. You can use this base class and override some of the protected methods instead of implementing the ITreeViewWidgetMgr calls. Make sure to use the constuctor with optionFlags. Pay particular attention to ApplyIndentToWidget() documentation for info on how indenting is handled by this class. Also make sure to read RegisterStyles()

Constructor & Destructor Documentation

CTreeViewWidgetMgr::CTreeViewWidgetMgr (IPMUnknownboss)

THIS CONSTRUCTOR IS DEPRECATED. For InDesign 4.0 and later, use the contructor with optionFlags!

CTreeViewWidgetMgr::CTreeViewWidgetMgr (IPMUnknownboss,
int32 optionFlags 
)
Parameters
boss
optionFlagspass kList if this tree is a simple list with no hierarchy. Pass kHierarchical for a tree with a hierarchy
virtual CTreeViewWidgetMgr::~CTreeViewWidgetMgr ()
virtual

destructor

Member Function Documentation

virtual bool16 CTreeViewWidgetMgr::ApplyDataToWidget (const NodeIDnode,
IPanelControlDatawidgetList,
int32 message = 0 
) const
protectedvirtual

Most TreeViews will override this method. This method is called from ApplyNodeIDToWidget() to apply the Node specific data to the widgets within the main node widget. Typically, the name of the node and icon for the node are applied to a Text widget and an icon widget. When overriding this method, the base class version is not typically called.

Parameters
nodethe node whose data you want applied to the given widget
widgetListThis is the IPanelControlData of the Tree node widget. The Tree node widget typically contains subwidgets which are changed based on the specific data for the given node.
messageif you call an ITreeViewMgr method with a message, that message will be passed back to you in this parameter. For instance, if it is expensive to update the text, but not the icon. You could pass yourself a kMyIconChanged message in ITreeViewMgr::NodeChanged() and then only update the icon in ApplyDataToWidget() if message=kMyIconChanged
Returns
bool16 kTrue if you were successful in applying data, kFalse if unsuccessful. If kFalse is returned, the TreeViewMgr will ask you to create a new widget for this node with CreateWidgetForNode() and then ask to apply data again

Reimplemented in PstLstUITVWidgetMgr, WLBCmpTVWidgetMgr, DCLSizTreeViewWidgetMgr, BscSlDlgTreeViewWidgetMgr, LnkWtchTreeViewWidgetMgr, TKITreeViewWidgetMgr, ViewListBoxTreeViewWidgetMgr, and StringListBoxWidgetMgr.

virtual void CTreeViewWidgetMgr::ApplyHighlightToWidget (const NodeIDnode,
IControlViewwidget,
int32 message = 0 
) const
protectedvirtual

This will highlight the specified widget. Called from ApplyNodeIDToWidget() when widget is hilited.

Parameters
nodenodeID of node to highlight
widgetwidget of the node that needs highlighting
messageif you call an ITreeViewMgr method with a message, that message will be passed back to you in this parameter. For instance, if it is expensive to update the text, but not the icon. You could pass yourself a kMyIconChanged message in ITreeViewMgr::NodeChanged() and then only update the icon in ApplyDataToWidget() if message=kMyIconChanged
virtual void CTreeViewWidgetMgr::ApplyIndentToWidget (const NodeIDnode,
IPanelControlDatawidgetList,
int32 message = 0 
) const
protectedvirtual

You may want to override this method to handle indent in your own way if the default way of handling indent doesn't work for you. By default, we get the indent for a node by recursively calling GetIndent to get the indent value. We use binding to determine which subwidgets to move for indentation. Only direct subwidgets of the node widget are moved. Subwidgets that are bound Left AND NOT bound Right, are NOT moved Subwidgets that are bound Right AND NOT bound Left, are NOT moved Subwidgets that are bound Left AND bound Right are resized Subwidgets that are NOT bound on Left OR Right, are moved

Parameters
nodenode to indent
widgetListthe IPanelControlData of the NodeWidget itself.
messageif you call an ITreeViewMgr method with a message, that message will be passed back to you in this parameter. For instance, if it is expensive to update the text, but not the icon. You could pass yourself a kMyIconChanged message in ITreeViewMgr::NodeChanged() and then only update the icon in ApplyDataToWidget() if message=kMyIconChanged
virtual bool16 CTreeViewWidgetMgr::ApplyNodeIDToWidget (const NodeIDnode,
IControlViewwidget,
int32 message = 0 
) const
virtual

Change data in your nodeWidget(widget) to reflect the node passed in.

Parameters
nodespecifies node to be rendered
widgetthis is where the data from the node should be rendered
messageif you call an ITreeViewMgr method with a message, that message will be passes back to you in this parameter. For instance, if it is expensive to update the text, but not the icon. You could pass yourself a kMyIconChanged message in ITreeViewMgr::NodeChanged() and then only update the icon in ApplyDataToWidget() if message=kMyIconChanged
Returns
kTrue if you were successful in applying data, kFalse if unsuccessful. If kFalse is returned, the TreeViewMgr will ask you to create a new widget for this node with CreateWidgetForNode() and then ask to apply data again

Implements ITreeViewWidgetMgr.

Reimplemented in CusDtLnkUITreeTVWidgetMgr, PnlTrvTVWidgetMgr, DataUpdaterUITVWidgetMgr, CusCondTxtTreeViewWidgetMgr, and StringListBoxWidgetMgr.

virtual IControlView* CTreeViewWidgetMgr::CreateWidgetForNode (const NodeIDnode) const
virtual

Create the widget, but don't change the widget-data to match the node; that should be done in ApplyNodeIDToWidget

Parameters
node
Returns
reference to IControlView interface on newly created widget boss object

Implements ITreeViewWidgetMgr.

Reimplemented in CusDtLnkUITreeTVWidgetMgr, PnlTrvTVWidgetMgr, DataUpdaterUITVWidgetMgr, CusCondTxtTreeViewWidgetMgr, StringListBoxWidgetMgr, TKITreeViewWidgetMgr, and ViewListBoxTreeViewWidgetMgr.

virtual PMReal CTreeViewWidgetMgr::GetIndent (const NodeIDnode) const
protectedvirtual

Returns the indent for this node in pixels. This is cumulative indent value, so if each item in a tree is indented 20 pixels from its parent and this node has 2 levels of hierarchy above it, this would return 60 pixels. Typically not needed if you override ApplyDataToWidget, but is needed if you override ApplyNodeIDToWidget instead.

Parameters
nodenodeID to indent
Returns
PMReal total number of pixels that this node is indented
virtual PMReal CTreeViewWidgetMgr::GetIndentForNode (const NodeIDnode) const
virtual

Returns indent in pixels for widget rendering given node.

Parameters
node
Returns
indent in pixels for widget rendering given node

Implements ITreeViewWidgetMgr.

Reimplemented in CusDtLnkUITreeTVWidgetMgr, PnlTrvTVWidgetMgr, DataUpdaterUITVWidgetMgr, and PstLstUITVWidgetMgr.

virtual PMReal CTreeViewWidgetMgr::GetNodeWidgetHeight (const NodeIDnode) const
virtual

Returns desired height in pixels of widget rendering given node.

Parameters
node
returndesired height in pixels of widget rendering given node

Implements ITreeViewWidgetMgr.

Reimplemented in StringListBoxWidgetMgr, and ViewListBoxTreeViewWidgetMgr.

virtual PMReal CTreeViewWidgetMgr::GetNodeWidgetWidth (const NodeIDnode) const
virtual

Returns desired width in pixels of widget rendering given node.

Parameters
node
Returns
desired width in pixels of widget rendering given node

Implements ITreeViewWidgetMgr.

Reimplemented in StringListBoxWidgetMgr, and ViewListBoxTreeViewWidgetMgr.

virtual int32 CTreeViewWidgetMgr::GetStyle () const
virtual

Returns current style identifer used by the interface. See SetStyle.

Implements ITreeViewWidgetMgr.

virtual PMReal CTreeViewWidgetMgr::GetTreeViewWidth () const
protectedvirtual

Returns the current width of the TreeView. Most often used when trying to determine how wide to make a widget when the tree has no horizontal scrollbar.

Returns
PMReal current width in pixels of the TreeView
virtual WidgetID CTreeViewWidgetMgr::GetWidgetTypeForNode (const NodeIDnode) const
virtual

Determine a widget id that corresponds to the type of widget that should be used to render data from the given node.

Parameters
nodespecifies the node of interest
Returns
a widget ID for a widget type that can be used to render this node's data

Implements ITreeViewWidgetMgr.

Reimplemented in CusDtLnkUITreeTVWidgetMgr, PnlTrvTVWidgetMgr, and DataUpdaterUITVWidgetMgr.

virtual void CTreeViewWidgetMgr::HideExpanderIfNotExpandable (const NodeIDnode,
IPanelControlDatawidgetList,
int32 message = 0 
) const
protectedvirtual

Helper method called from default implementation of ApplyNodeIDToWidget(). Given a Node Widget, this will search for the expander widget and hide the widget if node specified has no children. Requires expander widget to have WidgetID = kTreeNodeExpanderWidgetID.

Parameters
nodenode representing this widget
widgetListIPanelControlData off the Node widget
messageif you call an ITreeViewMgr method with a message, that message will be passed back to you in this parameter. For instance, if it is expensive to update the text, but not the icon. You could pass yourself a kMyIconChanged message in ITreeViewMgr::NodeChanged() and then only update the icon in ApplyDataToWidget() if message=kMyIconChanged
virtual bool16 CTreeViewWidgetMgr::IsOptionSet (Options option) const
protectedvirtual

Returns whether the specified option flag has been set.

Parameters
optionwhich option
Returns
bool16 kTrue if options is set, kFalse if not.
virtual void CTreeViewWidgetMgr::PreDeleteWidget (IControlViewwidget)
virtual

Only TreeViews that need to do something prior to the tree deleting a widget will need to override this method. This method is called from the tree view manaager before it deletes a widget. For example, this provides the widget manager client to disconnect any child widgets it wants to continue to manage.

Implements ITreeViewWidgetMgr.

Reimplemented in ViewListBoxTreeViewWidgetMgr.

virtual void CTreeViewWidgetMgr::RegisterStyles ()
protectedvirtual

This method is where you specify the widget that should be used for each of the Tree Styles you support. If you only support 1 Tree Style, then you need only Register one style in from this method. This method is automatically called when it is time to register your styles. Inside you should call RegisterStyleWidget() to asssociate a widget with a style.

If your tree can contain different widgets depending on the NodeID, then you should use override CreateWidgetForNode instead of this RegisterStyles() method

This default implementation registers the standard Tree widgets for large and small palette rows. If you aren't using the standard widgets, then override this and DON'T CALL the base class method.

Reimplemented in StringListBoxLargeSmallWidgetMgr, PstLstUITVWidgetMgr, StringListBoxSmallWidgetMgr, WLBCmpTVWidgetMgr, DCLSizTreeViewWidgetMgr, BscSlDlgTreeViewWidgetMgr, LnkWtchTreeViewWidgetMgr, StringListBoxWidgetMgr, TKITreeViewWidgetMgr, and ViewListBoxTreeViewWidgetMgr.

virtual void CTreeViewWidgetMgr::RegisterStyleWidget (int32 style,
RsrcID widgetRsrcID,
PluginID pluginID 
)
protectedvirtual

Registers a widgetRsrcID/PluginID with a particular style. Common use is to override RegisterStyles() and call this method for each style you wish to register. Current style will be used to create create widgets as needed in CreateWidgetForNode(). If you register styles, you don't need to override CreatewidgetForNode().

Parameters
stylethe styleID you are registering
widgetRsrcIDWidget Resource ID to use when creating widgets for specified style
pluginIDplugin ID to use when creating widgets for specified style
virtual void CTreeViewWidgetMgr::SetNodeIcon (IPanelControlDatawidgetList,
RsrcID iconRsrc,
PluginID pluginID = 0,
WidgetID iconWidget = kTreeNodeIconWidgetID 
) const
protectedvirtual

Helper method to search for the icon widget and set its new icon value.

Parameters
widgetListIPanelControlData off the Node widget
iconRsrcnew icon resource id
pluginIDof new icon resource
iconWidgetwidgetID of icon widget. Not necessary to specify if default ID of kTreeNodeIconWidgetID is used
virtual void CTreeViewWidgetMgr::SetNodeName (IPanelControlDatawidgetList,
const PMStringname,
WidgetID nameWidget = kTreeNodeNameWidgetID 
) const
protectedvirtual

Helper method to search for the name widget and set its text value.

Parameters
widgetListIPanelControlData off the Node widget
namenew name for name widget
nameWidgetwidgetID of name widget. Not necessary to specify if default ID of kTreeNodeNameWidgetID is used
virtual void CTreeViewWidgetMgr::SetStyle (int32 styleIdentifier)
virtual
A tree view may have different looks depending on state.  The most commonly used example of this 

is the list palettes that can be viewed with small palette rows as opposdd to the normal sized palette rows. SetStyle is called by the client code at it's discretion. The style identifier is just a unique way for the client to refer to it's different styles and is fully defined by the client, although 2 standard styleIdentifiers have been defined(kLargePaletteRowsTreeStyle & kSmallPaletteRowsTreeStyle) for convenience. The most common use of tree styles is palettes with Small Palette Rows. These Tree Views will show one node widget when in the small rows state and a different in the large rows state. They use the style identifiers kLargePaletteRowsTreeStyle & kSmallPaletteRowsTreeStyle to set the current style. This implementation does not work well with multiple widget types in a tree at one time. To do that, override ITreeViewWidgetMgr interfaces directly.

Parameters
styleIdentifierclient defined identifier for a particular style. Or use predefined styleIDs

Implements ITreeViewWidgetMgr.