瀏覽代碼

libobs: Add obs_property_set_description

This allows us to change the visible UI name of a property after it's
been created (particularly for a case where I want to change an
'Activate' button to 'Deactivate')
jp9000 10 年之前
父節點
當前提交
32ca251bb0
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 5 0
      libobs/obs-properties.c
  2. 3 0
      libobs/obs-properties.h

+ 5 - 0
libobs/obs-properties.c

@@ -461,6 +461,11 @@ void obs_property_set_enabled(obs_property_t *p, bool enabled)
 	if (p) p->enabled = enabled;
 }
 
+void obs_property_set_description(obs_property_t *p, const char *description)
+{
+	if (p) p->desc = description;
+}
+
 const char *obs_property_name(obs_property_t *p)
 {
 	return p ? p->name : NULL;

+ 3 - 0
libobs/obs-properties.h

@@ -193,6 +193,9 @@ EXPORT bool obs_property_button_clicked(obs_property_t *p, void *obj);
 EXPORT void obs_property_set_visible(obs_property_t *p, bool visible);
 EXPORT void obs_property_set_enabled(obs_property_t *p, bool enabled);
 
+EXPORT void obs_property_set_description(obs_property_t *p,
+		const char *description);
+
 EXPORT const char *           obs_property_name(obs_property_t *p);
 EXPORT const char *           obs_property_description(obs_property_t *p);
 EXPORT enum obs_property_type obs_property_get_type(obs_property_t *p);