wxAcceleratorTable

An accelerator table allows the application to specify a table of keyboard shortcuts for menus or other commands. On Windows, menu or button commands are supported; on GTK, only menu commands are supported.

The object wxNullAcceleratorTable is defined to be a table with no data, and is the initial accelerator table for a window.

Derived from

wxObject

Include files

<wx/accel.h>

Example

  wxAcceleratorEntry entries[4];
  entries[0].Set(wxACCEL_CTRL,  (int) 'N',     ID_NEW_WINDOW);
  entries[1].Set(wxACCEL_CTRL,  (int) 'X',     wxID_EXIT);
  entries[2].Set(wxACCEL_SHIFT, (int) 'A',     ID_ABOUT);
  entries[3].Set(wxACCEL_NORMAL,  WXK_DELETE,    wxID_CUT);
  wxAcceleratorTable accel(4, entries);
  frame->SetAcceleratorTable(accel);

Remarks

An accelerator takes precedence over normal processing and can be a convenient way to program some event handling. For example, you can use an accelerator table to enable a dialog with a multi-line text control to accept CTRL-Enter as meaning `OK' (but not in GTK+ at present).

See also

wxAcceleratorEntry, wxWindow::SetAcceleratorTable



wxAcceleratorTable::wxAcceleratorTable



wxAcceleratorTable(void)

Default constructor.



wxAcceleratorTable(const wxAcceleratorTable& bitmap)

Copy constructor.



wxAcceleratorTable(int n, wxAcceleratorEntry entries[])

Creates from an array of wxAcceleratorEntry objects.



wxAcceleratorTable(const wxString& resource)

Loads the accelerator table from a Windows resource (Windows only).

Parameters

n
Number of accelerator entries.

entries
The array of entries.

resource
Name of a Windows accelerator.

wxPython での注意点: The wxPython constructor accepts a list of wxAcceleratorEntry objects, or 3-tuples consisting of flags, keyCode, and cmd values like you would construct wxAcceleratorEntry objects with.

wxPerl での注意点: The wxPerl constructor accepts a list of either Wx::AcceleratorEntry objects or references to 3-element arrays ( flags, keyCode, cmd ), like the parameters of Wx::AcceleratorEntry::new.



wxAcceleratorTable::~wxAcceleratorTable



~wxAcceleratorTable(void)

Destroys the wxAcceleratorTable object.



wxAcceleratorTable::Ok

bool Ok(void) const

Returns true if the accelerator table is valid.



wxAcceleratorTable::operator $=$



wxAcceleratorTable& operator $=$(const wxAcceleratorTable& accel)

Assignment operator. This operator does not copy any data, but instead passes a pointer to the data in accel and increments a reference counter. It is a fast operation.

Parameters

accel
Accelerator table to assign.

Return value

Returns reference to this object.



wxAcceleratorTable::operator $==$



bool operator $==$(const wxAcceleratorTable& accel)

Equality operator. This operator tests whether the internal data pointers are equal (a fast test).

Parameters

accel
Accelerator table to compare with

Return value

Returns true if the accelerator tables were effectively equal, false otherwise.



wxAcceleratorTable::operator $\!=$



bool operator $\!=$(const wxAcceleratorTable& accel)

Inequality operator. This operator tests whether the internal data pointers are unequal (a fast test).

Parameters

accel
Accelerator table to compare with

Return value

Returns true if the accelerator tables were unequal, false otherwise.

ymasuda 平成17年11月19日