color_ramp_edit.h
1 #ifndef SCENE_GUI_COLOR_RAMP_EDIT_H_
2 #define SCENE_GUI_COLOR_RAMP_EDIT_H_
3 
4 #include "scene/gui/popup.h"
5 #include "scene/gui/color_picker.h"
6 #include "scene/resources/color_ramp.h"
7 #include "scene/resources/default_theme/theme_data.h"
8 
9 #define POINT_WIDTH 8
10 
11 class ColorRampEdit : public Control {
12 
13  OBJ_TYPE(ColorRampEdit,Control);
14 
15  PopupPanel *popup;
16  ColorPicker *picker;
17 
18  Ref<ImageTexture> checker;
19 
20  bool grabbing;
21  int grabbed;
23 
24  void _draw_checker(int x, int y, int w, int h);
25  void _color_changed(const Color& p_color);
26  int _get_point_from_pos(int x);
27  void _show_color_picker();
28 
29 protected:
30  void _input_event(const InputEvent& p_event);
31  void _notification(int p_what);
32  static void _bind_methods();
33 
34 public:
35  void set_ramp(const Vector<float>& p_offsets,const Vector<Color>& p_colors);
36  Vector<float> get_offsets() const;
37  Vector<Color> get_colors() const;
38  void set_points(Vector<ColorRamp::Point>& p_points);
39  Vector<ColorRamp::Point>& get_points();
40  virtual Size2 get_minimum_size() const;
41 
42  ColorRampEdit();
43  virtual ~ColorRampEdit();
44 };
45 
46 /*class ColorRampEditPanel : public Panel
47 {
48  OBJ_TYPE(ColorRampEditPanel, Panel );
49 };*/
50 
51 
52 #endif /* SCENE_GUI_COLOR_RAMP_EDIT_H_ */
Definition: color.h:37
Definition: color_picker.h:44
Definition: input_event.h:263
Definition: popup.h:74
Definition: math_2d.h:65
Definition: control.h:47
Definition: color_ramp_edit.h:11