mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
manimatepiece.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 #ifdef _MGNCSCTRL_ANIMATE
32 #ifndef _MGNCS_ANIMATEPIECE_H
33 #define _MGNCS_ANIMATEPIECE_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct _mAnimatePiece mAnimatePiece;
40 typedef struct _mAnimatePieceClass mAnimatePieceClass;
41 
42 #define mAnimatePieceHeader(clss) \
43  mStaticPieceHeader(clss) \
44  unsigned char flags; \
45  unsigned char align:4; \
46  unsigned char valign:4; \
47  mAnimateFrames *frame;
48 
49 struct _mAnimatePiece
50 {
51  mAnimatePieceHeader(mAnimatePiece)
52 };
53 
54 #define mAnimatePieceClassHeader(clss, superCls) \
55  mStaticPieceClassHeader(clss, superCls) \
56  void (*reset)(mAnimatePiece *self); \
57  void (*autofit)(mAnimatePiece *self, int *width, int *height); \
58 
59 struct _mAnimatePieceClass
60 {
61  mAnimatePieceClassHeader(mAnimatePiece, mStaticPiece)
62 };
63 
64 MGNCS_EXPORT extern mAnimatePieceClass g_stmAnimatePieceCls;
65 
66 enum mAnimatePieceProps {
67  NCSP_ANIMATEPIECE_GIFFILE = ANIMATEPIECE_PROP_BEGIN,
68  NCSP_ANIMATEPIECE_DIR,
69  NCSP_ANIMATEPIECE_MEM,
70  NCSP_ANIMATEPIECE_AUTOLOOP,
71  NCSP_ANIMATEPIECE_SCALE,
72  NCSP_ANIMATEPIECE_AUTOFIT,
73  NCSP_ANIMATEPIECE_AUTOPLAY,
74  NCSP_ANIMATEPIECE_BMPARRAY,
75  NCSP_ANIMATEPIECE_AFRAME,
76  NCSP_ANIMATEPIECE_ALIGN = PIECECOMM_PROP_ALIGN,
77  NCSP_ANIMATEPIECE_VALIGN = PIECECOMM_PROP_VALIGN
78 };
79 
80 #define NCSS_AF_AUTOLOOP 0x01
81 #define NCSS_AF_PLAY 0x02
82 #define NCSS_AF_SCALE 0x04
83 #define NCSS_AF_AUTOFIT 0x08
84 #define NCSS_AF_AUTOPLAY 0x10
85 
86 #define mAnimatePiece_setAutoloop(self, bautoloop) \
87  ((bautoloop)?SET_BIT((self)->flags, NCSS_AF_AUTOLOOP):CLEAR_BIT((self)->flags, NCSS_AF_AUTOLOOP))
88 
89 #define mAnimatePiece_isAutoloop(self) \
90  IS_BIT_SET((self)->flags, NCSS_AF_AUTOLOOP)
91 
92 #define mAnimatePiece_setScale(self, bscale) \
93  ((bscale)?SET_BIT((self)->flags, NCSS_AF_SCALE):CLEAR_BIT((self)->flags, NCSS_AF_SCALE))
94 
95 #define mAnimatePiece_isScale(self) \
96  IS_BIT_SET((self)->flags, NCSS_AF_SCALE)
97 
98 #define mAnimatePiece_setAutofit(self, bautofit) \
99  ((bautofit)?SET_BIT((self)->flags, NCSS_AF_AUTOFIT):CLEAR_BIT((self)->flags, NCSS_AF_AUTOFIT))
100 
101 #define mAnimatePiece_isAutofit(self) \
102  IS_BIT_SET((self)->flags, NCSS_AF_AUTOFIT)
103 
104 #define mAnimatePiece_setPlay(self, bplay) \
105  ((bplay)?SET_BIT((self)->flags, NCSS_AF_PLAY):CLEAR_BIT((self)->flags, NCSS_AF_PLAY))
106 
107 #define mAnimatePiece_isPlay(self) \
108  IS_BIT_SET((self)->flags, NCSS_AF_PLAY)
109 
110 #define mAnimatePiece_setAutoplay(self, bautoplay) \
111  ((bautoplay)?SET_BIT((self)->flags, NCSS_AF_AUTOPLAY):CLEAR_BIT((self)->flags, NCSS_AF_AUTOPLAY))
112 
113 #define mAnimatePiece_isAutoplay(self) \
114  IS_BIT_SET((self)->flags, NCSS_AF_AUTOPLAY)
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif
121 #endif //_MGNCSCTRL_ANIMATE
122