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