本文整理汇总了C++中CurrentSelection函数的典型用法代码示例。如果您正苦于以下问题:C++ CurrentSelection函数的具体用法?C++ CurrentSelection怎么用?C++ CurrentSelection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CurrentSelection函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CurrentSelection
void
RosterView::RemoveSelected()
{
if (CurrentItemSelection())
{
int32 selected = CurrentSelection();
RosterItem *item = CurrentItemSelection();
if (item == NULL) return;
RemoveItem(CurrentSelection());
if (ItemAt(selected)) Select(selected);
else if (ItemAt(selected - 1)) Select(selected - 1);
}
}
示例2: msg
void
SearchListView::ItemInvoked(void)
{
BIntegerField* pageField = (BIntegerField*)CurrentSelection()->GetField(0);
if (pageField == nullptr)
return;
BMessage msg(MSG_HIGHLIGHT_RECT);
msg.AddInt32("page", pageField->Value() - 1);
msg.AddRect("rect", fRectVec[IndexOf(CurrentSelection())]);
Window()->PostMessage(&msg);
BColumnListView::ItemInvoked();
}
示例3: ContextPopUp
void
FavView::_ShowPopUpMenu(BPoint screen)
{
if (fShowingPopUpMenu)
return;
ContextPopUp* menu = new ContextPopUp("PopUpMenu", this);
FavItem *currentFav = dynamic_cast<FavItem *>(ItemAt(CurrentSelection()));
BMessage* msg = NULL;
msg = new BMessage(FAV_EDIT);
msg->AddPointer("fav", currentFav);
BMenuItem* item = new BMenuItem(B_TRANSLATE("Edit title"), msg);
menu->AddItem(item);
msg = new BMessage(FAV_DELETE);
msg->AddPointer("fav", currentFav);
item = new BMenuItem(B_TRANSLATE("Remove favorite"),msg);
menu->AddItem(item);
msg = new BMessage(PASTE_SPRUNGE);
msg->AddPointer("fav", currentFav);
item = new BMenuItem(B_TRANSLATE("Paste to Sprunge.us"), msg);
menu->AddItem(item);
menu->SetTargetForItems(Looper());
menu->Go(screen, true, true, true);
fShowingPopUpMenu = true;
}
示例4: path
void
HEventList::SelectionChanged()
{
BColumnListView::SelectionChanged();
HEventRow* row = (HEventRow*)CurrentSelection();
if (row != NULL) {
entry_ref ref;
BMediaFiles().GetRefFor(fType, row->Name(), &ref);
BPath path(&ref);
if (path.InitCheck() == B_OK || ref.name == NULL
|| strcmp(ref.name, "") == 0) {
row->SetPath(path.Path());
UpdateRow(row);
} else {
printf("name %s\n", ref.name);
BMediaFiles().RemoveRefFor(fType, row->Name(), ref);
BAlert* alert = new BAlert("alert",
B_TRANSLATE("No such file or directory"), B_TRANSLATE("OK"));
alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE);
alert->Go();
return;
}
BMessage msg(M_EVENT_CHANGED);
msg.AddString("name", row->Name());
msg.AddString("path", row->Path());
Window()->PostMessage(&msg);
}
}
示例5: ContextPopUp
void
ClipView::_ShowPopUpMenu(BPoint screen)
{
if (fShowingPopUpMenu)
return;
ContextPopUp* menu = new ContextPopUp("PopUpMenu", this);
ClipItem* currentClip = dynamic_cast<ClipItem *>(ItemAt(CurrentSelection()));
BMessage* msg = NULL;
msg = new BMessage(PASTE_SPRUNGE);
msg->AddPointer("clip", currentClip);
BMenuItem* item = new BMenuItem(B_TRANSLATE("Paste to Sprunge.us"), msg, 'P');
menu->AddItem(item);
msg = new BMessage(FAV_ADD);
msg->AddPointer("clip", currentClip);
item = new BMenuItem(B_TRANSLATE("Add to favorites"), msg, 'A');
menu->AddItem(item);
msg = new BMessage(DELETE);
msg->AddPointer("clip", currentClip);
item = new BMenuItem(B_TRANSLATE("Remove"), msg);
menu->AddItem(item);
menu->SetTargetForItems(Looper());
menu->Go(screen, true, true, true);
fShowingPopUpMenu = true;
}
示例6: _
// SelectionChanged
void
DragSortableListView::SelectionChanged()
{
//printf("%s::SelectionChanged()", typeid(*this).name());
// modify global Selection
if (!fSelection || fSyncingToSelection)
return;
fModifyingSelection = true;
BList selectables;
for (int32 i = 0; BListItem* item = ItemAt(CurrentSelection(i)); i++) {
Selectable* selectable = SelectableFor(item);
if (selectable)
selectables.AddItem((void*)selectable);
}
AutoNotificationSuspender _(fSelection);
int32 count = selectables.CountItems();
if (count == 0) {
//printf(" deselecting all\n");
if (!fSyncingToSelection)
fSelection->DeselectAll();
} else {
//printf(" selecting %ld items\n", count);
for (int32 i = 0; i < count; i++) {
Selectable* selectable = (Selectable*)selectables.ItemAtFast(i);
fSelection->Select(selectable, i > 0);
}
}
fModifyingSelection = false;
}
示例7: CurrentSelection
void _ArpControllerRangeList::SelectionChanged()
{
inherited::SelectionChanged();
int32 selection = CurrentSelection();
BMessage update('iupd');
if (selection >= 0) {
BListItem* item;
for (int32 k = 0; (item = ItemAt(k)); k++) {
_ArpControllerRangeItem* ccItem = dynamic_cast<_ArpControllerRangeItem*>(item);
if (ccItem) {
if ( IsItemSelected(k) ) {
update.AddInt32(mSettingsKey.String(), k);
if ( !ccItem->IsActive() ) {
ccItem->SetActive(true);
InvalidateItem(k);
}
} else {
if ( ccItem->IsActive() ) {
ccItem->SetActive(false);
InvalidateItem(k);
}
}
}
}
}
if (mTarget) {
mTarget->Implementation().SendConfiguration(&update);
mTarget->Settings().Update(update);
}
}
示例8: switch
void
ClipView::KeyDown(const char* bytes, int32 numBytes)
{
switch (bytes[0]) {
case B_DELETE:
{
ClipItem* currentClip
= dynamic_cast<ClipItem *>(ItemAt(CurrentSelection()));
BMessage message(DELETE);
message.AddPointer("clip", currentClip);
Looper()->PostMessage(&message);
break;
}
case B_LEFT_ARROW:
case B_RIGHT_ARROW:
{
BMessage message(SWITCHLIST);
message.AddInt32("listview", (int32)0);
Looper()->PostMessage(&message);
break;
}
default:
{
BListView::KeyDown(bytes, numBytes);
break;
}
}
}
示例9: switch
void _OwqList::MessageReceived(BMessage* msg)
{
switch( msg->what ) {
case OWQ_INVOKE_ADD:
OpenAddWindow();
break;
case OWQ_ADD:
Add( msg );
break;
case OWQ_CHANGE:
Change();
break;
case OWQ_REMOVE:
{
BRow* selection = CurrentSelection();
if( selection ) {
RemoveRow( selection );
delete selection;
}
}
break;
default:
inherited::MessageReceived(msg);
break;
}
}
示例10: SelectionChanged
void LinkList::SelectionChanged()
{
LinkItem *item = (LinkItem*)ItemAt(CurrentSelection());
if ((item != NULL) && !(browseView->m_DontUpdateURL))
((MainWindow*)Window())->GoTo(item->link);
}
示例11:
void
ListView1::SelectionChanged(void) {
Window1 *window1=(Window1 *)Window();
((BButton *)window1->view1->iconBAR->ChildViewAt("bar_deleteitem"))->SetEnabled(CurrentSelection()!=NULL);
//be_app->PostMessage('mm05');
}
示例12: OnDoubleClick
void ConfigurationDialog::OnDoubleClick( wxMouseEvent& event )
{
if(CurrentSelection() < 0)
return;
wxCommandEvent e;
OnEditAlarm(e);
}
示例13: CurrentSelection
void _OwqList::Change()
{
_OwqRow* selection = dynamic_cast<_OwqRow*>( CurrentSelection() );
if( !selection ) return;
BMessage row( SET_PREFS_MSG );
if( selection->GetPreferences( &row ) == B_OK )
OpenAddWindow( &row );
}
示例14: RemoveItemList
/*****************************************************************************
* DragSortableListView::RemoveSelected
*****************************************************************************/
void
DragSortableListView::RemoveSelected()
{
BList items;
for ( int32 i = 0; BListItem* item = ItemAt( CurrentSelection( i ) ); i++ )
items.AddItem( (void*)item );
RemoveItemList( items );
}
示例15: while
// CountSelectedItems
int32
DragSortableListView::CountSelectedItems() const
{
int32 count = 0;
while (CurrentSelection(count) >= 0)
count++;
return count;
}