Annotation of nono/wx/wxmainview.h, revision 1.1.1.10

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: 
1.1.1.10! root       19:        bool Init();
        !            20: 
1.1       root       21:        void DoRefresh();
                     22:        void DoResize(double scale);
                     23: 
                     24:        // 現在のスケールを返す
                     25:        double GetScale() const;
                     26:        // 現在のスケール (wxapp が初期値を指定するため static 変数にしてある)
                     27:        static double screen_scale;
                     28: 
1.1.1.10! root       29:        // 文字入力モードを取得・設定
        !            30:        bool GetCharInputMode() const { return is_charinput; }
        !            31:        void SetCharInputMode(bool enable);
        !            32: 
1.1.1.2   root       33:        // マウスモードを設定
                     34:        void SetMouseMode(bool enable);
                     35:        // マウスモードを取得 (キャプチャされているなら true)
                     36:        bool GetMouseMode() const { return mousemode; }
1.1.1.4   root       37:        // アクティベートイベント
                     38:        void OnActivate(wxActivateEvent& event);
1.1.1.2   root       39: 
1.1.1.8   root       40:        // キー入力イベント (WXSoftKeyPanel からも呼ばれる)
                     41:        void OnKeyDown(wxKeyEvent& event);
                     42:        void OnKeyUp(wxKeyEvent& event);
1.1.1.10! root       43:        void OnChar(wxKeyEvent& event);
1.1.1.8   root       44: 
1.1       root       45:  private:
1.1.1.5   root       46:        void OnTimer(wxTimerEvent& event);
1.1       root       47:        void OnPaint(wxPaintEvent& event);
1.1.1.2   root       48:        void OnMouse(wxMouseEvent& event);
1.1       root       49: 
                     50:        // 裏バッファ。
                     51:        // VM がレンダリングするバッファ。
1.1.1.4   root       52:        std::unique_ptr<uint8[]> ImageBuf {};
1.1       root       53: 
                     54:        // 仮想画面サイズ (ピクセル)
1.1.1.6   root       55:        int rendwidth {};
                     56:        int rendheight {};
1.1       root       57: 
                     58:        // 実画面サイズ (ピクセル)
1.1.1.6   root       59:        int viewwidth {};
                     60:        int viewheight {};
1.1       root       61: 
                     62:        // 共通キーコードを取得する
                     63:        int GetKeyCode(wxKeyEvent& event);
                     64: 
1.1.1.8   root       65:        static const int keycode_table[0x190];
1.1       root       66: 
1.1.1.10! root       67:        // 文字入力モードなら true
        !            68:        bool is_charinput {};
        !            69: 
1.1.1.2   root       70:        // マウスモード (キャプチャしていれば true)
1.1.1.6   root       71:        bool mousemode {};
1.1.1.3   root       72:        // 前回のマウス座標とボタン
1.1.1.2   root       73:        wxPoint prevpos {};
1.1.1.3   root       74:        bool prevlb {};
                     75:        bool prevmb {};
                     76:        bool prevrb {};
                     77: 
1.1.1.2   root       78:        // WarpPointer() による移動検出用
1.1.1.6   root       79:        bool motion_by_warp_pointer {};
1.1.1.2   root       80:        // マウスカーソルを移動させる
                     81:        void MyWarpPointer(wxSize pos);
                     82: 
1.1.1.5   root       83:        // 再描画を律速する
                     84:        wxTimer timer {};
                     85:        std::atomic<bool> paint_request {};
1.1       root       86: 
                     87:        wxDECLARE_EVENT_TABLE();
                     88: };
                     89: 
                     90: extern WXMainView *gMainView;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.