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

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2022 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // 独自ボタン
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "wxtextpanel.h"
                     14: 
                     15: wxDECLARE_EVENT(NONO_EVT_BUTTON, wxCommandEvent);
                     16: 
                     17: class WXButton : public WXTextPanel
                     18: {
                     19:        using inherited = WXTextPanel;
                     20:  public:
                     21:        // 引数の並び順は標準スタイルとは変えてある
                     22:        WXButton(wxWindow *parent, wxWindowID id, const wxSize& size,
                     23:                const wxString& text_,
                     24:                const wxPoint& position = wxDefaultPosition);
                     25:        ~WXButton() override;
                     26: 
                     27:        void FontChanged() override;
1.1.1.2 ! root       28:        void Fit() override;
1.1       root       29: 
                     30:        bool Enable(bool enable_) override;
                     31: 
                     32:  private:
1.1.1.2 ! root       33:        void OnSize(wxSizeEvent&);
        !            34: 
1.1       root       35:        void OnMouse(wxMouseEvent& event);
                     36:        void OnTimer(wxTimerEvent& event);
                     37: 
                     38:        // ボタンが押されていれば true。
                     39:        bool IsPressed() const { return pressed; }
                     40: 
                     41:        // ボタンを押すか離した時の内部処理
                     42:        void Press(bool press);
                     43: 
                     44:        void Draw() override;
                     45: 
                     46:        // ボタン上のテキスト
                     47:        std::string sjistext {};
                     48: 
                     49:        // テキスト領域の大きさ
                     50:        wxSize textsize {};
                     51: 
                     52:        // テキスト描画開始の左上座標
                     53:        wxPoint textpos {};
                     54: 
                     55:        // ボタン押下中なら true
                     56:        bool pressed {};
                     57: 
                     58:        // キーリピート風動作のためのタイマーイベント
                     59:        wxTimer timer {};
                     60: 
                     61:        // イベントテーブル
                     62:        wxDECLARE_EVENT_TABLE();
                     63: };

unix.superglobalmegacorp.com

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