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

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 *);
                     18:        virtual ~WXMainView();
                     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       root       35:  private:
1.1.1.5 ! root       36:        void OnTimer(wxTimerEvent& event);
1.1       root       37:        void OnPaint(wxPaintEvent& event);
                     38:        void OnKeyDown(wxKeyEvent& event);
                     39:        void OnKeyUp(wxKeyEvent& event);
1.1.1.2   root       40:        void OnMouse(wxMouseEvent& event);
1.1       root       41: 
                     42:        // 裏バッファ。
                     43:        // VM がレンダリングするバッファ。
1.1.1.4   root       44:        std::unique_ptr<uint8[]> ImageBuf {};
1.1       root       45: 
                     46:        // 仮想画面サイズ (ピクセル)
                     47:        int rendwidth = 0;
                     48:        int rendheight = 0;
                     49: 
                     50:        // 実画面サイズ (ピクセル)
                     51:        int viewwidth = 0;
                     52:        int viewheight = 0;
                     53: 
                     54:        // 共通キーコードを取得する
                     55:        int GetKeyCode(wxKeyEvent& event);
                     56: 
                     57: #if defined(__WXGTK__)
                     58:        static const int keycode_table[0xd4];
                     59: #elif defined(__WXOSX__)
                     60:        static const int keycode_table[0x80];
                     61: #endif
                     62: 
1.1.1.2   root       63:        // マウスモード (キャプチャしていれば true)
                     64:        bool mousemode = false;
1.1.1.3   root       65:        // 前回のマウス座標とボタン
1.1.1.2   root       66:        wxPoint prevpos {};
1.1.1.3   root       67:        bool prevlb {};
                     68:        bool prevmb {};
                     69:        bool prevrb {};
                     70: 
1.1.1.2   root       71:        // WarpPointer() による移動検出用
                     72:        bool motion_by_warp_pointer = false;
                     73:        // マウスカーソルを移動させる
                     74:        void MyWarpPointer(wxSize pos);
                     75: 
1.1.1.5 ! root       76:        // 再描画を律速する
        !            77:        wxTimer timer {};
        !            78:        std::atomic<bool> paint_request {};
1.1       root       79: 
                     80:        wxDECLARE_EVENT_TABLE();
                     81: };
                     82: 
                     83: 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.