line-edit.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #if defined(Hiro_LineEdit)
  2. auto mLineEdit::allocate() -> pObject* {
  3. return new pLineEdit(*this);
  4. }
  5. //
  6. auto mLineEdit::backgroundColor() const -> Color {
  7. return state.backgroundColor;
  8. }
  9. auto mLineEdit::doActivate() const -> void {
  10. if(state.onActivate) return state.onActivate();
  11. }
  12. auto mLineEdit::doChange() const -> void {
  13. if(state.onChange) return state.onChange();
  14. }
  15. auto mLineEdit::editable() const -> bool {
  16. return state.editable;
  17. }
  18. auto mLineEdit::foregroundColor() const -> Color {
  19. return state.foregroundColor;
  20. }
  21. auto mLineEdit::onActivate(const function<void ()>& callback) -> type& {
  22. state.onActivate = callback;
  23. return *this;
  24. }
  25. auto mLineEdit::onChange(const function<void ()>& callback) -> type& {
  26. state.onChange = callback;
  27. return *this;
  28. }
  29. auto mLineEdit::setBackgroundColor(Color color) -> type& {
  30. state.backgroundColor = color;
  31. signal(setBackgroundColor, color);
  32. return *this;
  33. }
  34. auto mLineEdit::setEditable(bool editable) -> type& {
  35. state.editable = editable;
  36. signal(setEditable, editable);
  37. return *this;
  38. }
  39. auto mLineEdit::setForegroundColor(Color color) -> type& {
  40. state.foregroundColor = color;
  41. signal(setForegroundColor, color);
  42. return *this;
  43. }
  44. auto mLineEdit::setText(const string& text) -> type& {
  45. state.text = text;
  46. signal(setText, text);
  47. return *this;
  48. }
  49. auto mLineEdit::text() const -> string {
  50. return state.text;
  51. }
  52. #endif