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 ) {
155 this->observerNotifyWithSender(button, eventId, ZFArgs().param0(this).param1(zfobj<v_zfindex>(buttonIndex)));
156 }
157
158 virtual inline void buttonOnAdd(
160 , ZF_IN zfindex buttonIndex
161 ) {
162 this->observerNotifyWithSender(button, ZFUIButtonGroup::E_ButtonOnAdd(), ZFArgs().param0(this).param1(zfobj<v_zfindex>(buttonIndex)));
163 }
164
165 virtual inline void buttonOnRemove(
167 , ZF_IN zfindex buttonIndex
168 ) {
169 this->observerNotifyWithSender(button, ZFUIButtonGroup::E_ButtonOnRemove(), ZFArgs().param0(this).param1(zfobj<v_zfindex>(buttonIndex)));
170 }
171
172 // ============================================================
173 // for v_ZFUIButtonGroupType::e_Tab type
174public:
185 ZFEVENT(TabOnUpdate)
195 ZFEVENT(TabOnClickChecked)
196
202
209
210public:
228
233
234protected:
236 virtual inline void tabOnUpdate(
238 , ZF_IN zfindex buttonIndexPrev
239 ) {
240 this->observerNotifyWithSender(button, ZFUIButtonGroup::E_TabOnUpdate(), ZFArgs().param0(this).param1(zfobj<v_zfindex>(buttonIndexPrev)));
241 }
242
243 virtual inline void tabOnClickChecked(
245 , ZF_IN zfindex buttonIndex
246 ) {
248 }
249
250protected:
252 virtual void objectOnInit(void);
254 virtual void objectOnDealloc(void);
255
256private:
257 _ZFP_ZFUIButtonGroupPrivate *d;
258 friend zfclassFwd _ZFP_ZFUIButtonGroupPrivate;
259};
260
262#endif // #ifndef _ZFI_ZFUIButtonGroup_h_
263
#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:198
#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:692
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1024
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:853
#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:259
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:122
#define ZFEVENT(YourEvent)
see ZFObject::observerNotify
Definition ZFObjectObserver.h:312
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:120
#define ZFPROPERTY_ON_UPDATE_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:223
#define ZFPROPERTY_ON_ATTACH_DECLARE(Type, Name)
see ZFPROPERTY_ON_INIT_DECLARE
Definition ZFPropertyDeclare.h:233
abstract button
v_ZFUIButtonGroupType::ZFEnumType ZFUIButtonGroupType
see v_ZFUIButtonGroupType
Definition ZFUIButtonGroup.h:32
#define ZFLIB_ZFUIWidget
used to export symbols
Definition ZFUIWidgetDef.h:17
listener data used by ZFListener
Definition ZFArgs.h:20
void observerNotifyWithSender(ZFObject *customSender, zfidentity eventId, const ZFArgs &zfargs=ZFArgs())
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:206
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:158
virtual void tabOnUpdate(ZFUIButton *button, zfindex buttonIndexPrev)
see E_TabOnUpdate
Definition ZFUIButtonGroup.h:236
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:243
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:200
virtual zfindex buttonCount()
button count
virtual void buttonOnRemove(ZFUIButton *button, zfindex buttonIndex)
see E_ButtonOnRemove
Definition ZFUIButtonGroup.h:165
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:88
button group type
Definition ZFUIButtonGroup.h:17
see zfany
Definition zfany.h:113
util class to alloc and hold ZFObject type
Definition ZFObjectAutoPtr.h:72