ZFFramework
 
Loading...
Searching...
No Matches
ZFUIButtonGroup.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFUIButtonGroup_h_
7#define _ZFI_ZFUIButtonGroup_h_
8
9#include "ZFUIButton.h"
11
12// ============================================================
13// ZFUIButtonGroupType
34
35// ============================================================
36// ZFUIButtonGroup
37zfclassFwd _ZFP_ZFUIButtonGroupPrivate;
44zfclass ZFLIB_ZFUIWidget ZFUIButtonGroup : zfextend ZFStyle {
45 ZFOBJECT_DECLARE(ZFUIButtonGroup, ZFStyle)
46
47public:
48 // ============================================================
49 // events
58 ZFEVENT(ButtonOnAdd)
67 ZFEVENT(ButtonOnRemove)
68
69public:
75
76public:
86 )
91 , ZFMP_IN(zfindex, buttonIndex)
92 )
101 , ZFMP_IN_OPT(zfindex, atIndex, zfindexMax())
117 , ZFMP_IN(zfindex, buttonIndex)
123
124protected:
150 virtual inline void buttonOnEvent(
152 , ZF_IN zfindex buttonIndex
153 , ZF_IN zfidentity eventId
154 ) {
156 button,
157 eventId,
158 this,
159 zfobj<v_zfindex>(buttonIndex));
160 }
161
162 virtual inline void buttonOnAdd(
164 , ZF_IN zfindex buttonIndex
165 ) {
167 button,
169 this,
170 zfobj<v_zfindex>(buttonIndex));
171 }
172
173 virtual inline void buttonOnRemove(
175 , ZF_IN zfindex buttonIndex
176 ) {
178 button,
180 this,
181 zfobj<v_zfindex>(buttonIndex));
182 }
183
184 // ============================================================
185 // for v_ZFUIButtonGroupType::e_Tab type
186public:
197 ZFEVENT(TabOnUpdate)
207 ZFEVENT(TabOnClickChecked)
208
214
221
222public:
240
245
246protected:
248 virtual inline void tabOnUpdate(
250 , ZF_IN zfindex buttonIndexPrev
251 ) {
253 button,
255 this,
256 zfobj<v_zfindex>(buttonIndexPrev));
257 }
258
259 virtual inline void tabOnClickChecked(
261 , ZF_IN zfindex buttonIndex
262 ) {
264 button,
266 this,
267 zfobj<v_zfindex>(buttonIndex));
268 }
269
270protected:
272 virtual void objectOnInit(void);
274 virtual void objectOnDealloc(void);
275
276private:
277 _ZFP_ZFUIButtonGroupPrivate *d;
278 friend zfclassFwd _ZFP_ZFUIButtonGroupPrivate;
279};
280
282#endif // #ifndef _ZFI_ZFUIButtonGroup_h_
283
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:180
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#define zfindexMax()
(zfindex)-1, indicate a max index value, see zfindex
Definition ZFCoreTypeDef_CoreType.h:159
#define zffalse
bool false type
Definition ZFCoreTypeDef_CoreType.h:111
#define ZFENUM_SEPARATOR()
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:158
#define ZFENUM_VALUE_REGISTER(Value)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:168
#define ZFENUM_REG(ZFLIB_, EnumName,...)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:186
#define ZFENUM_VALUE(Value)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:151
#define ZFENUM_BEGIN(ZFLIB_, EnumName)
macros to define reflectable enum type
Definition ZFEnumDeclare.h:147
#define ZFENUM_END(ZFLIB_, EnumName)
see ZFENUM_BEGIN
Definition ZFEnumDeclare.h:172
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:693
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1025
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:854
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_ON_INIT_DECLARE_1(ZFMP_0)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:263
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:328
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
#define ZFPROPERTY_ON_UPDATE_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:238
#define ZFPROPERTY_ON_ATTACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:248
abstract button
v_ZFUIButtonGroupType::ZFEnumType ZFUIButtonGroupType
see v_ZFUIButtonGroupType
Definition ZFUIButtonGroup.h:32
#define ZFLIB_ZFUIWidget
used to export symbols
Definition ZFUIWidgetDef.h:17
void observerNotifyWithSender(ZFObject *customSender, zfidentity eventId, ZFObject *param0=zft_zfnull, ZFObject *param1=zft_zfnull)
see observerNotify
virtual ZFUIView * container()
the container currently attached, see containerAttach
virtual zfindex & tabChecked()
for v_ZFUIButtonGroupType::e_Tab type only, the checked tab index, zfindexMax() by default
Definition ZFUIButtonGroup.h:218
virtual void buttonRemove(ZFUIButton *button)
remove button or do nothing if not in this button group
virtual void containerAttach(ZFUIView *container)
util method to attach container to this button group
virtual void buttonOnEvent(ZFUIButton *button, zfindex buttonIndex, zfidentity eventId)
called when any of button event are notified to the buttons managed by this group
Definition ZFUIButtonGroup.h:150
virtual void buttonRemoveAll()
remove all button
virtual void objectOnInit(void)
override this to init your object
virtual void buttonOnAdd(ZFUIButton *button, zfindex buttonIndex)
see E_ButtonOnAdd
Definition ZFUIButtonGroup.h:162
virtual void tabOnUpdate(ZFUIButton *button, zfindex buttonIndexPrev)
see E_TabOnUpdate
Definition ZFUIButtonGroup.h:248
virtual zfanyT< ZFUIButton > buttonAt(zfindex buttonIndex)
get button at index
static zfidentity E_ButtonOnAdd(void)
see ZFObject::observerNotify
virtual void tabOnClickChecked(ZFUIButton *button, zfindex buttonIndex)
see E_TabOnClickChecked
Definition ZFUIButtonGroup.h:259
static zfidentity E_ButtonOnRemove(void)
see ZFObject::observerNotify
static zfidentity E_TabOnUpdate(void)
see ZFObject::observerNotify
virtual void containerDetach()
detach container, and remove all buttons, see containerAttach
virtual zfbool & tabAllowUnchecked()
for v_ZFUIButtonGroupType::e_Tab type only, whether allow uncheck all button, false by default
Definition ZFUIButtonGroup.h:212
virtual zfindex buttonCount()
button count
virtual void buttonOnRemove(ZFUIButton *button, zfindex buttonIndex)
see E_ButtonOnRemove
Definition ZFUIButtonGroup.h:173
virtual ZFUIButtonGroupType & type()
button group's type, see v_ZFUIButtonGroupType::e_Normal for more info
Definition ZFUIButtonGroup.h:73
static zfidentity E_TabOnClickChecked(void)
see ZFObject::observerNotify
virtual zfindex buttonFind(ZFUIButton *button)
find the button's index or return zfindexMax() if not exist
virtual void objectOnDealloc(void)
override this to destroy your object
virtual void buttonRemoveAt(zfindex buttonIndex)
remove button at index
virtual void button(ZFUIButton *button, zfindex atIndex=(((zfindex) -1)))
add button
abstract button
Definition ZFUIButton.h:42
base class of all UI views
Definition ZFUIView.h:93
button group type
Definition ZFUIButtonGroup.h:17
see zfany
Definition zfany.h:106
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:157