|
|
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:
1.1.1.3 ! root 13: #include "wxtextpanel.h"
1.1 root 14:
15: wxDECLARE_EVENT(NONO_EVT_SCROLL, wxScrollEvent);
16:
1.1.1.3 ! root 17: class WXScrollBar : public WXTextPanel
1.1 root 18: {
1.1.1.3 ! root 19: using inherited = WXTextPanel;
1.1 root 20:
21: public:
22: WXScrollBar(wxWindow *parent, wxWindowID id, long style);
23: ~WXScrollBar() override;
24:
1.1.1.3 ! root 25: void FontChanged() override;
! 26:
1.1 root 27: void SetScrollParam(int pos_, int thumbsize_, int range_, int pagesize_);
28:
1.1.1.3 ! root 29: bool SetThumbPosition(int pos_);
1.1 root 30:
31: int GetThumbPosition() const { return thumbpos; }
32: int GetThumbSize() const { return thumbsize; }
33: int GetRange() const { return range; }
34:
1.1.1.3 ! root 35: // コントロールの主方向(スクロール方向)の最小ピクセル数
! 36: int GetMinLength() const;
! 37:
1.1 root 38: void Draw() override;
39:
40: private:
41: void OnSize(wxSizeEvent& event);
42: void OnMouse(wxMouseEvent& event);
1.1.1.2 root 43: void OnTimer(wxTimerEvent& event);
1.1 root 44:
45: // つまみの位置を変更する (内部用)
46: void MoveThumb(int pos_);
47:
1.1.1.2 root 48: int PosCmp() const;
1.1 root 49:
50: bool is_vertical {};
51:
52: int thumbpos {}; // つまみの上(左)位置
53: int thumbsize {}; // つまみのサイズ
1.1.1.3 ! root 54: int thumbmin {}; // つまみの最小サイズ
1.1 root 55: int range {}; // スクロール領域の高さ(幅)
56: int pagesize {}; // ページアップ、ダウンの移動量
57:
58: int p1 {}; // つまみの上(左)ピクセル座標
59: int p2 {}; // つまみの下(右)ピクセル座標(開区間)
60: int range_px {}; // スクロール領域の高さ(幅)ピクセル
61:
62: int start_thumb; // ドラッグ開始時のつまみの位置
63: int start_px {}; // ドラッグ開始時のピクセル座標
64:
1.1.1.2 root 65: int mouse_px {}; // 直近のマウスカーソルのピクセル座標
66: bool left_click {}; // 左クリック継続中か
67:
68: wxTimer timer {};
69:
1.1 root 70: wxDECLARE_EVENT_TABLE();
71: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.