36 mTreeSelection(aTreeSelection),
37 mViewSelection(aViewSelection),
41 NS_ASSERTION(aTreeSelection && aViewSelection,
"Null passed to ctor");
45 sbPlaylistTreeSelection::GetTree(nsITreeBoxObject** aTree)
47 return mTreeSelection->GetTree(aTree);
50 sbPlaylistTreeSelection::SetTree(nsITreeBoxObject* aTree)
52 return mTreeSelection->SetTree(aTree);
56 sbPlaylistTreeSelection::GetSingle(PRBool* aSingle)
58 return mTreeSelection->GetSingle(aSingle);
62 sbPlaylistTreeSelection::GetCount(PRInt32*
aCount)
64 return mViewSelection->GetCount(aCount);
68 sbPlaylistTreeSelection::IsSelected(PRInt32 index, PRBool* _retval)
70 return mViewSelection->IsIndexSelected(index, _retval);
76 mShiftSelectPivot = -1;
79 nsresult rv = mTreeSelection->Select(index);
80 NS_ENSURE_SUCCESS(rv, rv);
81 rv = mViewSelection->SelectOnly(index);
82 NS_ENSURE_SUCCESS(rv, rv);
87 sbPlaylistTreeSelection::TimedSelect(PRInt32 index, PRInt32 delay)
89 mShiftSelectPivot = -1;
92 nsresult rv = mTreeSelection->TimedSelect(index, delay);
93 NS_ENSURE_SUCCESS(rv, rv);
94 rv = mViewSelection->TimedSelectOnly(index, delay);
95 NS_ENSURE_SUCCESS(rv, rv);
100 sbPlaylistTreeSelection::ToggleSelect(PRInt32 index)
102 mShiftSelectPivot = -1;
103 nsresult rv = mViewSelection->Toggle(index);
104 NS_ENSURE_SUCCESS(rv, rv);
105 rv = mTreeSelection->ToggleSelect(index);
106 NS_ENSURE_SUCCESS(rv, rv);
111 sbPlaylistTreeSelection::RangedSelect(PRInt32 startIndex,
120 PRInt32 currentIndex;
121 rv = mViewSelection->GetCurrentIndex(¤tIndex);
122 NS_ENSURE_SUCCESS(rv, rv);
125 rv = mViewSelection->SelectNone();
126 NS_ENSURE_SUCCESS(rv, rv);
127 rv = mTreeSelection->ClearSelection();
128 NS_ENSURE_SUCCESS(rv, rv);
131 if (startIndex == -1) {
132 if (mShiftSelectPivot != -1) {
133 startIndex = mShiftSelectPivot;
136 if (currentIndex != -1) {
137 startIndex = currentIndex;
140 startIndex = endIndex;
145 mShiftSelectPivot = startIndex;
147 rv = mViewSelection->SelectRange(startIndex, endIndex);
148 NS_ENSURE_SUCCESS(rv, rv);
149 rv = mTreeSelection->RangedSelect(startIndex, endIndex, PR_TRUE);
150 NS_ENSURE_SUCCESS(rv, rv);
155 sbPlaylistTreeSelection::ClearRange(PRInt32 startIndex,
158 mShiftSelectPivot = -1;
159 nsresult rv = mViewSelection->ClearRange(startIndex, endIndex);
160 NS_ENSURE_SUCCESS(rv, rv);
161 rv = mTreeSelection->ClearRange(startIndex, endIndex);
162 NS_ENSURE_SUCCESS(rv, rv);
167 sbPlaylistTreeSelection::ClearSelection()
169 mShiftSelectPivot = -1;
170 nsresult rv = mViewSelection->SelectNone();
171 NS_ENSURE_SUCCESS(rv, rv);
172 rv = mTreeSelection->ClearSelection();
173 NS_ENSURE_SUCCESS(rv, rv);
178 sbPlaylistTreeSelection::InvertSelection()
181 return NS_ERROR_NOT_IMPLEMENTED;
185 sbPlaylistTreeSelection::SelectAll()
187 mShiftSelectPivot = -1;
188 nsresult rv = mViewSelection->SelectAll();
189 NS_ENSURE_SUCCESS(rv, rv);
190 rv = mTreeSelection->SelectAll();
191 NS_ENSURE_SUCCESS(rv, rv);
196 sbPlaylistTreeSelection::GetRangeCount(PRInt32* _retval)
198 return NS_ERROR_NOT_IMPLEMENTED;
202 sbPlaylistTreeSelection::GetRangeAt(PRInt32
i,
206 return NS_ERROR_NOT_IMPLEMENTED;
210 sbPlaylistTreeSelection::InvalidateSelection()
212 return mTreeSelection->InvalidateSelection();
216 sbPlaylistTreeSelection::AdjustSelection(PRInt32 index, PRInt32
count)
219 PRInt32 currentIndex;
220 rv = mViewSelection->GetCurrentIndex(¤tIndex);
221 NS_ENSURE_SUCCESS(rv, rv);
224 if ((currentIndex != -1) && (index <= currentIndex)) {
226 if (count < 0 && (currentIndex <= (index - count -1))) {
230 currentIndex +=
count;
233 rv = mViewSelection->SetCurrentIndex(currentIndex);
234 NS_ENSURE_SUCCESS(rv, rv);
235 rv = mTreeSelection->SetCurrentIndex(currentIndex);
236 NS_ENSURE_SUCCESS(rv, rv);
240 if ((mShiftSelectPivot != 1) && (index <= mShiftSelectPivot)) {
242 if (count < 0 && (mShiftSelectPivot <= (index - count - 1))) {
243 mShiftSelectPivot = -1;
246 mShiftSelectPivot +=
count;
254 sbPlaylistTreeSelection::GetSelectEventsSuppressed(PRBool* aSelectEventsSuppressed)
256 return mTreeSelection->GetSelectEventsSuppressed(aSelectEventsSuppressed);
259 sbPlaylistTreeSelection::SetSelectEventsSuppressed(PRBool aSelectEventsSuppressed)
261 return mTreeSelection->SetSelectEventsSuppressed(aSelectEventsSuppressed);
265 sbPlaylistTreeSelection::GetCurrentIndex(PRInt32* aCurrentIndex)
267 return mViewSelection->GetCurrentIndex(aCurrentIndex);
270 sbPlaylistTreeSelection::SetCurrentIndex(PRInt32 aCurrentIndex)
272 nsresult rv = mViewSelection->SetCurrentIndex(aCurrentIndex);
273 NS_ENSURE_SUCCESS(rv, rv);
274 rv = mTreeSelection->SetCurrentIndex(aCurrentIndex);
275 NS_ENSURE_SUCCESS(rv, rv);
280 sbPlaylistTreeSelection::GetCurrentColumn(nsITreeColumn** aCurrentColumn)
282 return mTreeSelection->GetCurrentColumn(aCurrentColumn);
285 sbPlaylistTreeSelection::SetCurrentColumn(nsITreeColumn* aCurrentColumn)
287 return mTreeSelection->SetCurrentColumn(aCurrentColumn);
291 sbPlaylistTreeSelection::GetShiftSelectPivot(PRInt32* aShiftSelectPivot)
293 *aShiftSelectPivot = mShiftSelectPivot;
Use scope to manage the notifications suppressed flag on the view selection so it does not accidental...
NS_IMPL_ISUPPORTS1(sbPlaylistTreeSelection, nsITreeSelection) sbPlaylistTreeSelection
restoreHistoryPrecursor aCount
_getSelectedPageStyle s i