mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mgridboxpiece.h
1 /*
2  * This file is part of mGNCS, a component for MiniGUI.
3  *
4  * Copyright (C) 2008~2018, Beijing FMSoft Technologies Co., Ltd.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Or,
20  *
21  * As this program is a library, any link to this program must follow
22  * GNU General Public License version 3 (GPLv3). If you cannot accept
23  * GPLv3, you need to be licensed from FMSoft.
24  *
25  * If you have got a commercial license of this program, please use it
26  * under the terms and conditions of the commercial license.
27  *
28  * For more information about the commercial license, please refer to
29  * <http://www.minigui.com/en/about/licensing-policy/>.
30  */
31 
32 #ifndef _MGUI_NCSCTRL_GRIDBOXPIECE_H
33 #define _MGUI_NCSCTRL_GRIDBOXPIECE_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct _mGridBoxPieceClass mGridBoxPieceClass;
40 typedef struct _mGridBoxPiece mGridBoxPiece;
41 
42 #define CELL_POINT_ISNULL(cp) ((cp).row == 0xFFFF || (cp).col == 0xFFFF)
43 #define NULL_CELL_POINT { 0xFFFF, 0xFFFF}
44 typedef struct _CELL_POINT{
45  unsigned short row;
46  unsigned short col;
47 }CELL_POINT;
48 
49 #define mGridBoxPieceClassHeader(clss, superCls) \
50  mRenderablePieceClassHeader(clss, superCls) \
51  CELL_POINT (* hitCell)(clss *, int x, int y); \
52  RECT * (*getCellRect)(clss *, int row, int col, RECT *prc); \
53  void (*updateNewCell)(clss *, CELL_POINT old_cell, CELL_POINT new_cell, int old_mask, int new_mask, mWidget *owner);
54 
55 struct _mGridBoxPieceClass
56 {
57  mGridBoxPieceClassHeader(mGridBoxPiece, mRenderablePiece)
58 };
59 
60 MGNCS_EXPORT extern mGridBoxPieceClass g_stmGridBoxPieceCls;
61 
62 #define mGridBoxPieceHeader(clss) \
63  mRenderablePieceHeader(clss) \
64  unsigned short rows; \
65  unsigned short cols;
66 
67 struct _mGridBoxPiece
68 {
69  mGridBoxPieceHeader(mGridBoxPiece)
70 };
71 
72 
73 #define NCS_GRIDBOXPIECE_PAINT_MASK_DRAWSEL 0x01
74 #define NCS_GRIDBOXPIECE_PAINT_MASK_HOT 0x02
75 #define NCS_GRIDBOXPIECE_PAINT_MASK_REDRAW 0x04
76 #define NCS_GRIDBOXPIECE_PAINT_MASK_ALL_CELLS 0x10
77 typedef struct mGridBoxPiecePaintData{
78  DWORD mask;
79  CELL_POINT hot_cell;
80  CELL_POINT sel_cell;
81  DWORD add_data;
82 }mGridBoxPiecePaintData;
83 
84 enum mGridBoxPieceProps{
85  NCSP_GRIDBOXPIECE_ROWS = GRIDBOXPIECE_PROP_BEGIN,
86  NCSP_GRIDBOXPIECE_COLS
87 };
88 
89 #define mGridBoxPiece_makeCell(col, row) (DWORD)(((col)&0xFF)|(((row)&0xFF)<<8))
90 #define mGridBoxPiece_getRow(cell) (((cell)&0xFF00)>>8)
91 #define mGridBoxPiece_getCol(cell) ((cell)&0xFF)
92 
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif
99