Commit 41234e88 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

control/tree.c: Notify subtree/addition removal.

parent 9794062c
...@@ -307,6 +307,10 @@ typedef enum libvlc_event_type_t { ...@@ -307,6 +307,10 @@ typedef enum libvlc_event_type_t {
libvlc_MediaListItemDeleted, libvlc_MediaListItemDeleted,
libvlc_MediaListItemChanged, libvlc_MediaListItemChanged,
libvlc_TreeSubtreeAdded,
libvlc_TreeSubtreeDeleted,
libvlc_TreeItemValueChanged,
} libvlc_event_type_t; } libvlc_event_type_t;
/** /**
...@@ -348,6 +352,23 @@ typedef struct libvlc_event_t ...@@ -348,6 +352,23 @@ typedef struct libvlc_event_t
libvlc_media_descriptor_t * item; libvlc_media_descriptor_t * item;
int index; int index;
} media_list_item_changed; } media_list_item_changed;
/* Tree */
struct
{
libvlc_tree_t * subtree;
int index;
} tree_subtree_added;
struct
{
libvlc_tree_t * subtree;
int index;
} tree_subtree_deleted;
struct
{
void * new_value;
} tree_item_value_changed;
} u; } u;
} libvlc_event_t; } libvlc_event_t;
......
...@@ -40,7 +40,15 @@ notify_subtree_addition( libvlc_tree_t * p_tree, ...@@ -40,7 +40,15 @@ notify_subtree_addition( libvlc_tree_t * p_tree,
libvlc_tree_t * p_subtree, libvlc_tree_t * p_subtree,
int index ) int index )
{ {
libvlc_event_t event;
/* Construct the event */
event.type = libvlc_TreeSubtreeAdded;
event.u.tree_subtree_added.subtree = p_subtree;
event.u.tree_subtree_added.index = index;
/* Send the event */
libvlc_event_send( p_tree->p_event_manager, &event );
} }
/************************************************************************** /**************************************************************************
...@@ -53,9 +61,39 @@ notify_subtree_deletion( libvlc_tree_t * p_tree, ...@@ -53,9 +61,39 @@ notify_subtree_deletion( libvlc_tree_t * p_tree,
libvlc_tree_t * p_subtree, libvlc_tree_t * p_subtree,
int index ) int index )
{ {
libvlc_event_t event;
/* Construct the event */
event.type = libvlc_TreeSubtreeDeleted;
event.u.tree_subtree_deleted.subtree = p_subtree;
event.u.tree_subtree_deleted.index = index;
/* Send the event */
libvlc_event_send( p_tree->p_event_manager, &event );
} }
#ifdef NOT_USED
/**************************************************************************
* notify_tree_item_value_changed (private)
*
* Do the appropriate action when a tree's item changes.
**************************************************************************/
static void
notify_tree_item_value_changed( libvlc_tree_t * p_tree,
libvlc_tree_t * p_subtree,
int index )
{
libvlc_event_t event;
/* Construct the event */
event.type = libvlc_TreeItemValueChanged;
event.u.tree_item_value_changed.new_value = p_tree->p_item;
/* Send the event */
libvlc_event_send( p_tree->p_event_manager, &event );
}
#endif
/************************************************************************** /**************************************************************************
* new (Private) * new (Private)
**************************************************************************/ **************************************************************************/
...@@ -76,6 +114,15 @@ libvlc_tree_new( libvlc_retain_function item_retain, ...@@ -76,6 +114,15 @@ libvlc_tree_new( libvlc_retain_function item_retain,
p_tree->i_refcount = 1; p_tree->i_refcount = 1;
p_tree->p_item = item; p_tree->p_item = item;
ARRAY_INIT( p_tree->subtrees ); ARRAY_INIT( p_tree->subtrees );
p_tree->p_event_manager = libvlc_event_manager_new( p_tree, NULL, p_e );
libvlc_event_manager_register_event_type( p_tree->p_event_manager,
libvlc_TreeSubtreeAdded, p_e );
libvlc_event_manager_register_event_type( p_tree->p_event_manager,
libvlc_TreeSubtreeDeleted, p_e );
libvlc_event_manager_register_event_type( p_tree->p_event_manager,
libvlc_TreeItemValueChanged, p_e );
return p_tree; return p_tree;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment