mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mlinelayoutpiece.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 #if defined (_MGNCSCTRL_TOOLBAR) || defined (_MGNCSCTRL_IMWORDSEL)
32 
33 #ifndef _MGUI_NCSCTRL_LINELAYOUTPIECE_H
34 #define _MGUI_NCSCTRL_LINELAYOUTPIECE_H
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct _mLineLayoutPieceClass mLineLayoutPieceClass;
41 typedef struct _mLineLayoutPiece mLineLayoutPiece;
42 
43 #define NCS_LINELAYOUTPIECENODE_FLAG_FIXED 0x00 //the size of piece is fixed
44 #define NCS_LINELAYOUTPIECENODE_FLAG_AUTO 0x01 //the size of piece must bigger than def_size
45 typedef struct _mLineLayoutPieceNode {
46  mHotPiece * piece;
47  struct _mLineLayoutPieceNode * next, *prev;
48  unsigned int flags:8;
49  unsigned int def_min_size:12;
50  unsigned int def_max_size:12;
51 }mLineLayoutPieceNode;
52 
53 #define mLineLayoutPieceClassHeader(clss, superCls) \
54  mLayoutPieceClassHeader(clss, superCls) \
55  BOOL (*addPiece)(clss*, mHotPiece *piece, int type, int min_size, int max_size); \
56  BOOL (*appendPiece)(clss*, mHotPiece *piece, int type, int min_size, int max_size); \
57  void (*recalc)(clss*); \
58  mLineLayoutPieceNode * (*find)(clss *,mHotPiece *piece); \
59  void (*reset)(clss*, void (*free_piece)(mHotPiece*));
60 
61 struct _mLineLayoutPieceClass
62 {
63  mLineLayoutPieceClassHeader(mLineLayoutPiece, mLayoutPiece)
64 };
65 
66 extern mLineLayoutPieceClass g_stmLineLayoutPieceCls;
67 
68 #define mLineLayoutPieceHeader(clss) \
69  mLayoutPieceHeader(clss) \
70  int left:16; \
71  int top:16; \
72  int right:16; \
73  int bottom:16; \
74  unsigned short direction:1; \
75  unsigned short autoWrap:1; \
76  unsigned short line_height:14; \
77  unsigned char margin; \
78  unsigned char space; \
79  mLineLayoutPieceNode *node; \
80  mLineLayoutPieceNode *tail_node;
81 
82 
83 struct _mLineLayoutPiece
84 {
85  mLineLayoutPieceHeader(mLineLayoutPiece)
86 };
87 
88 enum mLineLayoutPieceProps{
89  NCSP_LINELAYOUTPIECE_COUNT = LINELAYOUTPIECE_PROP_BEGIN,
90  NCSP_LINELAYOUTPIECE_LINE_HEIGHT,
91  NCSP_LINELAYOUTPiECE_AUTOWRAP = PIECECOMM_PROP_AUTOWRAP,
92  NCSP_LINELAYOUTPIECE_DIRECTION = PIECECOMM_PROP_DIRECTION,
93  NCSP_LINELAYOUTPIECE_SPACE = PIECECOMM_PROP_SPACE,
94  NCSP_LINELAYOUTPIECE_MARGIN = PIECECOMM_PROP_MARGIN
95 };
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif
102 #endif //_MGNCSCTRL_TOOLBAR