check-button.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #if defined(Hiro_CheckButton)
  2. auto mCheckButton::allocate() -> pObject* {
  3. return new pCheckButton(*this);
  4. }
  5. //
  6. auto mCheckButton::bordered() const -> bool {
  7. return state.bordered;
  8. }
  9. auto mCheckButton::checked() const -> bool {
  10. return state.checked;
  11. }
  12. auto mCheckButton::doToggle() const -> void {
  13. if(state.onToggle) return state.onToggle();
  14. }
  15. auto mCheckButton::icon() const -> image {
  16. return state.icon;
  17. }
  18. auto mCheckButton::onToggle(const function<void ()>& callback) -> type& {
  19. state.onToggle = callback;
  20. return *this;
  21. }
  22. auto mCheckButton::orientation() const -> Orientation {
  23. return state.orientation;
  24. }
  25. auto mCheckButton::setBordered(bool bordered) -> type& {
  26. state.bordered = bordered;
  27. signal(setBordered, bordered);
  28. return *this;
  29. }
  30. auto mCheckButton::setChecked(bool checked) -> type& {
  31. state.checked = checked;
  32. signal(setChecked, checked);
  33. return *this;
  34. }
  35. auto mCheckButton::setIcon(const image& icon) -> type& {
  36. state.icon = icon;
  37. signal(setIcon, icon);
  38. return *this;
  39. }
  40. auto mCheckButton::setOrientation(Orientation orientation) -> type& {
  41. state.orientation = orientation;
  42. signal(setOrientation, orientation);
  43. return *this;
  44. }
  45. auto mCheckButton::setText(const string& text) -> type& {
  46. state.text = text;
  47. signal(setText, text);
  48. return *this;
  49. }
  50. auto mCheckButton::text() const -> string {
  51. return state.text;
  52. }
  53. #endif