DParameterButton.h

Classes

DParameterButton -- Implementation of DisplayParameter to package interface to button autoguis. (full description)

class DParameterButton : public DisplayParameter

Interface

Public Members
DParameterButton(const String name, const String description, const String text, const String help="", const String context="", const Bool editable=True)
DParameterButton(const DParameterButton &other)
virtual ~DParameterButton()
DParameterButton &operator=(const DParameterButton &other)
virtual Bool fromRecord(const RecordInterface &record)
virtual void toRecord(RecordInterface &record, const Bool fullrecord = True, const Bool overwrite = False)
Private Members
DParameterButton() : DisplayParameter(), itsText("")

Description

Prerequisite

Etymology

DParameterButton is an implementation of a DisplayParameter for Buttons. It defines the necessary information to define a button in autogui.g, and packages it into the parameter record field autogui requires.

Synopsis

This class is derived from DisplayParameter It holds the meta-information neccessary to define a button widget, packaging it into the 'parameter record' field required by autogui.g. It can determine whether the button was pressed. The 'value' has no meaning here (it will be True).

Example

 DParameterButton pbtn("unique_btn_id", "Label Beside Button",
			 "Text on Button", "Help Message for Button");

 Record rec;			// (usually within 'getoptions()')
 pstring.toRecord(rec);	// rec is returned to autogui.g
				// to define the button.

 // ...when inRec is received recording user gui updates
 // (usually within 'setOptions()'):
 
 if(pbtn.fromRecord(inRec)) /* button was pressed; respond */ ;

Motivation

Allows buttons to be defined using the same compact DParameter interface used for other autogui widgets.

Thrown Exceptions

Member Description

DParameterButton(const String name, const String description, const String text, const String help="", const String context="", const Bool editable=True)

Constructor taking the name (id) of the button, a label which will appear beside the button, and the text which will appear on the button. Optionally, popup help text, 'context' string, and a flag indicating whether the button is enabled (disable is not fully supported yet). The context string determines which autogui rollup the button will appear in (replace spaces with underscores in this string).

DParameterButton(const DParameterButton &other)

copy constructor.

virtual ~DParameterButton()

Destructor.

DParameterButton &operator=(const DParameterButton &other)

copy assignment.

virtual Bool fromRecord(const RecordInterface &record)

Determine whether the record (passed originally from autogui.g) indicates that the button was pressed.

virtual void toRecord(RecordInterface &record, const Bool fullrecord = True, const Bool overwrite = False)

Place a record describing this button in a sub-field of record with name matching that of this parameter. If overwrite is True, then any existing field with matching name will be overwritten. If fullrecord is True, then a complete description of the parameter is given, otherwise just its current value is stored in record. (At present, fullrecord is ignored; the full record is always returned).

DParameterButton() : DisplayParameter(), itsText("")

default constructor disabled--do not use.