TriState< TYPE > Class Template Reference

#include <c4d_gui.h>

详细描述

template<class TYPE>
class TriState< TYPE >

A convenience class that makes it easier to use the tristate feature of dialog controls, i.e. using a single control to represent the value of multiple objects.
The template allows manual instantiations for the following types: Bool , Int32 , Float , 向量 , BaseTime and String .

公共成员函数

  TriState ()
  TriState (const TYPE &val)
Bool   GetTri () const
void  SetTri ( Bool state)
const TYPE GetValue () const
Bool   HasChanged () const
void  添加 ( TYPE val)
void  添加 ( BaseContainer *bc, Int32 id)
Int32   Check ( GeDialog *dlg, const BaseContainer &msg, Int32 cid, Int32 gid)
Int32   CheckVector ( GeDialog *dlg, const BaseContainer &msg, Int32 current_id, Int32 gidx, Int32 gidy, Int32 gidz)
Int32   CheckBaseTime ( GeDialog *dlg, const BaseContainer &msg, BaseDocument *doc, Int32 cid, Int32 gid)

Private Attributes

Int32   tri
TYPE   value

构造函数 & 析构函数文档编制

◆  TriState() [1/2]

TriState ( )

Default constructor. Creates an empty tristate.

◆  TriState() [2/2]

TriState ( const TYPE val )

Creates a tristate and adds a single value.

参数
[in] val The value to add.

成员函数文档编制

◆  GetTri()

Bool GetTri ( ) const

Checks whether all added values are the same, or if a tristate mode is necessary.

返回
true if any of the added values is different, otherwise false .

◆  SetTri()

void SetTri ( Bool   state )

Sets the tristate without touching the value.

参数
[in] state True if a tristate shall be set.

◆  GetValue()

const TYPE & GetValue ( ) const

Retrieves the value of the tristate.

返回
The value that was added first, or TYPE() if the object is empty.

◆  HasChanged()

Bool HasChanged ( ) const

Checks if the tristate is empty.

返回
true if any values have been added, or false if the tristate is empty.

◆  Add() [1/2]

void Add ( TYPE   val )

Adds a value to the tristate.

参数
[in] val The value to add.

◆  Add() [2/2]

void Add ( BaseContainer bc ,
Int32   id  
)

Adds a value to the tristate from a base container.

参数
[in] bc The base container with the value. The caller owns the pointed base container.
[in] id The ID of the value to add.

◆  Check()

Int32 Check ( GeDialog dlg ,
const BaseContainer msg ,
Int32   cid ,
Int32   gid  
)

Analyzes a GeDialog::Command() message to see if a certain dialog control has changed, and in that case adds the new value to the tristate. The value can then be accessed with GetValue .

警告
Use a newly allocated tristate, i.e. one without any values added, or this function will not work.
参数
[in] dlg The dialog the message was sent to. The caller owns the pointed dialog.
[in] msg The message container.
[in] cid The control ID that triggered the message.
[in] gid The ID of the control to check for.
返回
true if the control had changed and its value was added, otherwise false .

◆  CheckVector()

Int32 CheckVector ( GeDialog dlg ,
const BaseContainer msg ,
Int32   current_id ,
Int32   gidx ,
Int32   gidy ,
Int32   gidz  
)

Analyzes a GeDialog::Command() message to see if any of the three dialog controls making up a vector has changed, and in that case adds the new value as a vector to the tristate. The vector can then be accessed with GetValue .

警告
Use a newly allocated tristate, i.e. one without any values added, or this function will not work.
参数
[in] dlg The dialog the message was sent to. The caller owns the pointed dialog.
[in] msg The message container.
[in] current_id The control ID that triggered the message.
[in] gidx The ID of the X control to check for.
[in] gidy The ID of the Y control to check for.
[in] gidz The ID of the Z control to check for.
返回
true if any of the controls had changed and their values were added, otherwise false .

◆  CheckBaseTime()

Int32 CheckBaseTime ( GeDialog dlg ,
const BaseContainer msg ,
BaseDocument doc ,
Int32   cid ,
Int32   gid  
)

Analyzes a GeDialog::Command() message to see if a time dialog control has changed, and in that case adds the new time to the tristate. The time can then be accessed with GetValue.

警告
Use a newly allocated tristate, i.e. one without any values added, or this function will not work.
参数
[in] dlg The dialog the message was sent to. The caller owns the pointed dialog.
[in] msg The message container.
[in] doc A document to get framerate settings from.
[in] cid The control ID that triggered the message.
[in] gid The ID of the control to check for.
返回
true if the control had changed and its time was added, otherwise false .

Member Data Documentation

◆  tri

Int32 tri
private

◆  value

TYPE value
private