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

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);
                     38: 
                     39:        // つまみの位置を計算して再描画
                     40:        void RefreshThumb();
                     41: 
                     42:        // つまみの位置を変更する (内部用)
                     43:        void MoveThumb(int pos_);
                     44: 
                     45:        int PosCmp(const wxPoint& pt) const;
                     46: 
                     47:        bool is_vertical {};
                     48: 
                     49:        int thumbpos {};        // つまみの上(左)位置
                     50:        int thumbsize {};       // つまみのサイズ
                     51:        int range {};           // スクロール領域の高さ(幅)
                     52:        int pagesize {};        // ページアップ、ダウンの移動量
                     53: 
                     54:        int p1 {};                      // つまみの上(左)ピクセル座標
                     55:        int p2 {};                      // つまみの下(右)ピクセル座標(開区間)
                     56:        int range_px {};        // スクロール領域の高さ(幅)ピクセル
                     57: 
                     58:        int start_thumb;        // ドラッグ開始時のつまみの位置
                     59:        int start_px {};        // ドラッグ開始時のピクセル座標
                     60: 
                     61:        wxDECLARE_EVENT_TABLE();
                     62: };

unix.superglobalmegacorp.com

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