mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
mlabelpiece.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 #ifndef _MGNCS_LABELPIECE_H
44 #define _MGNCS_LABELPIECE_H
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 typedef struct _mLabelPieceClass mLabelPieceClass;
51 typedef struct _mLabelPiece mLabelPiece;
52 
53 #define mLabelPieceClassHeader(clss, superCls) \
54  mStaticPieceClassHeader(clss, superCls)
55 
56 struct _mLabelPieceClass
57 {
58  mLabelPieceClassHeader(mLabelPiece, mStaticPiece)
59 };
60 
61 MGNCS_EXPORT extern mLabelPieceClass g_stmLabelPieceCls;
62 
63 #define mLabelPieceHeader(clss) \
64  mStaticPieceHeader(clss) \
65  const char* str; \
66  char align; \
67  char valign; \
68  unsigned char flag;
69 
70 struct _mLabelPiece
71 {
72  mLabelPieceHeader(mLabelPiece)
73 };
74 
75 #define mLabelPiece_setFlag(self, bitmask) (((self)->flag)|=(bitmask))
76 #define mLabelPiece_clearFlag(self, bitmask) (((self)->flag)&=(~(bitmask)))
77 #define mLabelPiece_isFlag(self, bitmask) (((self->flag)&(bitmask)) == (bitmask))
78 
79 #define mLabelPiece_setAutoWrap(self, autoWrap) ((autoWrap)?mLabelPiece_setFlag(self, 0x1):mLabelPiece_clearFlag(self, 0x1))
80 #define mLabelPiece_isAutoWrap(self) mLabelPiece_isFlag(self, 0x1)
81 
82 #define mLabelPiece_setPrefix(self, prefix) ((prefix)?mLabelPiece_setFlag(self, 0x2):mLabelPiece_clearFlag(self, 0x2))
83 #define mLabelPiece_isPrefix(self) mLabelPiece_isFlag(self, 0x2)
84 
85 #define mLabelPiece_setWordBreak(self, wordbreak) ((wordbreak)?mLabelPiece_setFlag(self, 0x4):mLabelPiece_clearFlag(self, 0x4))
86 #define mLabelPiece_isWordBreak(self) mLabelPiece_isFlag(self, 0x4)
87 
88 #define mLabelPiece_setSelected(self, selected) ((selected)?mLabelPiece_setFlag(self, 0x8):mLabelPiece_clearFlag(self, 0x8))
89 #define mLabelPiece_isSelected(self) mLabelPiece_isFlag(self, 0x8)
90 
91 enum mLabelPieceProps {
92  NCSP_LABELPIECE_LABEL = LABELPIECE_PROP_BEGIN,
93  NCSP_LABELPIECE_PREFIX,
94  NCSP_LABELPIECE_SELECT = PIECECOMM_PROP_SELECT,
95  NCSP_LABELPIECE_ALIGN = PIECECOMM_PROP_ALIGN,
96  NCSP_LABELPIECE_VALIGN = PIECECOMM_PROP_VALIGN,
97  NCSP_LABELPIECE_AUTOWRAP = PIECECOMM_PROP_AUTOWRAP,
98  NCSP_LABELPIECE_WORDBREAK = PIECECOMM_PROP_WORDBREAK
99 };
100 
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
107