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