1// Aseprite UI Library
2// Copyright (C) 2021 Igara Studio S.A.
3// Copyright (C) 2001-2017 David Capello
4//
5// This file is released under the terms of the MIT license.
6// Read LICENSE.txt for more information.
7
8#ifndef UI_SPLITTER_H_INCLUDED
9#define UI_SPLITTER_H_INCLUDED
10#pragma once
11
12#include "ui/widget.h"
13
14namespace ui {
15
16 class Splitter : public Widget {
17 public:
18 enum Type { ByPercentage, ByPixel };
19
20 Splitter(Type type, int align);
21
22 double getPosition() const { return m_userPos; }
23 void setPosition(double pos);
24
25 protected:
26 // Events
27 bool onProcessMessage(Message* msg) override;
28 void onInitTheme(InitThemeEvent& ev) override;
29 void onResize(ResizeEvent& ev) override;
30 void onSizeHint(SizeHintEvent& ev) override;
31 void onLoadLayout(LoadLayoutEvent& ev) override;
32 void onSaveLayout(SaveLayoutEvent& ev) override;
33
34 virtual void onPositionChange();
35
36 private:
37 Widget* panel1() const;
38 Widget* panel2() const;
39 void calcPos();
40
41 Type m_type;
42 double m_userPos, m_pos;
43 int m_guiscale;
44 };
45
46} // namespace ui
47
48#endif
49