1 | // Aseprite |
2 | // Copyright (C) 2001-2016 David Capello |
3 | // |
4 | // This program is distributed under the terms of |
5 | // the End-User License Agreement for Aseprite. |
6 | |
7 | #ifndef APP_UI_EDITOR_VIEW_H_INCLUDED |
8 | #define APP_UI_EDITOR_VIEW_H_INCLUDED |
9 | #pragma once |
10 | |
11 | #include "obs/connection.h" |
12 | #include "ui/view.h" |
13 | |
14 | namespace app { |
15 | class Editor; |
16 | |
17 | class EditorView : public ui::View { |
18 | public: |
19 | enum Type { CurrentEditorMode, AlwaysSelected }; |
20 | |
21 | enum Method { KeepOrigin, KeepCenter }; |
22 | static void SetScrollUpdateMethod(Method method); |
23 | |
24 | EditorView(Type type); |
25 | |
26 | protected: |
27 | void onPaint(ui::PaintEvent& ev) override; |
28 | void onResize(ui::ResizeEvent& ev) override; |
29 | void onSetViewScroll(const gfx::Point& pt) override; |
30 | void onScrollRegion(ui::ScrollRegionEvent& ev) override; |
31 | void onScrollChange() override; |
32 | |
33 | private: |
34 | Editor* editor(); |
35 | void setupScrollbars(); |
36 | |
37 | Type m_type; |
38 | obs::scoped_connection m_scrollSettingsConn; |
39 | static Method g_scrollUpdateMethod; |
40 | }; |
41 | |
42 | } // namespace app |
43 | |
44 | #endif // APP_UI_EDITOR_VIEW_H_INCLUDED |
45 | |