Annotation of nono/wx/wxstatuspanel.h, revision 1.1.1.2

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2021 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: #pragma once
                      8: 
1.1.1.2 ! root        9: #include "wxnono.h"
        !            10: #include "wxbitmapbuf.h"
1.1       root       11: #include "wxtextpanel.h"
                     12: #include "scsibus.h"
                     13: 
                     14: class Indicator;
                     15: class WXStatusPanel;
                     16: 
                     17: // インジケータ情報
                     18: class Indicator
                     19: {
                     20:        using dispfunc_t = void (WXStatusPanel::*)(wxDC&, const Indicator&);
                     21:        using dclickfunc_t = void (WXStatusPanel::*)(const Indicator&);
                     22:  public:
                     23:        Indicator(const std::string& text_, dispfunc_t draw_, int data_)
                     24:                : Indicator(text_, draw_)
                     25:        {
                     26:                userdata = data_;
                     27:        }
                     28:        Indicator(const std::string& text_, dispfunc_t draw_) {
                     29:                text = text_;
                     30:                draw = draw_;
                     31:        }
                     32: 
                     33:        // 表示する文字列。
                     34:        // 描画関数はこの文字列を使っても使わなくてもよいが、InitIndicators() が
                     35:        // この文字数に応じた大きさの枠を用意するため、使わない場合でも文字数
                     36:        // だけは揃えておくこと。
                     37:        std::string text {};
                     38: 
                     39:        // 描画関数
                     40:        dispfunc_t draw {};
                     41: 
                     42:        // ダブルクリックの処理関数
                     43:        dclickfunc_t dclick {};
                     44: 
                     45:        // ユーザデータ (ご自由にお使いください、SCSI ID とか)
                     46:        int userdata {};
                     47: 
                     48:        // 枠の位置と大きさ (実行時に計算する)
                     49:        wxRect rect {};
                     50: };
                     51: 
                     52: // ステータスパネル
                     53: class WXStatusPanel : public WXTextPanel
                     54: {
                     55:        using inherited = WXTextPanel;
                     56:  public:
                     57:        WXStatusPanel(wxWindow *parent);
                     58:        virtual ~WXStatusPanel() override;
                     59: 
                     60:        void SetFontSize(FontId) override;
                     61: 
                     62:  private:
                     63:        void OnClose(wxCloseEvent&);
                     64:        void OnShow(wxShowEvent&);
                     65:        void OnSize(wxSizeEvent&);
                     66:        void OnTimer(wxTimerEvent&);
                     67:        void OnPaint(wxPaintEvent&);
                     68:        void OnLeftDClick(wxMouseEvent&);
                     69: 
                     70:        void DoSize();
                     71:        bool UpdateStat();
                     72:        void Draw(wxDC&);
                     73:        void InitIndicators();
                     74:        void LayoutIndicators();
                     75:        void DrawPerf(wxDC&, const Indicator&);
                     76:        void DrawSCSI(wxDC&, const Indicator&);
                     77:        void DrawNet(wxDC&, const Indicator&);
                     78:        void DrawPower(wxDC&, const Indicator&);
                     79:        void DrawTextLED(wxDC&, const Indicator&,
                     80:                const wxColour& fg, const wxColour& bg);
                     81:        void DClickPerf(const Indicator&);
                     82: 
                     83:        // コントロール全域のビットマップ
1.1.1.2 ! root       84:        WXBitmapBuf bitmap {};
1.1       root       85: 
                     86:        // インジケータ情報
                     87:        std::vector<Indicator> indicators {};
                     88: 
                     89:        // インジケータ表示用
                     90:        bool ispower {};
                     91:        int perf_mode {};
                     92:        int perf_rate {};
                     93:        std::shared_ptr<SCSIBus> scsibus {};
                     94:        uint8 scsi_bsy {};
1.1.1.2 ! root       95:        bool scsi_out {};
        !            96:        enum {
        !            97:                NOT_AVAILABLE = -1,     // 存在しない (Nereid なし X68k とか)
        !            98:                DISABLE = 0,            // 存在してホスト側が無効 (driver = none)
        !            99:                ENABLE = 1,                     // 存在してホスト側が有効
        !           100:        } net_ok {};
        !           101:        uint64 net_tx_pkts {};
        !           102:        uint64 net_rx_pkts {};
        !           103:        bool net_tx_active {};
        !           104:        bool net_rx_active {};
1.1       root      105: 
                    106:        // タイマー
                    107:        wxTimer timer {};
                    108: 
                    109:        // イベントテーブル
                    110:        wxDECLARE_EVENT_TABLE();
                    111: };
                    112: 
                    113: extern WXStatusPanel *gStatusPanel;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.