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

cmGrPage.h 7.4KB

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