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