libcm is a C development framework with an emphasis on audio signal processing applications.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

cmGrPage.h 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #ifndef cmGrPage_h
  2. #define cmGrPage_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. enum
  7. {
  8. kHashMarkGrFl = 0x10,
  9. kHashLabelGrFl= 0x20
  10. };
  11. typedef cmHandle_t cmGrPgH_t;
  12. typedef cmHandle_t cmGrVwH_t;
  13. typedef cmHandle_t cmGrAxH_t;
  14. extern cmGrPgH_t cmGrPgNullHandle;
  15. extern cmGrVwH_t cmGrVwNullHandle;
  16. extern cmGrAxH_t cmGrAxNullHandle;
  17. // Create a cmGrPage object.
  18. cmGrRC_t cmGrPageCreate( cmCtx_t* ctx, cmGrPgH_t* hp, cmGrCbFunc_t cbFunc, void* cbArg );
  19. // Destroy and release the resources assoc'd with a cmGrPage object;
  20. cmGrRC_t cmGrPageDestroy( cmGrPgH_t* hp );
  21. // Return true if the cmGrPage object handle is valid
  22. bool cmGrPageIsValid( cmGrPgH_t h );
  23. // Remove all objects from the page.
  24. cmGrRC_t cmGrPageClear( cmGrPgH_t h );
  25. // Intialize the count of rows and columns and setup the default layout.
  26. cmGrRC_t cmGrPageInit( cmGrPgH_t h, const cmGrPExt_t* r, unsigned rn, unsigned cn, cmGrDcH_t dcH );
  27. // Update the position of the views on the page.
  28. cmGrRC_t cmGrPageResize( cmGrPgH_t h, const cmGrPExt_t* r, cmGrDcH_t dcH );
  29. // Return the current page size and loc'n as set by cmGrPageInit() or cmGrPageResize().
  30. void cmGrPageRect( cmGrPgH_t h, cmGrPExt_t* r );
  31. // Return the count of plot views contained by this page. (rn*cn)
  32. unsigned cmGrPageViewCount( cmGrPgH_t h );
  33. // Enable or disable the focus for a given view.
  34. // Note that the focused view is the view which is the target of controller
  35. // buttons and scrollbars. This does not refer to the focused object.
  36. // Set 'enableFl' if the view is receiving the focus.
  37. // Clear 'enableFl' if the view is losing focus.
  38. void cmGrPageViewFocus( cmGrPgH_t h, unsigned vwIdx, bool enableFl );
  39. // Return the view which currently has the focus or cmGrVwNullHandle if
  40. // no view has the focus.
  41. cmGrVwH_t cmGrPageFocusedView( cmGrPgH_t h );
  42. //
  43. bool cmGrPageLayout( cmGrPgH_t h, cmGrDcH_t dcH );
  44. // Draw the page.
  45. void cmGrPageDraw( cmGrPgH_t h, cmGrDcH_t dcH );
  46. typedef void (*cmGrLabelFunc_t)( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
  47. // Returns id of the new page label function.
  48. unsigned cmGrPageLabelFuncRegister( cmGrPgH_t h, cmGrLabelFunc_t func, void* arg, const cmChar_t* label );
  49. unsigned cmGrPageLabelFuncCount( cmGrPgH_t h );
  50. unsigned cmGrPageLabelFuncIndexToId( cmGrPgH_t h, unsigned index );
  51. unsigned cmGrPageLabelFuncLabelToId( cmGrPgH_t h, const cmChar_t* label );
  52. cmGrLabelFunc_t cmGrPageLabelFunc( cmGrPgH_t h, unsigned id );
  53. const cmChar_t* cmGrPageLabelFuncLabel( cmGrPgH_t h, unsigned id );
  54. void* cmGrPageLabelFuncArg( cmGrPgH_t h, unsigned id );
  55. // Get a view handle from the view index.
  56. cmGrVwH_t cmGrPageViewHandle( cmGrPgH_t h, unsigned vwIdx );
  57. // Get a view handle from to cmGrH_t.
  58. cmGrVwH_t cmGrPageGrHandleToView( cmGrPgH_t h, cmGrH_t grH );
  59. bool cmGrViewIsValid( cmGrVwH_t h );
  60. // Initialize a plot view. title,xLabel, and yLabel are optional.
  61. cmGrRC_t cmGrViewInit( cmGrVwH_t h, cmGrH_t grH, const cmChar_t* vwTitle, const cmChar_t* xLabel, const cmChar_t* yLabel );
  62. // Remove all objects from the view.
  63. cmGrRC_t cmGrViewClear( cmGrVwH_t h );
  64. // Get the plot views physical extents. This function will return the
  65. // current view location/size only after a call to cmGrPageDraw().
  66. // See the implementation note at the top of this file.
  67. cmGrRC_t cmGrViewPExt( cmGrVwH_t h, cmGrPExt_t* pext );
  68. bool cmGrViewHasFocus( cmGrVwH_t h );
  69. // Get the cmGrH_t associated with a view.
  70. cmGrH_t cmGrViewGrHandle( cmGrVwH_t h );
  71. // kExpandViewGrFl | kSelectHorzGrFl | kSelectVertGrFl
  72. void cmGrViewSetCfg( cmGrVwH_t h, unsigned cfgFlags );
  73. unsigned cmGrViewCfg( cmGrVwH_t h );
  74. void cmGrViewSetTitle( cmGrVwH_t h, const cmChar_t* title );
  75. const cmChar_t* cmGrViewTitle( cmGrVwH_t h );
  76. void cmGrViewSetFontFamily( cmGrVwH_t h, unsigned id );
  77. unsigned cmGrViewFontFamily( cmGrVwH_t h );
  78. void cmGrViewSetFontStyle( cmGrVwH_t h, unsigned flags );
  79. unsigned cmGrViewFontStyle( cmGrVwH_t h );
  80. void cmGrViewSetFontSize( cmGrVwH_t h, unsigned size );
  81. unsigned cmGrViewFontSize( cmGrVwH_t h );
  82. // Assign a translation function to be used with cmGrViewValue().
  83. // cmLeftGrIdx or cmGrRightGrIdx is used to assign y axis translation functions.
  84. // cmTopGrIdx or cmGrBottomGrIdx is used to assign x axis translation functions.
  85. // 'pgLabelFuncId' must be a valid page label function id as returned from cmGrPageLabelFuncRegister().
  86. // or cmGrPageLabelFuncIndexToId().
  87. void cmGrViewSetLabelFunc( cmGrVwH_t h, cmGrAxisIdx_t axisId, unsigned pgLabelFuncId );
  88. typedef enum
  89. {
  90. kLocalX_VwId,
  91. kLocalY_VwId,
  92. kGlobalX_VwId,
  93. kGlobalY_VwId,
  94. kSelX0_VwId,
  95. kSelY0_VwId,
  96. kSelX1_VwId,
  97. kSelY1_VwId,
  98. kSelW_VwId,
  99. kSelH_VwId
  100. } cmGrViewValueId_t;
  101. const cmChar_t* cmGrViewValue( cmGrVwH_t h, cmGrViewValueId_t id, cmChar_t* buf, unsigned bufCharCnt );
  102. // Get an axis handle.
  103. cmGrAxH_t cmGrViewAxisHandle( cmGrVwH_t h, cmGrAxisIdx_t axisIdx );
  104. bool cmGrAxisIsValid( cmGrAxH_t h );
  105. // kHashMarkGrFl | kHashLabelGrFl
  106. void cmGrAxisSetCfg( cmGrAxH_t h, unsigned cfgFlags );
  107. unsigned cmGrAxisCfg( cmGrAxH_t h );
  108. void cmGrAxisSetTitle( cmGrAxH_t h, const cmChar_t* title );
  109. const cmChar_t* cmGrAxisTitle( cmGrAxH_t h );
  110. void cmGrAxisTitleSetFontFamily( cmGrAxH_t h, unsigned id );
  111. unsigned cmGrAxisTitleFontFamily( cmGrAxH_t h );
  112. void cmGrAxisTitleSetFontStyle( cmGrAxH_t h, unsigned flags );
  113. unsigned cmGrAxisTitleFontStyle( cmGrAxH_t h );
  114. void cmGrAxisTitleSetFontSize( cmGrAxH_t h, unsigned size );
  115. unsigned cmGrAxisTitleFontSize( cmGrAxH_t h );
  116. void cmGrAxisLabelSetFontFamily( cmGrAxH_t h, unsigned id );
  117. unsigned cmGrAxisLabelFontFamily( cmGrAxH_t h );
  118. void cmGrAxisLabelSetFontStyle( cmGrAxH_t h, unsigned flags );
  119. unsigned cmGrAxisLabelFontStyle( cmGrAxH_t h );
  120. void cmGrAxisLabelSetFontSize( cmGrAxH_t h, unsigned size );
  121. unsigned cmGrAxisLabelFontSize( cmGrAxH_t h );
  122. // Assign a translation function for the value on this axis.
  123. // 'pgLabelFuncId' must be a valid page label function id as returned from cmGrPageLabelFuncRegister().
  124. // or cmGrPageLabelFuncIndexToId().
  125. void cmGrAxisSetLabelFunc( cmGrAxH_t h, unsigned pgLabelFuncId );
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. #endif