forked from adlr/PDFSketch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll_view.h
49 lines (36 loc) · 1.2 KB
/
scroll_view.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright...
#ifndef PDFSKETCH_SCROLL_VIEW_H__
#define PDFSKETCH_SCROLL_VIEW_H__
#include "scroll_bar_view.h"
#include "view.h"
namespace pdfsketch {
class ScrollView : public View,
public ScrollBarDelegate,
public ViewDelegate {
public:
ScrollView();
virtual std::string Name() const { return "ScrollView"; }
// Adds document as a subview of this:
void SetDocumentView(View* document);
void MoveDocPointToVisibleCenter(const Point& center);
virtual void Resize(const Size& size);
// ScrollBarDelegate method:
virtual void ScrollBarMovedTo(ScrollBarView* scroll_bar, double show_min);
// ViewDelegate method
virtual void ViewFrameChanged(View* view, const Rect& frame,
const Rect& old_frame);
virtual void OnScrollEvent(const ScrollInputEvent& event);
private:
void RepositionSubviews();
View* document_{nullptr};
Point doc_visible_center_;
Size doc_size_;
bool handling_doc_frame_changed_{false};
ScrollBarView h_scroller_{false};
bool h_visible_{false};
ScrollBarView v_scroller_{true};
bool v_visible_{false};
View clip_view_;
};
} // namespace pdfsketch
#endif // PDFSKETCH_SCROLL_VIEW_H__