class MPxUITableControl

Jump to documentation

: public MPxUIControl Base class for creating new spreadsheet controls. (OpenMayaUI) (OpenMayaMPx.py)

Inheritance:

MPxUITableControl < MPxUIControl

public members:

MPxUITableControl ( MPxControlCommand & )
virtual ~MPxUITableControl ()
enum MLabelType
kNoLabel
kRowLabel
kColumnLabel
kAllLabels
MStatus redrawLabels ( MLabelType lt = kAllLabels )
MStatus redrawCells ()
MStatus addToSelection ( unsigned int row, unsigned int col )
MStatus removeFromSelection ( unsigned int row, unsigned int column )
MStatus clearSelection ( )
MStatus setSelection ( unsigned int row, unsigned int column )
MStatus setSelection ( unsigned int firstRow, unsigned int lastRow, unsigned int firstCol, unsigned int lastCol )
MStatus setNumberOfRows ( unsigned int count )
unsigned int numberOfRows ( MStatus *ReturnStatus = NULL )
MStatus setNumberOfColumns ( unsigned int count )
unsigned int numberOfColumns ( MStatus *ReturnStatus = NULL ) const
bool suspendUpdates ( bool update, MStatus *ReturnStatue = NULL )
bool isSelected ( unsigned int row, unsigned int col, MStatus *status = NULL )
virtual bool collapseOrExpandRow ( unsigned int row )

protected members:

virtual MString cellString ( unsigned int r, unsigned int c, bool &ValidCell)
virtual MString labelString ( MLabelType labelType, unsigned int n)
virtual bool getCell ( unsigned int r, unsigned int c, MString &value )
NO SCRIPT SUPPORT
virtual void getLabel ( MLabelType labelType, unsigned int n, MString &value )
NO SCRIPT SUPPORT
virtual bool allowEdit ( ) const
virtual bool allowSelection ( int top, int left, int bottom, int right )

Inherited from MPxUIControl:

public members:

virtual ~MPxUIControl ()

Documentation

Base class for creating new spreadsheet controls.
Description

MPxUITableControl is the base class for creating new spreadsheet like interfaces. Every UI control has an associated command that is 'in-charge' of that control. Therefore, when creating a new table control, you will need to create an associated MPxControlCommand. Please refer to the MPxControlCommand documentation for details on how to use these class together.

At a minimum, when creating a new table control, you must overload getCell( ... ). Other methods available for overloading are getLabel(...), allowEdit( ... ), allowSelection( ... ), and collapseOrExpandRow( ... ).

Functions

MPxUITableControl:: ~MPxUITableControl ()
Description

Class destructor.

MPxUITableControl:: MPxUITableControl ( MPxControlCommand &command )

Description

Class constructor. You will always need to provide a constructor that takes a control command instance as an argument, and it is illegal to define your standard constructors.

MStatus MPxUITableControl:: redrawLabels ( MPxUITableControl::MLabelType labelType )

Description

Tells the table control to redraw the label entries.

Arguments

  • labelType - Specifies which labels to redraw.

Return Codes

  • MS::kSuccess - call was successful.
  • MS::kFailure - call was unsuccessful.

MStatus MPxUITableControl:: redrawCells ()

Description

Tells the UI control to redraw the cells of the table. The table control maintains a database of cell entries and it will populate these entries using getCell interface.

Arguments

None

Return Codes

  • MS::kSuccess - call was successful.
  • MS::kFailure - internal error.

MStatus MPxUITableControl:: addToSelection ( unsigned int row, unsigned int col )

Description

Add the follow cell to the selection data structure. To keep track of which entries that should be highlighted, an internal table is maintained.

Arguments

  • row - table row entry.
  • col - table col entry.

Return Codes

  • MS::kSuccess - successfully added the selection.
  • MS::kFailure - invalid row, col entry.

MStatus MPxUITableControl:: removeFromSelection ( unsigned int row, unsigned int column )

Description

Removes the specified cell entry from the internal selection list.

Arguments

  • row - cell row entry
  • column - cell column entry

Return Values

  • MS::kFailure - invalid row / col entry.
  • MS::kSuccess - successfully removed entry from selection list.

MStatus MPxUITableControl:: clearSelection ( )
Description

Clears the selection table. This will remove all highlighted cells from the table.

Arguments

None

Return Codes

  • MS::kFailure - invalid row / col entry.
  • MS::kSuccess - successfully removed entry from selection list.

MStatus MPxUITableControl:: setSelection ( unsigned int row, unsigned int column )

Description

Sets the table selection list based on the row & column entry. This replaces the current selection list with the new entry.

Arguments

  • row - cell row entry
  • column - cell column entry

Return Values

  • MS::kFailure - invalid row / col entry.
  • MS::kSuccess - successfully removed entry from selection list.

MStatus MPxUITableControl:: setSelection ( unsigned int firstRow, unsigned int lastRow, unsigned int firstCol, unsigned int lastCol )

Description

Sets the selection to be the range of cells specified. This replaces the current selection with the specified selection range.

Arguments

  • firstRow - first row of the selection
  • lastRow - last row of the selection
  • firstCol - first column of the selection
  • lastCol - last column of the selection

Return Values

  • MS::kFailure - invalid range.
  • MS::kSuccess - successfully edited the selection list.

MStatus MPxUITableControl:: setNumberOfRows ( unsigned int count )

Description

Specifies the number of rows for the table.

Arguments

  • count - number of rows desired.

Return Codes

  • MS::kSuccess - successfully edited the row size.

unsigned int MPxUITableControl:: numberOfRows ( MStatus *ReturnStatus )

Description

Returns the number of rows in the table.

Arguments

  • ReturnStatus - status of the call.

Return Codes

  • MS::kFailure - invalid class object
  • MS::kSuccess - successfully returned the number of rows.

MStatus MPxUITableControl:: setNumberOfColumns ( unsigned int count )

Description

Specifies the number of columns for the table.

Arguments

  • count - number of columns desired.

Return Codes

  • MS::kSuccess - successfully edited the number of columns.

unsigned int MPxUITableControl:: numberOfColumns ( MStatus *ReturnStatus ) const

Description

Returns the number of columns in the table.

Arguments

  • ReturnStatus - status of the call.

Return Codes

  • MS::kFailure - invalid class object
  • MS::kSuccess - successfully returned the number of rows.

bool MPxUITableControl:: suspendUpdates ( bool update, MStatus *ReturnStatus )

Description

When set to true, it prevents the UI from updating the table. The old suspend status is returned.

Arguments

  • state - the new suspend status.

Return Codes

  • MS::kSuccess - suspend status updated.
  • MS::kFailure - object error occured.

bool MPxUITableControl:: isSelected ( unsigned int row, unsigned int col, MStatus *ReturnStatus)

Description

Returns true if the specified cell is selected.

Arguments

  • row - cell row position.
  • col - cell col position.

Return Values

  • MS::kSuccess - successfully returned the selected state.
  • MS::kFailure - object error occurred.

bool MPxUITableControl:: collapseOrExpandRow ( unsigned int row )

Description

This is called when a row should be collapsed or expanded (depending on its current state).

Arguments

  • row - the row to collapse.

Return Codes

  • true - the action was handled.
  • false - the action was not handled.

bool MPxUITableControl:: getCell ( unsigned int row, unsigned int column, MString &value )

Description

Derived classes MUST either override this method or the cellString method. It is used to describe the contents of a cell.

Python Notes

This method is not supported in Python. See the cellString() function which returns a string.

Arguments

  • row - row index
  • column - column index
  • value - the value of the specified table entry.

Return Codes

Return a true state if a valid value was returned.

MString MPxUITableControl:: cellString ( unsigned int r, unsigned int c, bool & isValidCell)

Description

Derived classes MUST either override this method or the cellString method. It is used to describe the contents of a cell.

Arguments

  • row - row index
  • column - column index
  • value - the value of the specified table entry.

Return Codes

Return a true state if a valid value was returned.

void MPxUITableControl:: getLabel ( MLabelType labelType, unsigned int n, MString &value )

Description

Specifies the label value for the given row or column (as defined by) MLabelType. The base implementation of the method always returns an empty string.

Python Notes

This method is not supported in Python. See the labelString() function which returns a string.

Arguments

  • labelType - is it a row or column label
  • n - row or column entry
  • value - the string value of the label.

Return Codes

None

MString MPxUITableControl:: labelString ( MLabelType , unsigned int)

Description

Specifies the label value for the given row or column (as defined by) MLabelType. The base implementation of the method always returns an empty string.

Arguments

  • labelType - is it a row or column label
  • n - row or column entry

Return Value

  • string value of the label

None

bool MPxUITableControl:: allowEdit ( ) const

Description

Tells the base UI table control class if this control is editable. It is possible to implement tables that simple display information and do not allow the user to edit them.

Arguments

None

Return Codes

  • true - the table can be edited.
  • false - the table should not be edited.

bool MPxUITableControl:: allowSelection ( int top, int left, int bottom, int right )

Description

This method is called when a selection occurs. In this base implementation it always returns true. However, this method can be overridden to allow or disallow a selection.

Arguments

  • top - top cell coordinate
  • left - left cell coordinate
  • bottom - bottom cell coordinate
  • right - right cell coordinate

Return Codes

  • true - the table can be edited.
  • false - the table should not be edited.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright