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

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;
                     28: 
                     29:        bool Enable(bool enable_) override;
                     30: 
                     31:  private:
                     32:        void OnMouse(wxMouseEvent& event);
                     33:        void OnTimer(wxTimerEvent& event);
                     34: 
                     35:        // ボタンが押されていれば true。
                     36:        bool IsPressed() const { return pressed; }
                     37: 
                     38:        // ボタンを押すか離した時の内部処理
                     39:        void Press(bool press);
                     40: 
                     41:        void Draw() override;
                     42: 
                     43:        // ボタン上のテキスト
                     44:        std::string sjistext {};
                     45: 
                     46:        // テキスト領域の大きさ
                     47:        wxSize textsize {};
                     48: 
                     49:        // テキスト描画開始の左上座標
                     50:        wxPoint textpos {};
                     51: 
                     52:        // ボタン押下中なら true
                     53:        bool pressed {};
                     54: 
                     55:        // キーリピート風動作のためのタイマーイベント
                     56:        wxTimer timer {};
                     57: 
                     58:        // イベントテーブル
                     59:        wxDECLARE_EVENT_TABLE();
                     60: };

unix.superglobalmegacorp.com

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