Annotation of nono/wx/wxscrollbar.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: //
                      8: // 独自スクロールバー
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "wxbitmappanel.h"
                     14: 
                     15: wxDECLARE_EVENT(NONO_EVT_SCROLL, wxScrollEvent);
                     16: 
                     17: class WXScrollBar : public WXBitmapPanel
                     18: {
                     19:        using inherited = WXBitmapPanel;
                     20: 
                     21:  public:
                     22:        WXScrollBar(wxWindow *parent, wxWindowID id, long style);
                     23:        ~WXScrollBar() override;
                     24: 
                     25:        void SetScrollParam(int pos_, int thumbsize_, int range_, int pagesize_);
                     26: 
                     27:        void SetThumbPosition(int pos_);
                     28: 
                     29:        int GetThumbPosition() const { return thumbpos; }
                     30:        int GetThumbSize() const { return thumbsize; }
                     31:        int GetRange() const { return range; }
                     32: 
                     33:        void Draw() override;
                     34: 
                     35:  private:
                     36:        void OnSize(wxSizeEvent& event);
                     37:        void OnMouse(wxMouseEvent& event);
1.1.1.2 ! root       38:        void OnTimer(wxTimerEvent& event);
1.1       root       39: 
                     40:        // つまみの位置を計算して再描画
                     41:        void RefreshThumb();
                     42: 
                     43:        // つまみの位置を変更する (内部用)
                     44:        void MoveThumb(int pos_);
                     45: 
1.1.1.2 ! root       46:        int PosCmp() const;
1.1       root       47: 
                     48:        bool is_vertical {};
                     49: 
                     50:        int thumbpos {};        // つまみの上(左)位置
                     51:        int thumbsize {};       // つまみのサイズ
                     52:        int range {};           // スクロール領域の高さ(幅)
                     53:        int pagesize {};        // ページアップ、ダウンの移動量
                     54: 
                     55:        int p1 {};                      // つまみの上(左)ピクセル座標
                     56:        int p2 {};                      // つまみの下(右)ピクセル座標(開区間)
                     57:        int range_px {};        // スクロール領域の高さ(幅)ピクセル
                     58: 
                     59:        int start_thumb;        // ドラッグ開始時のつまみの位置
                     60:        int start_px {};        // ドラッグ開始時のピクセル座標
                     61: 
1.1.1.2 ! root       62:        int mouse_px {};        // 直近のマウスカーソルのピクセル座標
        !            63:        bool left_click {};     // 左クリック継続中か
        !            64: 
        !            65:        wxTimer timer {};
        !            66: 
1.1       root       67:        wxDECLARE_EVENT_TABLE();
                     68: };

unix.superglobalmegacorp.com

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