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 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #ifndef cmUiDrvr_h
  2. #define cmUiDrvr_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //( {file_desc:"UI independent driver used by an rtSys application to communicate with the UI." kw:[rtsys]}
  7. typedef unsigned cmUiRC_t;
  8. // cmUi result codes
  9. enum
  10. {
  11. kOkUiRC = cmOkRC,
  12. kAppNotFoundUiRC,
  13. kCtlNotFoundUiRC,
  14. kPanelNotFoundUiRC,
  15. kInvalidAppIdUiRC,
  16. kPanelFullUiRC,
  17. kDrvrErrUiRC,
  18. kInvalidCtlOpUiRC,
  19. kInvalidColRowUiRC,
  20. kInvalidIdUiRC,
  21. kSubSysFailUiRC,
  22. kBufTooSmallUiRC,
  23. kBufCorruptUiRC,
  24. kNotImplementedUiRC
  25. };
  26. // Built-in control types.
  27. typedef enum
  28. {
  29. kInvalidUiCId,
  30. kPanelUiCId,
  31. kBtnUiCId,
  32. kCheckUiCId,
  33. kMenuBtnUiCId,
  34. kListUiCId,
  35. kLabelUiCId,
  36. kStringUiCId,
  37. kConsoleUiCId,
  38. kNumberUiCId,
  39. kSliderUiCId,
  40. kProgressUiCId,
  41. kMeterUiCId,
  42. kFilenameUiCId,
  43. kDirUiCId,
  44. kMaxUiCId
  45. } cmUiCId_t;
  46. // Control selector id's
  47. typedef enum
  48. {
  49. kInvalidDId,
  50. kCreateCtlDId,
  51. kDestroyCtlDId,
  52. kSetValDId,
  53. kEnableDId, // ival holds new enable state
  54. kMaxDId
  55. } cmUiDId_t;
  56. // Control flags.
  57. enum
  58. {
  59. // All controls recognize kValUiFl and kLblUiFl
  60. kValUiFl = 0x00000001,
  61. kLblUiFl = 0x00000002,
  62. // Flags for Number,Progress,Meter
  63. kMinUiFl = 0x00000004,
  64. kMaxUiFl = 0x00000010,
  65. kIncUiFl = 0x00000020,
  66. kNumMask = kValUiFl | kMinUiFl | kMaxUiFl | kIncUiFl,
  67. kHorzUiFl = 0x00000040,
  68. kVertUiFl = 0x00000080,
  69. // Flags for Filename and Dir
  70. kFnPatUiFl = 0x00000100, // file pattern string
  71. kFnDirUiFl = 0x00000200, // toggle file btn type
  72. kFnMask = kFnPatUiFl | kFnDirUiFl,
  73. // Append list or menu element.
  74. kAppendUiFl = 0x00000400,
  75. kPrependUiFl = 0x00000800,
  76. kClearUiFl = 0x00001000, // clear all ele' from a list or menu
  77. // Alignment flags
  78. kLeftUiFl = 0x00002000,
  79. kTopUiFl = 0x00004000,
  80. kRightUiFl = 0x00008000,
  81. kBottomUiFl = 0x00010000,
  82. kHCtrUiFl = 0x00020000,
  83. kVCtrUiFl = 0x00040000,
  84. kInsideUiFl = 0x00080000,
  85. // Value flags indicate which value fields are valid
  86. kIvalUiFl = 0x00100000,
  87. kFvalUiFl = 0x00200000,
  88. kSvalUiFl = 0x00400000,
  89. kNoReflectUiFl = 0x01000000, // do not reflect event to the client
  90. // When to send text fields
  91. kSendChangeFl = 0x10000000, // whenever text changes
  92. kSendEnterFl = 0x20000000, // when enter key is pressed (and changed or not-changed)
  93. kSendFocusFl = 0x40000000, // when ctl loses focus
  94. kSendNoChangeFl= 0x80000000 // on enter even if no-change
  95. };
  96. // A control can be uniquely idenfied by
  97. // appId and usrId (appId's are unique among app's)
  98. // (usrId's are unique among ctl's on an app)
  99. // appId's and usrId's should be zero based low numbers
  100. // because they are used internally as indexes.
  101. typedef struct
  102. {
  103. cmRtSysMsgHdr_t hdr;
  104. cmUiDId_t dId; // function selector id
  105. unsigned appId; // app id (plug-in instance id)
  106. unsigned usrId; // ctl id
  107. unsigned panelId; // parent panel id
  108. cmUiCId_t cId; // UI control type
  109. unsigned flags; // See kXXXUiFl above.
  110. int ival; // Valid if kIvalUiFl is set.
  111. double fval; // Valid if kFvalUiFl is set.
  112. const cmChar_t* sval; // Valid if kSvalUiFl is set.
  113. int x;
  114. int y;
  115. int w;
  116. int h;
  117. } cmUiDriverArg_t;
  118. typedef cmUiRC_t (*cmUiDriverFunc_t)( void* arg, const cmUiDriverArg_t* a );
  119. void cmUiDriverArgSetup( cmUiDriverArg_t* a,
  120. unsigned rtSubIdx,
  121. unsigned selId,
  122. cmUiDId_t dId,
  123. unsigned appId,
  124. unsigned usrId,
  125. unsigned panelId,
  126. cmUiCId_t cId,
  127. unsigned flags,
  128. int ival,
  129. double fval,
  130. const cmChar_t* sval,
  131. int x,
  132. int y,
  133. int w,
  134. int h
  135. );
  136. unsigned cmUiDriverArgSerializeBufByteCount( const cmUiDriverArg_t* a );
  137. // Returns kBufTooSmallUiRC if the buffer is too small otherwise returns kOkUiRC.
  138. // This function does not call cmErrMsg() on error
  139. // the caller is therefore responsible for generating errors.
  140. cmUiRC_t cmUiDriverArgSerialize( const cmUiDriverArg_t* a, void* buf, unsigned bufByteCnt );
  141. // Return kBufTooSmallUiRC or kBufCorruptUiRC if buffer corruption is detected
  142. // otherwise returns kOkUiRC. This function does not call cmErrMsg() on error
  143. // the caller is therefore responsible for generating errors.
  144. cmUiRC_t cmUiDriverArgDeserialize( cmUiDriverArg_t* a, const void* buf, unsigned bufByteCnt );
  145. // Return an arg. value converted to the requiested type.
  146. // Note that numeric values will be automatically converted but
  147. // values will not be converted between string and numeric values.
  148. int cmUiDriverArgGetInt( const cmUiDriverArg_t* a );
  149. double cmUiDriverArgGetDouble( const cmUiDriverArg_t* a );
  150. const cmChar_t* cmUiDriverArgGetString( const cmUiDriverArg_t* a );
  151. //)
  152. #ifdef __cplusplus
  153. }
  154. #endif
  155. #endif