--- nono/wx/wxmonitor.h 2026/04/29 17:05:08 1.1.1.7 +++ nono/wx/wxmonitor.h 2026/04/29 17:05:57 1.1.1.13 @@ -11,17 +11,78 @@ #pragma once #include "wxsubwindow.h" -#include "monitor.h" +#include "wxtextscreen.h" +#include "wxscrollbar.h" +// モニタパネル +class WXMonitorPanel : public WXTextScreen +{ + using inherited = WXTextScreen; + public: + WXMonitorPanel(wxWindow *parent, Monitor *monitor_); + ~WXMonitorPanel() override; + + void FontChanged() override; + + // 画面を更新して再描画する。 + virtual void DoRefresh(); + + // 更新頻度設定 + void SetRate(int hz); + + Monitor *GetMonitor() const { return monitor; } + + private: + void OnTimer(wxTimerEvent&); + + Monitor *monitor {}; + wxTimer timer {}; + + wxDECLARE_EVENT_TABLE(); +}; + +// モニタウィンドウ (サイズ固定) class WXMonitorWindow : public WXSubWindow { using inherited = WXSubWindow; public: WXMonitorWindow(wxWindow *parent, const wxString& name, - Monitor& monitor_); - virtual ~WXMonitorWindow() override; + Monitor *monitor_); + ~WXMonitorWindow() override; + + protected: + // モニタパネル + WXMonitorPanel *monpanel {}; +}; + +// 縦スクロールバー付きモニタウィンドウ +class WXScrollMonitorWindow : public WXSubWindow +{ + using inherited = WXSubWindow; + public: + WXScrollMonitorWindow(wxWindow *parent, const wxString& name, + Monitor *monitor_); + ~WXScrollMonitorWindow() override; + + void FontChanged() override; + bool Layout() override; protected: - // テキストスクリーン - WXTextScreen *screen {}; + // モニタパネル + WXMonitorPanel *monpanel {}; + + private: + bool GetMySizeHints(wxSize *, wxSize *, wxSize *, wxSize *) override; + + // マウスホイールイベント + void OnMouseWheel(wxMouseEvent&); + + // スクロールイベント + void OnScroll(wxScrollEvent& event); + + // スクロール処理 + void DoScroll(int pos); + + // スクロールバー + WXScrollBar *vscroll {}; };