The Be Book The Media Kit The Media Kit Index

BDiscreteParameter

Derived from: BParameter
Declared in:  be/media/ParameterWeb.h
Library: libmedia.so
Allocation: Constructor only
Summary:  more...


The BDiscreteParameter class represents a parameter that is set to one of a discrete set of values, and is usually used for non-linear values such as color spaces, multiplexers, and mutes or enables.

Each discrete value has a name that's displayed to the user by applications that draw a user interface for the node.

The default system theme renders these as BCheckBox controls, BRadioButton groups, or BMenuField controls, depending on the parameter kind. Other themes might implement these differently.


Constructor and Destructor

You never create or delete a BDiscreteParameter object yourself. Instead, call the BParameterGroup::MakeDiscreteParameter() function to create a BDiscreteParameter within the desired BParameterGroup.


Member Functions


AddItem()

status_t AddItem(int32 value, const char *name)

Adds a new name/value pair to the list of possible values the control can take. Whenever the selection named name is chosen, the user interface application will send a value change message to the control with the specified value.

RETURN CODES


CountItems()

int32 CountItems(void)

Returns the number of discrete values the control can take.


ItemNameAt() , ItemValueAt()

const char *ItemNameAt(int32 index)
int32 ItemValueAt(int32 index)

These functions return the name and value of the item at the specified index, where index ranges from 0 to CountItems()-1.

Selection values aren't necessarily in any sort of order, nor are they necessarily unique.


MakeEmpty()

void MakeEmpty(void)

Removes all items from the BDiscreteParameter.


MakeItemsFromInputs() , MakeItemsFromOutputs()

void MakeItemsFromInputs(void)
void MakeItemsFromOutputs(void)

These functions add all inputs or outputs as selections, where the input or output's name is used as the item's name, and the input or output's index number is used as the value of the item.

These shortcuts let you easily create the item lists for MUX-like controls, which allow the user to choose one of a number of inputs or outputs.

It's important to note that the correct inputs and outputs must already be connected to the parameter when you call either of these functions, otherwise no items will be added, since the inputs and outputs aren't there.


ValueType()

virtual type_code ValueType(void)

Returns B_INT32_TYPE, which is the data type a BDiscreteParameter's value is maintained in.


The Be Book The Media Kit The Media Kit Index

The Be Book,
...in lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..