--- nono/wx/wxmonitor.h 2026/04/29 17:05:08 1.1.1.7 +++ nono/wx/wxmonitor.h 2026/04/29 17:05:12 1.1.1.8 @@ -11,8 +11,36 @@ #pragma once #include "wxsubwindow.h" +#include "wxtextscreen.h" +#include "wxscrollbar.h" #include "monitor.h" +// モニタパネル +class WXMonitorPanel : public WXTextScreen +{ + using inherited = WXTextScreen; + public: + WXMonitorPanel(wxWindow *parent, Monitor& monitor_); + virtual ~WXMonitorPanel() override; + + // 画面を更新して再描画する。 + 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; @@ -22,6 +50,40 @@ class WXMonitorWindow : public WXSubWind virtual ~WXMonitorWindow() override; protected: - // テキストスクリーン - WXTextScreen *screen {}; + // モニタパネル + WXMonitorPanel *monpanel {}; +}; + +// 縦スクロールバー付きモニタウィンドウ +class WXScrollMonitorWindow : public WXSubWindow +{ + using inherited = WXSubWindow; + public: + WXScrollMonitorWindow(wxWindow *parent, const wxString& name, + Monitor& monitor_); + virtual ~WXScrollMonitorWindow() override; + + bool Layout() override; + + private: + // サイズ変更イベント + void OnSize(wxSizeEvent& event); + + // マウスホイールイベント + void OnMouseWheel(wxMouseEvent&); + + // スクロールイベント + void OnScroll(wxScrollEvent& event); + + // スクロール処理 + void DoScroll(int pos); + + // モニタパネル + WXMonitorPanel *monpanel {}; + + // スクロールバー + WXScrollBar *vscroll {}; + + // イベントテーブル + wxDECLARE_EVENT_TABLE(); };