本文整理汇总了C++中CLVColumn类的典型用法代码示例。如果您正苦于以下问题:C++ CLVColumn类的具体用法?C++ CLVColumn怎么用?C++ CLVColumn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CLVColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddSortKey
void ColumnListView::AddSortKey(int32 ColumnIndex)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
Column = NULL;
if(Column && !fSortKeyList.HasItem(Column))
{
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
BRect LabelBounds = fColumnLabelView->Bounds();
fSortKeyList.AddItem(Column);
if(Column->fSortMode == NoSort)
SetSortMode(ColumnIndex,Ascending);
SortItems();
//Need to draw new underline
fColumnLabelView->Invalidate(BRect(Column->fColumnBegin,LabelBounds.top,Column->fColumnEnd,
LabelBounds.bottom));
if(ParentWindow)
ParentWindow->Unlock();
}
}
示例2: SetSortMode
void ColumnListView::SetSortMode(int32 ColumnIndex,CLVSortMode Mode)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
return;
if(Column->fSortMode != Mode)
{
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
BRect LabelBounds = fColumnLabelView->Bounds();
Column->fSortMode = Mode;
if(Mode == NoSort && fSortKeyList.HasItem(Column))
fSortKeyList.RemoveItem(Column);
SortItems();
//Need to draw or erase underline
fColumnLabelView->Invalidate(BRect(Column->fColumnBegin,LabelBounds.top,Column->fColumnEnd,
LabelBounds.bottom));
if(ParentWindow)
ParentWindow->Unlock();
}
}
示例3: DrawItem
void CLVListItem::DrawItem(BView* owner, BRect itemRect, bool complete)
{
BList* DisplayList = &((ColumnListView*)owner)->fColumnDisplayList;
int32 NumberOfColumns = DisplayList->CountItems();
//float PushMax = itemRect.right;
CLVColumn* ThisColumn;
BRect ThisColumnRect = itemRect;
BRegion ClippingRegion;
if(!complete)
owner->GetClippingRegion(&ClippingRegion);
else
ClippingRegion.Set(itemRect);
float LastColumnEnd = -1.0;
//Draw the columns
for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
{
ThisColumn = (CLVColumn*)DisplayList->ItemAt(Counter);
if(!ThisColumn->IsShown())
continue;
ThisColumnRect.left = ThisColumn->fColumnBegin;
ThisColumnRect.right = LastColumnEnd = ThisColumn->fColumnEnd;
if(ThisColumnRect.right >= ThisColumnRect.left && ClippingRegion.Intersects(ThisColumnRect))
DrawItemColumn(owner, ThisColumnRect, ((ColumnListView*)owner)->fColumnList.IndexOf(ThisColumn),complete);
}
//Fill the area after all the columns (so the select highlight goes all the way across)
ThisColumnRect.left = LastColumnEnd + 1.0;
ThisColumnRect.right = owner->Bounds().right;
if(ThisColumnRect.left <= ThisColumnRect.right && ClippingRegion.Intersects(ThisColumnRect))
DrawItemColumn(owner, ThisColumnRect,-1,complete);
}
示例4: ColumnAt
/***********************************************************
* Destructor
***********************************************************/
HListView::~HListView() {
HPrefs* prefs = ((HApp*)be_app)->Prefs();
for (int16 i = 1; i <= 6; i++) {
CLVColumn* col = ColumnAt(i);
BString name = "col";
name << (int32)i;
int16 width = static_cast<int16>(col->Width());
prefs->SetData(name.String(), width);
}
SetInvocationMessage(NULL);
SetSelectionMessage(NULL);
}
示例5: Window
int32 ColumnListView::Sorting(int32* SortKeys, CLVSortMode* SortModes) const
{
BWindow* ParentWindow = Window();
if(ParentWindow)
ParentWindow->Lock();
int32 NumberOfKeys = fSortKeyList.CountItems();
for(int32 Counter = 0; Counter < NumberOfKeys; Counter++)
{
CLVColumn* Column = (CLVColumn*)fSortKeyList.ItemAt(Counter);
SortKeys[Counter] = IndexOfColumn(Column);
SortModes[Counter] = Column->SortMode();
}
if(ParentWindow)
ParentWindow->Unlock();
return NumberOfKeys;
}
示例6: saveTo
// Saves the application settings file to (saveEntry). Because this is a
// non-essential file, errors are ignored when writing the settings.
void
ShortcutsWindow::_SaveWindowSettings(BEntry& saveEntry)
{
BFile saveTo(&saveEntry, B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
if (saveTo.InitCheck() != B_OK)
return;
BMessage saveMsg;
saveMsg.AddRect("window frame", Frame());
for (int i = 0; i < fColumnListView->CountColumns(); i++) {
CLVColumn* column = fColumnListView->ColumnAt(i);
saveMsg.AddFloat("column width", column->Width());
}
saveMsg.Flatten(&saveTo);
}
示例7: ReverseSortMode
void ColumnListView::ReverseSortMode(int32 ColumnIndex)
{
CLVColumn* Column;
if(ColumnIndex >= 0)
{
Column = (CLVColumn*)fColumnList.ItemAt(ColumnIndex);
if(!(Column->Flags()&CLV_SORT_KEYABLE))
return;
}
else
return;
if(Column->fSortMode == Ascending)
SetSortMode(ColumnIndex,Descending);
else if(Column->fSortMode == Descending)
SetSortMode(ColumnIndex,NoSort);
else if(Column->fSortMode == NoSort)
SetSortMode(ColumnIndex,Ascending);
}
示例8: UpdateColumnSizesDataRectSizeScrollBars
void ColumnListView::UpdateColumnSizesDataRectSizeScrollBars()
{
//Figure out the width
float ColumnBegin;
float ColumnEnd = -1.0;
fDataWidth = 0.0;
bool NextPushedByExpander = false;
int32 NumberOfColumns = fColumnDisplayList.CountItems();
for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
{
CLVColumn* Column = (CLVColumn*)fColumnDisplayList.ItemAt(Counter);
if(NextPushedByExpander)
Column->fPushedByExpander = true;
else
Column->fPushedByExpander = false;
if(Column->IsShown())
{
float ColumnWidth = Column->Width();
ColumnBegin = ColumnEnd + 1.0;
ColumnEnd = ColumnBegin + ColumnWidth;
Column->fColumnBegin = ColumnBegin;
Column->fColumnEnd = ColumnEnd;
fDataWidth = Column->fColumnEnd;
if(NextPushedByExpander)
if(!(Column->fFlags & CLV_PUSH_PASS))
NextPushedByExpander = false;
if(Column->fFlags & CLV_EXPANDER)
//Set the next column to be pushed
NextPushedByExpander = true;
}
}
//Figure out the height
fDataHeight = 0.0;
int32 NumberOfItems = CountItems();
for(int32 Counter2 = 0; Counter2 < NumberOfItems; Counter2++)
fDataHeight += ItemAt(Counter2)->Height()+1.0;
if(NumberOfItems > 0)
fDataHeight -= 1.0;
//Update the scroll bars
UpdateScrollBars();
}
示例9: max_c
// Loads the application settings file from (loadMsg) and resizes the interface
// to match the previously saved settings. Because this is a non-essential
// file, errors are ignored when loading the settings.
void
ShortcutsWindow::_LoadWindowSettings(const BMessage& loadMsg)
{
BRect frame;
if (loadMsg.FindRect("window frame", &frame) == B_OK) {
// Ensure the frame does not resize below the computed minimum.
float width = max_c(Bounds().right, frame.right - frame.left);
float height = max_c(Bounds().bottom, frame.bottom - frame.top);
ResizeTo(width, height);
// Ensure the frame is not placed outside of the screen.
BScreen screen(this);
float left = min_c(screen.Frame().right - width, frame.left);
float top = min_c(screen.Frame().bottom - height, frame.top);
MoveTo(left, top);
}
for (int i = 0; i < fColumnListView->CountColumns(); i++) {
CLVColumn* column = fColumnListView->ColumnAt(i);
float columnWidth;
if (loadMsg.FindFloat("column width", i, &columnWidth) == B_OK)
column->SetWidth(max_c(column->Width(), columnWidth));
}
}
示例10: SetShownColumns
void TeamListView::SetShownColumns(int32 mask)
{
CLVColumn *col;
col = ColumnAt(name_ndx);
col->SetShown(mask & Options::name_col);
col = ColumnAt(id_ndx);
col->SetShown(mask & Options::id_col);
col = ColumnAt(state_ndx);
col->SetShown(mask & Options::state_col);
col = ColumnAt(priority_ndx);
col->SetShown(mask & Options::priority_col);
col = ColumnAt(areas_ndx);
col->SetShown(mask & Options::memory_col);
col = ColumnAt(CPU_ndx);
col->SetShown(mask & Options::cpu_col);
}
示例11: Bounds
void CLVColumnLabelView::Draw(BRect update_rect)
{
BRect ViewBounds = Bounds();
//Draw each column label in turn
float ColumnBegin = 0.0;
float ColumnEnd = -1.0;
bool MergeWithLeft = false;
int32 NumberOfColumns = fDisplayList->CountItems();
BPoint Start,Stop;
for(int32 ColumnDraw = 0; ColumnDraw < NumberOfColumns; ColumnDraw++)
{
CLVColumn* ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnDraw);
if(ThisColumn->IsShown())
{
//Figure out where this column is
ColumnBegin = ThisColumn->fColumnBegin;
ColumnEnd = ThisColumn->fColumnEnd;
//Start by figuring out if this column will merge with a shown column to the right
bool MergeWithRight = false;
if(ThisColumn->fFlags & CLV_MERGE_WITH_RIGHT)
{
for(int32 ColumnCounter = ColumnDraw+1; ColumnCounter < NumberOfColumns;
ColumnCounter++)
{
CLVColumn* NextColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnCounter);
if(NextColumn->IsShown())
{
//The next column is shown
MergeWithRight = true;
break;
}
else if(!(NextColumn->fFlags & CLV_MERGE_WITH_RIGHT))
//The next column is not shown and doesn't pass on the merge
break;
}
}
if(update_rect.Intersects(BRect(ColumnBegin,ViewBounds.top,ColumnEnd,
ViewBounds.bottom)))
{
//Need to draw this column
BeginLineArray(4);
//Top line
Start.Set(ColumnBegin,ViewBounds.top);
Stop.Set(ColumnEnd-1.0,ViewBounds.top);
if(MergeWithRight && !(ThisColumn == fColumnClicked && fColumnResizing))
Stop.x = ColumnEnd;
AddLine(Start,Stop,BeHighlight);
//Left line
if(!MergeWithLeft)
AddLine(BPoint(ColumnBegin,ViewBounds.top+1.0),
BPoint(ColumnBegin,ViewBounds.bottom),BeHighlight);
//Bottom line
Start.Set(ColumnBegin+1.0,ViewBounds.bottom);
if(MergeWithLeft)
Start.x = ColumnBegin;
Stop.Set(ColumnEnd-1.0,ViewBounds.bottom);
if(MergeWithRight && !(ThisColumn == fColumnClicked && fColumnResizing))
Stop.x = ColumnEnd;
AddLine(Start,Stop,BeShadow);
//Right line
if(ThisColumn == fColumnClicked && fColumnResizing)
AddLine(BPoint(ColumnEnd,ViewBounds.top),BPoint(ColumnEnd,ViewBounds.bottom),
BeFocusBlue);
else if(!MergeWithRight)
AddLine(BPoint(ColumnEnd,ViewBounds.top),BPoint(ColumnEnd,ViewBounds.bottom),
BeShadow);
EndLineArray();
//Add the label
//Limit the clipping region to the interior of the box
BRect TextRect(ColumnBegin+1.0,ViewBounds.top+1.0,ColumnEnd-1.0,
ViewBounds.bottom-1.0);
BRegion TextRegion;
TextRegion.Include(TextRect);
ConstrainClippingRegion(&TextRegion);
bool focus;
bool sort_key;
if(ThisColumn == fColumnClicked && !fColumnResizing)
focus = true;
else
focus = false;
if(fParent->fSortKeyList.HasItem(ThisColumn) && ThisColumn->fSortMode != NoSort)
sort_key = true;
else
sort_key = false;
ThisColumn->DrawColumnHeader(this,TextRect,sort_key,focus,fFontAscent);
//Restore the clipping region
ConstrainClippingRegion(NULL);
}
//Set MergeWithLeft flag for the next column to the appropriate state
MergeWithLeft = MergeWithRight;
}
}
//Add highlight and shadow to the region after the columns if necessary
if(ColumnEnd < ViewBounds.right)
//.........这里部分代码省略.........
示例12: TempList
void CLVColumnLabelView::UpdateDragGroups()
{
//Make a copy of the DragGroups list. Use it to store the CLVDragGroup's for recycling
BList TempList(fDragGroups);
fDragGroups.MakeEmpty();
int32 NumberOfColumns = fDisplayList->CountItems();
bool ContinueGroup = false;
CLVDragGroup* CurrentGroup = NULL;
for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
{
CLVColumn* CurrentColumn = (CLVColumn*)fDisplayList->ItemAt(Counter);
if(!ContinueGroup)
{
//Recycle or obtain a new CLVDragGroup
CurrentGroup = (CLVDragGroup*)TempList.RemoveItem(int32(0));
if(CurrentGroup == NULL)
CurrentGroup = new CLVDragGroup;
//Add the CLVDragGroup to the DragGroups list
fDragGroups.AddItem(CurrentGroup);
//Set up the new DragGroup
CurrentGroup->GroupStartDispListIndex = Counter;
CurrentGroup->GroupStopDispListIndex = Counter;
CurrentGroup->Flags = 0;
if(CurrentColumn->IsShown())
{
CurrentGroup->GroupBegin = CurrentColumn->fColumnBegin;
CurrentGroup->GroupEnd = CurrentColumn->fColumnEnd;
CurrentGroup->LastColumnShown = CurrentColumn;
CurrentGroup->Shown = true;
if(CurrentColumn->fFlags & CLV_LOCK_AT_BEGINNING)
CurrentGroup->AllLockBeginning = true;
else
CurrentGroup->AllLockBeginning = false;
if(CurrentColumn->fFlags & CLV_LOCK_AT_END)
CurrentGroup->AllLockEnd = true;
else
CurrentGroup->AllLockEnd = false;
}
else
{
CurrentGroup->GroupBegin = -1.0;
CurrentGroup->GroupEnd = -1.0;
CurrentGroup->LastColumnShown = NULL;
CurrentGroup->Shown = false;
if(CurrentColumn->fFlags & CLV_LOCK_AT_BEGINNING)
CurrentGroup->AllLockBeginning = true;
else
CurrentGroup->AllLockBeginning = false;
if(CurrentColumn->fFlags & CLV_LOCK_AT_END)
CurrentGroup->AllLockEnd = true;
else
CurrentGroup->AllLockEnd = false;
}
}
else
{
//Add this column to the current DragGroup
CurrentGroup->GroupStopDispListIndex = Counter;
if(CurrentColumn->IsShown())
{
if(CurrentGroup->GroupBegin == -1.0)
CurrentGroup->GroupBegin = CurrentColumn->fColumnBegin;
CurrentGroup->GroupEnd = CurrentColumn->fColumnEnd;
CurrentGroup->LastColumnShown = CurrentColumn;
CurrentGroup->Shown = true;
}
if(!(CurrentColumn->fFlags & CLV_LOCK_AT_BEGINNING))
CurrentGroup->AllLockBeginning = false;
if(!(CurrentColumn->fFlags & CLV_LOCK_AT_END))
CurrentGroup->AllLockEnd = false;
}
CurrentGroup->Flags |= CurrentColumn->fFlags & (CLV_NOT_MOVABLE|CLV_LOCK_AT_BEGINNING|
CLV_LOCK_AT_END);
//See if I should add more columns to this group
if(CurrentColumn->fFlags & CLV_LOCK_WITH_RIGHT)
ContinueGroup = true;
else
ContinueGroup = false;
}
//If any unused groups remain in TempList, delete them
while((CurrentGroup = (CLVDragGroup*)TempList.RemoveItem(int32(0))) != NULL)
delete CurrentGroup;
}
示例13: if
void CLVColumnLabelView::MouseMoved(BPoint where, uint32 code, const BMessage */*message*/)
{
bool should_show_modified_cursor = false;
if(fColumnClicked == NULL)
{
if(code != B_EXITED_VIEW)
{
//Check for whether to switch the mouse to indicate that you can resize
int32 NumberOfColumns = fDisplayList->CountItems();
for(int32 ColumnFind = 0; ColumnFind < NumberOfColumns; ColumnFind++)
{
CLVColumn* ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
if(ThisColumn->IsShown())
{
float ColumnEnd = ThisColumn->fColumnEnd;
if(where.x >= ColumnEnd-2.0 && where.x <= ColumnEnd+2.0)
{
//User clicked the resize tab for (after) this column
if(!(ThisColumn->fFlags & CLV_NOT_RESIZABLE))
should_show_modified_cursor = true;
break;
}
else if(where.x < ColumnEnd+2.0)
break;
}
}
}
}
else if(!fColumnResizing)
{
//User is clicking or dragging
BRect ViewBounds = Bounds();
if((where.x<fMouseClickedPos.x-2.0 || where.x>fMouseClickedPos.x+2.0) &&
!fColumnDragging)
{
//User is initiating a drag
if(fTheDragGroup->Flags & CLV_NOT_MOVABLE)
{
//Not allowed to drag this column - terminate the click
Invalidate(BRect(fColumnClicked->fColumnBegin,ViewBounds.top,
fColumnClicked->fColumnEnd,ViewBounds.bottom));
fColumnClicked = NULL;
}
else
{
//Actually initiate a drag
fColumnDragging = true;
fPrevDragOutlineLeft = -1.0;
fPrevDragOutlineRight = -1.0;
}
}
//Now deal with dragging
if(fColumnDragging)
{
//User is dragging
if(where.x<fPreviousMousePos.x || where.x>fPreviousMousePos.x)
{
//Mouse moved since I last checked
ViewBounds = Bounds();
bool ColumnSnapped;
do
{
//Live dragging of columns
ColumnSnapped = false;
float ColumnsUpdateLeft = 0.0;
float ColumnsUpdateRight = 0.0;
float MainViewUpdateLeft = 0.0;
float MainViewUpdateRight = 0.0;
CLVColumn* LastSwapColumn = NULL;
if(fSnapMin != -1.0 && where.x < fSnapMin)
{
//Shift the group left
ColumnsUpdateLeft = fTheShownGroupBefore->GroupBegin;
ColumnsUpdateRight = fTheDragGroup->GroupEnd;
MainViewUpdateLeft = ColumnsUpdateLeft;
MainViewUpdateRight = ColumnsUpdateRight;
LastSwapColumn = fTheShownGroupBefore->LastColumnShown;
if(fTheDragGroup->LastColumnShown->fFlags & CLV_MERGE_WITH_RIGHT)
ColumnsUpdateRight += 1.0;
else if(fTheShownGroupBefore->LastColumnShown->fFlags & CLV_MERGE_WITH_RIGHT)
ColumnsUpdateRight += 1.0;
ShiftDragGroup(fSnapGroupBefore);
ColumnSnapped = true;
}
if(fSnapMax != -1.0 && where.x > fSnapMax)
{
//Shift the group right
ColumnsUpdateLeft = fTheDragGroup->GroupBegin;
ColumnsUpdateRight = fTheShownGroupAfter->GroupEnd;
MainViewUpdateLeft = ColumnsUpdateLeft;
MainViewUpdateRight = ColumnsUpdateRight;
LastSwapColumn = fTheDragGroup->LastColumnShown;
if(fTheDragGroup->LastColumnShown->fFlags & CLV_MERGE_WITH_RIGHT)
ColumnsUpdateRight += 1.0;
else if(fTheShownGroupAfter->LastColumnShown->fFlags & CLV_MERGE_WITH_RIGHT)
ColumnsUpdateRight += 1.0;
ShiftDragGroup(fSnapGroupAfter+1);
ColumnSnapped = true;
//.........这里部分代码省略.........
示例14: GetMouse
void CLVColumnLabelView::MouseDown(BPoint Point)
{
//Only pay attention to primary mouse button
bool WatchMouse = false;
BPoint MousePos;
uint32 Buttons;
GetMouse(&MousePos,&Buttons);
if(Buttons == B_PRIMARY_MOUSE_BUTTON)
{
BRect ViewBounds = Bounds();
//Make sure no other column was already clicked. If so, just discard the old one and redraw the
//view
if(fColumnClicked != NULL)
{
Invalidate();
fColumnClicked = NULL;
}
//Find the column that the user clicked, if any
bool GrabbedResizeTab = false;
int32 NumberOfColumns = fDisplayList->CountItems();
int32 ColumnFind;
CLVColumn* ThisColumn = NULL;
for(ColumnFind = 0; ColumnFind < NumberOfColumns; ColumnFind++)
{
ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
if(ThisColumn->IsShown())
{
float ColumnBegin = ThisColumn->fColumnBegin;
float ColumnEnd = ThisColumn->fColumnEnd;
if(Point.x >= ColumnBegin && Point.x <= ColumnEnd)
{
//User clicked in this column
if(Point.x <= ColumnBegin+2.0)
{
//User clicked the resize tab preceding this column
for(ColumnFind--; ColumnFind >= 0; ColumnFind--)
{
ThisColumn = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
if(ThisColumn->IsShown())
{
GrabbedResizeTab = true;
break;
}
}
}
else if(Point.x >= ColumnEnd-2.0)
{
//User clicked the resize tab for (after) this column
GrabbedResizeTab = true;
}
else
{
//The user clicked in this column
fColumnClicked = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
fColumnResizing = false;
fPreviousMousePos = Point;
fMouseClickedPos = Point;
fColumnDragging = false;
SetSnapMinMax();
fDragBoxMouseHoldOffset = Point.x-
((CLVDragGroup*)fDragGroups.ItemAt(fDragGroup))->GroupBegin;
Invalidate(BRect(ColumnBegin+1.0,ViewBounds.top+1.0,ColumnEnd-1.0,
ViewBounds.bottom-1.0));
//Start watching the mouse
WatchMouse = true;
}
break;
}
}
}
if(GrabbedResizeTab)
{
//The user grabbed a resize tab. See if resizing of this column is allowed
if(!(ThisColumn->fFlags & CLV_NOT_RESIZABLE))
{
fColumnClicked = (CLVColumn*)fDisplayList->ItemAt(ColumnFind);
fColumnResizing = true;
fPreviousMousePos = Point;
fMouseClickedPos = Point;
fColumnDragging = false;
fResizeMouseHoldOffset = Point.x-fColumnClicked->fColumnEnd;
Invalidate(BRect(fColumnClicked->fColumnEnd,ViewBounds.top,ThisColumn->fColumnEnd,
ViewBounds.bottom));
//Start watching the mouse
WatchMouse = true;
}
}
}
if(WatchMouse)
SetMouseEventMask(B_POINTER_EVENTS,B_NO_POINTER_HISTORY);
fPreviousMousePos = MousePos;
}
示例15: SetSelectedColumnIndex
void ColumnListView::MouseDown(BPoint point)
{
int prevColumn = _selectedColumn;
int32 numberOfColumns = fColumnDisplayList.CountItems();
float xleft = point.x;
for(int32 Counter = 0; Counter < numberOfColumns; Counter++)
{
CLVColumn* Column = (CLVColumn*)fColumnDisplayList.ItemAt(Counter);
if(Column->IsShown())
{
if (xleft > 0)
{
xleft -= Column->Width();
if (xleft <= 0)
{
SetSelectedColumnIndex(GetActualIndexOf(Counter));
break;
}
}
}
}
int32 ItemIndex = IndexOf(point);
if(ItemIndex >= 0)
{
CLVListItem* ClickedItem = (CLVListItem*)BListView::ItemAt(ItemIndex);
if(ClickedItem->fSuperItem)
if(ClickedItem->fExpanderButtonRect.Contains(point))
{
if(ClickedItem->IsExpanded())
Collapse(ClickedItem);
else
Expand(ClickedItem);
return;
}
}
// If it's a right-click, hoist up the popup-menu
const char * selectedText = NULL;
CLVColumn * col = ColumnAt(_selectedColumn);
if (col)
{
BPopUpMenu * popup = col->GetPopup();
if (popup)
{
BMessage * msg = Window()->CurrentMessage();
int32 buttons;
if ((msg->FindInt32("buttons", &buttons) == B_NO_ERROR)&&(buttons == B_SECONDARY_MOUSE_BUTTON))
{
BPoint where(point);
Select(IndexOf(where));
ConvertToScreen(&where);
BMenuItem * result = popup->Go(where, false);
if (result) selectedText = result->Label();
}
}
}
int prevRow = CurrentSelection();
BListView::MouseDown(point);
int curRow = CurrentSelection();
if ((_editMessage != NULL)&&((selectedText)||((_selectedColumn == prevColumn)&&(curRow == prevRow))))
{
// Send mouse message...
BMessage temp(*_editMessage);
temp.AddInt32("column", _selectedColumn);
temp.AddInt32("row", CurrentSelection());
if (selectedText) temp.AddString("text", selectedText);
else temp.AddInt32("mouseClick", 0);
_editTarget.SendMessage(&temp);
}
}