Hotkey< T > Struct Template Reference

All data for a single hotkey. More...

#include <hotkeys.h>

Data Structures

struct  CallbackWrapper
 A wrapper around the callback function. More...

Public Types

typedef void(T::* hotkey_callback )(int)

Public Member Functions

 Hotkey (uint16 default_keycode, const char *name, int num, hotkey_callback callback=NULL)
 Create a new Hotkey object with a single default keycode.
 Hotkey (const uint16 *default_keycodes, const char *name, int num, hotkey_callback callback=NULL)
 Create a new Hotkey object with multiple default keycodes.
void AddKeycode (uint16 keycode)
 Add a keycode to this hotkey, from now that keycode will be matched in addition to any previously added keycodes.

Data Fields

const char * name
int num
SmallVector< uint16, 1 > keycodes
CallbackWrappercallback

Detailed Description

template<class T>
struct Hotkey< T >

All data for a single hotkey.

The name (for saving/loading a configfile), a list of keycodes and a number to help identifying this hotkey.

Definition at line 23 of file hotkeys.h.


Constructor & Destructor Documentation

template<class T>
Hotkey< T >::Hotkey ( uint16  default_keycode,
const char *  name,
int  num,
hotkey_callback  callback = NULL 
) [inline]

Create a new Hotkey object with a single default keycode.

Parameters:
default_keycode The default keycode for this hotkey.
name The name of this hotkey.
num Number of this hotkey, should be unique within the hotkey list.
callback The function to call if the hotkey is pressed.

Definition at line 47 of file hotkeys.h.

template<class T>
Hotkey< T >::Hotkey ( const uint16 *  default_keycodes,
const char *  name,
int  num,
hotkey_callback  callback = NULL 
) [inline]

Create a new Hotkey object with multiple default keycodes.

Parameters:
default_keycodes An array of default keycodes terminated with 0.
name The name of this hotkey.
num Number of this hotkey, should be unique within the hotkey list.
callback The function to call if the hotkey is pressed.

Definition at line 66 of file hotkeys.h.


Member Function Documentation

template<class T>
void Hotkey< T >::AddKeycode ( uint16  keycode  )  [inline]

Add a keycode to this hotkey, from now that keycode will be matched in addition to any previously added keycodes.

Parameters:
keycode The keycode to add.

Definition at line 93 of file hotkeys.h.

Referenced by Hotkey< TerraformToolbarWindow >::Hotkey(), and ParseHotkeys().


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

Generated on Fri May 27 04:20:45 2011 for OpenTTD by  doxygen 1.6.1