-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMatrixWnd.h
82 lines (64 loc) · 2.54 KB
/
MatrixWnd.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*****************************************************************************/
/* MatrixWnd.h : CMatrixWnd declaration */
/*****************************************************************************/
/*
Copyright (C) 2019 Hermann Seib
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _MatrixWnd_h__included_
#define _MatrixWnd_h__included_
#include "KbdGuiLayout.h"
/*****************************************************************************/
/* CMatrixWnd class declaration */
/*****************************************************************************/
class CKbdWnd;
class CMatrixWnd : public wxGrid
{
public:
CMatrixWnd(wxWindow *parent, int numRows = NUMROWS, int numCols = NUMCOLS, bool switched = true);
virtual ~CMatrixWnd(void);
// Attention: these must be done before SetKbdMatrix()!
void SetOrientation(bool switched = true);
void SetLayout(int numRows = NUMROWS, int numCols = NUMCOLS);
void SetLayer(int layer) { layernum = layer; }
int GetLayer() { return layernum; }
void SetKbdMatrix(KbdMatrix const &kbm);
void SelectMatrix(int row, int col);
void SetKbdWnd(CKbdWnd *pKbdWnd = NULL) { this->pKbdWnd = pKbdWnd; }
wxSize GetMatrixSize()
{ return wxSize(GetColRight(GetNumberCols() - 1),
GetRowBottom(GetNumberRows() - 1)); }
protected:
void RC2Internal(int &row, int &col)
{
if (bColsRowsSwitched)
{
int i = col;
col = row;
row = i;
}
}
// may be overridden if necessary
virtual void OnMatrixChanged(int row, int col, wxUint16 key);
private:
wxDECLARE_EVENT_TABLE();
void OnKeyDown(wxKeyEvent &);
void OnChar(wxKeyEvent &);
void OnKeyUp(wxKeyEvent &);
void OnCellValueChanged( wxGridEvent& );
protected:
int layernum;
bool bColsRowsSwitched;
CKbdWnd *pKbdWnd;
};
void SetupText2HIDMapping(wxUint16 fwVer = MAX_FW_VER);
void RemoveText2HIDMapping();
#endif // defined(_MatrixWnd_h__included_)