CustomGuiData Class Reference

abstract

#include <c4d_customguidata.h>

Inheritance diagram for CustomGuiData:
Inheritance graph
[ legend ]

详细描述

A data class for creating custom GUIs for data types. These can be used in descriptions for the Attribute Manager.
使用 RegisterCustomGuiPlugin() to register the custom GUI plugin.

注意
Even if a library is not created it is needed to call InstallLibrary() for a dummy library during registration: Bool RegisterExampleDataTypeGui( void ) { static BaseCustomGuiLib mylib; ClearMem (&mylib, sizeof (mylib)); FillBaseCustomGui (mylib); if (! InstallLibrary (MYCUSTOMGUI_ID, &mylib, 1000, sizeof (mylib))) return false ;
return RegisterCustomGuiPlugin ( "My Custom GUI" , 0, NewObj (MyCustomGui)); }

公共成员函数

virtual Int32   GetId ()=0
virtual CDialog *  Alloc (const BaseContainer &settings)=0
virtual void  Free (CDialog *dlg, void *userdata)=0
virtual const Char GetResourceSym ()=0
virtual CustomProperty GetProperties ()
virtual Int32   GetResourceDataType ( Int32 *&table)
CUSTOMGUIPLUGIN *  GetPlugin ()
-  Public Member Functions inherited from BaseData
  BaseData ()
virtual  ~BaseData (void)
void  Destructor (void)

成员函数文档编制

◆  GetId()

virtual Int32 GetId ( )
pure virtual

Called to get the plugin ID of the custom GUI.

返回
A unique plugin ID. Must be obtained from http://www.plugincafe.com

◆  Alloc()

virtual CDialog* Alloc ( const BaseContainer settings )
pure virtual

Called to allocate a sub-dialog for the custom GUI.
Normally this method override should look like this:

virtual CDialog* Alloc ( const BaseContainer & settings) { T* dlg = NewObj (T(settings, GetPlugin ())); if (!dlg) return nullptr ; CDialog *cdlg = dlg->Get(); if (!cdlg) return nullptr ; return cdlg; }

In the above code T stands for a type derived from iCustomGui .

参数
[in] settings The settings for the GUI. (Using the IDs defined by GetProperties() .)
返回
The allocated sub-dialog.

◆  Free()

virtual void Free ( CDialog *  dlg ,
void *  userdata  
)
pure virtual

Called to free sub-dialogs allocated by Alloc() .
Normally this method override should look like this:

virtual void Free (CDialog *dlg, void *userdata) { if (!dlg || !userdata) return ; T* sub = static_cast< T* > (userdata); DeleteObj (sub); }

In the above code T stands for a type derived from iCustomGui .

参数
[in,out] dlg The sub-dialog to free.
[in] userdata The user data.

◆  GetResourceSym()

virtual const Char * GetResourceSym ( )
pure virtual

Called to get the symbol to use in resource files, for example "GRADIENT" .

注意
Only 7-bit ASCII characters are allowed, hence the Char type.
返回
A pointer to a global const Char* string with the resource symbol.

◆  GetProperties()

virtual CustomProperty * GetProperties ( )
virtual

Called to get the properties that the custom GUI accepts in resource files.

另请参阅
CustomProperty .
返回
A pointer to a global array of CustomProperty elements, ended with a CUSTOMTYPE::END property: CustomProperty bitmapbuttonprops[] = { { CUSTOMTYPE::FLAG , BITMAPBUTTON_BORDER , "BORDER" }, { CUSTOMTYPE::FLAG , BITMAPBUTTON_BUTTON , "BUTTON" }, { CUSTOMTYPE::END , 0, nullptr } };

◆  GetResourceDataType()

virtual Int32 GetResourceDataType ( Int32 *&  table )
virtual

Called to return the IDs of compatible data types for the custom GUI.

另请参阅
CustomDataTypeClass::GetConversionsFrom .
参数
[out] table Set this to point to a global array with the IDs of compatible data types for the custom GUI.
返回
The length of the array pointed by table, or 0 if table has not been set.

◆  GetPlugin()

CUSTOMGUIPLUGIN* GetPlugin ( )

Gets the plugin structure for the custom GUI.

返回
The custom GUI plugin structure. Cinema 4D owns the pointed plugin structure.
DeleteObj
#define DeleteObj(obj)
定义: newobj.h:159
RegisterCustomGuiPlugin
Bool RegisterCustomGuiPlugin(const maxon::String &str, Int32 info, CustomGuiData *dat)
CUSTOMTYPE::END
@ END
End marker.
CustomGuiData::Alloc
virtual CDialog * Alloc(const BaseContainer &settings)=0
InstallLibrary
Bool InstallLibrary(Int32 id, C4DLibrary *lib, Int32 version, Int32 size)
FillBaseCustomGui
void FillBaseCustomGui(BaseCustomGuiLib &lib)
ClearMem
void ClearMem(void *d, Int size, Int32 value=0)
定义: c4d_memory.h:53
BITMAPBUTTON_BORDER
#define BITMAPBUTTON_BORDER
定义: customgui_bitmapbutton.h:33
CustomProperty
定义: c4d_customguidata.h:113
NewObj
#define NewObj(T,...)
定义: newobj.h:108
BITMAPBUTTON_BUTTON
#define BITMAPBUTTON_BUTTON
定义: customgui_bitmapbutton.h:35
Bool
maxon::Bool Bool
定义: ge_sys_math.h:53
CUSTOMTYPE::FLAG
@ FLAG
Bool data. (Either the property is there or not.)
CustomGuiData::GetPlugin
CUSTOMGUIPLUGIN * GetPlugin()
CustomGuiData::Free
virtual void Free(CDialog *dlg, void *userdata)=0
BaseContainer
定义: c4d_basecontainer.h:46