BsGUIButton.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #include "BsPrerequisites.h"
  3. #include "BsGUIButtonBase.h"
  4. #include "BsImageSprite.h"
  5. #include "BsTextSprite.h"
  6. #include "BsGUIContent.h"
  7. #include "BsEvent.h"
  8. namespace BansheeEngine
  9. {
  10. /**
  11. * @brief GUI button that can be clicked. Has normal, hover and active states
  12. * with an optional label.
  13. */
  14. class BS_EXPORT GUIButton : public GUIButtonBase
  15. {
  16. public:
  17. /**
  18. * Returns type name of the GUI element used for finding GUI element styles.
  19. */
  20. static const String& getGUITypeName();
  21. /**
  22. * Creates a new button with the specified label.
  23. *
  24. * @param text Label to display on the button.
  25. * @param stylename Optional style to use for the button. Style will be retrieved
  26. * from GUISkin of the GUIWidget the element is used on. If not specified
  27. * default button style is used.
  28. */
  29. static GUIButton* create(const HString& text, const String& styleName = StringUtil::BLANK);
  30. /**
  31. * Creates a new button with the specified label.
  32. *
  33. * @param text Label to display on the button.
  34. * @param layoutOptions Options that allows you to control how is the element positioned in
  35. * GUI layout. This will override any similar options set by style.
  36. * @param stylename Optional style to use for the button. Style will be retrieved
  37. * from GUISkin of the GUIWidget the element is used on. If not specified
  38. * default button style is used.
  39. */
  40. static GUIButton* create(const HString& text, const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
  41. /**
  42. * Creates a new button with the specified label.
  43. *
  44. * @param content Content to display on a button. May include a label, image and a tooltip.
  45. * @param stylename Optional style to use for the button. Style will be retrieved
  46. * from GUISkin of the GUIWidget the element is used on. If not specified
  47. * default button style is used.
  48. */
  49. static GUIButton* create(const GUIContent& content, const String& styleName = StringUtil::BLANK);
  50. /**
  51. * Creates a new button with the specified label.
  52. *
  53. * @param content Content to display on a button. May include a label, image and a tooltip.
  54. * @param layoutOptions Options that allows you to control how is the element positioned in
  55. * GUI layout. This will override any similar options set by style.
  56. * @param stylename Optional style to use for the button. Style will be retrieved
  57. * from GUISkin of the GUIWidget the element is used on. If not specified
  58. * default button style is used.
  59. */
  60. static GUIButton* create(const GUIContent& content, const GUIOptions& layoutOptions, const String& styleName = StringUtil::BLANK);
  61. /**
  62. * @copydoc GUIElement::getElementType
  63. */
  64. virtual ElementType getElementType() const { return ElementType::Button; }
  65. private:
  66. GUIButton(const String& styleName, const GUIContent& content, const GUILayoutOptions& layoutOptions);
  67. };
  68. }