HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DT_Plugin Class Referenceabstract

#include <DT_Plugin.h>

Public Member Functions

 DT_Plugin (DT_Host &host)
 
virtual ~DT_Plugin ()
 
const DT_NodeHandlerootNode () const
 
DT_Hosthost () const
 
virtual bool getSelected (const DT_Node &node, bool &state)
 
virtual bool setSelected (const DT_Node &node, bool state)
 
virtual const DT_ParmDefListgetOptionDefs ()
 Returns the list of parameter definitions for the tree columns. More...
 
virtual bool getOptionValue (int parm_id, DT_Value &value)
 
virtual bool setOptionValue (int parm_id, const DT_Value &value)
 Sets an option value for the plugin. More...
 
virtual bool getOptionMenuItems (int parm_id, DT_MenuItemList &items)
 
virtual void opEvent (const DT_NodeIdSet &node_ids, OP_EventType type, void *data)
 
virtual void runDelayedAction (int action_id, const UT_Array< UT_SharedPtr< void > > &data_list)
 
virtual bool dragHasData (const DT_Node &node, const char *data_label)
 Drag Source. More...
 
virtual voiddragGetData (const DT_Node &node, const char *data_label)
 Drag Source. More...
 
virtual bool dropAccept (const DT_Node &node, DD_Source &drag_src, const char *data_label)
 Drop Receiver. More...
 
virtual bool dropTest (const DT_Node &node, DD_Source &drag_src)
 Drag Source. More...
 
virtual void dropGetChoice (const DT_Node &node, DD_Source &drag_src, DD_ChoiceList &drop_choices)
 Drag Source. More...
 
virtual void nodesReordered (const DT_Node &parent_node, const UT_IntArray &from_idx, const UT_IntArray &to_idx)
 
virtual bool writeDesktopData (std::ostream &os)
 
virtual bool readDesktopData (std::istream &is)
 
virtual bool writeSceneData (std::ostream &os)
 
virtual bool readSceneData (std::istream &is)
 

Protected Member Functions

DT_NoderootNodeRef ()
 Only subclasses can access a non-const version of our root DT_Node. More...
 

Static Protected Member Functions

static DT_NodeHandle createRootNode ()
 
enum  RenameStyle { RS_INVALID, RS_ALPHANUM, RS_OPNAME, RS_ANY }
 
virtual const UT_StringHoldername () const =0
 
virtual const UT_StringHolderhelpId () const =0
 
virtual bool getChildren (const DT_Node &parent, DT_NodeList &list)=0
 Get the children of the given node. More...
 
virtual bool hasChildren (const DT_Node &parent)
 
virtual bool getNodeInfoText (const DT_Node &node, UT_WorkBuffer &info_text)
 Get the info text to show in the MMB popup window. More...
 
virtual bool canDeleteNode (const DT_Node &node)
 The node delete operation is valid for this plugin. More...
 
virtual bool deleteNodes (const DT_NodeList &node_list)
 Called when a request for delete occurs. More...
 
virtual bool canCopyNodes (const DT_NodeList &list, DT_NodeList *filtered_list)
 Check if the node copy operation is valid for this plugin. More...
 
virtual bool copyNodes (const DT_NodeList &list)
 Called when a request to copy occurs. More...
 
virtual bool canPasteNodes (const DT_Node &parent_node)
 Check if the reviously copied nodes can be pasted into the given parent. More...
 
virtual bool pasteNodes (const DT_Node &parent_node)
 Called when a request to paste into a parent node occurs. More...
 
virtual RenameStyle getRenameStyle (const DT_Node &node)
 The node rename operation is valid for this plugin. More...
 
virtual bool renameNode (const DT_Node &node, const char *new_name)
 Called when a request for node rename occurs. More...
 
virtual bool getNodeMenu (const DT_NodeList &node_list, const char *sub_menu_token, DT_NodeMenuItemList &items)
 
virtual void runMenuAction (const DT_NodeList &node_list, const char *menu_token)
 
enum  ParmState {
  PS_INVALID, PS_VALID, PS_INDETERMINATE, PS_ANIMATED,
  PS_LOCKED
}
 
virtual const DT_ParmDefListgetParameterDefs ()=0
 Returns the list of parameter definitions for the tree columns. More...
 
virtual int getGroupedParameterId (const DT_Node &node, int parm_id)
 
virtual ParmState getParameterValue (const DT_Node &node, int parm_id, DT_Value &value, bool for_feel)=0
 
virtual bool setParameterValue (const DT_Node &node, int parm_id, const DT_Value &value)=0
 
virtual bool setParameterValues (const DT_NodeList &node_list, int parm_id, const DT_Value &value)
 
virtual bool getParameterMenuItems (const DT_Node &node, int parm_id, DT_MenuItemList &items)
 

Detailed Description

Definition at line 893 of file DT_Plugin.h.

Member Enumeration Documentation

Tree parameters

Enumerator
PS_INVALID 

No value can be retrieved.

PS_VALID 

Value is valid.

PS_INDETERMINATE 

The value state is indeterminate.

PS_ANIMATED 

The value is animated and should have a green background.

PS_LOCKED 

The value is locked and cannot be edited.

Definition at line 998 of file DT_Plugin.h.

Tree nodes

Enumerator
RS_INVALID 
RS_ALPHANUM 
RS_OPNAME 
RS_ANY 

Definition at line 924 of file DT_Plugin.h.

Constructor & Destructor Documentation

DT_Plugin::DT_Plugin ( DT_Host host)
virtual DT_Plugin::~DT_Plugin ( )
virtual

Member Function Documentation

virtual bool DT_Plugin::canCopyNodes ( const DT_NodeList list,
DT_NodeList filtered_list 
)
inlinevirtual

Check if the node copy operation is valid for this plugin.

Definition at line 954 of file DT_Plugin.h.

virtual bool DT_Plugin::canDeleteNode ( const DT_Node node)
inlinevirtual

The node delete operation is valid for this plugin.

Definition at line 946 of file DT_Plugin.h.

virtual bool DT_Plugin::canPasteNodes ( const DT_Node parent_node)
inlinevirtual

Check if the reviously copied nodes can be pasted into the given parent.

Definition at line 963 of file DT_Plugin.h.

virtual bool DT_Plugin::copyNodes ( const DT_NodeList list)
inlinevirtual

Called when a request to copy occurs.

Definition at line 959 of file DT_Plugin.h.

static DT_NodeHandle DT_Plugin::createRootNode ( )
staticprotected

Under special circumstances, a subclass may want to create a new root-like DT_Node (using the default DT_Node constructor, which is private). This function makes that possible.

virtual bool DT_Plugin::deleteNodes ( const DT_NodeList node_list)
inlinevirtual

Called when a request for delete occurs.

Definition at line 950 of file DT_Plugin.h.

virtual void* DT_Plugin::dragGetData ( const DT_Node node,
const char *  data_label 
)
inlinevirtual

Drag Source.

Drag and drop

Definition at line 1135 of file DT_Plugin.h.

virtual bool DT_Plugin::dragHasData ( const DT_Node node,
const char *  data_label 
)
inlinevirtual

Drag Source.

Drag and drop

Definition at line 1131 of file DT_Plugin.h.

virtual bool DT_Plugin::dropAccept ( const DT_Node node,
DD_Source drag_src,
const char *  data_label 
)
inlinevirtual

Drop Receiver.

Definition at line 1140 of file DT_Plugin.h.

virtual void DT_Plugin::dropGetChoice ( const DT_Node node,
DD_Source drag_src,
DD_ChoiceList drop_choices 
)
inlinevirtual

Drag Source.

Drag and drop

Definition at line 1148 of file DT_Plugin.h.

virtual bool DT_Plugin::dropTest ( const DT_Node node,
DD_Source drag_src 
)
inlinevirtual

Drag Source.

Drag and drop

Definition at line 1145 of file DT_Plugin.h.

virtual bool DT_Plugin::getChildren ( const DT_Node parent,
DT_NodeList list 
)
pure virtual

Get the children of the given node.

virtual int DT_Plugin::getGroupedParameterId ( const DT_Node node,
int  parm_id 
)
inlinevirtual

For dealing with DT_ParmDefGrouped parameters, this method controls which grouped DT_ParmDef should be displayed for a particular DT_Node.

Definition at line 1013 of file DT_Plugin.h.

virtual bool DT_Plugin::getNodeInfoText ( const DT_Node node,
UT_WorkBuffer info_text 
)
inlinevirtual

Get the info text to show in the MMB popup window.

Definition at line 941 of file DT_Plugin.h.

virtual bool DT_Plugin::getNodeMenu ( const DT_NodeList node_list,
const char *  sub_menu_token,
DT_NodeMenuItemList items 
)
inlinevirtual

Called when the right mouse-button (RMB) is clicked on a node. The entire node selection is passed in, allowing to create a combined menu for all selected nodes. When retrieving the top-level menu, sub_menu_token will be NULL.

Definition at line 982 of file DT_Plugin.h.

virtual const DT_ParmDefList& DT_Plugin::getOptionDefs ( )
virtual

Returns the list of parameter definitions for the tree columns.

User-modifiable Plugin Options

virtual bool DT_Plugin::getOptionMenuItems ( int  parm_id,
DT_MenuItemList items 
)
inlinevirtual

For DT_ParmDefMenu items that are defined as dynamic, this function returns the list of menu items based on the current state.

Definition at line 1101 of file DT_Plugin.h.

virtual bool DT_Plugin::getOptionValue ( int  parm_id,
DT_Value value 
)
inlinevirtual

Gets a value for a given option from the plugin. See getParameterValue

Parameters
parm_idThe id of the parameter. Corresponds to the return value of DT_ParmDef::id.
valueThe value returned from the plugin.
Returns
true if successful, false otherwise.

Definition at line 1092 of file DT_Plugin.h.

virtual const DT_ParmDefList& DT_Plugin::getParameterDefs ( )
pure virtual

Returns the list of parameter definitions for the tree columns.

virtual bool DT_Plugin::getParameterMenuItems ( const DT_Node node,
int  parm_id,
DT_MenuItemList items 
)
inlinevirtual

For DT_ParmDefMenu items that are defined as dynamic, this function can be used to return a list of menu items based on the specific node, or the current state of other parameters.

Definition at line 1053 of file DT_Plugin.h.

virtual ParmState DT_Plugin::getParameterValue ( const DT_Node node,
int  parm_id,
DT_Value value,
bool  for_feel 
)
pure virtual

Retrieve a value of a specific parameter for the given node. The parm_id is the value returned from DT_ParmDef::id(). The for_feel flag indicates if we are fetching this value to set up our UI_Feel when the mouse moves over this cell.

Use the copyValue function for each function definition to retrieve a concrete values from the opaque DT_Value type. The caller expects DT_Value to be able to cast to specific types to retrieve the display value. Use the following table, based on the parm def type:

A return value of PS_INDETERMINATE should only be returned if the parameter definition supports it, otherwise it is ignored. Return PS_INVALID if no value can be retrieved from the node.

Note
This function is never called for T_BUTTON types. Only setParameterValue.
virtual RenameStyle DT_Plugin::getRenameStyle ( const DT_Node node)
inlinevirtual

The node rename operation is valid for this plugin.

Definition at line 971 of file DT_Plugin.h.

virtual bool DT_Plugin::getSelected ( const DT_Node node,
bool &  state 
)
inlinevirtual

Selection Called when a node queries for its selection state. If the selection state can be computed, the selection state is returned through the argument 'state' and a value of true returned. Return false if the selection can not be computed, or not supported. In that case, if DT_Node::opId returns a valid id, the op node is queried for its selection state.

Definition at line 1068 of file DT_Plugin.h.

virtual bool DT_Plugin::hasChildren ( const DT_Node parent)
inlinevirtual

Returns true if the parent node potentially has children. False positives are much better than false negatives.

Definition at line 937 of file DT_Plugin.h.

virtual const UT_StringHolder& DT_Plugin::helpId ( ) const
pure virtual

Returns the help ID to be used when the user clicks on the help button in the Data Tree pane. By default it just returns the base help for the Data Tree.

DT_Host& DT_Plugin::host ( ) const
inline

Returns the DT_DT_HostInterface object which can be used to communicate with the host to notify of dirty nodes, parameter changes, global option changes, etc.

Definition at line 906 of file DT_Plugin.h.

virtual const UT_StringHolder& DT_Plugin::name ( ) const
pure virtual

Methods to be implemented by the plugin. Returns the display name of the data tree plugin. This will be shown in the list of available plugins in the data tree pane.

virtual void DT_Plugin::nodesReordered ( const DT_Node parent_node,
const UT_IntArray from_idx,
const UT_IntArray to_idx 
)
inlinevirtual

When drag and drop is used to reorder child nodes, we get notified through this function.

Definition at line 1155 of file DT_Plugin.h.

virtual void DT_Plugin::opEvent ( const DT_NodeIdSet node_ids,
OP_EventType  type,
void data 
)
inlinevirtual

Events Called when an operator event has occurred. All nodes that have an interest in a given operator are in the array. See OP_EventType for explanation of what the data pointer contains.

Definition at line 1112 of file DT_Plugin.h.

virtual bool DT_Plugin::pasteNodes ( const DT_Node parent_node)
inlinevirtual

Called when a request to paste into a parent node occurs.

Definition at line 967 of file DT_Plugin.h.

virtual bool DT_Plugin::readDesktopData ( std::istream &  is)
inlinevirtual

Persistence When the desktop is saved, this method is called to allow the plugin to save any data that would not be saved otherwise.

Definition at line 1169 of file DT_Plugin.h.

virtual bool DT_Plugin::readSceneData ( std::istream &  is)
inlinevirtual

Persistence When the desktop is saved, this method is called to allow the plugin to save any data that would not be saved otherwise.

Definition at line 1175 of file DT_Plugin.h.

virtual bool DT_Plugin::renameNode ( const DT_Node node,
const char *  new_name 
)
inlinevirtual

Called when a request for node rename occurs.

Definition at line 975 of file DT_Plugin.h.

const DT_NodeHandle& DT_Plugin::rootNode ( ) const
inline

Methods provided by the plugin architecture.

Definition at line 901 of file DT_Plugin.h.

DT_Node& DT_Plugin::rootNodeRef ( )
protected

Only subclasses can access a non-const version of our root DT_Node.

virtual void DT_Plugin::runDelayedAction ( int  action_id,
const UT_Array< UT_SharedPtr< void > > &  data_list 
)
inlinevirtual

Called by the host when it is time to run a delayed action that was added with DT_Host::addDelayedAction. Multiple delayed actions are coalesced into one call, hence the list of data.

Definition at line 1120 of file DT_Plugin.h.

virtual void DT_Plugin::runMenuAction ( const DT_NodeList node_list,
const char *  menu_token 
)
inlinevirtual

Perform the menu action specified by the user. The menu_token argument will be the token of the menu item that the user selected. The node list will be the same as was passed into getNodeMenu.

Definition at line 990 of file DT_Plugin.h.

virtual bool DT_Plugin::setOptionValue ( int  parm_id,
const DT_Value value 
)
inlinevirtual

Sets an option value for the plugin.

Definition at line 1096 of file DT_Plugin.h.

virtual bool DT_Plugin::setParameterValue ( const DT_Node node,
int  parm_id,
const DT_Value value 
)
pure virtual

Sets the value of a specific parameter for the given node. The parm_id is the value returned from DT_ParmDef::id() See the table for getValue for which C++ types should be expected for a given parameter definition type.

virtual bool DT_Plugin::setParameterValues ( const DT_NodeList node_list,
int  parm_id,
const DT_Value value 
)
virtual

Sets the same value of a specific parameter on multiple nodes. This can be used to optimize costly operations, or support exclusivity. The first node in the list is the node for who the user set the value on. The parm_id is the value returned from DT_ParmDef::id()

virtual bool DT_Plugin::setSelected ( const DT_Node node,
bool  state 
)
inlinevirtual

Called when a node is selected or de-selected in the UI. The requested selection state is given by the 'state' argument. If the selection is handled, a value of true should be returned. Otherwise, return a value of false. In that case, if DT_Node::opId returns a valid id, the op node is selected.

Definition at line 1076 of file DT_Plugin.h.

virtual bool DT_Plugin::writeDesktopData ( std::ostream &  os)
inlinevirtual

Persistence When the desktop is saved, this method is called to allow the plugin to save any data that would not be saved otherwise.

Definition at line 1166 of file DT_Plugin.h.

virtual bool DT_Plugin::writeSceneData ( std::ostream &  os)
inlinevirtual

Persistence When the desktop is saved, this method is called to allow the plugin to save any data that would not be saved otherwise.

Definition at line 1172 of file DT_Plugin.h.


The documentation for this class was generated from the following file: