Open Search
    TriState< TYPE > Class Template Reference

    #include <c4d_gui.h>

    Detailed Description

    template<class TYPE>
    class cinema::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, 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
     

    Constructor & Destructor Documentation

    ◆ TriState() [1/3]

    TriState ( )

    Default constructor. Creates an empty tristate.

    ◆ TriState() [2/3]

    TriState ( const TYPE &  val)

    Creates a tristate and adds a single value.

    Parameters
    [in]valThe value to add.

    ◆ TriState() [3/3]

    TriState ( TYPE &&  val)

    Member Function Documentation

    ◆ GetTri()

    Bool GetTri ( ) const

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

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

    ◆ SetTri()

    void SetTri ( Bool  state)

    Sets the tristate without touching the value.

    Parameters
    [in]stateTrue if a tristate shall be set.

    ◆ GetValue()

    const TYPE& GetValue ( ) const

    Retrieves the value of the tristate.

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

    ◆ HasChanged()

    Bool HasChanged ( ) const

    Checks if the tristate is empty.

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

    ◆ Add() [1/3]

    void Add ( const TYPE &  val)

    Adds a value to the tristate.

    Parameters
    [in]valThe value to add.

    ◆ Add() [2/3]

    void Add ( TYPE &&  val)

    ◆ Add() [3/3]

    void Add ( BaseContainer bc,
    Int32  id 
    )

    Adds a value to the tristate from a base container.

    Parameters
    [in]bcThe base container with the value. The caller owns the pointed base container.
    [in]idThe 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.

    Warning
    Use a newly allocated tristate, i.e. one without any values added, or this function will not work.
    Parameters
    [in]dlgThe dialog the message was sent to. The caller owns the pointed dialog.
    [in]msgThe message container.
    [in]cidThe control ID that triggered the message.
    [in]gidThe ID of the control to check for.
    Returns
    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.

    Warning
    Use a newly allocated tristate, i.e. one without any values added, or this function will not work.
    Parameters
    [in]dlgThe dialog the message was sent to. The caller owns the pointed dialog.
    [in]msgThe message container.
    [in]current_idThe control ID that triggered the message.
    [in]gidxThe ID of the X control to check for.
    [in]gidyThe ID of the Y control to check for.
    [in]gidzThe ID of the Z control to check for.
    Returns
    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::

    Warning
    Use a newly allocated tristate, i.e. one without any values added, or this function will not work.
    Parameters
    [in]dlgThe dialog the message was sent to. The caller owns the pointed dialog.
    [in]msgThe message container.
    [in]docA document to get framerate settings from.
    [in]cidThe control ID that triggered the message.
    [in]gidThe ID of the control to check for.
    Returns
    true if the control had changed and its time was added, otherwise false.

    Member Data Documentation

    ◆ tri

    Int32 tri
    private

    ◆ value

    TYPE value
    private