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.0KB

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