#include <c4d_customguidata.h>
详细描述
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));
}
成员函数文档编制
◆
GetId()
Called to get the plugin ID of the custom GUI.
-
返回
-
A unique plugin ID. Must be obtained from
http://www.plugincafe.com
◆
Alloc()
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()
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.
#define DeleteObj(obj)
定义:
newobj.h:159
Bool RegisterCustomGuiPlugin(const maxon::String &str, Int32 info, CustomGuiData *dat)
virtual CDialog * Alloc(const BaseContainer &settings)=0
Bool InstallLibrary(Int32 id, C4DLibrary *lib, Int32 version, Int32 size)
void FillBaseCustomGui(BaseCustomGuiLib &lib)
void ClearMem(void *d, Int size, Int32 value=0)
定义:
c4d_memory.h:53
#define BITMAPBUTTON_BORDER
定义:
customgui_bitmapbutton.h:33
定义:
c4d_customguidata.h:113
#define NewObj(T,...)
定义:
newobj.h:108
#define BITMAPBUTTON_BUTTON
定义:
customgui_bitmapbutton.h:35
maxon::Bool Bool
定义:
ge_sys_math.h:53
@ FLAG
Bool data. (Either the property is there or not.)
CUSTOMGUIPLUGIN * GetPlugin()
virtual void Free(CDialog *dlg, void *userdata)=0
定义:
c4d_basecontainer.h:46