gui::QSMenu Class Reference

QObject wrapper around popup menu. More...

#include <qsmenu.h>

Inheritance diagram for gui::QSMenu:
gui::QSCObject

List of all members.

Public Slots

QString popup ()
void reset ()
void addItemDef (QString def)
void addItem (const QString &name)
void addSeparator ()

Public Member Functions

 QSMenu (Menu *_msys, BaseCore *_base, const QString &name=QString::null)
QString getAction (int id)
virtual ~QSMenu ()

Private Attributes

Q_PopupMenu * menu
Menumsys
int actionId
QStringList actions

Detailed Description

QObject wrapper around popup menu.

Class providing Popup menu functionality to script with functions to create and show these menus


Constructor & Destructor Documentation

gui::QSMenu::QSMenu ( Menu _msys,
BaseCore _base,
const QString &  name = QString::null 
)

Construct popup menu containing the same items as some other already specified menu (which is used as template)

Parameters:
_msys Menu system of window in which this popup menu will be shown
_base Scripting base
name Name of the menu as it is stored in settings. If null or not specified, menu will be initially empty

References actionId, addItem(), debug::DBG_WARN, util::explode(), guiPrintDbg, gui::Menu::isList(), menu, gui::MENUDEF_SEPARATOR, gui::InvalidMenuException::message(), msys, gui::Menu::parseName(), Q_OUT, Q_PopupMenu, and gui::Menu::readItem().

gui::QSMenu::~QSMenu (  )  [virtual]

destructor

References menu.


Member Function Documentation

void gui::QSMenu::addItem ( const QString &  name  )  [slot]

Append item (or list) to menu using its name (as specified in configuration).
Special: if the name is "-" or "", separator is added to menu
Exceptions are ignored and will result only in the item not added to menu

Parameters:
name name of item (item or list)

References addItemDef(), debug::DBG_DBG, debug::DBG_WARN, guiPrintDbg, gui::Menu::isList(), gui::Menu::loadItem(), menu, gui::InvalidMenuException::message(), msys, Q_OUT, and gui::Menu::readItem().

Referenced by addSeparator(), and QSMenu().

void gui::QSMenu::addItemDef ( QString  def  )  [slot]

Append item to menu using its definition.
Exceptions are ignored and will result only in the item not added to menu
You can add items only, not lists in this way. If you want to add list, you must have it defined in configuration first.

Parameters:
def Definition of menu item (same format as used in application menus)

References actionId, actions, debug::DBG_DBG, debug::DBG_WARN, util::explode(), gui::Menu::getIconSet(), guiPrintDbg, pdfobjects::isNull(), menu, gui::MENUDEF_SEPARATOR, gui::InvalidMenuException::message(), msys, gui::Menu::parseName(), Q_OUT, and gui::TMP_OFFSET.

Referenced by addItem().

void gui::QSMenu::addSeparator (  )  [slot]

Insert a separator in the menu

References addItem().

QString gui::QSMenu::getAction ( int  id  ) 

For given ID get associated action (script)

Parameters:
id ID of menu action
Returns:
script corresponding to the action

References actions, gui::Menu::getAction(), msys, and gui::TMP_OFFSET.

Referenced by popup().

QString gui::QSMenu::popup (  )  [slot]

Invoke popup menu near position of mouse pointer, return selected action

Returns:
selected action (script), or null string if no action selected

References debug::DBG_DBG, getAction(), guiPrintDbg, menu, and Q_OUT.

void gui::QSMenu::reset (  )  [slot]

Reset the menu and remove all items from it

References actionId, actions, and menu.


Member Data Documentation

int gui::QSMenu::actionId [private]

last used action ID

Referenced by addItemDef(), QSMenu(), and reset().

QStringList gui::QSMenu::actions [private]

List of menu actions

Referenced by addItemDef(), getAction(), and reset().

Q_PopupMenu* gui::QSMenu::menu [private]

Menu held in class

Referenced by addItem(), addItemDef(), popup(), QSMenu(), reset(), and ~QSMenu().

Menu* gui::QSMenu::msys [private]

Menu system of window in which this popup menu will be shown

Referenced by addItem(), addItemDef(), getAction(), and QSMenu().


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