mGNCS API Reference  v1.5.0
A new control set and a new framework for MiniGUI apps
mbutton.h
Go to the documentation of this file.
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 
54 #ifndef _MGUI_NCSCTRL_BUTTON_H
55 #define _MGUI_NCSCTRL_BUTTON_H
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif /* __cplusplus */
60 
70 #define NCSCTRL_BUTTON NCSCLASSNAME("button")
71 
72 typedef struct _mButton mButton;
73 typedef struct _mButtonClass mButtonClass;
74 typedef struct _mButtonRenderer mButtonRenderer;
75 
85 };
86 
100 #define mButtonHeader(clsName) \
101  mWidgetHeader(clsName) \
102  mWidget* group;
103 
113 struct _mButton
114 {
115  mButtonHeader(mButton)
116 };
117 
118 #define mButtonClassHeader(clsName, parentClass) \
119  mWidgetClassHeader(clsName, parentClass) \
120  mObject * (*createContent)(clsName *self, DWORD dwStyle); \
121  mObject * (*createButtonBody)(clsName *self, DWORD dwStyle, mObject * content);
122 
144 struct _mButtonClass
145 {
146  mButtonClassHeader(mButton, mWidget)
147 };
148 
149 #define mButtonRendererHeader(clsName, parentClass) \
150  mWidgetRendererHeader(clsName, parentClass) \
151  void (*drawPushButton)(clsName *self, HDC hdc, \
152  const RECT *rect, \
153  DWORD color1, DWORD color2, int status);
154 
172 struct _mButtonRenderer
173 {
174  mButtonRendererHeader(mButton, mWidget)
175 };
176 
181 MGNCS_EXPORT extern mButtonClass g_stmButtonCls;
182 
195  NCSP_BUTTON_ALIGN = NCSP_WIDGET_MAX + 1,
252  NCSP_BUTTON_MAX
253 };
254 
265  NCSN_BUTTON_PUSHED = NCSN_WIDGET_MAX + 1,
273  NCSN_BUTTON_MAX
274 };
275 
280 #define NCSS_BUTTON_IMAGE (1<<NCSS_WIDGET_SHIFT)
281 
285 #define NCSS_BUTTON_CHECKABLE (2<<NCSS_WIDGET_SHIFT)
286 
291 #define NCSS_BUTTON_AUTOCHECK (4<<NCSS_WIDGET_SHIFT)
292 
297 #define NCSS_BUTTON_3DCHECK (8<<NCSS_WIDGET_SHIFT)
298 
303 #define NCSS_BUTTON_IMAGELABEL (0x10<<NCSS_WIDGET_SHIFT)
304 
309 #define NCSS_BUTTON_VERTIMAGELABEL (0x20<<NCSS_WIDGET_SHIFT)
310 #define NCSS_BUTTON_SHIFT (NCSS_WIDGET_SHIFT + 6)
311 
317 #ifdef __cplusplus
318 }
319 #endif /* __cplusplus */
320 
321 #endif /* _MGUI_NCSCTRL_BUTTON_H */
322 
NCSP_BUTTON_VALIGN
@ NCSP_BUTTON_VALIGN
Set the button text vertical align.
Definition: mbutton.h:203
NCSN_BUTTON_PUSHED
@ NCSN_BUTTON_PUSHED
button pushed
Definition: mbutton.h:265
mButton
Button class, derived from mWidget.
NCSP_BUTTON_IMAGE
@ NCSP_BUTTON_IMAGE
Set the button image pointer.
Definition: mbutton.h:219
NCSP_BUTTON_WORDWRAP
@ NCSP_BUTTON_WORDWRAP
Set the button text to autowrap mode.
Definition: mbutton.h:211
NCSP_BUTTON_GROUPID
@ NCSP_BUTTON_GROUPID
Set the button group id.
Definition: mbutton.h:243
NCSP_BUTTON_ALIGN
@ NCSP_BUTTON_ALIGN
Set the button text horizontal align.
Definition: mbutton.h:195
eButtonNotify
eButtonNotify
the notification code of mButton
Definition: mbutton.h:260
NCSP_BUTTON_GROUP
@ NCSP_BUTTON_GROUP
Set the button group.
Definition: mbutton.h:251
NCS_BUTTON_UNCHECKED
@ NCS_BUTTON_UNCHECKED
button unchecked state, the button is not pushed down
Definition: mbutton.h:82
NCSN_BUTTON_STATE_CHANGED
@ NCSN_BUTTON_STATE_CHANGED
button check state changed
Definition: mbutton.h:272
NCSP_BUTTON_CHECKSTATE
@ NCSP_BUTTON_CHECKSTATE
Set the check state of button.
Definition: mbutton.h:227
mWidget
define the mWidget members, inherit from mComponent
NCS_BUTTON_CHECKED
@ NCS_BUTTON_CHECKED
button checked state, the button is pushed down
Definition: mbutton.h:84
NCSP_BUTTON_IMAGE_SIZE_PERCENT
@ NCSP_BUTTON_IMAGE_SIZE_PERCENT
Set the image size.
Definition: mbutton.h:235
mButtonCheckState
mButtonCheckState
define the check state of button
Definition: mbutton.h:81
mButtonRenderer
Button class renderer interface, derived from mWidgetRenderer.
mButtonProp
mButtonProp
the properties id of mButton
Definition: mbutton.h:187
NCS_BUTTON_HALFCHECKED
@ NCS_BUTTON_HALFCHECKED
button halfchecked state, it is a state between checked and unchecked, halfchecked state is valid if ...
Definition: mbutton.h:83
mButtonClass
button struct of button control, derived from mWidgetClass
g_stmButtonCls
MGNCS_EXPORT mButtonClass g_stmButtonCls
global mButtonClass