#include <c4d_gui.h>
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, Vector, BaseTime and String.
Public Member Functions | |
TriState () | |
TriState (const TYPE &val) | |
TriState (TYPE &&val) | |
Bool | GetTri () const |
void | SetTri (Bool state) |
const TYPE & | GetValue () const |
Bool | HasChanged () const |
void | Add (const TYPE &val) |
void | Add (TYPE &&val) |
void | Add (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 | ( | ) |
Default constructor. Creates an empty tristate.
Creates a tristate and adds a single value.
[in] | val | The value to add. |
Bool GetTri | ( | ) | const |
Checks whether all added values are the same, or if a tristate mode is necessary.
void SetTri | ( | Bool | state | ) |
Sets the tristate without touching the value.
[in] | state | True if a tristate shall be set. |
const TYPE& GetValue | ( | ) | const |
Retrieves the value of the tristate.
TYPE()
if the object is empty. Bool HasChanged | ( | ) | const |
Checks if the tristate is empty.
void Add | ( | const TYPE & | val | ) |
Adds a value to the tristate.
[in] | val | The value to add. |
void Add | ( | TYPE && | val | ) |
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. |
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.
[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. |
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.
[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. |
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::
[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. |
|
private |
|
private |