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