DzActionMgr Class Reference
[Interface ComponentsManager Objects]

Manager that handles DzAction objects. More...

List of all members.

Methods

String addCustomAction (String text, String desc, String script, Boolean isFile=true, String shortcut="", String iconFile="")
DzAction findAction (String className)
Number findCustomAction (String name)
DzAction getAction (Number which)
Number getCustomAction (String name)
String getCustomActionDesc (Number which)
String getCustomActionFile (Number which)
String getCustomActionIcon (Number which)
String getCustomActionName (Number which)
String getCustomActionScript (Number which)
String getCustomActionShortcut (Number which)
String getCustomActionText (Number which)
DzActionMenu getMenu ()
Number getNumActions ()
Number getNumCustomActions ()
Boolean loadInterfaceFile (String filename)
void removeAllCustomActions ()
void removeCustomAction (Number which)
Boolean saveInterfaceFile (String filename)
void setAccel (String className, String key)
void setCustomActionAccel (Number which, String shortcut)
void setCustomActionDesc (Number which, String desc)
void setCustomActionIcon (Number which, String iconFile)
void setCustomActionScript (Number which, String script, Boolean isFile=true)
void setCustomActionText (Number which, String text)
void unsetAccel (String key)

Signals

void customActionAdded (String name)
 Signature: "customActionAdded( const QString &name )"
void customActionListChanged ()
 Signature: "customActionListChanged()"
void customActionRemoved (String name)
 Signature: "customActionRemoved( const QString &name )"


Detailed Description

Manager that handles DzAction objects.

This class manages actions that the user can perform in the interface via pressing a hot key or clicking on a menu/toolbar item. There is only one instance of this manager in an application. This instance is created and owned by DzMainWindow. Don't create an instance of this class, but rather request a pointer to it from DzMainWindow via DzMainWindow::getActionMgr().

See also:
DzAction


Member Function Documentation

String DzActionMgr::addCustomAction ( String  text,
String  desc,
String  script,
Boolean  isFile = true,
String  shortcut = "",
String  iconFile = "" 
)

Adds a custom action to the action manager.

Parameters:
text The text of the action. This is displayed in menus the action is added to unless a different menu text is specified.
desc The description of the action.
script The filename of the script to execute, or the actual text of the script to execute.
isFile If true, then script is assumed to contain a filename, otherwise script is assumed to be the actual script.
shortcut The default keyboard shortcut for the action.
iconFile The path of an image file that will be the icon for the action.
Returns:
The name of the newly created custom action.

DzActionMgr::customActionAdded ( String  name  )  [signal]

Signature: "customActionAdded( const QString &name )"

Emitted when a custom action is added to the action manager

void DzActionMgr::customActionListChanged (  )  [signal]

Signature: "customActionListChanged()"

Emitted when custom actions are added to or removed from the action manager

DzActionMgr::customActionRemoved ( String  name  )  [signal]

Signature: "customActionRemoved( const QString &name )"

Emitted when a custom action is removed from the action manager

DzAction DzActionMgr::findAction ( String  className  ) 

Parameters:
className The class name of the action to find.
Returns:
A pointer to the action object of the given class type.
Example:
        var action;
        var mgr = MainWindow.getActionMgr();

        // find the 'New File' action and print its accelerator to the log file.
        action = mgr.findAction( "DzNewAction" );
        if( action )
            print( action.text + ": " + action.shortcut );

Number DzActionMgr::findCustomAction ( String  name  ) 

Parameters:
name The name of the custom action to find.
Returns:
The index of the custom action with the given name, -1 if none was found.

DzAction DzActionMgr::getAction ( Number  which  ) 

Parameters:
which The index of the action to return.
Returns:
A pointer to the given action object.
Example:
        var i, n;
        var action;
        var mgr = MainWindow.getActionMgr();

        // go through the list of actions, and print their accelerators to the log file
        n = mgr.getNumActions();
        for( i = 0; i < n; i++ ){
            action = mgr.getAction( i );
            print( action.text + ": " + action.shortcut );
        }

Number DzActionMgr::getCustomAction ( String  name  ) 

Parameters:
name The name of the custom action to get.
Returns:
The index of the custom action with the given name, creates a custom action if one does not already exist.

String DzActionMgr::getCustomActionDesc ( Number  which  ) 

Parameters:
which The index of the custom action to get the description of.
Returns:
The description for the custom action at the given index.

String DzActionMgr::getCustomActionFile ( Number  which  ) 

Parameters:
which The index of the custom action to get the filename for.
Returns:
The path to the file for the custom action at the given index, if the custom action is a file. Otherwise null.

String DzActionMgr::getCustomActionIcon ( Number  which  ) 

Parameters:
which The index of the custom action to get the icon file for.
Returns:
The icon file for the custom action at the given index.

String DzActionMgr::getCustomActionName ( Number  which  ) 

Parameters:
which The index of the custom action to get the name of.
Returns:
The name of the custom action at the given index (i.e. "Custom0").

String DzActionMgr::getCustomActionScript ( Number  which  ) 

Parameters:
which The index of the custom action to get the script for.
script The string that will be set to the action's script.
isFile This will be set to true if the script is a filename, if the script is code, this will be set to false.

String DzActionMgr::getCustomActionShortcut ( Number  which  ) 

Parameters:
which The index of the custom action to return the shortcut for.
Returns:
The keyboard shortcut for the custom action at the given index.

String DzActionMgr::getCustomActionText ( Number  which  ) 

Parameters:
which The index of the custom action to get the text for.
Returns:
The text for the custom action at the given index.

DzActionMenu DzActionMgr::getMenu (  ) 

Returns:
A pointer to the Main Menu layout class for the application.

Number DzActionMgr::getNumActions (  ) 

Returns:
The number of action items in the application.

Number DzActionMgr::getNumCustomActions (  ) 

Returns:
The number of custom actions in the action manager.

Boolean DzActionMgr::loadInterfaceFile ( String  filename  ) 

Builds the main menu, pane menus and tool bars from the given file.

Parameters:
filename The name of the interface file to load.
Returns:
true if the file was successfully loaded, otherwise, false.

void DzActionMgr::removeAllCustomActions (  ) 

Removes all custom actions from the application.

void DzActionMgr::removeCustomAction ( Number  which  ) 

Parameters:
which The index of the custom action to remove. Removes the custom action at the given index.

Boolean DzActionMgr::saveInterfaceFile ( String  filename  ) 

Saves the main menu, pane menus and tool bars to the given file.

Parameters:
filename The name of the file to save the interface settings to.
Returns:
true if the file was saved successfully, otherwise, false.

void DzActionMgr::setAccel ( String  className,
String  key 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
className The name of the action class to set the accelerator for.
key The string representation of the accelerator.
Example:
        var mgr = MainWindow.getActionMgr();

        // set the accelerator for the 'New File' action to be 'Control+N'
        mgr.setAccel( "DzNewAction","Ctrl+N" );

void DzActionMgr::setCustomActionAccel ( Number  which,
String  shortcut 
)

Parameters:
which The index of the custom action to set the accelerator for.
shortcut The string representation of the accelerator. Sets the keyboard shortcut for the custom action at the given index.

void DzActionMgr::setCustomActionDesc ( Number  which,
String  desc 
)

Parameters:
which The index of the custom action to set the description for.
desc The description of the custom action. Sets the description for the custom action at the given index.

void DzActionMgr::setCustomActionIcon ( Number  which,
String  iconFile 
)

Parameters:
which The index of the custom action to set the icon file for.
iconFile The name of the file that will be loaded for the action's icon. Sets the icon for the custom action at the given index.

void DzActionMgr::setCustomActionScript ( Number  which,
String  script,
Boolean  isFile = true 
)

Sets the script for the custom action at the given index.

Parameters:
which The index of the custom action to set the script for.
script The script to set as the Custom action's script.
isFile If true, script contains the name of a script file that should be loaded, if false, script contains the code for the action's script.

void DzActionMgr::setCustomActionText ( Number  which,
String  text 
)

Parameters:
which The index of the custom action to set the text for.
text The new text for the action. Sets the text for the custom action at the given index.

void DzActionMgr::unsetAccel ( String  key  ) 

Parameters:
key The accelerator to remove from actions in the app.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Example:
        var mgr = MainWindow.getActionMgr();

        // unset the accelerator for the action using 'Control+N'
        mgr.unsetAccel( "Ctrl+N" );


Generated on Thu Sep 24 12:21:10 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.