grid.h
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:4k
源码类别:

DVD

开发平台:

Others

  1. /* **************************************************************************************
  2.  *  Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
  3.  *  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
  4.  *
  5.  *  File: $Workfile: Grid.h $             
  6.  *
  7.  * Description:
  8.  * ============
  9.  * Menu system choice extension widget
  10.  * 
  11.  * Log:
  12.  * ====
  13.  * $Revision: 3 $
  14.  * Last Modified by $Author: Nirm $ at $Modtime: 23/04/02 9:06 $ 
  15.  ****************************************************************************************
  16.  * Updates:
  17.  ****************************************************************************************
  18.  * $Log: /I49/H49V/UI/Menu_sys/Grid.h $
  19.  * 
  20.  * 3     23/04/02 9:39 Nirm
  21.  * - Added dependency in "Config.h".
  22.  * 
  23.  * 2     25/12/01 10:24 Atai
  24.  * Code Cleaning
  25.  * 
  26.  * 
  27.  **************************************************************************************** */
  28. #include "Config.h" // Global Configuration - do not remove!
  29. #ifndef _GRID_H_
  30. #define _GRID_H_
  31. // Values for m_wAttrs orientation
  32. #define GRID_VERTICAL   0x0000
  33. #define GRID_HORIZONTAL   0x0001
  34. #define GRID_IS_HORIZONTAL(_pGrid_)   ( ((_pGrid_)->m_wAttrs & GRID_HORIZONTAL) == GRID_HORIZONTAL )
  35. #define GRID_IS_VERTICAL(_pGrid_)   (!GRID_IS_HORIZONTAL(_pGrid_))
  36. // Values for m_wAttrs h-wrap
  37. #define GRID_HWRAP_PREV_NEXT 0x0002
  38. #define GRID_HWRAP_SAME_ROW 0x0004
  39. #define GRID_HWRAP (GRID_HWRAP_PREV_NEXT | GRID_HWRAP_SAME_ROW)
  40. #define GRID_IS_HWRAP(_pGrid_)    ((_pGrid_)->m_wAttrs & GRID_HWRAP)
  41. #define GRID_IS_HWRAP_PREV_NEXT(_pGrid_) ( ((_pGrid_)->m_wAttrs & GRID_HWRAP_PREV_NEXT) == GRID_HWRAP_PREV_NEXT )
  42. #define GRID_IS_HWRAP_SAME_ROW(_pGrid_) ( ((_pGrid_)->m_wAttrs & GRID_HWRAP_SAME_ROW) == GRID_HWRAP_SAME_ROW )
  43. // Values for m_wAttrs v-wrap
  44. #define GRID_VWRAP_PREV_NEXT 0x0008
  45. #define GRID_VWRAP_SAME_COLUMN 0x0010
  46. #define GRID_VWRAP (GRID_VWRAP_PREV_NEXT | GRID_VWRAP_SAME_COLUMN)
  47. #define GRID_IS_VWRAP(_pGrid_)    ((_pGrid_)->m_wAttrs & GRID_VWRAP)
  48. #define GRID_IS_VWRAP_PREV_NEXT(_pGrid_) ( ((_pGrid_)->m_wAttrs & GRID_VWRAP_PREV_NEXT) == GRID_VWRAP_PREV_NEXT )
  49. #define GRID_IS_VWRAP_SAME_COLUMN(_pGrid_)   ( ((_pGrid_)->m_wAttrs & GRID_VWRAP_SAME_COLUMN) == GRID_VWRAP_SAME_COLUMN )
  50. // For horizontal grids, this member is used for items per row
  51. #define   m_wItemsPerRow m_wItemsPerColumn
  52. typedef struct oGrid
  53. {
  54.   WORD m_wNumItems;
  55.   WORD m_wItemsPerColumn;
  56.   WORD m_wLeftX;
  57.   WORD m_wTopY;
  58.   WORD m_wColumnWidth;
  59.   WORD m_wRowHeight;
  60.   WORD m_wAttrs;
  61. } O_GRID, *PO_GRID;
  62. WORD grid_row( PO_GRID pGrid, WORD wItemNum );
  63. WORD grid_column( PO_GRID pGrid, WORD wItemNum );
  64. WORD grid_last_column_in_row( PO_GRID pGrid, WORD wRow );
  65. WORD grid_last_row_in_column( PO_GRID pGrid, WORD wColumn );
  66. void grid_init( PO_GRID pGrid, WORD wNumItems, WORD wItemsPerColumn,
  67.  WORD wLeftX, WORD wTopY,
  68.  WORD wColumnWidth, WORD wRowHeight,
  69.  WORD wAttrs );
  70. PO_GRID grid_create( WORD wNumItems, WORD wItemsPerColumn,
  71.  WORD wLeftX, WORD wTopY,
  72.  WORD wColumnWidth, WORD wRowHeight,
  73.  WORD wAttrs );
  74. WORD grid_item_x( PO_GRID pGrid, WORD wItemNum );
  75. WORD grid_item_y( PO_GRID pGrid, WORD wItemNum );
  76. WORD grid_itemNum( PO_GRID pGrid, WORD wColumn, WORD wRow );
  77. WORD grid_itemNum_from_pos( PO_GRID pGrid, WORD x, WORD y );
  78. WORD grid_item_up( PO_GRID pGrid, WORD wItemNum );
  79. WORD grid_item_down( PO_GRID pGrid, WORD wItemNum );
  80. WORD grid_item_left( PO_GRID pGrid, WORD wItemNum );
  81. WORD grid_item_right( PO_GRID pGrid, WORD wItemNum );
  82. #endif // _GRID_H_