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