| Version: 3.3.1

Public Member Functions | List of all members
wxAcceleratorEntry Class Reference
Class List by Category » Data Structures

`#include <wx/accel.h>`

## Detailed Description

An object used by an application wishing to create an accelerator table (see wxAcceleratorTable).

##

Library: wxCore
Category: Data Structures

See also
  wxAcceleratorTable, wxWindow::SetAcceleratorTable

## Public Member Functions
| wxAcceleratorEntry (int flags=0, int keyCode=0, int cmd=0, wxMenuItem *item=nullptr)
| Constructor. More...
| wxAcceleratorEntry (const wxAcceleratorEntry &entry)
| Copy ctor. More...
int | GetCommand () const
| Returns the command identifier for the accelerator table entry. More...
int | GetFlags () const
| Returns the flags for the accelerator table entry. More...
int | GetKeyCode () const
| Returns the keycode for the accelerator table entry. More...
wxMenuItem * | GetMenuItem () const
| Returns the menu item associated with this accelerator entry. More...
void | Set (int flags, int keyCode, int cmd, wxMenuItem *item=nullptr)
| Sets the accelerator entry parameters. More...
bool | IsOk () const
| Returns true if this object is correctly initialized. More...
wxString | ToString () const
| Returns a textual representation of this accelerator. More...
wxString | ToRawString () const
| Returns a textual representation of this accelerator which is appropriate for saving in configuration files. More...
bool | FromString (const wxString &str)
| Parses the given string and sets the accelerator accordingly. More...
wxAcceleratorEntry & | operator= (const wxAcceleratorEntry &entry)
bool | operator== (const wxAcceleratorEntry &entry) const
bool | operator!= (const wxAcceleratorEntry &entry) const

## Constructor & Destructor Documentation

## ◆ wxAcceleratorEntry() [1/2]

wxAcceleratorEntry::wxAcceleratorEntry | ( | int | flags = `0`,
|  | int | keyCode = `0`,
|  | int | cmd = `0`,
|  | wxMenuItem * | item = `nullptr`
| ) |  |

Constructor.

Parameters

  flags | A combination of the wxAcceleratorEntryFlags values, which indicates which modifier keys are held down.
  keyCode | The keycode to be detected. See wxKeyCode for a full list of keycodes.
  cmd | The menu or control command identifier (ID).
  item | The menu item associated with this accelerator.

## ◆ wxAcceleratorEntry() [2/2]

wxAcceleratorEntry::wxAcceleratorEntry | ( | const wxAcceleratorEntry & | entry | ) |

Copy ctor.

## Member Function Documentation

## ◆ FromString()

bool wxAcceleratorEntry::FromString | ( | const wxString & | str | ) |

Parses the given string and sets the accelerator accordingly.

Parameters

  str | This string may be either in the same format as returned by ToString(), i.e. contain the accelerator itself only, or have the format of a full menu item text with i.e. `Label TAB Accelerator`. In the latter case, the part of the string before the TAB is ignored. Notice that the latter format is only supported for the compatibility with the previous wxWidgets versions and the new code should pass only the accelerator string itself to this function.

Returns
  true if the given string correctly initialized this object (i.e. if IsOk() returns true after this call)

## ◆ GetCommand()

int wxAcceleratorEntry::GetCommand | ( |  | ) | const

Returns the command identifier for the accelerator table entry.

## ◆ GetFlags()

int wxAcceleratorEntry::GetFlags | ( |  | ) | const

Returns the flags for the accelerator table entry.

## ◆ GetKeyCode()

int wxAcceleratorEntry::GetKeyCode | ( |  | ) | const

Returns the keycode for the accelerator table entry.

## ◆ GetMenuItem()

wxMenuItem* wxAcceleratorEntry::GetMenuItem | ( |  | ) | const

Returns the menu item associated with this accelerator entry.

## ◆ IsOk()

bool wxAcceleratorEntry::IsOk | ( |  | ) | const

Returns true if this object is correctly initialized.

## ◆ operator!=()

bool wxAcceleratorEntry::operator!= | ( | const wxAcceleratorEntry & | entry | ) | const

## ◆ operator=()

wxAcceleratorEntry& wxAcceleratorEntry::operator= | ( | const wxAcceleratorEntry & | entry | ) |

## ◆ operator==()

bool wxAcceleratorEntry::operator== | ( | const wxAcceleratorEntry & | entry | ) | const

## ◆ Set()

void wxAcceleratorEntry::Set | ( | int | flags,
|  | int | keyCode,
|  | int | cmd,
|  | wxMenuItem * | item = `nullptr`
| ) |  |

Sets the accelerator entry parameters.

Parameters

  flags | A combination of the wxAcceleratorEntryFlags values, which indicates which modifier keys are held down.
  keyCode | The keycode to be detected. See wxKeyCode for a full list of keycodes.
  cmd | The menu or control command identifier (ID).
  item | The menu item associated with this accelerator.

## ◆ ToRawString()

wxString wxAcceleratorEntry::ToRawString | ( |  | ) | const

Returns a textual representation of this accelerator which is appropriate for saving in configuration files.

Unlike the string returned by ToString(), this one is never translated so, while it's not suitable for showing to the user, it can be used to uniquely identify the accelerator independently of the user language.

The returned string can still be parsed by FromString().

Since
  2.9.4

## ◆ ToString()

wxString wxAcceleratorEntry::ToString | ( |  | ) | const

Returns a textual representation of this accelerator.

The returned string is of the form `[Alt+][Ctrl+][RawCtrl+][Shift+]Key` where the modifier keys are present only if the corresponding flag is set.