本文整理汇总了C++中CLVColumn::GetPopup方法的典型用法代码示例。如果您正苦于以下问题:C++ CLVColumn::GetPopup方法的具体用法?C++ CLVColumn::GetPopup怎么用?C++ CLVColumn::GetPopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLVColumn
的用法示例。
在下文中一共展示了CLVColumn::GetPopup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseDown
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);
}
}