1// Aseprite UI Library
2// Copyright (C) 2022 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_INT_ENTRY_H_INCLUDED
9#define UI_INT_ENTRY_H_INCLUDED
10#pragma once
11
12#include "ui/entry.h"
13#include "ui/slider.h"
14
15#include <memory>
16
17namespace ui {
18
19 class CloseEvent;
20 class PopupWindow;
21
22 class IntEntry : public Entry {
23 public:
24 IntEntry(int min, int max, SliderDelegate* sliderDelegate = nullptr);
25 ~IntEntry();
26
27 int getValue() const;
28 void setValue(int value);
29
30 protected:
31 bool onProcessMessage(Message* msg) override;
32 void onInitTheme(InitThemeEvent& ev) override;
33 void onSizeHint(SizeHintEvent& ev) override;
34 void onChange() override;
35
36 // New events
37 virtual void onValueChange();
38
39 private:
40 void openPopup();
41 void closePopup();
42 void onChangeSlider();
43 void onPopupClose(CloseEvent& ev);
44 void removeSlider();
45
46 int m_min;
47 int m_max;
48 Slider m_slider;
49 std::unique_ptr<PopupWindow> m_popupWindow;
50 bool m_changeFromSlider;
51 };
52
53} // namespace ui
54
55#endif
56