libgphoto2 photo camera library (libgphoto2) Internals
2.5.26
|
#include "config.h"
#include <gphoto2/gphoto2-widget.h>
#include <stdlib.h>
#include <string.h>
#include <gphoto2/gphoto2-result.h>
#include <gphoto2/gphoto2-port-log.h>
Go to the source code of this file.
Data Structures | |
struct | _CameraWidget |
Functions | |
int | gp_widget_new (CameraWidgetType type, const char *label, CameraWidget **widget) |
Create a new widget. More... | |
int | gp_widget_free (CameraWidget *widget) |
Frees a CameraWidget. More... | |
int | gp_widget_ref (CameraWidget *widget) |
Increments the reference count for the CameraWidget. More... | |
int | gp_widget_unref (CameraWidget *widget) |
Decrements the reference count for the CameraWidget. More... | |
int | gp_widget_get_info (CameraWidget *widget, const char **info) |
Retrieves the information about the widget. More... | |
int | gp_widget_set_info (CameraWidget *widget, const char *info) |
Sets the information about the widget. More... | |
int | gp_widget_get_name (CameraWidget *widget, const char **name) |
Gets the name of the widget. More... | |
int | gp_widget_set_name (CameraWidget *widget, const char *name) |
Sets the name of the widget. More... | |
int | gp_widget_get_id (CameraWidget *widget, int *id) |
Retrieves the unique id of the CameraWidget. More... | |
int | gp_widget_set_changed (CameraWidget *widget, int changed) |
Tells that the widget has been changed. More... | |
int | gp_widget_set_readonly (CameraWidget *widget, int readonly) |
Tells that the widget is readonly. More... | |
int | gp_widget_get_readonly (CameraWidget *widget, int *readonly) |
Retrieves the readonly state of the CameraWidget. More... | |
int | gp_widget_get_type (CameraWidget *widget, CameraWidgetType *type) |
Retrieves the type of the CameraWidget. More... | |
int | gp_widget_get_label (CameraWidget *widget, const char **label) |
Retrieves the label of the CameraWidget. More... | |
int | gp_widget_set_value (CameraWidget *widget, const void *value) |
Sets the value of the widget. More... | |
int | gp_widget_get_value (CameraWidget *widget, void *value) |
Retrieves the value of the CameraWidget. More... | |
int | gp_widget_append (CameraWidget *widget, CameraWidget *child) |
Appends a CameraWidget to a CameraWidget. More... | |
int | gp_widget_prepend (CameraWidget *widget, CameraWidget *child) |
Prepends a CameraWidget to a CameraWidget. More... | |
int | gp_widget_count_children (CameraWidget *widget) |
Counts the children of the CameraWidget. More... | |
int | gp_widget_get_child (CameraWidget *widget, int child_number, CameraWidget **child) |
Retrieves the child number child_number of the parent. More... | |
int | gp_widget_get_child_by_label (CameraWidget *widget, const char *label, CameraWidget **child) |
Retrieves the child with label label of the CameraWidget. More... | |
int | gp_widget_get_child_by_id (CameraWidget *widget, int id, CameraWidget **child) |
Retrieves the child with id id of the widget. More... | |
int | gp_widget_get_child_by_name (CameraWidget *widget, const char *name, CameraWidget **child) |
Retrieves the child with name name of the widget. More... | |
int | gp_widget_get_parent (CameraWidget *widget, CameraWidget **parent) |
Retrieves the parent of a CameraWidget. More... | |
int | gp_widget_get_root (CameraWidget *widget, CameraWidget **root) |
Retrieves the root of the CameraWidget. More... | |
int | gp_widget_set_range (CameraWidget *range, float min, float max, float increment) |
Sets some range parameters of the CameraWidget. More... | |
int | gp_widget_get_range (CameraWidget *range, float *min, float *max, float *increment) |
Retrieves some range parameters of the CameraWidget. More... | |
int | gp_widget_add_choice (CameraWidget *widget, const char *choice) |
Adds a choice to the CameraWidget. More... | |
int | gp_widget_count_choices (CameraWidget *widget) |
Counts the choices of the CameraWidget. More... | |
int | gp_widget_get_choice (CameraWidget *widget, int choice_number, const char **choice) |
Retrieves the choice number choice_number . More... | |
int | gp_widget_changed (CameraWidget *widget) |
Tells if the widget has been changed. More... | |
Definition in file gphoto2-widget.c.
int gp_widget_add_choice | ( | CameraWidget * | widget, |
const char * | choice | ||
) |
Adds a choice to the CameraWidget.
widget | a CameraWidget of type GP_WIDGET_RADIO or GP_WIDGET_MENU |
choice |
Definition at line 760 of file gphoto2-widget.c.
References _CameraWidget::choice, _CameraWidget::choice_count, GP_OK, GP_WIDGET_MENU, GP_WIDGET_RADIO, and _CameraWidget::type.
Referenced by gp_camera_get_single_config().
int gp_widget_append | ( | CameraWidget * | widget, |
CameraWidget * | child | ||
) |
Appends a CameraWidget to a CameraWidget.
widget | a CameraWidget |
child | the CameraWidget you would like to append to above |
Definition at line 470 of file gphoto2-widget.c.
References _CameraWidget::changed, _CameraWidget::children, _CameraWidget::children_count, GP_OK, GP_WIDGET_SECTION, GP_WIDGET_WINDOW, _CameraWidget::parent, and _CameraWidget::type.
int gp_widget_changed | ( | CameraWidget * | widget | ) |
Tells if the widget has been changed.
widget | a CameraWidget |
Returns 1 if the state of the CameraWidget has been changed or 0 if not.
Note: this formerly cleared the changed state. It no longer does with 2.5.11.
Definition at line 823 of file gphoto2-widget.c.
References _CameraWidget::changed.
int gp_widget_count_children | ( | CameraWidget * | widget | ) |
Counts the children of the CameraWidget.
widget | a CameraWidget |
Definition at line 529 of file gphoto2-widget.c.
References _CameraWidget::children_count.
Referenced by _get_widget_names(), and gp_widget_free().
int gp_widget_count_choices | ( | CameraWidget * | widget | ) |
Counts the choices of the CameraWidget.
widget | a CameraWidget of type GP_WIDGET_RADIO or GP_WIDGET_MENU |
Definition at line 780 of file gphoto2-widget.c.
References _CameraWidget::choice_count, GP_WIDGET_MENU, GP_WIDGET_RADIO, and _CameraWidget::type.
Referenced by gp_camera_get_single_config().
int gp_widget_free | ( | CameraWidget * | widget | ) |
Frees a CameraWidget.
widget | the CameraWidget to be freed |
Definition at line 132 of file gphoto2-widget.c.
References _CameraWidget::children, _CameraWidget::choice, _CameraWidget::choice_count, GP_OK, gp_widget_count_children(), GP_WIDGET_SECTION, GP_WIDGET_WINDOW, _CameraWidget::type, and _CameraWidget::value_string.
Referenced by gp_camera_get_single_config(), gp_camera_list_config(), gp_camera_set_single_config(), and gp_widget_unref().
int gp_widget_get_child | ( | CameraWidget * | widget, |
int | child_number, | ||
CameraWidget ** | child | ||
) |
Retrieves the child number child_number
of the parent.
widget | a CameraWidget |
child_number | the number of the child |
child |
Definition at line 546 of file gphoto2-widget.c.
References _CameraWidget::children, and GP_OK.
Referenced by _get_widget_names().
int gp_widget_get_child_by_id | ( | CameraWidget * | widget, |
int | id, | ||
CameraWidget ** | child | ||
) |
Retrieves the child with id id
of the widget.
widget | a CameraWidget |
id | the id of the child |
child |
Definition at line 603 of file gphoto2-widget.c.
References _CameraWidget::children, _CameraWidget::children_count, GP_ERROR_BAD_PARAMETERS, GP_OK, _CameraWidget::id, and result.
int gp_widget_get_child_by_label | ( | CameraWidget * | widget, |
const char * | label, | ||
CameraWidget ** | child | ||
) |
Retrieves the child with label label
of the CameraWidget.
widget | a CameraWidget |
label | the label of the child |
child |
Definition at line 566 of file gphoto2-widget.c.
References _CameraWidget::children, _CameraWidget::children_count, GP_ERROR_BAD_PARAMETERS, GP_OK, _CameraWidget::label, and result.
int gp_widget_get_child_by_name | ( | CameraWidget * | widget, |
const char * | name, | ||
CameraWidget ** | child | ||
) |
Retrieves the child with name name
of the widget.
widget | a CameraWidget |
name | the name of the child |
Definition at line 638 of file gphoto2-widget.c.
References _CameraWidget::children, _CameraWidget::children_count, GP_ERROR_BAD_PARAMETERS, GP_OK, _CameraWidget::name, and result.
Referenced by gp_camera_get_single_config(), and gp_camera_set_single_config().
int gp_widget_get_choice | ( | CameraWidget * | widget, |
int | choice_number, | ||
const char ** | choice | ||
) |
Retrieves the choice number choice_number
.
widget | a CameraWidget of type GP_WIDGET_RADIO or GP_WIDGET_MENU |
choice_number | |
choice |
Definition at line 799 of file gphoto2-widget.c.
References _CameraWidget::choice, GP_OK, GP_WIDGET_MENU, GP_WIDGET_RADIO, and _CameraWidget::type.
Referenced by gp_camera_get_single_config().
int gp_widget_get_id | ( | CameraWidget * | widget, |
int * | id | ||
) |
Retrieves the unique id of the CameraWidget.
widget | a CameraWidget |
id |
Definition at line 269 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::id.
int gp_widget_get_info | ( | CameraWidget * | widget, |
const char ** | info | ||
) |
Retrieves the information about the widget.
widget | a CameraWidget |
info |
Definition at line 198 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::info.
int gp_widget_get_label | ( | CameraWidget * | widget, |
const char ** | label | ||
) |
Retrieves the label of the CameraWidget.
widget | a CameraWidget |
label |
Definition at line 361 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::label.
Referenced by gp_camera_get_single_config().
int gp_widget_get_name | ( | CameraWidget * | widget, |
const char ** | name | ||
) |
Gets the name of the widget.
widget | a CameraWidget |
name | Name of above widget |
Definition at line 233 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::name.
Referenced by _get_widget_names().
int gp_widget_get_parent | ( | CameraWidget * | widget, |
CameraWidget ** | parent | ||
) |
Retrieves the parent of a CameraWidget.
widget | a CameraWidget |
parent | the pointer to the parent to return |
Definition at line 674 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::parent.
int gp_widget_get_range | ( | CameraWidget * | range, |
float * | min, | ||
float * | max, | ||
float * | increment | ||
) |
Retrieves some range parameters of the CameraWidget.
range | a CameraWidget of type GP_WIDGET_RANGE |
min | |
max | |
increment |
Definition at line 738 of file gphoto2-widget.c.
References GP_OK, GP_WIDGET_RANGE, _CameraWidget::increment, _CameraWidget::max, _CameraWidget::min, and _CameraWidget::type.
Referenced by gp_camera_get_single_config().
int gp_widget_get_readonly | ( | CameraWidget * | widget, |
int * | readonly | ||
) |
Retrieves the readonly state of the CameraWidget.
widget | a CameraWidget |
readonly |
Definition at line 327 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::readonly.
Referenced by gp_camera_get_single_config().
int gp_widget_get_root | ( | CameraWidget * | widget, |
CameraWidget ** | root | ||
) |
Retrieves the root of the CameraWidget.
widget | a CameraWidget |
root |
Definition at line 692 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::parent.
int gp_widget_get_type | ( | CameraWidget * | widget, |
CameraWidgetType * | type | ||
) |
Retrieves the type of the CameraWidget.
widget | a CameraWidget |
type |
Definition at line 344 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::type.
Referenced by _get_widget_names(), gp_camera_get_single_config(), and gp_camera_set_single_config().
int gp_widget_get_value | ( | CameraWidget * | widget, |
void * | value | ||
) |
Retrieves the value of the CameraWidget.
widget | a CameraWidget |
value |
Definition at line 434 of file gphoto2-widget.c.
References _CameraWidget::callback, 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.
Referenced by gp_camera_get_single_config(), and gp_camera_set_single_config().
int gp_widget_new | ( | CameraWidgetType | type, |
const char * | label, | ||
CameraWidget ** | widget | ||
) |
Create a new widget.
The function creates a new CameraWidget of specified type and with given label.
type | the type |
label | the label |
widget |
Definition at line 93 of file gphoto2-widget.c.
References GP_OK.
Referenced by camera_config_get(), and gp_camera_get_single_config().
int gp_widget_prepend | ( | CameraWidget * | widget, |
CameraWidget * | child | ||
) |
Prepends a CameraWidget to a CameraWidget.
widget | a CameraWidget |
child | the CameraWidget you would like to prepend to above |
Definition at line 496 of file gphoto2-widget.c.
References _CameraWidget::changed, _CameraWidget::children, _CameraWidget::children_count, GP_OK, GP_WIDGET_SECTION, GP_WIDGET_WINDOW, _CameraWidget::parent, and _CameraWidget::type.
int gp_widget_ref | ( | CameraWidget * | widget | ) |
Increments the reference count for the CameraWidget.
widget | a CameraWidget you want to ref-count |
Definition at line 160 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::ref_count.
int gp_widget_set_changed | ( | CameraWidget * | widget, |
int | changed | ||
) |
Tells that the widget has been changed.
widget | a CameraWidget |
changed | a boolean whether we changed or not |
Sets the changed of the CameraWidget depending on the changed parameter.
Definition at line 289 of file gphoto2-widget.c.
References _CameraWidget::changed, and GP_OK.
Referenced by gp_camera_set_single_config().
int gp_widget_set_info | ( | CameraWidget * | widget, |
const char * | info | ||
) |
Sets the information about the widget.
widget | a CameraWidget |
info | Information about above widget |
Definition at line 216 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::info.
int gp_widget_set_name | ( | CameraWidget * | widget, |
const char * | name | ||
) |
Sets the name of the widget.
widget | a CameraWidget |
name | Name of above widget |
Definition at line 250 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::name.
Referenced by gp_camera_get_single_config().
int gp_widget_set_range | ( | CameraWidget * | range, |
float | min, | ||
float | max, | ||
float | increment | ||
) |
Sets some range parameters of the CameraWidget.
range | a CameraWidget of type GP_WIDGET_RANGE |
min | |
max | |
increment |
Definition at line 715 of file gphoto2-widget.c.
References GP_OK, GP_WIDGET_RANGE, _CameraWidget::increment, _CameraWidget::max, _CameraWidget::min, and _CameraWidget::type.
Referenced by gp_camera_get_single_config().
int gp_widget_set_readonly | ( | CameraWidget * | widget, |
int | readonly | ||
) |
Tells that the widget is readonly.
widget | a CameraWidget |
changed | a boolean whether we are readonly or not |
Sets the readonly of the CameraWidget depending on the changed parameter.
Only useful when called from the camera driver.
Definition at line 310 of file gphoto2-widget.c.
References GP_OK, and _CameraWidget::readonly.
Referenced by gp_camera_get_single_config().
int gp_widget_set_value | ( | CameraWidget * | widget, |
const void * | value | ||
) |
Sets the value of the widget.
widget | a CameraWidget |
value |
Please pass (char*) for GP_WIDGET_MENU, GP_WIDGET_TEXT, GP_WIDGET_RADIO, (float) for GP_WIDGET_RANGE, (int) for GP_WIDGET_DATE, GP_WIDGET_TOGGLE, and (CameraWidgetCallback) for GP_WIDGET_BUTTON.
Definition at line 384 of file gphoto2-widget.c.
References _CameraWidget::callback, _CameraWidget::changed, 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::label, _CameraWidget::type, _CameraWidget::value_float, _CameraWidget::value_int, and _CameraWidget::value_string.
Referenced by gp_camera_get_single_config(), and gp_camera_set_single_config().
int gp_widget_unref | ( | CameraWidget * | widget | ) |
Decrements the reference count for the CameraWidget.
widget | a CameraWidget you want to unref |
Definition at line 177 of file gphoto2-widget.c.
References GP_OK, gp_widget_free(), and _CameraWidget::ref_count.