diff options
| author | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-05 16:44:50 +0100 |
| commit | 5dbf1809c6e3e905b94b8764e99491e608122261 (patch) | |
| tree | 5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /scene/gui/popup_menu.h | |
| parent | 45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff) | |
| download | godot-5dbf180.tar.gz godot-5dbf180.tar.zst godot-5dbf180.zip | |
A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?
I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon
A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format
A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
Diffstat (limited to 'scene/gui/popup_menu.h')
| -rw-r--r-- | scene/gui/popup_menu.h | 79 |
1 files changed, 42 insertions, 37 deletions
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index b5fca9a45..186d40f6d 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -35,11 +35,9 @@ @author Juan Linietsky <reduzio@gmail.com> */ - - class PopupMenu : public Popup { - GDCLASS(PopupMenu, Popup ); + GDCLASS(PopupMenu, Popup); struct Item { Ref<Texture> icon; @@ -59,10 +57,18 @@ class PopupMenu : public Popup { Ref<ShortCut> shortcut; bool shortcut_is_global; - Item() { checked=false; checkable=false; separator=false; accel=0; disabled=false; _ofs_cache=0; h_ofs=0; shortcut_is_global=false; } + Item() { + checked = false; + checkable = false; + separator = false; + accel = 0; + disabled = false; + _ofs_cache = 0; + h_ofs = 0; + shortcut_is_global = false; + } }; - Timer *submenu_timer; List<Rect2> autohide_areas; Vector<Item> items; @@ -70,7 +76,7 @@ class PopupMenu : public Popup { int submenu_over; Rect2 parent_rect; String _get_accel_text(int p_item) const; - int _get_mouse_over(const Point2& p_over) const; + int _get_mouse_over(const Point2 &p_over) const; virtual Size2 get_minimum_size() const; void _gui_input(const InputEvent &p_event); void _activate_submenu(int over); @@ -81,44 +87,44 @@ class PopupMenu : public Popup { Vector2 moved; Array _get_items() const; - void _set_items(const Array& p_items); + void _set_items(const Array &p_items); - Map< Ref<ShortCut>, int> shortcut_refcount; + Map<Ref<ShortCut>, int> shortcut_refcount; void _ref_shortcut(Ref<ShortCut> p_sc); - void _unref_shortcut( Ref<ShortCut> p_sc); -protected: + void _unref_shortcut(Ref<ShortCut> p_sc); - virtual bool has_point(const Point2& p_point) const; +protected: + virtual bool has_point(const Point2 &p_point) const; -friend class MenuButton; + friend class MenuButton; void _notification(int p_what); static void _bind_methods(); -public: - void add_icon_item(const Ref<Texture>& p_icon,const String& p_label,int p_ID=-1,uint32_t p_accel=0); - void add_item(const String& p_label,int p_ID=-1,uint32_t p_accel=0); - void add_icon_check_item(const Ref<Texture>& p_icon,const String& p_label,int p_ID=-1,uint32_t p_accel=0); - void add_check_item(const String& p_label,int p_ID=-1,uint32_t p_accel=0); - void add_submenu_item(const String& p_label,const String& p_submenu, int p_ID=-1); +public: + void add_icon_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0); + void add_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0); + void add_icon_check_item(const Ref<Texture> &p_icon, const String &p_label, int p_ID = -1, uint32_t p_accel = 0); + void add_check_item(const String &p_label, int p_ID = -1, uint32_t p_accel = 0); + void add_submenu_item(const String &p_label, const String &p_submenu, int p_ID = -1); - void add_icon_shortcut(const Ref<Texture>& p_icon,const Ref<ShortCut>& p_shortcut,int p_ID=-1,bool p_global=false); - void add_shortcut(const Ref<ShortCut>& p_shortcut,int p_ID=-1,bool p_global=false); - void add_icon_check_shortcut(const Ref<Texture>& p_icon,const Ref<ShortCut>& p_shortcut,int p_ID=-1,bool p_global=false); - void add_check_shortcut(const Ref<ShortCut>& p_shortcut,int p_ID=-1,bool p_global=false); + void add_icon_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false); + void add_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false); + void add_icon_check_shortcut(const Ref<Texture> &p_icon, const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false); + void add_check_shortcut(const Ref<ShortCut> &p_shortcut, int p_ID = -1, bool p_global = false); - void set_item_text(int p_idx,const String& p_text); - void set_item_icon(int p_idx,const Ref<Texture>& p_icon); - void set_item_checked(int p_idx,bool p_checked); - void set_item_ID(int p_idx,int p_ID); - void set_item_accelerator(int p_idx,uint32_t p_accel); - void set_item_metadata(int p_idx,const Variant& p_meta); - void set_item_disabled(int p_idx,bool p_disabled); - void set_item_submenu(int p_idx, const String& p_submenu); + void set_item_text(int p_idx, const String &p_text); + void set_item_icon(int p_idx, const Ref<Texture> &p_icon); + void set_item_checked(int p_idx, bool p_checked); + void set_item_ID(int p_idx, int p_ID); + void set_item_accelerator(int p_idx, uint32_t p_accel); + void set_item_metadata(int p_idx, const Variant &p_meta); + void set_item_disabled(int p_idx, bool p_disabled); + void set_item_submenu(int p_idx, const String &p_submenu); void set_item_as_separator(int p_idx, bool p_separator); void set_item_as_checkable(int p_idx, bool p_checkable); - void set_item_tooltip(int p_idx,const String& p_tooltip); - void set_item_shortcut(int p_idx, const Ref<ShortCut>& p_shortcut,bool p_global=false); + void set_item_tooltip(int p_idx, const String &p_tooltip); + void set_item_shortcut(int p_idx, const Ref<ShortCut> &p_shortcut, bool p_global = false); void set_item_h_offset(int p_idx, int p_offset); void toggle_item_checked(int p_idx); @@ -139,7 +145,7 @@ public: int get_item_count() const; - bool activate_item_by_event(const InputEvent& p_event,bool p_for_global_only=false); + bool activate_item_by_event(const InputEvent &p_event, bool p_for_global_only = false); void activate_item(int p_item); void remove_item(int p_idx); @@ -148,13 +154,13 @@ public: void clear(); - void set_parent_rect(const Rect2& p_rect); + void set_parent_rect(const Rect2 &p_rect); - virtual String get_tooltip(const Point2& p_pos) const; + virtual String get_tooltip(const Point2 &p_pos) const; virtual void get_translatable_strings(List<String> *p_strings) const; - void add_autohide_area(const Rect2& p_area); + void add_autohide_area(const Rect2 &p_area); void clear_autohide_areas(); void set_invalidate_click_until_motion(); @@ -163,7 +169,6 @@ public: PopupMenu(); ~PopupMenu(); - }; #endif |
