bool OnKey(IInputProvider* pprovider, const KeyState& ks, bool& fForceTranslate) { VerifyScrollPos(); if (ks.bDown) { switch (ks.vk) { case VK_DOWN: NextItem(); SelectionChanged(); return true; case VK_UP: PreviousItem(); SelectionChanged(); return true; case VK_PRIOR: // page up PageUp(); SelectionChanged(); return true; case VK_NEXT: // page down PageDown(); SelectionChanged(); return true; } } return false; }
// ================= // PRIVATE // ================= void DirWidget::setupConnections(){ //Info routines connect(treeWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) ); connect(listWidget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(OpenContextMenu()) ); connect(treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) ); connect(listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) ); //Activation routines connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(on_tool_act_run_clicked()) ); connect(treeWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); connect(listWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(on_tool_act_run_clicked()) ); connect(listWidget, SIGNAL(DataDropped(QString, QStringList)), this, SIGNAL(PasteFiles(QString, QStringList)) ); connect(line_dir, SIGNAL(returnPressed()), this, SLOT(dir_changed()) ); //Keyboard Shortcuts /*connect(copyFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_copy_clicked() ) ); connect(cutFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_cut_clicked() ) ); connect(pasteFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_paste_clicked() ) ); connect(deleteFilesShort, SIGNAL(activated()), this, SLOT( on_tool_act_rm_clicked() ) );*/ //Filesystem Watcher connect(watcher, SIGNAL(directoryChanged(const QString&)), this, SLOT(startSync(const QString &)) ); connect(watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(startSync(const QString &)) ); //just in case connect(synctimer, SIGNAL(timeout()), this, SLOT(refresh()) ); }
MouseResult Button( IInputProvider* pprovider, const Point& point, int button, bool bCaptured, bool bInside, bool bDown ) { VerifyScrollPos(); if (button == 0 && bDown) { int nSize = GetSignificantSize(*m_ppainter); int nSignificantMouseDim = (int)(m_bHorizontal ? point.X(): point.Y()); SetSelection(m_plist->GetItem((nSignificantMouseDim + GetScrollPos()) / nSize)); NeedPaint(); SelectionChanged(); if (pprovider->IsDoubleClick()) { m_peventDoubleClick->Trigger(); } else { m_peventSingleClick->Trigger(); } } else if(button == 1 && bDown) { int nSize = GetSignificantSize(*m_ppainter); int nSignificantMouseDim = (int)(m_bHorizontal ? point.X(): point.Y()); SetSelection(m_plist->GetItem((nSignificantMouseDim + GetScrollPos()) / nSize)); NeedPaint(); SelectionChanged(); if (pprovider->IsDoubleClick()) { m_peventDoubleRightClick->Trigger(); } else { m_peventSingleRightClick->Trigger(); } } else if(button == 8 && bDown) { //Imago 8/14/09 mouse wheel NextItem(); SelectionChanged(); } else if(button == 9 && bDown) { PreviousItem(); SelectionChanged(); } return MouseResult(); }
void EditFaceDataMod::ClearSelection(int selLevel) { ModContextList list; INodeTab nodes; ip->GetModContexts(list,nodes); EditFaceDataModData *d; for (int i=0; i<list.Count(); i++) { d = (EditFaceDataModData*)list[i]->localData; if (!d) continue; // Check if we have anything selected first: switch (selLevel) { case SEL_FACE: if (!d->GetFaceSel().NumberSet()) continue; else break; } if (theHold.Holding() && !d->GetHeld()) theHold.Put (new SelectRestore (this, d)); d->SynchSize (); switch (selLevel) { case SEL_FACE: d->GetFaceSel().ClearAll(); break; } } nodes.DisposeTemporary(); SelectionChanged (); }
/** ** Load a game to file. ** ** @param filename File name to be loaded. */ void LoadGame(const std::string &filename) { // log will be enabled if found in the save game CommandLogDisabled = true; SaveGameLoading = true; //Wyrmgus start // SetDefaultTextColors(FontYellow, FontWhite); SetDefaultTextColors(UI.NormalFontColor, UI.ReverseFontColor); //Wyrmgus end LoadFonts(); LuaGarbageCollect(); InitUnitTypes(1); LuaLoadFile(filename); LuaGarbageCollect(); PlaceUnits(); const unsigned long game_cycle = GameCycle; const unsigned syncrand = SyncRandSeed; const unsigned synchash = SyncHash; InitModules(); LoadModules(); GameCycle = game_cycle; SyncRandSeed = syncrand; SyncHash = synchash; SelectionChanged(); }
void PanelView::Rescan() //////////////////////////////////////////////////////////////////////// { if (m_PanelMode != PM_NORMAL) return; if (!DoesEntryExist(m_Path.String())) { GotoRoot(); return; } SaveItemSelection(); // A listaban meg levo de mar nem letezo fajlokat kitoroljuk a listabol... RescanForMissingEntries(); // Az uj jovevenyeket meg beletesszuk a listaba... RescanForNewEntries(); m_CustomListView->DoSortList(); LoadItemSelection(); m_CurrentTotalSize = m_CustomListView->GetCurrentTotalSize(); SelectionChanged(); }
void Bilet::codSelectC() { QString tmp; tmp.clear(); if(CodC->selectedItems().count() > 2) for(int i = 2; i <= CodC->selectedItems().count();i++) CodC->selectedItems().at(i)->setSelected(false); Ccod = CodC->selectedItems(); QList<int> list; list[0]=-1; for(int i = 0; i < Ccod.count(); i++) list<<Ccod.at(i)->text().toInt(); if(Ccod.count()==2){ qSort(list.begin(), list.end()); if(list[0] == 0)tmp.sprintf("%d%d",list[1],list[0]); else tmp.sprintf("%d%d",list[0],list[1]); } else tmp.sprintf("%d",list[0]); codC = tmp.toInt(); //dor pt verificare....... //tmp1 = QString::number(codC); //tmp1 = QString::number(setStop(codC).n); //......... emit SelectionChanged(); tmp.clear(); }
void SetSelection(ItemID pitem) { if (pitem != m_pitemSelection) { if (pitem) { m_indexSelection = m_plist->GetIndex(pitem); if (m_indexSelection == -1) { assert(false); pitem = NULL; } } else m_indexSelection = -1; m_pitemSelection = pitem; if (m_bNeedScrollUpdate) m_iOldSelection = -1; else m_iOldSelection = m_indexSelection; SelectionChanged(); NeedPaint(); } }
int LineEdit::PlaceCaretNoG(int newcursor, bool sel) { if(newcursor > total) newcursor = total; Point p = GetColumnLine(newcursor); if(sel) { if(anchor < 0) { anchor = cursor; } if(rectsel || rectsel != dorectsel) Refresh(); else RefreshLines(p.y, GetLine(cursor)); rectsel = dorectsel; } else { if(anchor >= 0) { if(rectsel || dorectsel) Refresh(); else RefreshLines(GetLine(cursor), GetLine(anchor)); anchor = -1; } rectsel = false; } RefreshLine(GetColumnLine(cursor).y); RefreshLine(p.y); cursor = newcursor; ScrollIntoCursor(); PlaceCaret0(p); SelectionChanged(); WhenSel(); if(IsAnySelection()) SetSelectionSource(ClipFmtsText()); return p.x; }
/** ** Add group to current selection. ** ** @param group Group number to add. */ static void UiAddGroupToSelection(unsigned group) { CUnit **units; int n; if (!(n = GetNumberUnitsOfGroup(group, SELECT_ALL))) { return; } // // Don't allow to mix units and buildings // if (NumSelected && Selected[0]->Type->Building) { return; } units = GetUnitsOfGroup(group); while (n--) { if (!(units[n]->Removed || units[n]->Type->Building)) { SelectUnit(*units[n]); } } SelectionChanged(); }
bool BListView::_MoveItem(int32 from, int32 to) { // remember item frames before doing anything BRect frameFrom = ItemFrame(from); BRect frameTo = ItemFrame(to); if (!fList.MoveItem(from, to)) return false; // track anchor item if (fAnchorIndex == from) fAnchorIndex = to; // track selection if (ItemAt(to)->IsSelected()) { _RescanSelection(from, to); // though the actually selected items stayed the // same, the selection has still changed SelectionChanged(); } _RecalcItemTops((to > from) ? from : to); // take care of invalidation if (Window()) { // NOTE: window looper is assumed to be locked! Invalidate(frameFrom | frameTo); } return true; }
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent), m_sdr(new SelectDateRange(this)), lbl_dateStart(new QLabel()), lbl_dateEnd(new QLabel()), lbl_updateCount(new QLabel()), m_updateCount(0) { QWidget *c = new QWidget(this); this->setCentralWidget(c); QVBoxLayout *l = new QVBoxLayout(c); l->addWidget(m_sdr); l->addWidget(lbl_dateStart); l->addWidget(lbl_dateEnd); l->addWidget(lbl_updateCount); resize(500, 200); connect(m_sdr, SIGNAL(SelectionChanged(QDate,QDate)), this, SLOT(DateRangeUpdated(QDate,QDate))); QDate d = QDate::currentDate(); m_sdr->SetDateRange(Range<QDate>::CreateDoubleBound(d, d, true, true)); // m_sdr->SetDateRange(Range<QDate>::CreateDoubleBound(d.addDays(1 - d.dayOfWeek()), // d.addDays(7 - d.dayOfWeek()), // true, true)); // m_sdr->SetDateRange(Range<QDate>::CreateDoubleBound(d.addDays(1 - d.day()), // d.addDays(1 - d.day()).addMonths(1), // true, false)); // m_sdr->SetDateRange(Range<QDate>::CreateDoubleBound(d.addDays(1 - d.dayOfYear()), // d.addDays(1 - d.dayOfYear()).addYears(1), // true, false)); DateRangeUpdated(); }
/** ** Find the next idle worker, select it, and center on it */ void UiFindIdleWorker() { if (ThisPlayer->FreeWorkers.empty()) { return; } CUnit *unit = ThisPlayer->FreeWorkers[0]; if (LastIdleWorker) { const std::vector<CUnit *> &freeWorkers = ThisPlayer->FreeWorkers; std::vector<CUnit *>::const_iterator it = std::find(freeWorkers.begin(), freeWorkers.end(), LastIdleWorker); if (it != ThisPlayer->FreeWorkers.end()) { if (*it != ThisPlayer->FreeWorkers.back()) { unit = *(++it); } } } if (unit != NULL) { LastIdleWorker = unit; SelectSingleUnit(*unit); UI.StatusLine.Clear(); UI.StatusLine.ClearCosts(); CurrentButtonLevel = 0; PlayUnitSound(*Selected[0], VoiceSelected); SelectionChanged(); UI.SelectedViewport->Center(unit->GetMapPixelPosCenter()); } }
void CTimeline::_emitSelectionChanged() { int frame = -1; if (m_selection.y() >= 0 && m_selection.x() >= 0) frame = m_rows[m_selection.y()].keys[m_selection.x()]; emit SelectionChanged(m_selection.y(), frame); }
void BListView::Select(int32 start, int32 finish, bool extend) { if (_Select(start, finish, extend)) { SelectionChanged(); InvokeNotify(fSelectMessage, B_CONTROL_MODIFIED); } }
void BListView::Select(int32 index, bool extend) { if (_Select(index, extend)) { SelectionChanged(); InvokeNotify(fSelectMessage, B_CONTROL_MODIFIED); } }
void BListView::DeselectAll() { if (_DeselectAll(-1, -1)) { SelectionChanged(); InvokeNotify(fSelectMessage, B_CONTROL_MODIFIED); } }
void BListView::Deselect(int32 index) { if (_Deselect(index)) { SelectionChanged(); InvokeNotify(fSelectMessage, B_CONTROL_MODIFIED); } }
QmitkBoundingObjectWidget::QmitkBoundingObjectWidget (QWidget* parent, Qt::WindowFlags f ):QWidget( parent, f ), m_DataStorage(NULL), m_lastSelectedItem(NULL), m_lastAffineObserver(0), m_ItemNodeMap(), m_BoundingObjectCounter(1) { QBoxLayout* mainLayout = new QVBoxLayout(this); QHBoxLayout* buttonLayout = new QHBoxLayout(); QStringList boList; boList << tr("add") << tr("cube") << tr("cone") << tr("ellipse") << tr("cylinder"); m_addComboBox = new QComboBox(); m_addComboBox->addItems(boList); m_addComboBox->setItemIcon(1, QIcon(":/QmitkWidgetsExt/btnCube.xpm")); m_addComboBox->setItemIcon(2, QIcon(":/QmitkWidgetsExt/btnPyramid.xpm")); m_addComboBox->setItemIcon(3, QIcon(":/QmitkWidgetsExt/btnEllipsoid.xpm")); m_addComboBox->setItemIcon(4, QIcon(":/QmitkWidgetsExt/btnCylinder.xpm")); buttonLayout->addWidget(m_addComboBox); m_DelButton = new QPushButton("del"); buttonLayout->addWidget(m_DelButton); m_SaveButton = new QPushButton("save"); buttonLayout->addWidget(m_SaveButton); m_SaveButton->setEnabled(false); m_LoadButton = new QPushButton("load"); buttonLayout->addWidget(m_LoadButton); m_LoadButton->setEnabled(false); m_TreeWidget = new QTreeWidget(this); m_TreeWidget->setColumnCount(3); QStringList sList; sList << tr("name") << tr("inverted") << tr("visible"); m_TreeWidget->setHeaderLabels(sList); m_TreeWidget->setColumnWidth(0, 250); m_TreeWidget->setColumnWidth(1, 50); m_TreeWidget->setColumnWidth(2, 50); m_TreeWidget->setAutoScroll(true); m_TreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); mainLayout->addWidget(m_TreeWidget); mainLayout->addLayout(buttonLayout); connect( m_addComboBox , SIGNAL(currentIndexChanged(int)), this, SLOT(CreateBoundingObject(int)) ); connect( m_TreeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged()) ); connect( m_DelButton, SIGNAL(clicked()), this, SLOT(OnDelButtonClicked()) ); connect(m_TreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(OnItemDoubleClicked(QTreeWidgetItem*, int)) ); connect(m_TreeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(OnItemDataChanged(QTreeWidgetItem*, int)) ); }
bool BListView::_SwapItems(int32 a, int32 b) { // remember frames of items before anyhing happens, // the tricky situation is when the two items have // a different height BRect aFrame = ItemFrame(a); BRect bFrame = ItemFrame(b); if (!fList.SwapItems(a, b)) return false; if (a == b) { // nothing to do, but success nevertheless return true; } // track anchor item if (fAnchorIndex == a) fAnchorIndex = b; else if (fAnchorIndex == b) fAnchorIndex = a; // track selection // NOTE: this is only important if the selection status // of both items is not the same int32 first = min_c(a, b); int32 last = max_c(a, b); if (ItemAt(a)->IsSelected() != ItemAt(b)->IsSelected()) { if (first < fFirstSelected || last > fLastSelected) { _RescanSelection(min_c(first, fFirstSelected), max_c(last, fLastSelected)); } // though the actually selected items stayed the // same, the selection has still changed SelectionChanged(); } ItemAt(a)->SetTop(aFrame.top); ItemAt(b)->SetTop(bFrame.top); // take care of invalidation if (Window()) { // NOTE: window looper is assumed to be locked! if (aFrame.Height() != bFrame.Height()) { _RecalcItemTops(first, last); // items in between shifted visually Invalidate(aFrame | bFrame); } else { Invalidate(aFrame); Invalidate(bFrame); } } return true; }
void Bilet::nrSelectC() { //short int nrstopC = setStop(codC).n; varbilet.clear(); if(CampC->selectedItems().count() > setStop(codC).n) for(int i = setStop(codC).n; i <= CampC->selectedItems().count();i++) CampC->selectedItems().at(i)->setSelected(false); nrC = CampC->selectedItems(); emit SelectionChanged(); }
void ManipulatableGraphicsView::OnSceneSelectionChanged(IManipulatable *pNewSelectedManipulatable, IManipulatableObject *pNewSelectedObject) { if (pSelectedObject != pNewSelectedObject) { pSelectedManipulatable = pNewSelectedManipulatable; pSelectedObject = pNewSelectedObject; emit SelectionChanged(pSelectedManipulatable, pSelectedObject); } }
void EditPatchMod::PatchSelChanged() { SelectionChanged(); if (hSurfPanel && selLevel == EP_PATCH) InvalidateSurfaceUI(); if (hTilePanel && selLevel == EP_TILE) InvalidateTileUI(); if (hEdgePanel && selLevel == EP_EDGE) InvalidateEdgeUI(); }
bool nuiMatrixView::DeselectAll() { uint row, col; uint firstRow = 0; uint firstCol = 0; if (mColumnHeader) firstRow=1; if (mRowHeader) firstCol = 1; mAllSelected = false; bool eventDisabled = false; if (!SelectionChanged.IsEnabled()) eventDisabled = true; if (!eventDisabled) SelectionChanged.Disable(); // entire rows and cols have a special selection process for (row=firstRow; row < GetNbRows (); row++) mRowSelected[row] = false; for (col=firstCol; col < GetNbColumns (); col++) mColumnSelected[col] = false; // list the selected items and deselect'em // std::map<nuiMatrixViewItem*, bool>::iterator itr; // for (itr = mSelectedItems.begin(); itr != mSelectedItems.end(); ++itr) // { // nuiMatrixViewItem* item = itr->first; // SelectCell(item->GetCol(), item->GetRow(), false); // } std::map<nuiMatrixViewItem*, bool>::iterator it = mSelectedItems.begin(); std::map<nuiMatrixViewItem*, bool>::iterator itEnd = mSelectedItems.end(); while (it != itEnd) { nuiMatrixViewItem* item = it->first; item->SetSelected(false); ++it; } // no selected items left mSelectedItems.clear (); if (!eventDisabled) SelectionChanged.Enable(); SelectionChanged(); return true; }
/** Mouse click scenarios. */ void AlbumView::MouseDown(BPoint where) { // This is an event hook so there must be a Looper. BMessage *message = Window()->CurrentMessage(); int32 mods = 0, clicks = 0, buttons=0; message->FindInt32("modifiers", &mods); message->FindInt32("clicks", &clicks); message->FindInt32("buttons", &buttons); // Scale back. where.x /= fZoom; where.y /= fZoom; int32 i = IndexOf(&where); int32 changes = 0; if (i >= 0) { AlbumItem *item = ItemAt(i); // double-clicks are handled later in MouseUp() fDoubleClick = (fLastSelected == i && clicks == 2 && (buttons & B_PRIMARY_MOUSE_BUTTON)); fMayDrag = !fDoubleClick && (buttons & B_PRIMARY_MOUSE_BUTTON); if (mods & B_SHIFT_KEY) // Block selection changes += SelectBlock(fLastSelected, i, !item->IsSelected()); else if (mods & B_COMMAND_KEY) // Modify selection changes += Select(i, 1, !item->IsSelected()); else { // Normal selection if (!item->IsSelected()) changes += DeselectAll(); changes += Select(i); } fLastWhere = where; fLastSelected = i; } else changes += DeselectAll(); if (changes > 0) { //PRINT(("selection changed\n")); SelectionChanged(); if (!fDoubleClick && Message()) { BMessage msg = *Message(); msg.AddInt32("buttons", buttons); msg.AddPoint("where", where); msg.AddInt32("index", fLastSelected); Invoke(&msg); } } }
static int CclSelectSingleUnit(lua_State *l) { const int nargs = lua_gettop(l); Assert(nargs == 1); lua_pushvalue(l, 1); CUnit *unit = CclGetUnit(l); lua_pop(l, 1); SelectSingleUnit(*unit); SelectionChanged(); return 0; }
void BListView::DeselectExcept(int32 exceptFrom, int32 exceptTo) { if (exceptFrom > exceptTo || exceptFrom < 0 || exceptTo < 0) return; if (_DeselectAll(exceptFrom, exceptTo)) { SelectionChanged(); InvokeNotify(fSelectMessage, B_CONTROL_MODIFIED); } }
void PreviousItem() { if (m_indexSelection != 0) { m_indexSelection--; m_pitemSelection = m_plist->GetItem(m_indexSelection); NeedPaint(); SelectionChanged(); m_bNeedScrollUpdate = true; m_bNeedSelectionOnScreen = true; } }
void NextItem() { if (m_indexSelection < m_plist->GetCount() - 1) { m_indexSelection++; m_pitemSelection = m_plist->GetNext(m_pitemSelection); NeedPaint(); SelectionChanged(); m_bNeedScrollUpdate = true; m_bNeedSelectionOnScreen = true; } }
void Bilet::clearSelection() { CampA->clearSelection(); CodA->clearSelection(); CampB->clearSelection(); CodB->clearSelection(); CampC->clearSelection(); CodC->clearSelection(); emit SelectionChanged(); }