* remove whitespaces, no functional change
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26274 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
21a0d9a1f7
commit
f589ec0229
@ -2,7 +2,7 @@
|
|||||||
* Copyright (c) 2001-2008, Haiku, Inc.
|
* Copyright (c) 2001-2008, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Ulrich Wimboeck
|
* Ulrich Wimboeck
|
||||||
* Marc Flerackers (mflerackers@androme.be)
|
* Marc Flerackers (mflerackers@androme.be)
|
||||||
* Stephan Assmus <superstippi@gmx.de>
|
* Stephan Assmus <superstippi@gmx.de>
|
||||||
@ -32,35 +32,35 @@ struct track_data {
|
|||||||
|
|
||||||
static property_info sProperties[] = {
|
static property_info sProperties[] = {
|
||||||
{ "Item", { B_COUNT_PROPERTIES, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
{ "Item", { B_COUNT_PROPERTIES, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
||||||
"Returns the number of BListItems currently in the list.", 0, { B_INT32_TYPE }
|
"Returns the number of BListItems currently in the list.", 0, { B_INT32_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "Item", { B_EXECUTE_PROPERTY, 0 }, { B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER,
|
{ "Item", { B_EXECUTE_PROPERTY, 0 }, { B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER,
|
||||||
B_RANGE_SPECIFIER, B_REVERSE_RANGE_SPECIFIER, 0 },
|
B_RANGE_SPECIFIER, B_REVERSE_RANGE_SPECIFIER, 0 },
|
||||||
"Select and invoke the specified items, first removing any existing selection."
|
"Select and invoke the specified items, first removing any existing selection."
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "Selection", { B_COUNT_PROPERTIES, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
{ "Selection", { B_COUNT_PROPERTIES, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
||||||
"Returns int32 count of items in the selection.", 0, { B_INT32_TYPE }
|
"Returns int32 count of items in the selection.", 0, { B_INT32_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "Selection", { B_EXECUTE_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
{ "Selection", { B_EXECUTE_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
||||||
"Invoke items in selection."
|
"Invoke items in selection."
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "Selection", { B_GET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
{ "Selection", { B_GET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
||||||
"Returns int32 indices of all items in the selection.", 0, { B_INT32_TYPE }
|
"Returns int32 indices of all items in the selection.", 0, { B_INT32_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "Selection", { B_SET_PROPERTY, 0 }, { B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER,
|
{ "Selection", { B_SET_PROPERTY, 0 }, { B_INDEX_SPECIFIER, B_REVERSE_INDEX_SPECIFIER,
|
||||||
B_RANGE_SPECIFIER, B_REVERSE_RANGE_SPECIFIER, 0 },
|
B_RANGE_SPECIFIER, B_REVERSE_RANGE_SPECIFIER, 0 },
|
||||||
"Extends current selection or deselects specified items. Boolean field \"data\" "
|
"Extends current selection or deselects specified items. Boolean field \"data\" "
|
||||||
"chooses selection or deselection.", 0, { B_BOOL_TYPE }
|
"chooses selection or deselection.", 0, { B_BOOL_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{ "Selection", { B_SET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
{ "Selection", { B_SET_PROPERTY, 0 }, { B_DIRECT_SPECIFIER, 0 },
|
||||||
"Select or deselect all items in the selection. Boolean field \"data\" chooses "
|
"Select or deselect all items in the selection. Boolean field \"data\" chooses "
|
||||||
"selection or deselection.", 0, { B_BOOL_TYPE }
|
"selection or deselection.", 0, { B_BOOL_TYPE }
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ BListView::BListView(BMessage* archive)
|
|||||||
|
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
BMessage subData;
|
BMessage subData;
|
||||||
|
|
||||||
while (archive->FindMessage("_l_items", i++, &subData)) {
|
while (archive->FindMessage("_l_items", i++, &subData)) {
|
||||||
BArchivable *object = instantiate_object(&subData);
|
BArchivable *object = instantiate_object(&subData);
|
||||||
if (!object)
|
if (!object)
|
||||||
@ -498,8 +498,8 @@ BListView::AddItem(BListItem *item, int32 index)
|
|||||||
|
|
||||||
item->Update(this, &font);
|
item->Update(this, &font);
|
||||||
|
|
||||||
_RecalcItemTops(index);
|
_RecalcItemTops(index);
|
||||||
|
|
||||||
_FixupScrollBar();
|
_FixupScrollBar();
|
||||||
_InvalidateFrom(index);
|
_InvalidateFrom(index);
|
||||||
}
|
}
|
||||||
@ -515,14 +515,14 @@ BListView::AddItem(BListItem* item)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// No need to adapt selection, as this item is the last in the list
|
// No need to adapt selection, as this item is the last in the list
|
||||||
|
|
||||||
if (Window()) {
|
if (Window()) {
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
|
|
||||||
item->Update(this, &font);
|
item->Update(this, &font);
|
||||||
|
|
||||||
_RecalcItemTops(CountItems() - 1);
|
_RecalcItemTops(CountItems() - 1);
|
||||||
|
|
||||||
_FixupScrollBar();
|
_FixupScrollBar();
|
||||||
InvalidateItem(CountItems() - 1);
|
InvalidateItem(CountItems() - 1);
|
||||||
@ -549,12 +549,12 @@ BListView::AddList(BList* list, int32 index)
|
|||||||
if (Window()) {
|
if (Window()) {
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
|
|
||||||
for (int32 i = index; i <= (index + list->CountItems() - 1); i++)
|
for (int32 i = index; i <= (index + list->CountItems() - 1); i++)
|
||||||
ItemAt(i)->Update(this, &font);
|
ItemAt(i)->Update(this, &font);
|
||||||
|
|
||||||
_RecalcItemTops(index);
|
_RecalcItemTops(index);
|
||||||
|
|
||||||
_FixupScrollBar();
|
_FixupScrollBar();
|
||||||
Invalidate(); // TODO
|
Invalidate(); // TODO
|
||||||
}
|
}
|
||||||
@ -582,15 +582,15 @@ BListView::RemoveItem(int32 index)
|
|||||||
|
|
||||||
if (!fList.RemoveItem(item))
|
if (!fList.RemoveItem(item))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (fFirstSelected != -1 && index < fFirstSelected)
|
if (fFirstSelected != -1 && index < fFirstSelected)
|
||||||
fFirstSelected--;
|
fFirstSelected--;
|
||||||
|
|
||||||
if (fLastSelected != -1 && index < fLastSelected)
|
if (fLastSelected != -1 && index < fLastSelected)
|
||||||
fLastSelected--;
|
fLastSelected--;
|
||||||
|
|
||||||
_RecalcItemTops(index);
|
_RecalcItemTops(index);
|
||||||
|
|
||||||
_InvalidateFrom(index);
|
_InvalidateFrom(index);
|
||||||
_FixupScrollBar();
|
_FixupScrollBar();
|
||||||
|
|
||||||
@ -711,14 +711,14 @@ BListView::IndexOf(BPoint point) const
|
|||||||
mid = (low + high) / 2;
|
mid = (low + high) / 2;
|
||||||
frameTop = ItemAt(mid)->Top();
|
frameTop = ItemAt(mid)->Top();
|
||||||
frameBottom = ItemAt(mid)->Bottom();
|
frameBottom = ItemAt(mid)->Bottom();
|
||||||
if (point.y < frameTop)
|
if (point.y < frameTop)
|
||||||
high = mid - 1;
|
high = mid - 1;
|
||||||
else if (point.y > frameBottom)
|
else if (point.y > frameBottom)
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
else
|
else
|
||||||
return mid;
|
return mid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,7 +884,7 @@ BListView::Invoke(BMessage *message)
|
|||||||
|
|
||||||
if (!message && !notify)
|
if (!message && !notify)
|
||||||
message = Message();
|
message = Message();
|
||||||
|
|
||||||
if (!message) {
|
if (!message) {
|
||||||
if (!IsWatched())
|
if (!IsWatched())
|
||||||
return err;
|
return err;
|
||||||
@ -956,7 +956,7 @@ BListView::SelectionChanged()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BListView::SortItems(int (*cmp)(const void *, const void *))
|
BListView::SortItems(int (*cmp)(const void *, const void *))
|
||||||
{
|
{
|
||||||
if (_DeselectAll(-1, -1)) {
|
if (_DeselectAll(-1, -1)) {
|
||||||
SelectionChanged();
|
SelectionChanged();
|
||||||
@ -1013,7 +1013,7 @@ BListView::AttachedToWindow()
|
|||||||
|
|
||||||
if (!Messenger().IsValid())
|
if (!Messenger().IsValid())
|
||||||
SetTarget(Window(), NULL);
|
SetTarget(Window(), NULL);
|
||||||
|
|
||||||
_FixupScrollBar();
|
_FixupScrollBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,13 +1062,13 @@ BListView::GetSupportedSuites(BMessage* data)
|
|||||||
{
|
{
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
status_t err = data->AddString("suites", "suite/vnd.Be-list-view");
|
status_t err = data->AddString("suites", "suite/vnd.Be-list-view");
|
||||||
|
|
||||||
BPropertyInfo propertyInfo(sProperties);
|
BPropertyInfo propertyInfo(sProperties);
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
err = data->AddFlat("messages", &propertyInfo);
|
err = data->AddFlat("messages", &propertyInfo);
|
||||||
|
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
return BView::GetSupportedSuites(data);
|
return BView::GetSupportedSuites(data);
|
||||||
return err;
|
return err;
|
||||||
@ -1116,13 +1116,13 @@ BListView::GetPreferredSize(float *width, float *height)
|
|||||||
int32 count = CountItems();
|
int32 count = CountItems();
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
float maxWidth = 0.0;
|
float maxWidth = 0.0;
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
float itemWidth = ItemAt(i)->Width();
|
float itemWidth = ItemAt(i)->Width();
|
||||||
if (itemWidth > maxWidth)
|
if (itemWidth > maxWidth)
|
||||||
maxWidth = itemWidth;
|
maxWidth = itemWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
*width = maxWidth;
|
*width = maxWidth;
|
||||||
*height = ItemAt(count - 1)->Bottom();
|
*height = ItemAt(count - 1)->Bottom();
|
||||||
} else {
|
} else {
|
||||||
@ -1228,7 +1228,7 @@ BListView::_FixupScrollBar()
|
|||||||
|
|
||||||
BRect bounds = Bounds();
|
BRect bounds = Bounds();
|
||||||
int32 count = CountItems();
|
int32 count = CountItems();
|
||||||
|
|
||||||
float itemHeight = 0.0;
|
float itemHeight = 0.0;
|
||||||
|
|
||||||
if (CountItems() > 0)
|
if (CountItems() > 0)
|
||||||
@ -1277,10 +1277,10 @@ BListView::_FontChanged()
|
|||||||
{
|
{
|
||||||
BFont font;
|
BFont font;
|
||||||
GetFont(&font);
|
GetFont(&font);
|
||||||
for (int32 i = 0; i < CountItems(); i++)
|
for (int32 i = 0; i < CountItems(); i++)
|
||||||
ItemAt(i)->Update(this, &font);
|
ItemAt(i)->Update(this, &font);
|
||||||
_RecalcItemTops(0);
|
_RecalcItemTops(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1527,14 +1527,14 @@ BListView::_SwapItems(int32 a, int32 b)
|
|||||||
fAnchorIndex = b;
|
fAnchorIndex = b;
|
||||||
else if (fAnchorIndex == b)
|
else if (fAnchorIndex == b)
|
||||||
fAnchorIndex = a;
|
fAnchorIndex = a;
|
||||||
|
|
||||||
// track selection
|
// track selection
|
||||||
// NOTE: this is only important if the selection status
|
// NOTE: this is only important if the selection status
|
||||||
// of both items is not the same
|
// of both items is not the same
|
||||||
int32 first = min_c(a, b);
|
int32 first = min_c(a, b);
|
||||||
int32 last = max_c(a, b);
|
int32 last = max_c(a, b);
|
||||||
if (ItemAt(a)->IsSelected() != ItemAt(b)->IsSelected()) {
|
if (ItemAt(a)->IsSelected() != ItemAt(b)->IsSelected()) {
|
||||||
if (first < fFirstSelected || last > fLastSelected)
|
if (first < fFirstSelected || last > fLastSelected)
|
||||||
_RescanSelection(min_c(first, fFirstSelected), min_c(last, fLastSelected));
|
_RescanSelection(min_c(first, fFirstSelected), min_c(last, fLastSelected));
|
||||||
// though the actually selected items stayed the
|
// though the actually selected items stayed the
|
||||||
// same, the selection has still changed
|
// same, the selection has still changed
|
||||||
@ -1543,7 +1543,7 @@ BListView::_SwapItems(int32 a, int32 b)
|
|||||||
|
|
||||||
ItemAt(a)->SetTop(bFrame.top);
|
ItemAt(a)->SetTop(bFrame.top);
|
||||||
ItemAt(b)->SetTop(aFrame.top);
|
ItemAt(b)->SetTop(aFrame.top);
|
||||||
|
|
||||||
// take care of invalidation
|
// take care of invalidation
|
||||||
if (Window()) {
|
if (Window()) {
|
||||||
// NOTE: window looper is assumed to be locked!
|
// NOTE: window looper is assumed to be locked!
|
||||||
@ -1582,9 +1582,9 @@ BListView::_MoveItem(int32 from, int32 to)
|
|||||||
// same, the selection has still changed
|
// same, the selection has still changed
|
||||||
SelectionChanged();
|
SelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
_RecalcItemTops((to > from) ? from : to);
|
_RecalcItemTops((to > from) ? from : to);
|
||||||
|
|
||||||
// take care of invalidation
|
// take care of invalidation
|
||||||
if (Window()) {
|
if (Window()) {
|
||||||
// NOTE: window looper is assumed to be locked!
|
// NOTE: window looper is assumed to be locked!
|
||||||
|
Loading…
Reference in New Issue
Block a user