27 #ifndef __SB_LOCALDATABASEMEDIALISTVIEWSELECTION_H__
28 #define __SB_LOCALDATABASEMEDIALISTVIEWSELECTION_H__
30 #include "sbIMediaListViewSelection.h"
33 #include <nsAutoPtr.h>
35 #include <nsDataHashtable.h>
36 #include <nsIClassInfo.h>
37 #include <nsISimpleEnumerator.h>
38 #include <nsISerializable.h>
40 #include <nsStringGlue.h>
42 #include <nsTObserverArray.h>
43 #include <sbILibrary.h>
44 #include <sbILocalDatabaseGUIDArray.h>
52 NS_DECL_SBIMEDIALISTVIEWSELECTION
57 const nsAString& aListGUID,
67 typedef nsresult (*PR_CALLBACK sbSelectionEnumeratorCallbackFunc)
68 (PRUint32 aIndex,
const nsAString& aId,
const nsAString& aGuid,
void* aUserData);
70 nsresult GetUniqueIdForIndex(PRUint32 aIndex, nsAString& aId);
72 nsresult GetUniqueIdForIndex(PRInt32 aIndex, nsAString& aId);
74 nsresult GetIndexForUniqueId(
const nsAString& aId,
77 static void DelayedSelectNotification(nsITimer* aTimer,
void*
aClosure);
79 nsresult AddToSelection(PRUint32 aIndex);
80 nsresult RemoveFromSelection(PRUint32 aIndex);
81 inline void CheckSelectAll() {
83 mSelectionIsAll = (mSelection.Count() == mLength);
85 mSelectionIsAll = PR_FALSE;
87 if (mSelectionIsAll) {
96 typedef nsTObserverArray<nsCOMPtr<sbIMediaListViewSelectionListener> > sbObserverArray;
97 sbObserverArray mObservers;
100 PRBool mSelectionIsAll;
101 PRInt32 mCurrentIndex;
102 nsString mCurrentUID;
104 nsCOMPtr<sbILibrary> mLibrary;
107 nsCOMPtr<nsITimer> mSelectTimer;
115 PRBool mSelectionNotificationsSuppressed;
126 mSelection(aSelection)
128 NS_ASSERTION(aSelection,
"aSelection is null");
132 mSelection->SetSelectionNotificationsSuppressed(PR_TRUE);
133 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to set");
141 mSelection->SetSelectionNotificationsSuppressed(PR_FALSE);
142 NS_ASSERTION(NS_SUCCEEDED(rv),
"Failed to unset");
154 NS_DECL_NSISERIALIZABLE
172 NS_DECL_NSISIMPLEENUMERATOR
177 nsresult
AddGuid(
const nsAString& aGuid, PRUint32 aIndex);
185 nsresult GetNextItem();
188 nsCOMPtr<sbILibrary> mLibrary;
189 nsTArray<Item> mItems;
191 nsCOMPtr<sbIMediaItem> mNextItem;
192 PRUint32 mNextItemIndex;
200 NS_DECL_NSISIMPLEENUMERATOR
209 nsTArray<nsString> mGUIDArray;
210 nsCOMPtr<sbILibrary> mLibrary;
211 nsCOMPtr<sbILocalDatabaseGUIDArray> mArray;
225 NS_DECL_NSISIMPLEENUMERATOR
231 nsCOMPtr<nsISimpleEnumerator> mIndexedEnumerator;
nsDataHashtable< nsStringHashKey, nsString > sbSelectionList
NS_DECL_ISUPPORTS NS_DECL_NSISIMPLEENUMERATOR NS_DECL_NSICLASSINFO sbIndexedGUIDArrayEnumerator(sbILibrary *aLibrary, sbILocalDatabaseGUIDArray *aArray)
~sbAutoSelectNotificationsSuppressed()
[USER CODE SHOULD NOT REFERENCE THIS CLASS]
Use scope to manage the notifications suppressed flag on the view selection so it does not accidental...
Media library abstraction.
sbAutoSelectNotificationsSuppressed(sbIMediaListViewSelection *aSelection)