libui
A portable GUI library for C
Loading...
Searching...
No Matches
uiTableValue Struct Reference

Description

Container to store values used in container related methods.

uiTableValue objects are immutable.

uiTable and uiTableModel methods take ownership of the uiTableValue objects when passed as parameter. Exception: uiNewTableValueImage().

uiTable and uiTableModel methods retain ownership when returning uiTableValue objects. Exception: uiTableValueImage().

#include <ui.h>

Public Member Functions

void uiFreeTableValue (uiTableValue *v)
 Frees the uiTableValue.
 
uiTableValueType uiTableValueGetType (const uiTableValue *v)
 Gets the uiTableValue type.
 
const char * uiTableValueString (const uiTableValue *v)
 Returns the string value held internally.
 
uiImageuiTableValueImage (const uiTableValue *v)
 Returns a reference to the image contained.
 
int uiTableValueInt (const uiTableValue *v)
 Returns the integer value held internally.
 
void uiTableValueColor (const uiTableValue *v, double *r, double *g, double *b, double *a)
 Returns the color value held internally.
 

Static Public Member Functions

uiTableValueuiNewTableValueString (const char *str)
 Creates a new table value to store a text string.
 
uiTableValueuiNewTableValueImage (uiImage *img)
 Creates a new table value to store an image.
 
uiTableValueuiNewTableValueInt (int i)
 Creates a new table value to store an integer.
 
uiTableValueuiNewTableValueColor (double r, double g, double b, double a)
 Creates a new table value to store a color in.
 

Member Function Documentation

◆ uiFreeTableValue()

void uiFreeTableValue ( uiTableValue * v)

Frees the uiTableValue.

Parameters
vTable value to free.
Warning
This function is to be used only on uiTableValue objects that have NOT been passed to uiTable or uiTableModel - as these take ownership of the object.
Use this for freeing erroneously created values or when directly calling uiTableModelHandler without transferring ownership to uiTable or uiTableModel.

◆ uiNewTableValueColor()

uiTableValue * uiNewTableValueColor ( double r,
double g,
double b,
double a )
static

Creates a new table value to store a color in.

Parameters
rRed. Double in range of [0, 1.0].
gGreen. Double in range of [0, 1.0].
bBlue. Double in range of [0, 1.0].
aAlpha. Double in range of [0, 1.0].
Returns
A new uiTableValue instance.

◆ uiNewTableValueImage()

uiTableValue * uiNewTableValueImage ( uiImage * img)
static

Creates a new table value to store an image.

Parameters
imgImage.
Data is NOT copied and needs to kept alive.
Returns
A new uiTableValue instance.
Warning
Unlike other uiTableValue constructors, uiNewTableValueImage() does NOT copy the image to save time and space. Make sure the image data stays valid while in use by the library. As a general rule: if the constructor is called via the uiTableModelHandler, the image is safe to free once execution returns to ANY of your code.

◆ uiNewTableValueInt()

uiTableValue * uiNewTableValueInt ( int i)
static

Creates a new table value to store an integer.

This value type can be used in conjunction with properties like column editable [TRUE, FALSE] or controls like progress bars and checkboxes. For these, consult uiProgressBar and uiCheckbox for the allowed integer ranges.

Parameters
iInteger value.
Returns
A new uiTableValue instance.

◆ uiNewTableValueString()

uiTableValue * uiNewTableValueString ( const char * str)
static

Creates a new table value to store a text string.

Parameters
strString value.
A valid, NUL terminated UTF-8 string.
Data is copied internally. Ownership is not transferred.
Returns
A new uiTableValue instance.

◆ uiTableValueColor()

void uiTableValueColor ( const uiTableValue * v,
double * r,
double * g,
double * b,
double * a )

Returns the color value held internally.

To be used only on uiTableValue objects of type uiTableValueTypeColor.

Parameters
vTable value.
[out]rRed. Double in range of [0, 1.0].
[out]gGreen. Double in range of [0, 1.0].
[out]bBlue. Double in range of [0, 1.0].
[out]aAlpha. Double in range of [0, 1.0].

◆ uiTableValueGetType()

uiTableValueType uiTableValueGetType ( const uiTableValue * v)

Gets the uiTableValue type.

Parameters
vTable value.
Returns
Table value type.

◆ uiTableValueImage()

uiImage * uiTableValueImage ( const uiTableValue * v)

Returns a reference to the image contained.

To be used only on uiTableValue objects of type uiTableValueTypeImage.

Parameters
vTable value.
Returns
Image.
Data is owned by the caller of uiNewTableValueImage().
Warning
The image returned is not owned by the object v, hence no lifetime guarantees can be made.

◆ uiTableValueInt()

int uiTableValueInt ( const uiTableValue * v)

Returns the integer value held internally.

To be used only on uiTableValue objects of type uiTableValueTypeInt.

Parameters
vTable value.
Returns
Integer value.

◆ uiTableValueString()

const char * uiTableValueString ( const uiTableValue * v)

Returns the string value held internally.

To be used only on uiTableValue objects of type uiTableValueTypeString.

Parameters
vTable value.
Returns
String value.
A NUL terminated UTF-8 string.
Data remains owned by v, do NOT call uiFreeText().

The documentation for this struct was generated from the following file: