mGNCS API Reference  v1.2.0
A new control set and a new framework for MiniGUI apps
mhotpiece.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 
32 #ifndef _MGNCS_HOT_PIECEC_H
33 #define _MGNCS_HOT_PIECEC_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include "piece-id.h"
40 
41 typedef struct _mHotPieceClass mHotPieceClass;
42 typedef struct _mHotPiece mHotPiece;
43 
44 #define mHotPieceClassHeader(clss, superCls) \
45  mObjectClassHeader(clss, superCls) \
46  mHotPiece* (*hitTest)(clss *, int x, int y); \
47  void (*paint)(clss *, HDC hdc, mObject * owner, DWORD add_data); \
48  LRESULT (*processMessage)(clss *, UINT message, WPARAM, LPARAM, mObject *owner); \
49  BOOL (*setProperty)(clss *, int id, DWORD value); \
50  DWORD(*getProperty)(clss *, int id); \
51  BOOL (*enable)(clss *, BOOL benable); \
52  BOOL (*isEnabled)(clss *); \
53  BOOL (*setRenderer)(clss *, const char* rdr_name); \
54  BOOL (*setRect)(clss *, const RECT * prc); \
55  BOOL (*getRect)(clss *, RECT * prc); \
56  BOOL (*autoSize)(clss *, mObject *owner, const SIZE *pszMin, const SIZE *pszMax);
57 
58 struct _mHotPieceClass
59 {
60  mHotPieceClassHeader(mHotPiece, mObject)
61 };
62 
63 MGNCS_EXPORT extern mHotPieceClass g_stmHotPieceCls;
64 
65 #define mHotPieceHeader(clss) \
66  mObjectHeader(clss) \
67  mHotPiece * parent;
68 
69 struct _mHotPiece
70 {
71  mHotPieceHeader(mHotPiece)
72 };
73 
74 typedef void (*PHotPieceRdrFunc)(mHotPiece*, HDC hdc, mObject* owner, DWORD add_data);
75 
76 
77 #define SET_BIT(flag, mask) ((flag)|=(mask))
78 #define IS_BIT_SET(flag, mask) (((flag)&(mask)) == (mask))
79 #define CLEAR_BIT(flag, mask) ((flag)&=~(mask))
80 
81 
82 MGNCS_EXPORT mHotPiece * ncsNewPiece(mHotPieceClass *_class, DWORD add_data);
83 #define NEWPIECEEX(Piece,add_data) (Piece*)(ncsNewPiece((mHotPieceClass*)((void *)&(Class(Piece))),(DWORD)(add_data)))
84 #define NEWPIECE(Piece) NEWPIECEEX(Piece, 0)
85 MGNCS_EXPORT void ncsDelPiece(mHotPiece* piece);
86 #define DELPIECE(p) ncsDelPiece((mHotPiece*)p)
87 
88 
89 MGNCS_EXPORT void mHotPiece_update(mHotPiece *self, mObject *onwer, BOOL bUpdate);
90 
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif
97 
98 
the Object struct