libcm is a C development framework with an emphasis on audio signal processing applications.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

cmGrPage.h 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. // Label callback functions are used to translate numeric axis values to
  47. // text strings. Multiple label callback functions can be registered with
  48. // a page and then assigned to a given view axis via cmGrViewSetLabelFunc().
  49. typedef void (*cmGrLabelFunc_t)( void* arg, cmChar_t* label, unsigned labelCharCnt, cmGrV_t value );
  50. // Returns id of the new page label function.
  51. unsigned cmGrPageLabelFuncRegister( cmGrPgH_t h, cmGrLabelFunc_t func, void* arg, const cmChar_t* label );
  52. unsigned cmGrPageLabelFuncCount( cmGrPgH_t h );
  53. unsigned cmGrPageLabelFuncIndexToId( cmGrPgH_t h, unsigned index );
  54. unsigned cmGrPageLabelFuncLabelToId( cmGrPgH_t h, const cmChar_t* label );
  55. cmGrLabelFunc_t cmGrPageLabelFunc( cmGrPgH_t h, unsigned id );
  56. const cmChar_t* cmGrPageLabelFuncLabel( cmGrPgH_t h, unsigned id );
  57. void* cmGrPageLabelFuncArg( cmGrPgH_t h, unsigned id );
  58. // Get a view handle from the view index.
  59. cmGrVwH_t cmGrPageViewHandle( cmGrPgH_t h, unsigned vwIdx );
  60. // Get a view handle from to cmGrH_t.
  61. cmGrVwH_t cmGrPageGrHandleToView( cmGrPgH_t h, cmGrH_t grH );
  62. bool cmGrViewIsValid( cmGrVwH_t h );
  63. // Initialize a plot view. title,xLabel, and yLabel are optional.
  64. cmGrRC_t cmGrViewInit( cmGrVwH_t h, cmGrH_t grH, const cmChar_t* vwTitle, const cmChar_t* xLabel, const cmChar_t* yLabel );
  65. // Remove all objects from the view.
  66. cmGrRC_t cmGrViewClear( cmGrVwH_t h );
  67. // Get the plot views physical extents. This function will return the
  68. // current view location/size only after a call to cmGrPageDraw().
  69. // See the implementation note at the top of this file.
  70. cmGrRC_t cmGrViewPExt( cmGrVwH_t h, cmGrPExt_t* pext );
  71. bool cmGrViewHasFocus( cmGrVwH_t h );
  72. // Get the cmGrH_t associated with a view.
  73. cmGrH_t cmGrViewGrHandle( cmGrVwH_t h );
  74. // kExpandViewGrFl | kSelectHorzGrFl | kSelectVertGrFl
  75. void cmGrViewSetCfg( cmGrVwH_t h, unsigned cfgFlags );
  76. unsigned cmGrViewCfg( cmGrVwH_t h );
  77. void cmGrViewSetTitle( cmGrVwH_t h, const cmChar_t* title );
  78. const cmChar_t* cmGrViewTitle( cmGrVwH_t h );
  79. void cmGrViewSetFontFamily( cmGrVwH_t h, unsigned id );
  80. unsigned cmGrViewFontFamily( cmGrVwH_t h );
  81. void cmGrViewSetFontStyle( cmGrVwH_t h, unsigned flags );
  82. unsigned cmGrViewFontStyle( cmGrVwH_t h );
  83. void cmGrViewSetFontSize( cmGrVwH_t h, unsigned size );
  84. unsigned cmGrViewFontSize( cmGrVwH_t h );
  85. // Assign a translation function to be used with cmGrViewValue().
  86. // cmLeftGrIdx or cmGrRightGrIdx is used to assign y axis translation functions.
  87. // cmTopGrIdx or cmGrBottomGrIdx is used to assign x axis translation functions.
  88. // 'pgLabelFuncId' must be a valid page label function id as returned from cmGrPageLabelFuncRegister().
  89. // or cmGrPageLabelFuncIndexToId().
  90. void cmGrViewSetLabelFunc( cmGrVwH_t h, cmGrAxisIdx_t axisId, unsigned pgLabelFuncId );
  91. typedef enum
  92. {
  93. kLocalX_VwId,
  94. kLocalY_VwId,
  95. kGlobalX_VwId,
  96. kGlobalY_VwId,
  97. kSelX0_VwId,
  98. kSelY0_VwId,
  99. kSelX1_VwId,
  100. kSelY1_VwId,
  101. kSelW_VwId,
  102. kSelH_VwId
  103. } cmGrViewValueId_t;
  104. const cmChar_t* cmGrViewValue( cmGrVwH_t h, cmGrViewValueId_t id, cmChar_t* buf, unsigned bufCharCnt );
  105. // Get an axis handle.
  106. cmGrAxH_t cmGrViewAxisHandle( cmGrVwH_t h, cmGrAxisIdx_t axisIdx );
  107. bool cmGrAxisIsValid( cmGrAxH_t h );
  108. // kHashMarkGrFl | kHashLabelGrFl
  109. void cmGrAxisSetCfg( cmGrAxH_t h, unsigned cfgFlags );
  110. unsigned cmGrAxisCfg( cmGrAxH_t h );
  111. void cmGrAxisSetTitle( cmGrAxH_t h, const cmChar_t* title );
  112. const cmChar_t* cmGrAxisTitle( cmGrAxH_t h );
  113. void cmGrAxisTitleSetFontFamily( cmGrAxH_t h, unsigned id );
  114. unsigned cmGrAxisTitleFontFamily( cmGrAxH_t h );
  115. void cmGrAxisTitleSetFontStyle( cmGrAxH_t h, unsigned flags );
  116. unsigned cmGrAxisTitleFontStyle( cmGrAxH_t h );
  117. void cmGrAxisTitleSetFontSize( cmGrAxH_t h, unsigned size );
  118. unsigned cmGrAxisTitleFontSize( cmGrAxH_t h );
  119. void cmGrAxisLabelSetFontFamily( cmGrAxH_t h, unsigned id );
  120. unsigned cmGrAxisLabelFontFamily( cmGrAxH_t h );
  121. void cmGrAxisLabelSetFontStyle( cmGrAxH_t h, unsigned flags );
  122. unsigned cmGrAxisLabelFontStyle( cmGrAxH_t h );
  123. void cmGrAxisLabelSetFontSize( cmGrAxH_t h, unsigned size );
  124. unsigned cmGrAxisLabelFontSize( cmGrAxH_t h );
  125. // Assign a translation function for the value on this axis.
  126. // 'pgLabelFuncId' must be a valid page label function id as returned from cmGrPageLabelFuncRegister().
  127. // or cmGrPageLabelFuncIndexToId().
  128. void cmGrAxisSetLabelFunc( cmGrAxH_t h, unsigned pgLabelFuncId );
  129. #ifdef __cplusplus
  130. }
  131. #endif
  132. #endif