Planeshift
psControl Struct Reference

Defines a generic button trigger. More...

#include <pscharcontrol.h>

Public Types

typedef const void * DataPtr
 Pointer to an object used by a TriggerFunction. More...
 
enum  Device { NONE, KEYBOARD, MOUSE }
 
enum  PressType { NORMAL, TOGGLE }
 
typedef void(psTriggerHandler::* TriggerFunction) (const psControl *, bool)
 Pointer to a member function in the psTriggerHandler class. More...
 

Public Member Functions

void Execute () const
 Does whatever this does. More...
 
 psControl (const char *n, PressType t, TriggerFunction f)
 
csString ToString () const
 Returns button combo in string form. More...
 

Public Attributes

uint button
 Button this is bound to. More...
 
DataPtr data
 Optional pointer to data needed by function. More...
 
Device device
 Location of button. More...
 
TriggerFunction function
 Function called when triggered. More...
 
uint32 mods
 Modifiers to go with the button. More...
 
csString name
 Name of this control. More...
 
bool state
 Is this active? More...
 
PressType type
 Trigger method. More...
 

Static Public Attributes

static psTriggerHandlerhandler
 Static pointer to the function handler class. More...
 

Detailed Description

Defines a generic button trigger.

Each game action that may be activated by a button press has a psControl object. (or 2, if a secondary trigger is created) These are managed by psControlManager which takes incoming CS input events and looks up any registered triggers Note that for shortcuts and secondary triggers the internal name listed in the object may differ from the display name which should be used in the GUI. The function GetDisplayName() may be used to convert the name. (ex: "Shortcut 1" -> "Greet")

Definition at line 49 of file pscharcontrol.h.

Member Typedef Documentation

typedef const void* psControl::DataPtr

Pointer to an object used by a TriggerFunction.

Definition at line 55 of file pscharcontrol.h.

typedef void(psTriggerHandler::* psControl::TriggerFunction) (const psControl *, bool)

Pointer to a member function in the psTriggerHandler class.

Definition at line 52 of file pscharcontrol.h.

Member Enumeration Documentation

Enumerator
NONE 

Not set.

KEYBOARD 

Keypress.

MOUSE 

Mouseclick.

Definition at line 63 of file pscharcontrol.h.

Enumerator
NORMAL 

Triggers on press and un-triggers on release.

TOGGLE 

Triggers on press and un-triggers on another press.

Definition at line 57 of file pscharcontrol.h.

Constructor & Destructor Documentation

psControl::psControl ( const char *  n,
PressType  t,
TriggerFunction  f 
)
inline

Definition at line 70 of file pscharcontrol.h.

Member Function Documentation

void psControl::Execute ( ) const

Does whatever this does.

csString psControl::ToString ( ) const

Returns button combo in string form.

Member Data Documentation

uint psControl::button

Button this is bound to.

Definition at line 76 of file pscharcontrol.h.

DataPtr psControl::data

Optional pointer to data needed by function.

Definition at line 80 of file pscharcontrol.h.

Device psControl::device

Location of button.

Definition at line 75 of file pscharcontrol.h.

TriggerFunction psControl::function

Function called when triggered.

Definition at line 79 of file pscharcontrol.h.

psTriggerHandler* psControl::handler
static

Static pointer to the function handler class.

Definition at line 85 of file pscharcontrol.h.

uint32 psControl::mods

Modifiers to go with the button.

Definition at line 77 of file pscharcontrol.h.

csString psControl::name

Name of this control.

Definition at line 73 of file pscharcontrol.h.

bool psControl::state

Is this active?

Definition at line 74 of file pscharcontrol.h.

PressType psControl::type

Trigger method.

Definition at line 78 of file pscharcontrol.h.


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