hex-edit.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #if defined(Hiro_HexEdit)
  2. auto mHexEdit::allocate() -> pObject* {
  3. return new pHexEdit(*this);
  4. }
  5. //
  6. auto mHexEdit::address() const -> unsigned {
  7. return state.address;
  8. }
  9. auto mHexEdit::backgroundColor() const -> Color {
  10. return state.backgroundColor;
  11. }
  12. auto mHexEdit::columns() const -> unsigned {
  13. return state.columns;
  14. }
  15. auto mHexEdit::doRead(unsigned offset) const -> uint8_t {
  16. if(state.onRead) return state.onRead(offset);
  17. return 0x00;
  18. }
  19. auto mHexEdit::doWrite(unsigned offset, uint8_t data) const -> void {
  20. if(state.onWrite) return state.onWrite(offset, data);
  21. }
  22. auto mHexEdit::foregroundColor() const -> Color {
  23. return state.foregroundColor;
  24. }
  25. auto mHexEdit::length() const -> unsigned {
  26. return state.length;
  27. }
  28. auto mHexEdit::onRead(const function<uint8_t (unsigned)>& callback) -> type& {
  29. state.onRead = callback;
  30. return *this;
  31. }
  32. auto mHexEdit::onWrite(const function<void (unsigned, uint8_t)>& callback) -> type& {
  33. state.onWrite = callback;
  34. return *this;
  35. }
  36. auto mHexEdit::rows() const -> unsigned {
  37. return state.rows;
  38. }
  39. auto mHexEdit::setAddress(unsigned address) -> type& {
  40. state.address = address;
  41. signal(setAddress, address);
  42. return *this;
  43. }
  44. auto mHexEdit::setBackgroundColor(Color color) -> type& {
  45. state.backgroundColor = color;
  46. signal(setBackgroundColor, color);
  47. return *this;
  48. }
  49. auto mHexEdit::setColumns(unsigned columns) -> type& {
  50. state.columns = columns;
  51. signal(setColumns, columns);
  52. return *this;
  53. }
  54. auto mHexEdit::setForegroundColor(Color color) -> type& {
  55. state.foregroundColor = color;
  56. signal(setForegroundColor, color);
  57. return *this;
  58. }
  59. auto mHexEdit::setLength(unsigned length) -> type& {
  60. state.length = length;
  61. signal(setLength, length);
  62. return *this;
  63. }
  64. auto mHexEdit::setRows(unsigned rows) -> type& {
  65. state.rows = rows;
  66. signal(setRows, rows);
  67. return *this;
  68. }
  69. auto mHexEdit::update() -> type& {
  70. signal(update);
  71. return *this;
  72. }
  73. #endif