mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mboxlayoutpiece.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_BOXLAYOUTPIECE_H
33 #define _MGUI_NCSCTRL_BOXLAYOUTPIECE_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct _mBoxLayoutPieceClass mBoxLayoutPieceClass;
40 typedef struct _mBoxLayoutPiece mBoxLayoutPiece;
41 
42 #define mBoxLayoutPieceClassHeader(clss, superCls) \
43  mLayoutPieceClassHeader(clss, superCls) \
44  \
45  void (*recalcBox)(clss *); \
46  int (*getCellAutoSize)(clss *, int i); \
47  \
48  int (*setCellInfo)(clss *, int idx, int size, int type/*=NCS_BOXLAYOUTPIECE_ST_FIXED*/, BOOL bupdate/*=FALSE*/); \
49  mHotPiece* (*setCell)(clss *, int idx, mHotPiece *cell); \
50  mHotPiece* (*getCell)(clss *, int idx);
51 
52 struct _mBoxLayoutPieceClass
53 {
54  mBoxLayoutPieceClassHeader(mBoxLayoutPiece, mLayoutPiece)
55 };
56 
57 MGNCS_EXPORT extern mBoxLayoutPieceClass g_stmBoxLayoutPieceCls;
58 
59 #define mBoxLayoutPieceHeader(clss) \
60  mLayoutPieceHeader(clss) \
61  int left:16; \
62  int top:16; \
63  int right:16; \
64  int bottom:16; \
65  unsigned short count; \
66  unsigned char margin; \
67  unsigned char space; \
68  unsigned short * cell_info; \
69  mHotPiece ** cells;
70 
71 
72 struct _mBoxLayoutPiece
73 {
74  mBoxLayoutPieceHeader(mBoxLayoutPiece)
75 };
76 
77 #define mBoxLayoutPiece_getSizeType(size) mLayoutPiece_getSizeType(size)
78 #define mBoxLayoutPiece_setSizeType(size, type) mLayoutPiece_setSizeType(size, type)
79 #define mBoxLayoutPiece_setSize(size, value) mLayoutPiece_setSize(size, value)
80 #define mBoxLayoutPiece_getSize(size) mLayoutPiece_getSize(size)
81 
82 
83 enum mBoxLayoutPieceProps{
84  NCSP_BOXLAYOUTPIECE_COUNT = BOXLAYOUTPIECE_PROP_BEGIN,
85  NCSP_BOXLAYOUTPIECE_SPACE = PIECECOMM_PROP_SPACE,
86  NCSP_BOXLAYOUTPIECE_MARGIN = PIECECOMM_PROP_MARGIN
87 };
88 
91 BOOL mBoxLayoutPiece_calcSize(mBoxLayoutPiece *self, int total_size, int *sizes);
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
98