File: accel.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (62 lines) | stat: -rw-r--r-- 2,317 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/////////////////////////////////////////////////////////////////////////////
// Name:        wx/qt/accel.h
// Purpose:     wxAcceleratorTable class
// Author:      Peter Most, Javier Torres, Mariano Reingart
// Copyright:   (c) 2009 wxWidgets dev team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_QT_ACCEL_H_
#define _WX_QT_ACCEL_H_

/* wxQt accelerators implementation:
 *
 * Storing:
 * QShortcuts are stored in wxWindow (m_qtShortcuts) to allow to delete them
 * when the accelerator table is changed, and also because we need to specify
 * a not-null parent from them, which is unknown at the moment of creating the
 * accelerator table. So, the accelerator table only contains a list of
 * wxAcceleratorEntries, which are converted to a list of QShortcuts when
 * the table is fixed to a wxWindow.
 *
 * Passing keypresses to accelerators:
 * The accelerators are implemented using QShortcut's. As there is no easy way
 * to call them, we must pass all keypress events through the QApplication
 * notify() function (which is the one that checks if the keypress match any
 * shortcut.
 *
 * Executing commands when a QShortcut is triggered:
 * Each QShortcut has a property ("wxQt_Command") set with the number of the
 * wx command it is associated to. Then, its activated() signal is connected to
 * a small handler (wxQtShortcutHandler in window_qt.h) which calls the main
 * handler (wxWindow::QtHandleShortcut) passing the command extracted from the
 * QShortcut. This handler will finally create and send the appropriate wx
 * event to the window. */

#include "wx/vector.h"

class QShortcut;
template < class T > class QList;

class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject
{
public:
    wxAcceleratorTable();
    wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);

    // Implementation
    wxVector<QShortcut*> ConvertShortcutTable( QWidget *parent ) const;

    bool Ok() const { return IsOk(); }
    bool IsOk() const;

protected:
    // ref counting code
    virtual wxObjectRefData *CreateRefData() const wxOVERRIDE;
    virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const wxOVERRIDE;

private:
    wxDECLARE_DYNAMIC_CLASS(wxAcceleratorTable);
};

#endif // _WX_QT_ACCEL_H_