obs-properties.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /******************************************************************************
  2. Copyright (C) 2014 by Hugh Bailey <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #pragma once
  15. #include "util/c99defs.h"
  16. #include "obs-data.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. enum obs_property_type {
  21. OBS_PROPERTY_INVALID,
  22. OBS_PROPERTY_BOOL,
  23. OBS_PROPERTY_INT,
  24. OBS_PROPERTY_FLOAT,
  25. OBS_PROPERTY_TEXT,
  26. OBS_PROPERTY_PATH,
  27. OBS_PROPERTY_LIST,
  28. OBS_PROPERTY_COLOR,
  29. };
  30. enum obs_combo_format {
  31. OBS_COMBO_FORMAT_INVALID,
  32. OBS_COMBO_FORMAT_INT,
  33. OBS_COMBO_FORMAT_FLOAT,
  34. OBS_COMBO_FORMAT_STRING
  35. };
  36. enum obs_combo_type {
  37. OBS_COMBO_TYPE_INVALID,
  38. OBS_COMBO_TYPE_EDITABLE,
  39. OBS_COMBO_TYPE_LIST,
  40. };
  41. enum obs_text_type {
  42. OBS_TEXT_DEFAULT,
  43. OBS_TEXT_PASSWORD,
  44. };
  45. struct obs_properties;
  46. struct obs_property;
  47. typedef struct obs_properties *obs_properties_t;
  48. typedef struct obs_property *obs_property_t;
  49. /* ------------------------------------------------------------------------- */
  50. EXPORT obs_properties_t obs_properties_create(const char *locale);
  51. EXPORT obs_properties_t obs_properties_create_param(const char *locale,
  52. void *param, void (*destroy)(void *param));
  53. EXPORT void obs_properties_destroy(obs_properties_t props);
  54. EXPORT void obs_properties_set_param(obs_properties_t props,
  55. void *param, void (*destroy)(void *param));
  56. EXPORT void *obs_properties_get_param(obs_properties_t props);
  57. EXPORT const char *obs_properties_locale(obs_properties_t props);
  58. EXPORT obs_property_t obs_properties_first(obs_properties_t props);
  59. EXPORT obs_property_t obs_properties_get(obs_properties_t props,
  60. const char *property);
  61. /* used internally by libobs */
  62. extern void obs_properties_apply_settings(obs_properties_t props,
  63. obs_data_t settings);
  64. /* ------------------------------------------------------------------------- */
  65. EXPORT obs_property_t obs_properties_add_bool(obs_properties_t props,
  66. const char *name, const char *description);
  67. EXPORT obs_property_t obs_properties_add_int(obs_properties_t props,
  68. const char *name, const char *description,
  69. int min, int max, int step);
  70. EXPORT obs_property_t obs_properties_add_float(obs_properties_t props,
  71. const char *name, const char *description,
  72. double min, double max, double step);
  73. EXPORT obs_property_t obs_properties_add_text(obs_properties_t props,
  74. const char *name, const char *description,
  75. enum obs_text_type type);
  76. EXPORT obs_property_t obs_properties_add_path(obs_properties_t props,
  77. const char *name, const char *description);
  78. EXPORT obs_property_t obs_properties_add_list(obs_properties_t props,
  79. const char *name, const char *description,
  80. enum obs_combo_type type, enum obs_combo_format format);
  81. EXPORT obs_property_t obs_properties_add_color(obs_properties_t props,
  82. const char *name, const char *description);
  83. /* ------------------------------------------------------------------------- */
  84. /**
  85. * Optional callback for when a property is modified. If the properties
  86. * need to be refreshed due to changes to the property layout, return true,
  87. * otherwise return false.
  88. */
  89. typedef bool (*obs_property_modified_t)(obs_properties_t props,
  90. obs_property_t property, obs_data_t settings);
  91. EXPORT void obs_property_set_modified_callback(obs_property_t p,
  92. obs_property_modified_t modified);
  93. EXPORT bool obs_property_modified(obs_property_t p, obs_data_t settings);
  94. EXPORT void obs_property_set_visible(obs_property_t p, bool visible);
  95. EXPORT void obs_property_set_enabled(obs_property_t p, bool enabled);
  96. EXPORT const char * obs_property_name(obs_property_t p);
  97. EXPORT const char * obs_property_description(obs_property_t p);
  98. EXPORT enum obs_property_type obs_property_get_type(obs_property_t p);
  99. EXPORT bool obs_property_enabled(obs_property_t p);
  100. EXPORT bool obs_property_visible(obs_property_t p);
  101. EXPORT bool obs_property_next(obs_property_t *p);
  102. EXPORT int obs_property_int_min(obs_property_t p);
  103. EXPORT int obs_property_int_max(obs_property_t p);
  104. EXPORT int obs_property_int_step(obs_property_t p);
  105. EXPORT double obs_property_float_min(obs_property_t p);
  106. EXPORT double obs_property_float_max(obs_property_t p);
  107. EXPORT double obs_property_float_step(obs_property_t p);
  108. EXPORT enum obs_text_type obs_proprety_text_type(obs_property_t p);
  109. EXPORT enum obs_combo_type obs_property_list_type(obs_property_t p);
  110. EXPORT enum obs_combo_format obs_property_list_format(obs_property_t p);
  111. EXPORT void obs_property_list_clear(obs_property_t p);
  112. EXPORT void obs_property_list_add_string(obs_property_t p,
  113. const char *name, const char *val);
  114. EXPORT void obs_property_list_add_int(obs_property_t p,
  115. const char *name, long long val);
  116. EXPORT void obs_property_list_add_float(obs_property_t p,
  117. const char *name, double val);
  118. EXPORT void obs_property_list_remove(obs_property_t p, size_t idx);
  119. EXPORT size_t obs_property_list_item_count(obs_property_t p);
  120. EXPORT const char *obs_property_list_item_name(obs_property_t p, size_t idx);
  121. EXPORT const char *obs_property_list_item_string(obs_property_t p, size_t idx);
  122. EXPORT long long obs_property_list_item_int(obs_property_t p, size_t idx);
  123. EXPORT double obs_property_list_item_float(obs_property_t p, size_t idx);
  124. #ifdef __cplusplus
  125. }
  126. #endif