texture_button.h
1 /*************************************************************************/
2 /* texture_button.h */
3 /*************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* http://www.godotengine.org */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
9 /* */
10 /* Permission is hereby granted, free of charge, to any person obtaining */
11 /* a copy of this software and associated documentation files (the */
12 /* "Software"), to deal in the Software without restriction, including */
13 /* without limitation the rights to use, copy, modify, merge, publish, */
14 /* distribute, sublicense, and/or sell copies of the Software, and to */
15 /* permit persons to whom the Software is furnished to do so, subject to */
16 /* the following conditions: */
17 /* */
18 /* The above copyright notice and this permission notice shall be */
19 /* included in all copies or substantial portions of the Software. */
20 /* */
21 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
22 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
23 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
24 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
25 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
26 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
27 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
28 /*************************************************************************/
29 #ifndef TEXTURE_BUTTON_H
30 #define TEXTURE_BUTTON_H
31 
32 #include "scene/gui/base_button.h"
33 #include "scene/resources/bit_mask.h"
34 class TextureButton : public BaseButton {
35 
36  OBJ_TYPE( TextureButton, BaseButton );
37 
38  Ref<Texture> normal;
39  Ref<Texture> pressed;
40  Ref<Texture> hover;
41  Ref<Texture> disabled;
42  Ref<Texture> focused;
43  Ref<BitMap> click_mask;
44  Size2 scale;
45  Color modulate;
46 
47 
48 protected:
49 
50  virtual bool has_point(const Point2& p_point) const;
51  virtual Size2 get_minimum_size() const;
52  void _notification(int p_what);
53  static void _bind_methods();
54 
55 public:
56 
57  void set_normal_texture(const Ref<Texture>& p_normal);
58  void set_pressed_texture(const Ref<Texture>& p_pressed);
59  void set_hover_texture(const Ref<Texture>& p_hover);
60  void set_disabled_texture(const Ref<Texture>& p_disabled);
61  void set_focused_texture(const Ref<Texture>& p_focused);
62  void set_click_mask(const Ref<BitMap>& p_image);
63 
64  Ref<Texture> get_normal_texture() const;
65  Ref<Texture> get_pressed_texture() const;
66  Ref<Texture> get_hover_texture() const;
67  Ref<Texture> get_disabled_texture() const;
68  Ref<Texture> get_focused_texture() const;
69  Ref<BitMap> get_click_mask() const;
70 
71  void set_texture_scale(Size2 p_scale);
72  Size2 get_texture_scale() const;
73 
74  void set_modulate(const Color& p_modulate);
75  Color get_modulate() const;
76 
77  TextureButton();
78 };
79 
80 #endif // TEXTURE_BUTTON_H
Definition: color.h:37
Definition: base_button.h:40
Definition: texture_button.h:34
Definition: math_2d.h:65