1 // Aseprite UI Library 2 // Copyright (C) 2001-2017 David Capello 3 // 4 // This file is released under the terms of the MIT license. 5 // Read LICENSE.txt for more information. 6 7 #ifndef UI_INT_ENTRY_H_INCLUDED 8 #define UI_INT_ENTRY_H_INCLUDED 9 #pragma once 10 11 #include "ui/entry.h" 12 #include "ui/slider.h" 13 14 namespace ui { 15 16 class CloseEvent; 17 class PopupWindow; 18 19 class IntEntry : public Entry { 20 public: 21 IntEntry(int min, int max, SliderDelegate* sliderDelegate = nullptr); 22 ~IntEntry(); 23 24 int getValue() const; 25 void setValue(int value); 26 27 protected: 28 bool onProcessMessage(Message* msg) override; 29 void onInitTheme(InitThemeEvent& ev) override; 30 void onSizeHint(SizeHintEvent& ev) override; 31 void onChange() override; 32 33 // New events 34 virtual void onValueChange(); 35 36 private: 37 void openPopup(); 38 void closePopup(); 39 void onChangeSlider(); 40 void onPopupClose(CloseEvent& ev); 41 void removeSlider(); 42 43 int m_min; 44 int m_max; 45 Slider m_slider; 46 PopupWindow* m_popupWindow; 47 bool m_changeFromSlider; 48 }; 49 50 } // namespace ui 51 52 #endif 53