Import of widgets from wxKanjiPad, plus the files needed to compile kpengine. Also...
[jben.git] / panel_kanjipad.h
blob75e73c70801d3411c324c24ac3f2da1a07d45c76
1 /*
2 Project: wxKanjiPad
3 Author: Paul Goins
4 License: GNU General Public License (GPL) version 2
5 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
7 File: panel_kanjipad.h
9 This file is part of wxKanjiPad, a port of KanjiPad to wxWidgets with
10 some minor additional modifications. It uses and is based off the
11 modified kanjipad source code used in im-ja (http://im-ja.sourceforge.net/).
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License along
24 with this program; if not, write to the Free Software Foundation, Inc.,
25 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #ifndef panel_kanjipad_h
29 #define panel_kanjipad_h
31 /* Stock wxWidgets includes */
32 #include "wx/wxprec.h"
33 #ifdef __BORLANDC__
34 #pragma hdrstop
35 #endif
36 #ifndef WX_PRECOMP
37 #include "wx/wx.h"
38 #endif
40 #include "wx/process.h"
41 #include <list>
42 using namespace std;
44 #define KANJIPAD_MAX_KANJI 5
46 class PanelKanjiPad: public wxPanel {
47 public:
48 PanelKanjiPad(wxWindow *owner, wxWindowID id=wxID_ANY,
49 const wxPoint& pos=wxDefaultPosition,
50 const wxSize& size=wxDefaultSize,
51 long style=wxBORDER_SIMPLE,
52 const wxString& name = _T("panelkanjipad"));
53 /* Public methods */
54 void Clear();
55 list< list<wxPoint> > const* GetStrokes();
56 bool Search();
57 /* Events */
58 void OnMouseDown(wxMouseEvent& ev);
59 void OnMouseUp(wxMouseEvent& ev);
60 void OnMouseMove(wxMouseEvent& ev);
61 void OnMouseRightDown(wxMouseEvent& ev);
62 void OnPaint(wxPaintEvent& ev);
63 void AfterEngineCall(wxProcessEvent& ev);
64 /* Public Vars */
65 wxChar results[KANJIPAD_MAX_KANJI];
67 private:
68 list<wxPoint> currentStroke;
69 list< list<wxPoint> > strokes;
70 bool isDrawing;
71 /* Related to running kpengine process */
72 wxProcess *kpengine;
73 wxInputStream *kpStdout, *kpStderr;
74 wxOutputStream *kpStdin;
75 long kpPid;
76 /* wxWidgets standard stuff */
77 DECLARE_EVENT_TABLE()
80 #endif