bool ExGridCtrl::Key(dword key, int count) { if (!_UseKeys && !IsEdit()) return GridCtrl::Key(key, count); bool result; if (key == K_UP) { if (0 < curpos.y || curpos.y <= GetRowCount() + 1) { EndEdit(); SetCursor(curpos.y - 1); result = GridCtrl::Key(key, count); StartEdit(); return result; } } if (key == K_DOWN) { if (0 <= curpos.y || curpos.y < GetRowCount()) { EndEdit(); SetCursor(curpos.y - 1); result = GridCtrl::Key(key, count); StartEdit(); return result; } } return GridCtrl::Key(key, count); }
void CBasicView::OnEditUndo() { CEdit* pEdit = (CEdit*)GetFocus(); if (IsEdit(pEdit)) { pEdit->Undo(); } }
void CBasicView::OnEditCopy() { CEdit* pEdit = (CEdit*)GetFocus(); if (IsEdit( pEdit)) { pEdit->Copy(); } }
void CBasicView::OnEditPaste() { CWnd* pWnd = GetFocus(); if (IsEdit(pWnd) && ::IsClipboardFormatAvailable(CF_TEXT)) { static_cast<CEdit*>(pWnd)->Paste(); } else { pWnd->SendMessage(WM_COMMAND, ID_EDIT_PASTE); } }
bool FileList::Key(dword key, int count) { if(key == K_ESCAPE && IsEdit()) { EndEdit(); return true; } if(key == K_ENTER && IsEdit()) { OkEdit(); return true; } if(accelkey) { int c = ToUpper((int)key); if(key < 256 && IsAlNum(c)) { if(!FindChar(GetCursor() + 1, c)) FindChar(0, c); return true; } } return ColumnList::Key(key, count); }
void FileList::LeftDown(Point p, dword flags) { int c = GetCursor(); if(IsEdit()) { OkEdit(); c = -1; } ColumnList::LeftDown(p, flags); KillEdit(); if(c == GetCursor() && c >= 0 && !HasCapture() && renaming && !(flags & (K_SHIFT|K_CTRL))) SetTimeCallback(750, THISBACK(StartEdit), TIMEID_STARTEDIT); }
void AttrEditor::AddCustomAttr() { SimConfigDlg dlg; QString mCmdLine; if(dlg.exec() == QDialog::Accepted){ mCmdLine = dlg.CmdLine(); if(!mCmdLine.isEmpty()){ ui.table->insertRow(row); ui.table->setItem(row,0,new QTableWidgetItem(mCmdLine)); auto item = new QTableWidgetItem(); ui.table->setItem(row,1,item); IsEdit(); row ++; } } }
void AttrEditor::UpdateUI(const QString& item){ FORBID_SIGNAL(); #define MACTCH_ITEM(str) (item.isEmpty() || item==str) if(MACTCH_ITEM("pos")){ QPointF pos = mpItem->pos(); ui.xPos->setValue(pos.x()); ui.yPos->setValue(-pos.y()); } if(MACTCH_ITEM("scale")){ ui.scale->setValue(mpItem->scale()); } if(MACTCH_ITEM("image")){ ui.image->setText(mpItem->Name()); } if(MACTCH_ITEM("flipX")){ ui.flipX->setCheckState(mpItem->FlipX()?Qt::Checked:Qt::Unchecked); } if(MACTCH_ITEM("flipY")){ ui.flipY->setCheckState(mpItem->FlipY()?Qt::Checked:Qt::Unchecked); } if(MACTCH_ITEM("customAttr")){ int r = 0; for(auto it=mpItem->customAttr.begin();it!=mpItem->customAttr.end();it++){ QString key = it.key(); QString value = it.value(); if(!key.isEmpty()){ ui.table->insertRow(r); ui.table->setItem(r,0,new QTableWidgetItem(key)); ui.table->setItem(r,1,new QTableWidgetItem(value)); r++; } } IsEdit(); } }