|
|
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:
7: #pragma once
8:
1.1.1.9 ! root 9: #include "wxnono.h"
1.1 root 10: #include <atomic>
11:
1.1.1.9 ! root 12: class WXMainView : public wxPanel
1.1 root 13: {
1.1.1.4 root 14: using inherited = wxPanel;
1.1 root 15: public:
16: WXMainView(wxWindow *);
1.1.1.7 root 17: virtual ~WXMainView() override;
1.1 root 18:
19: void DoRefresh();
20: void DoResize(double scale);
21:
22: // 現在のスケールを返す
23: double GetScale() const;
24: // 現在のスケール (wxapp が初期値を指定するため static 変数にしてある)
25: static double screen_scale;
26:
1.1.1.2 root 27: // マウスモードを設定
28: void SetMouseMode(bool enable);
29: // マウスモードを取得 (キャプチャされているなら true)
30: bool GetMouseMode() const { return mousemode; }
1.1.1.4 root 31: // アクティベートイベント
32: void OnActivate(wxActivateEvent& event);
1.1.1.2 root 33:
1.1.1.8 root 34: // キー入力イベント (WXSoftKeyPanel からも呼ばれる)
35: void OnKeyDown(wxKeyEvent& event);
36: void OnKeyUp(wxKeyEvent& event);
37:
1.1 root 38: private:
1.1.1.5 root 39: void OnTimer(wxTimerEvent& event);
1.1 root 40: void OnPaint(wxPaintEvent& event);
1.1.1.2 root 41: void OnMouse(wxMouseEvent& event);
1.1 root 42:
43: // 裏バッファ。
44: // VM がレンダリングするバッファ。
1.1.1.4 root 45: std::unique_ptr<uint8[]> ImageBuf {};
1.1 root 46:
47: // 仮想画面サイズ (ピクセル)
1.1.1.6 root 48: int rendwidth {};
49: int rendheight {};
1.1 root 50:
51: // 実画面サイズ (ピクセル)
1.1.1.6 root 52: int viewwidth {};
53: int viewheight {};
1.1 root 54:
55: // 共通キーコードを取得する
56: int GetKeyCode(wxKeyEvent& event);
57:
1.1.1.8 root 58: static const int keycode_table[0x190];
1.1 root 59:
1.1.1.2 root 60: // マウスモード (キャプチャしていれば true)
1.1.1.6 root 61: bool mousemode {};
1.1.1.3 root 62: // 前回のマウス座標とボタン
1.1.1.2 root 63: wxPoint prevpos {};
1.1.1.3 root 64: bool prevlb {};
65: bool prevmb {};
66: bool prevrb {};
67:
1.1.1.2 root 68: // WarpPointer() による移動検出用
1.1.1.6 root 69: bool motion_by_warp_pointer {};
1.1.1.2 root 70: // マウスカーソルを移動させる
71: void MyWarpPointer(wxSize pos);
72:
1.1.1.5 root 73: // 再描画を律速する
74: wxTimer timer {};
75: std::atomic<bool> paint_request {};
1.1 root 76:
77: wxDECLARE_EVENT_TABLE();
78: };
79:
80: extern WXMainView *gMainView;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.