1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #ifndef SPIN_BOX_H
- #define SPIN_BOX_H
- #include "scene/gui/line_edit.h"
- #include "scene/gui/range.h"
- #include "scene/main/timer.h"
- class SpinBox : public Range {
- GDCLASS(SpinBox, Range);
- LineEdit *line_edit;
- int last_w;
- Timer *range_click_timer;
- void _range_click_timeout();
- void _text_entered(const String &p_string);
- virtual void _value_changed(double);
- String prefix;
- String suffix;
- void _line_edit_input(const Ref<InputEvent> &p_event);
- struct Drag {
- float base_val;
- bool allowed;
- bool enabled;
- Vector2 capture_pos;
- float diff_y;
- } drag;
- void _line_edit_focus_exit();
- inline void _adjust_width_for_icon(const Ref<Texture> icon);
- protected:
- void _gui_input(const Ref<InputEvent> &p_event);
- void _notification(int p_what);
- static void _bind_methods();
- public:
- LineEdit *get_line_edit();
- virtual Size2 get_minimum_size() const;
- void set_align(LineEdit::Align p_align);
- LineEdit::Align get_align() const;
- void set_editable(bool p_editable);
- bool is_editable() const;
- void set_suffix(const String &p_suffix);
- String get_suffix() const;
- void set_prefix(const String &p_prefix);
- String get_prefix() const;
- SpinBox();
- };
- #endif
|