--- nono/wx/wxmonitor.h 2026/04/29 17:04:43 1.1.1.4 +++ nono/wx/wxmonitor.h 2026/04/29 17:05:12 1.1.1.8 @@ -4,23 +4,86 @@ // Licensed under nono-license.txt // +// +// モニターウィンドウ +// + #pragma once #include "wxsubwindow.h" -#include "object.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; public: - WXMonitorWindow(wxWindow *parent, wxWindowID id, const wxString& name, - IMonitor& monitor_); - virtual ~WXMonitorWindow(); + WXMonitorWindow(wxWindow *parent, const wxString& name, + Monitor& monitor_); + virtual ~WXMonitorWindow() override; + + protected: + // モニタパネル + 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: - // テキストスクリーン - WXTextScreen *screen {}; + // サイズ変更イベント + void OnSize(wxSizeEvent& event); + + // マウスホイールイベント + void OnMouseWheel(wxMouseEvent&); + + // スクロールイベント + void OnScroll(wxScrollEvent& event); + + // スクロール処理 + void DoScroll(int pos); + + // モニタパネル + WXMonitorPanel *monpanel {}; + + // スクロールバー + WXScrollBar *vscroll {}; + + // イベントテーブル + wxDECLARE_EVENT_TABLE(); };