libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmUiDrvr.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #ifndef cmUiDrvr_h
  2. #define cmUiDrvr_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. typedef unsigned cmUiRC_t;
  7. // cmUi result codes
  8. enum
  9. {
  10. kOkUiRC = cmOkRC,
  11. kAppNotFoundUiRC,
  12. kCtlNotFoundUiRC,
  13. kPanelNotFoundUiRC,
  14. kPanelFullUiRC,
  15. kDrvrErrUiRC,
  16. kInvalidCtlOpUiRC,
  17. kInvalidColRowUiRC,
  18. kInvalidIdUiRC,
  19. kSubSysFailUiRC,
  20. kBufTooSmallUiRC,
  21. kBufCorruptUiRC
  22. };
  23. // Built-in control types.
  24. typedef enum
  25. {
  26. kInvalidUiCId,
  27. kPanelUiCId,
  28. kBtnUiCId,
  29. kCheckUiCId,
  30. kMenuBtnUiCId,
  31. kListUiCId,
  32. kLabelUiCId,
  33. kTextUiCId,
  34. kNumberUiCId,
  35. kSliderUiCId,
  36. kProgressUiCId,
  37. kMeterUiCId,
  38. kFilenameUiCId,
  39. kDirUiCId,
  40. kMaxUiCId
  41. } cmUiCId_t;
  42. // Control selector id's
  43. typedef enum
  44. {
  45. kInvalidDId,
  46. kCreateCtlDId,
  47. kDestroyCtlDId,
  48. kSetValDId,
  49. kDestroyAllDId,
  50. kMaxDId
  51. } cmUiDId_t;
  52. // Control flags.
  53. enum
  54. {
  55. // All controls recognize kValUiFl and kLblUiFl
  56. kValUiFl = 0x0000001,
  57. kLblUiFl = 0x0000002,
  58. // Flags for Number,Progress,Meter
  59. kMinUiFl = 0x000004,
  60. kMaxUiFl = 0x000010,
  61. kIncUiFl = 0x000020,
  62. kNumMask = kValUiFl | kMinUiFl | kMaxUiFl | kIncUiFl,
  63. kHorzUiFl = 0x000040,
  64. kVertUiFl = 0x000080,
  65. // Flags for Filename and Dir
  66. kFnPatUiFl = 0x000100, // file pattern string
  67. kFnDirUiFl = 0x000200, // toggle file btn type
  68. kFnMask = kFnPatUiFl | kFnDirUiFl,
  69. // Append list or menu element.
  70. kAppendUiFl = 0x000400,
  71. kLeftUiFl = 0x001000,
  72. kTopUiFl = 0x002000,
  73. kRightUiFl = 0x004000,
  74. kBottomUiFl = 0x008000,
  75. kHCtrUiFl = 0x010000,
  76. kVCtrUiFl = 0x020000,
  77. kInsideUiFl = 0x040000,
  78. // Value flags indicate which value fields are valid
  79. kIvalUiFl = 0x100000,
  80. kFvalUiFl = 0x200000,
  81. kSvalUiFl = 0x400000
  82. };
  83. // A control can be uniquely idenfied by
  84. // appId and usrId (appId's are unique among app's)
  85. // (usrId's are unique among ctl's on an app)
  86. // appId's and usrId's should be zero based low numbers
  87. // because they are used internally as indexes.
  88. typedef struct
  89. {
  90. cmUiDId_t dId; // function selector id
  91. unsigned appId; // app id (plug-in instance id)
  92. unsigned usrId; // ctl id
  93. unsigned panelId; // parent panel id
  94. cmUiCId_t cId; // UI control type
  95. unsigned flags; // See kXXXUiFl above.
  96. int ival; // Valid if kIvalUiFl is set.
  97. double fval; // Valid if kFvalUiFl is set.
  98. const cmChar_t* sval; // Valid if kSvalUiFl is set.
  99. int x;
  100. int y;
  101. int w;
  102. int h;
  103. } cmUiDriverArg_t;
  104. typedef cmUiRC_t (*cmUiDriverFunc_t)( void* arg, const cmUiDriverArg_t* a );
  105. void cmUiDriverArgSetup( cmUiDriverArg_t* a,
  106. cmUiDId_t dId,
  107. unsigned appId,
  108. unsigned usrId,
  109. unsigned panelId,
  110. cmUiCId_t cId,
  111. unsigned flags,
  112. int ival,
  113. double fval,
  114. const cmChar_t* sval,
  115. int x,
  116. int y,
  117. int w,
  118. int h
  119. );
  120. unsigned cmUiDriverArgSerializeBufByteCount( const cmUiDriverArg_t* a );
  121. // Returns kBufTooSmallUiRC if the buffer is too small otherwise returns kOkUiRC.
  122. // This function does not call cmErrMsg() on error
  123. // the caller is therefore responsible for generating errors.
  124. cmUiRC_t cmUiDriverArgSerialize( const cmUiDriverArg_t* a, void* buf, unsigned bufByteCnt );
  125. // Return kBufTooSmallUiRC or kBufCorruptUiRC if buffer corruption is detected
  126. // otherwise returns kOkUiRC. This function does not call cmErrMsg() on error
  127. // the caller is therefore responsible for generating errors.
  128. cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, void* buf, unsigned bufByteCnt );
  129. // Return an arg. value converted to the requiested type.
  130. // Note that numeric values will be automatically converted but
  131. // values will not be converted between string and numeric values.
  132. int cmUiDriverArgGetInt( const cmUiDriverArg_t* a );
  133. double cmUiDriverArgGetDouble( const cmUiDriverArg_t* a );
  134. const cmChar_t* cmUiDriverArgGetString( const cmUiDriverArg_t* a );
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif