Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
PopupMenu Class Reference

#include <popupMenu.h>

+ Inheritance diagram for PopupMenu:

Public Member Functions

 PopupMenu ()
 
virtual ~PopupMenu ()
 
void createPlatformPopupMenuData ()
 
void deletePlatformPopupMenuData ()
 
 DECLARE_CONOBJECT (PopupMenu)
 
virtual bool onAdd ()
 Called when the object is added to the sim. More...
 
virtual void onRemove ()
 Called when the object is removed from the sim. More...
 
void createPlatformMenu ()
 
S32 insertItem (S32 pos, const char *title, const char *accelerator)
 
S32 insertSubMenu (S32 pos, const char *title, PopupMenu *submenu)
 
void removeItem (S32 itemPos)
 
void enableItem (S32 pos, bool enable)
 implemented on a per-platform basis. More...
 
void checkItem (S32 pos, bool checked)
 implemented on a per-platform basis. More...
 
void checkRadioItem (S32 firstPos, S32 lastPos, S32 checkPos)
 
bool isItemChecked (S32 pos)
 
void attachToMenuBar (S32 pos, const char *title)
 
void removeFromMenuBar ()
 Removes this menu from the menu bar. More...
 
void showPopup (S32 x=-1, S32 y=-1)
 
bool canHandleID (U32 iD)
 
bool handleSelect (U32 command, const char *text=NULL)
 
virtual bool onMessageReceived (StringTableEntry queue, const char *event, const char *data)
 Callback for when messages are received. More...
 
virtual bool onMessageObjectReceived (StringTableEntry queue, Message *msg)
 Callback for when message objects are received. More...
 
- Public Member Functions inherited from SimObject
StringTableEntry getClassNamespace () const
 
StringTableEntry getSuperClassNamespace () const
 
void setClassNamespace (const char *classNamespace)
 
void setSuperClassNamespace (const char *superClassNamespace)
 
void pushScriptCallbackGuard (void)
 
void popScriptCallbackGuard (void)
 
S32 getScriptCallbackGuard (void)
 
virtual SimObjectfindObject (const char *name)
 
NamespacegetNamespace ()
 Return the object's namespace. More...
 
const char * tabComplete (const char *prevText, S32 baseLen, bool)
 
virtual void dump ()
 
virtual void dumpClassHierarchy ()
 
SimObjectclone (const bool copyDynamicFields)
 
virtual void copyTo (SimObject *object)
 
template<typename T >
bool isType (void)
 
virtual bool handlesConsoleMethod (const char *fname, S32 *routingId)
 
 DECLARE_CONOBJECT (SimObject)
 
NotifyremoveNotify (void *ptr, Notify::Type)
 Remove a notification from the list. More...
 
void deleteNotify (SimObject *obj)
 Notify an object when we are deleted. More...
 
void clearNotify (SimObject *obj)
 Notify an object when we are cleared. More...
 
void clearAllNotifications ()
 Remove all notifications for this object. More...
 
void processDeleteNotifies ()
 Send out deletion notifications. More...
 
void registerReference (SimObject **obj)
 
void unregisterReference (SimObject **obj)
 
const char * getDataField (StringTableEntry slotName, const char *array)
 
void setDataField (StringTableEntry slotName, const char *array, const char *value)
 
const char * getPrefixedDataField (StringTableEntry fieldName, const char *array)
 
void setPrefixedDataField (StringTableEntry fieldName, const char *array, const char *value)
 
const char * getPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const S32 fieldType=-1)
 
void setPrefixedDynamicDataField (StringTableEntry fieldName, const char *array, const char *value, const S32 fieldType=-1)
 
StringTableEntry getDataFieldPrefix (StringTableEntry fieldName)
 
U32 getDataFieldType (StringTableEntry slotName, const char *array)
 
SimFieldDictionarygetFieldDictionary ()
 
void clearDynamicFields (void)
 Clear all dynamic fields. More...
 
void setCanSaveDynamicFields (bool bCanSave)
 Set whether fields created at runtime should be saved. Default is true. More...
 
bool getCanSaveDynamicFields (void) const
 Get whether fields created at runtime should be saved. Default is true. More...
 
void setInternalName (const char *newname)
 
StringTableEntry getInternalName ()
 Get the internal of of this control. More...
 
virtual bool save (const char *pcFilePath, bool bOnlySelected=false)
 Save object as a TorqueScript File. More...
 
virtual bool isMethod (const char *methodName)
 Check if a method exists in the objects current namespace. More...
 
SimObjectId getId (void) const
 
StringTableEntry getIdString (void) const
 
U32 getType () const
 
const StringTableEntry getName (void) const
 
void setId (SimObjectId id)
 
void assignName (const char *name)
 
SimGroupgetGroup () const
 
bool isChildOfGroup (SimGroup *pGroup)
 
bool isProperlyAdded () const
 
bool isDeleted () const
 
bool isRemoved () const
 
bool isLocked ()
 
void setLocked (bool b)
 
bool isHidden ()
 
void setHidden (bool b)
 
void setProgenitorFile (const char *pFile)
 
StringTableEntry getProgenitorFile (void) const
 
void setPeriodicTimerID (const S32 timerID)
 
S32 getPeriodicTimerID (void) const
 
bool isPeriodicTimerActive (void) const
 
bool isSelected () const
 
bool isExpanded () const
 
void setSelected (bool sel)
 
void setExpanded (bool exp)
 
void setModDynamicFields (bool dyn)
 
void setModStaticFields (bool sta)
 
 SimObject (const U8 namespaceLinkMask=LinkSuperClassName|LinkClassName)
 
virtual ~SimObject ()
 
virtual bool processArguments (S32 argc, const char **argv)
 Process constructor options. (ie, new SimObject(1,2,3)) More...
 
virtual void onGroupAdd ()
 Called when the object is added to a SimGroup. More...
 
virtual void onGroupRemove ()
 Called when the object is removed from a SimGroup. More...
 
virtual void onNameChange (const char *name)
 Called when the object's name is changed. More...
 
virtual void onStaticModified (const char *slotName, const char *newValue=NULL)
 
virtual void inspectPreApply ()
 
virtual void inspectPostApply ()
 
virtual void onDeleteNotify (SimObject *object)
 
virtual void onEditorEnable ()
 Called when the editor is activated. More...
 
virtual void onEditorDisable ()
 Called when the editor is deactivated. More...
 
bool registerObject ()
 
bool registerObject (U32 id)
 
bool registerObject (const char *name)
 
bool registerObject (const char *name, U32 id)
 
void unregisterObject ()
 
void deleteObject ()
 
bool addToSet (SimObjectId)
 
bool addToSet (const char *)
 
bool removeFromSet (SimObjectId)
 
bool removeFromSet (const char *)
 
virtual bool writeField (StringTableEntry fieldname, const char *value)
 
virtual void write (Stream &stream, U32 tabStop, U32 flags=0)
 
virtual void writeFields (Stream &stream, U32 tabStop)
 
virtual bool writeObject (Stream *stream)
 
virtual bool readObject (Stream *stream)
 
virtual void buildFilterList ()
 
void addFieldFilter (const char *fieldName)
 
void removeFieldFilter (const char *fieldName)
 
void clearFieldFilters ()
 
bool isFiltered (const char *fieldName)
 
void assignFieldsFrom (SimObject *obj)
 
void assignDynamicFieldsFrom (SimObject *obj)
 
- Public Member Functions inherited from ConsoleObject
const AbstractClassRep::FieldfindField (StringTableEntry fieldName) const
 Get a reference to a field by name. More...
 
virtual AbstractClassRepgetClassRep () const
 Gets the ClassRep. More...
 
bool setField (const char *fieldName, const char *value)
 Set the value of a field. More...
 
virtual ~ConsoleObject ()
 
const AbstractClassRep::FieldListgetFieldList () const
 Get a list of all the fields. This information cannot be modified. More...
 
AbstractClassRep::FieldListgetModifiableFieldList ()
 
bool & getDynamicGroupExpand ()
 
S32 getClassId (U32 netClassGroup) const
 
const char * getClassName () const
 
- Public Member Functions inherited from IMessageListener
virtual ~IMessageListener ()
 
virtual void onAddToQueue (StringTableEntry queue)
 Callback for when the listener is added to a queue. More...
 
virtual void onRemoveFromQueue (StringTableEntry queue)
 Callback for when the listener is removed from a queue. More...
 

Static Public Member Functions

static void initPersistFields ()
 
- Static Public Member Functions inherited from SimObject
static void initPersistFields ()
 
- Static Public Member Functions inherited from ConsoleObject
static const char * lookupClassName (const U32 in_classTag)
 Get the classname from a class tag. More...
 
static void initPersistFields ()
 
static void consoleInit ()
 
static ConsoleObjectcreate (const char *in_pClassName)
 
static ConsoleObjectcreate (const U32 groupId, const U32 typeId, const U32 in_classId)
 
static AbstractClassRepgetStaticClassRep ()
 Get the abstract class information for this class. More...
 
static AbstractClassRepgetParentStaticClassRep ()
 Get the abstract class information for this class's superclass. More...
 

Protected Attributes

PlatformPopupMenuData * mData
 
SimSetmSubmenus
 
bool mIsPopup
 
- Protected Attributes inherited from SimObject
SimObjectId mId
 Id number for this object. More...
 
StringTableEntry mIdString
 
NamespacemNameSpace
 
U32 mTypeMask
 
S32 mScriptCallbackGuard
 Whether the object is executing a script callback. More...
 
bool mCanSaveFieldDictionary
 true if dynamic fields (added at runtime) should be saved, defaults to true More...
 
StringTableEntry mInternalName
 Stores object Internal Name. More...
 
StringTableEntry mClassName
 Stores the class name to link script class namespaces. More...
 
StringTableEntry mSuperClassName
 Stores super class name to link script class namespaces. More...
 
U8 mNSLinkMask
 
- Protected Attributes inherited from IMessageListener
Vector< StringTableEntry > mQueues
 List of queues this listener is registered with. More...
 

Additional Inherited Members

- Public Types inherited from SimObject
enum  WriteFlags { SelectedOnly = BIT(0) }
 
- Protected Types inherited from SimObject
enum  SimObjectNSLinkType { LinkClassName = BIT(0), LinkSuperClassName = BIT(1) }
 
- Protected Member Functions inherited from SimObject
virtual void onTamlPreWrite (void)
 Taml callbacks. More...
 
virtual void onTamlPostWrite (void)
 Called after Taml has finished writing the object. More...
 
virtual void onTamlPreRead (void)
 Called prior to Taml reading the object. More...
 
virtual void onTamlPostRead (const TamlCustomNodes &customNodes)
 
virtual void onTamlAddParent (SimObject *pParentObject)
 Called after Taml has finished reading the object and has added the object to any parent. More...
 
virtual void onTamlCustomWrite (TamlCustomNodes &customNodes)
 Called during the writing of the object to allow custom properties to be written. More...
 
virtual void onTamlCustomRead (const TamlCustomNodes &customNodes)
 Called during the reading of the object to allow custom properties to be read. More...
 
void linkNamespaces ()
 
void unlinkNamespaces ()
 
- Static Protected Member Functions inherited from SimObject
static bool setClass (void *obj, const char *data)
 
static bool setSuperClass (void *obj, const char *data)
 
static bool writeCanSaveDynamicFields (void *obj, StringTableEntry pFieldName)
 
static bool writeInternalName (void *obj, StringTableEntry pFieldName)
 
static bool setParentGroup (void *obj, const char *data)
 
static bool writeParentGroup (void *obj, StringTableEntry pFieldName)
 
static bool writeSuperclass (void *obj, StringTableEntry pFieldName)
 
static bool writeClass (void *obj, StringTableEntry pFieldName)
 
static SimObject::NotifyallocNotify ()
 Get a free Notify structure. More...
 
static void freeNotify (SimObject::Notify *)
 Mark a Notify structure as free. More...
 
- Static Protected Attributes inherited from SimObject
static SimObject::NotifymNotifyFreeList = NULL
 

Constructor & Destructor Documentation

PopupMenu ( )
~PopupMenu ( )
virtual

Member Function Documentation

void attachToMenuBar ( S32  pos,
const char *  title 
)

Places this menu in the menu bar of the application's main window.

Parameters
posThe relative position at which to place the menu.
titleThe name of the menu
bool canHandleID ( U32  iD)

Returns true iff this menu contains an item that matches iD. implemented on a per-platform basis. TODO: factor out common code

void checkItem ( S32  pos,
bool  checked 
)

implemented on a per-platform basis.

void checkRadioItem ( S32  firstPos,
S32  lastPos,
S32  checkPos 
)

All items at positions firstPos through lastPos are unchecked, and the item at checkPos is checked. implemented on a per-platform basis.

void createPlatformMenu ( )

Creates the platform specific menu object, a peer to this object. The platform menu must exist before calling any method that manipulates menu items or displays the menu. implementd on a per-platform basis.

void createPlatformPopupMenuData ( )
DECLARE_CONOBJECT ( PopupMenu  )
void deletePlatformPopupMenuData ( )
void enableItem ( S32  pos,
bool  enable 
)

implemented on a per-platform basis.

bool handleSelect ( U32  command,
const char *  text = NULL 
)

A menu item in this menu has been selected by id. Submenus are given a chance to respond to the command first. If no submenu can handle the command id, this menu handles it. The script callback this::onSelectItem( position, text) is called. If text is null, then the text arg passed to script is the text of the selected menu item. implemented on a per-platform basis. TODO: factor out common code

void initPersistFields ( void  )
static
S32 insertItem ( S32  pos,
const char *  title,
const char *  accelerator 
)

pass NULL for title to insert a separator returns the menu item's ID, or -1 on failure. implementd on a per-platform basis. TODO: factor out common code

S32 insertSubMenu ( S32  pos,
const char *  title,
PopupMenu submenu 
)

pass NULL for title to insert a separator returns the menu item's ID, or -1 on failure. adds the submenu to the mSubmenus vector. implemented on a per-platform basis. TODO: factor out common code

bool isItemChecked ( S32  pos)
bool onAdd ( void  )
virtual

Called when the object is added to the sim.

Reimplemented from SimObject.

bool onMessageObjectReceived ( StringTableEntry  queue,
Message msg 
)
virtual

Callback for when message objects are received.

Parameters
queueThe name of the queue the message was dispatched to
msgThe message object
Returns
false to prevent other listeners receiving this message, true otherwise
See Also
onMessageReceived()

Implements IMessageListener.

bool onMessageReceived ( StringTableEntry  queue,
const char *  msg,
const char *  data 
)
virtual

Callback for when messages are received.

Parameters
queueThe name of the queue the message was dispatched to
msgThe type of message
dataThe data for the message
Returns
false to prevent other listeners receiving this message, true otherwise
See Also
onMessageObjectReceived()

Implements IMessageListener.

void onRemove ( )
virtual

Called when the object is removed from the sim.

Reimplemented from SimObject.

void removeFromMenuBar ( )

Removes this menu from the menu bar.

void removeItem ( S32  itemPos)

remove the menu item at itemPos if the item has a submenu, it is removed from the mSubmenus list. implemented on a per-platform basis. TODO: factor out common code

void showPopup ( S32  x = -1,
S32  y = -1 
)

Displays this menu as a popup menu and blocks until the user has selected an item.

Parameters
xwindow local x coordinate at which to display the popup menu
ywindow local y coordinate at which to display the popup menu implemented on a per-platform basis.

Member Data Documentation

PlatformPopupMenuData* mData
protected
bool mIsPopup
protected
SimSet* mSubmenus
protected

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