DataEditor.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef _DataEditor_h_
  2. #define _DataEditor_h_
  3. /* DataEditor.h
  4. *
  5. * Copyright (C) 1995-2011,2012,2015 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "Editor.h"
  21. Thing_declare (DataSubEditor);
  22. Thing_declare (VectorEditor);
  23. Thing_declare (MatrixEditor);
  24. Thing_declare (StructEditor);
  25. Thing_declare (ClassEditor);
  26. Thing_declare (DataEditor);
  27. typedef struct structDataSubEditor_FieldData {
  28. GuiLabel label;
  29. GuiButton button;
  30. GuiText text;
  31. void *address;
  32. Data_Description description;
  33. integer minimum, maximum, min2, max2;
  34. autostring32 history; // the full prefix of the members
  35. int rank; // should the button open a StructEditor (0) or VectorEditor (1) or MatrixEditor (2) ?
  36. int y;
  37. } *DataSubEditor_FieldData;
  38. #define kDataSubEditor_MAXNUM_ROWS 12
  39. Thing_define (DataSubEditor, Editor) {
  40. DataEditor root;
  41. void *d_address;
  42. Data_Description d_description;
  43. GuiScrollBar d_scrollBar;
  44. int d_irow, d_topField, d_numberOfFields;
  45. struct structDataSubEditor_FieldData d_fieldData [1 + kDataSubEditor_MAXNUM_ROWS];
  46. void v_destroy () noexcept
  47. override;
  48. bool v_scriptable ()
  49. override { return false; }
  50. void v_createChildren ()
  51. override;
  52. void v_createHelpMenuItems (EditorMenu menu)
  53. override;
  54. virtual integer v_countFields () { return 0; }
  55. virtual void v_showMembers () { }
  56. };
  57. Thing_define (VectorEditor, DataSubEditor) {
  58. integer d_minimum, d_maximum;
  59. integer v_countFields ()
  60. override;
  61. void v_showMembers ()
  62. override;
  63. };
  64. Thing_define (MatrixEditor, DataSubEditor) {
  65. integer d_minimum, d_maximum, d_min2, d_max2;
  66. integer v_countFields ()
  67. override;
  68. void v_showMembers ()
  69. override;
  70. };
  71. Thing_define (StructEditor, DataSubEditor) {
  72. integer v_countFields ()
  73. override;
  74. void v_showMembers ()
  75. override;
  76. };
  77. Thing_define (ClassEditor, StructEditor) {
  78. void v_showMembers ()
  79. override;
  80. };
  81. Thing_define (DataEditor, ClassEditor) {
  82. CollectionOf <structDataSubEditor> children;
  83. void v_destroy () noexcept
  84. override;
  85. void v_dataChanged ()
  86. override;
  87. };
  88. autoDataEditor DataEditor_create (conststring32 title, Daata data);
  89. /* End of file DataEditor.h */
  90. #endif