Logo Search packages:      
Sourcecode: libgphoto2 version File versions

int gp_widget_get_value ( CameraWidget widget,
void *  value 
)

Retrieves the value of the CameraWidget.

Parameters:
widget a CameraWidget
value 
Returns:
a gphoto2 error code.

Definition at line 398 of file gphoto2-widget.c.

References _CameraWidget::callback, CHECK_NULL, GP_ERROR_BAD_PARAMETERS, GP_OK, GP_WIDGET_BUTTON, GP_WIDGET_DATE, GP_WIDGET_MENU, GP_WIDGET_RADIO, GP_WIDGET_RANGE, GP_WIDGET_SECTION, GP_WIDGET_TEXT, GP_WIDGET_TOGGLE, GP_WIDGET_WINDOW, _CameraWidget::type, _CameraWidget::value_float, _CameraWidget::value_int, and _CameraWidget::value_string.

{
      CHECK_NULL (widget && value);

        switch (widget->type) {
      case GP_WIDGET_BUTTON:
            *(CameraWidgetCallback*)value = widget->callback;
            return (GP_OK);
      case GP_WIDGET_MENU:
      case GP_WIDGET_RADIO:
        case GP_WIDGET_TEXT:
            *((char**)value) = widget->value_string;
            return (GP_OK);
        case GP_WIDGET_RANGE:
            *((float*)value) = widget->value_float;
            return (GP_OK);
        case GP_WIDGET_TOGGLE:
      case GP_WIDGET_DATE:
                  *((int*)value) = widget->value_int;
            return (GP_OK);
      case GP_WIDGET_SECTION:
      case GP_WIDGET_WINDOW:
        default:
            return (GP_ERROR_BAD_PARAMETERS);
        }
}


Generated by  Doxygen 1.6.0   Back to index