--- nono/wx/wxmainview.h 2026/04/29 17:04:33 1.1.1.3 +++ nono/wx/wxmainview.h 2026/04/29 17:04:45 1.1.1.7 @@ -1,19 +1,21 @@ // // nono -// Copyright (C) 2018 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // #pragma once +#include "wxheader.h" #include class WXMainView : public wxPanel { - typedef wxPanel inherited; + using inherited = wxPanel; public: WXMainView(wxWindow *); - virtual ~WXMainView(); + virtual ~WXMainView() override; void DoRefresh(); void DoResize(double scale); @@ -27,27 +29,27 @@ class WXMainView void SetMouseMode(bool enable); // マウスモードを取得 (キャプチャされているなら true) bool GetMouseMode() const { return mousemode; } + // アクティベートイベント + void OnActivate(wxActivateEvent& event); private: + void OnTimer(wxTimerEvent& event); void OnPaint(wxPaintEvent& event); - - void DoPaint(wxDC &dc); - void OnKeyDown(wxKeyEvent& event); void OnKeyUp(wxKeyEvent& event); void OnMouse(wxMouseEvent& event); // 裏バッファ。 // VM がレンダリングするバッファ。 - uint8_t *ImageBuf = NULL; + std::unique_ptr ImageBuf {}; // 仮想画面サイズ (ピクセル) - int rendwidth = 0; - int rendheight = 0; + int rendwidth {}; + int rendheight {}; // 実画面サイズ (ピクセル) - int viewwidth = 0; - int viewheight = 0; + int viewwidth {}; + int viewheight {}; // 共通キーコードを取得する int GetKeyCode(wxKeyEvent& event); @@ -59,7 +61,7 @@ class WXMainView #endif // マウスモード (キャプチャしていれば true) - bool mousemode = false; + bool mousemode {}; // 前回のマウス座標とボタン wxPoint prevpos {}; bool prevlb {}; @@ -67,13 +69,13 @@ class WXMainView bool prevrb {}; // WarpPointer() による移動検出用 - bool motion_by_warp_pointer = false; + bool motion_by_warp_pointer {}; // マウスカーソルを移動させる void MyWarpPointer(wxSize pos); - wxTimer paintTimer; - std::atomic paintRequested {}; - void OnTimer(wxTimerEvent& event); + // 再描画を律速する + wxTimer timer {}; + std::atomic paint_request {}; wxDECLARE_EVENT_TABLE(); };