|
|
1.1 root 1: //
2: // nono
1.1.1.4 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
1.1.1.11 root 7: //
8: // メイン画面パネル
9: //
10:
1.1 root 11: #pragma once
12:
1.1.1.9 root 13: #include "wxnono.h"
1.1 root 14:
1.1.1.13 root 15: wxDECLARE_EVENT(NONO_EVT_MOUSEMODE, wxCommandEvent);
16:
1.1.1.15 root 17: class DumbKeyboard;
1.1.1.13 root 18: class Keyboard;
1.1.1.17! root 19: class VideoRenderer;
1.1.1.13 root 20:
1.1.1.9 root 21: class WXMainView : public wxPanel
1.1 root 22: {
1.1.1.4 root 23: using inherited = wxPanel;
1.1 root 24: public:
1.1.1.14 root 25: explicit WXMainView(wxWindow *);
1.1.1.16 root 26: ~WXMainView() override;
1.1 root 27:
1.1.1.10 root 28: bool Init();
29:
1.1.1.11 root 30: void Close();
1.1 root 31: void DoResize(double scale);
32:
33: // 現在のスケールを返す
34: double GetScale() const;
35: // 現在のスケール (wxapp が初期値を指定するため static 変数にしてある)
36: static double screen_scale;
37:
1.1.1.10 root 38: // 文字入力モードを取得・設定
39: bool GetCharInputMode() const { return is_charinput; }
40: void SetCharInputMode(bool enable);
41:
1.1.1.2 root 42: // マウスモードを設定
43: void SetMouseMode(bool enable);
44: // マウスモードを取得 (キャプチャされているなら true)
45: bool GetMouseMode() const { return mousemode; }
1.1.1.4 root 46: // アクティベートイベント
47: void OnActivate(wxActivateEvent& event);
1.1.1.2 root 48:
1.1.1.8 root 49: // キー入力イベント (WXSoftKeyPanel からも呼ばれる)
50: void OnKeyDown(wxKeyEvent& event);
51: void OnKeyUp(wxKeyEvent& event);
1.1.1.10 root 52: void OnChar(wxKeyEvent& event);
1.1.1.8 root 53:
1.1 root 54: private:
1.1.1.5 root 55: void OnTimer(wxTimerEvent& event);
1.1 root 56: void OnPaint(wxPaintEvent& event);
1.1.1.2 root 57: void OnMouse(wxMouseEvent& event);
1.1.1.12 root 58: void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
1.1.1.11 root 59: void OnRender(wxCommandEvent& event);
1.1.1.13 root 60: void OnMouseMode(wxCommandEvent& event);
1.1 root 61:
62: // 実画面サイズ (ピクセル)
1.1.1.6 root 63: int viewwidth {};
64: int viewheight {};
1.1 root 65:
66: // 共通キーコードを取得する
67: int GetKeyCode(wxKeyEvent& event);
68:
1.1.1.8 root 69: static const int keycode_table[0x190];
1.1 root 70:
1.1.1.10 root 71: // 文字入力モードなら true
72: bool is_charinput {};
73:
1.1.1.2 root 74: // マウスモード (キャプチャしていれば true)
1.1.1.6 root 75: bool mousemode {};
1.1.1.3 root 76: // 前回のマウス座標とボタン
1.1.1.2 root 77: wxPoint prevpos {};
1.1.1.3 root 78: bool prevlb {};
79: bool prevmb {};
80: bool prevrb {};
81:
1.1.1.2 root 82: // WarpPointer() による移動検出用
1.1.1.6 root 83: bool motion_by_warp_pointer {};
1.1.1.2 root 84: // マウスカーソルを移動させる
85: void MyWarpPointer(wxSize pos);
86:
1.1.1.15 root 87: DumbKeyboard *dumbkbd {};
88: Keyboard *richkbd {};
1.1.1.17! root 89: VideoRenderer *renderer {};
1.1.1.13 root 90:
1.1 root 91: wxDECLARE_EVENT_TABLE();
92: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.