|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // スクリーンモニタ
9: //
10:
11: #pragma once
12:
13: #include "wxbitmappanel.h"
14: #include "wxsubwindow.h"
15:
16: class WXScrollBar;
17:
18: // スクリーンパネル (共通部)
19: class WXScreenPanel : public WXBitmapPanel
20: {
21: using inherited = WXBitmapPanel;
22:
23: public:
24: WXScreenPanel(wxWindow *parent);
25: ~WXScreenPanel() override;
26:
27: int GetVirtualWidth() const { return virtual_width; }
28: int GetVirtualHeight() const { return virtual_height; }
29: const wxPoint& GetCursor() const { return cursor; }
30:
31: void SetScale(int new_scale);
32:
33: void OnScroll(wxScrollEvent&);
34:
35: // 現在表示中のビュー (virtual_size 座標系)
36: Rect view {};
37:
38: protected:
39: // コンストラクタの後半。
40: void Ctor(int screen_width_, int screen_height_);
41:
42: void OnMouseMove(wxMouseEvent&);
43: void OnMouseWheel(wxMouseEvent&);
44:
45: // 拡大前のビットマップの大きさ (TVRAM なら 1024x1024 など)
46: int plane_width {};
47: int plane_height {};
48:
49: // 拡大後のビットマップの大きさ
50: int virtual_width {};
51: int virtual_height {};
52: // 倍率
53: int scale {};
54:
55: // マウスカーソルがこのパネル上にあればその座標。拡大前ビットマップ座標系。
56: // マウスカーソルがパネル外なら wxDefaultPosition とする。
57: wxPoint cursor {};
58:
59: // イベントテーブル
60: wxDECLARE_EVENT_TABLE();
61: };
62:
63: // スクリーンモニタウィンドウ (共通部)
64: class WXScreenWindow : public WXSubWindow
65: {
66: using inherited = WXSubWindow;
67:
68: public:
69: WXScreenWindow(wxWindow *parent, const wxString& name);
70: ~WXScreenWindow() override;
71:
72: bool Layout() override;
73:
74: // 縦スクロールバーの位置を設定する。(パネルから呼ばれる)
75: void SetVScrollPosition(int);
76:
77: protected:
78: // コンストラクタの共通部。
79: void Ctor();
80:
81: // ステータス部の更新。
82: virtual void UpdateInfo(TextScreen&, int px, int py) = 0;
83:
84: void OnScale(wxCommandEvent&);
85: void DoScale(int scale_index_);
86: void OnTimer(wxTimerEvent&);
87:
88: bool GetMySizeHints(wxSize *, wxSize *, wxSize *, wxSize *) override;
89: void SetScroll();
90:
91: // コントロールパネル
92: wxPanel *ctrlpanel {};
93: // ステータスパネル
94: WXTextScreen *statuspanel {};
95: WXBitmapPanel *spacer {}; // ステータスパネル右の空き地用
96: // グラフィックパネル
97: WXScreenPanel *viewpanel {};
98: WXScrollBar *vscroll {};
99: WXScrollBar *hscroll {};
100: WXBitmapPanel *corner {}; // 右下の空き地
101:
102: // タイマー
103: wxTimer timer {};
104:
105: // イベントテーブル
106: wxDECLARE_EVENT_TABLE();
107: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.