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); }
//------------------------------------------------------------------------ //! Hook to proces windows messages before they are dispatched. //! Catch keyboard events that can should cause the cell value editor to close //! //! @param pMsg Points to a MSG structure that contains the message to process //! @return Nonzero if the message was translated and should not be dispatched; 0 if the message was not translated and should be dispatched. //------------------------------------------------------------------------ BOOL CGridEditorText::PreTranslateMessage(MSG* pMsg) { switch (pMsg->message) { case WM_KEYDOWN: { switch (pMsg->wParam) { case VK_RETURN: { if (GetStyle() & ES_WANTRETURN) break; EndEdit(true); return TRUE; } case VK_TAB: EndEdit(true); return FALSE; case VK_ESCAPE: EndEdit(false);return TRUE; } break; }; case WM_MOUSEWHEEL: EndEdit(true); return FALSE; // Don't steal event } return CEdit::PreTranslateMessage(pMsg); }
// the heading text is in the format of "text,width,format;text,width,format;..." BOOL CReportCtrl::SetColumnHeader(const CString& strHeadings) { DeleteAllItems(); DeleteAllColumns(); EndEdit(TRUE); BOOL bInserted = FALSE; CStringArray aLong, aShort; _StringSplit(strHeadings, aLong, _T(';')); for (int i = 0; i < aLong.GetSize(); i++) { _StringSplit(aLong[i], aShort, _T(',')); if (aShort.GetSize() > 0) { const int WIDTH = aShort.GetSize() > 1 ? _ttoi(aShort[1]) : 100; int nFormat = aShort.GetSize() > 2 ? _ttoi(aShort[2]) : 0; if (nFormat == 1) nFormat = LVCFMT_CENTER; else if (nFormat == 2) nFormat = LVCFMT_RIGHT; else nFormat = LVCFMT_LEFT; bInserted |= (InsertColumn(GetColumnCount(), aShort[0], nFormat, WIDTH) >= 0); } } return bInserted; }
int CReportCtrl::DeleteAllItems(DWORD dwStates) { EndEdit(FALSE); int nItemCount = CListCtrl::GetItemCount(); if (dwStates & RC_ITEM_ALL) { LockWindowUpdate(); for (int i = 0; i < nItemCount; i++) _FreeItemMemory(i); CListCtrl::DeleteAllItems(); UnlockWindowUpdate(); return nItemCount; } int nDelCount = 0; LockWindowUpdate(); for (int i = 0; i < nItemCount; i++) { if (ExamItemStates(i, dwStates)) { DeleteItem(i--); nItemCount--; nDelCount++; } } UnlockWindowUpdate(); return nDelCount; }
void CReportCtrl::SortItems(int nColumn, BOOL bAscending) { EndEdit(TRUE); if (nColumn < 0 || nColumn >= GetColumnCount() || !IsSortable()) return; // do the sorting m_nSortCol = nColumn; m_bSortAscending = bAscending; BOOL bEnd = FALSE; int nSep1 = -1; int nSep2 = _FindSeparator(-1, nColumn); do { if (nSep2 < 0) { nSep2 = GetItemCount(); bEnd = TRUE; } _PartialSort(nSep1 + 1, nSep2 - 1); nSep1 = _FindSeparator(nSep2 - 1, nColumn); nSep2 = _FindSeparator(nSep1, nColumn); } while (!bEnd && nSep1 >= 0); GetParent()->SendMessage(WM_ITEM_SORTED, (WPARAM)m_nSortCol, (LPARAM)m_bSortAscending); }
int CReportCtrl::InsertItemEx(int nItem, LPCTSTR lpText, ...) { EndEdit(TRUE); _UnsetSortedColumn(); const int IDX = CListCtrl::InsertItem(nItem, lpText); if (IDX < 0) return -1; va_list list; va_start(list, lpText); for(int iColumn = 1; iColumn < GetColumnCount(); iColumn++) { LPCTSTR lp = va_arg(list, LPCTSTR); if (lp != NULL) { CListCtrl::SetItemText(IDX, iColumn, lp); } else { break; } } va_end(list); if (IDX >= 0) _AllocItemMemory(IDX); return IDX; }
void ApplicationListDlg::OnApply() { int i = 0; TCHAR filename[MAX_PATH]; DWORD length = MAX_PATH; //Validate current parameter, if any if (IsEditing()) EndEdit(); //Remove entries which have been removed (ie are not in the list box) while(length=MAX_PATH, m_appgroup->EnumEntry(i, filename, &length)) { if (FindProgram(filename) != -1) i++; else m_appgroup->RemoveEntry(filename); } //Add/set value for all entries in the list box for(i=0; i<ListView_GetItemCount(m_hAppListWnd); i++) { ListView_GetItemText(m_hAppListWnd, i, 0, filename, length); m_appgroup->SaveDWord(filename, GetProgramParam(i)); } }
void PropEditCtrlXRCID::Clear() { EndEdit(); REAL_NODE->DeleteProperty(_T("name")); m_TreeCtrl->SetItemBold(m_TreeItem, FALSE); EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED); }
BOOL CHtmlProperties::Show( CReg *pReg) { EndEdit(); // Destroy properties list GetPropList().Destroy(); // Lose list items GetListCtrl().Destroy(); // Rebuild header GetListCtrl().GetHeader().Destroy(); GetListCtrl().GetHeader().AddHeaderItem( 120, "Name" ); GetListCtrl().GetHeader().AddHeaderItem( 120, "Value" ); if ( pReg == NULL ) { LoadList(); RedrawWindow(); return FALSE; } // end if // Add variables AddKey( pReg, pReg->GetKey( "vars" ) ); AddKey( pReg, pReg->GetKey( "lvars" ) ); AddKey( pReg, pReg->GetKey( "dvars" ) ); // AddDynamic( pReg ); // Loadup the list LoadList(); RedrawWindow(); return TRUE; }
void NodePalette::disconnectSignals() { // signals and slots disconnetions disconnect(editEditButton, SIGNAL(clicked()), this, SLOT(EndEdit())); disconnect(DeleteNode, SIGNAL(clicked()), this, SLOT(DelN())); disconnect(AddNode, SIGNAL(clicked()), this, SLOT(AddN())); disconnect(MoveNode, SIGNAL(clicked()), this, SLOT(MoveN())); disconnect(AsymMove, SIGNAL(clicked()), this, SLOT(SetAsym())); disconnect(SymMove, SIGNAL(clicked()), this, SLOT(SetSym())); disconnect(ResNode, SIGNAL(clicked()), this, SLOT(ResetControl())); disconnect(Res1Node, SIGNAL(clicked()), this, SLOT(Reset1Control())); disconnect(BezierClose, SIGNAL(clicked()), this, SLOT(CloseBezier())); disconnect(PolySplit, SIGNAL(clicked()), this, SLOT(SplitPoly())); disconnect(MoveControl, SIGNAL(clicked()), this, SLOT(MoveK())); disconnect(XSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint())); disconnect(YSpin, SIGNAL(valueChanged(double)), this, SLOT(MovePoint())); disconnect(PolyMirrorH, SIGNAL(clicked()), this, SLOT(MirrorH())); disconnect(PolyMirrorV, SIGNAL(clicked()), this, SLOT(MirrorV())); disconnect(PolyShearR, SIGNAL(clicked()), this, SLOT(ShearR())); disconnect(PolyShearL, SIGNAL(clicked()), this, SLOT(ShearL())); disconnect(PolyShearU, SIGNAL(clicked()), this, SLOT(ShearU())); disconnect(PolyShearD, SIGNAL(clicked()), this, SLOT(ShearD())); disconnect(RotateCCW, SIGNAL(clicked()), this, SLOT(doRotCCW())); disconnect(RotateCW, SIGNAL(clicked()), this, SLOT(doRotCW())); disconnect(Shrink, SIGNAL(clicked()), this, SLOT(doShrink())); disconnect(Expand, SIGNAL(clicked()), this, SLOT(doExpand())); disconnect(Reduce, SIGNAL(clicked()), this, SLOT(doReduce())); disconnect(Enlarge, SIGNAL(clicked()), this, SLOT(doEnlarge())); disconnect(ResetCont, SIGNAL(clicked()), this, SLOT(ResetContour())); disconnect(ResetContClip, SIGNAL(clicked()), this, SLOT(ResetContourToImageClip())); disconnect(ResetShape2Clip, SIGNAL(clicked()), this, SLOT(ResetShapeToImageClip())); }
RenderEngine::~RenderEngine() { if (editMode) EndEdit(EditActionList()); if (started) Stop(); delete ctx; }
HybridRenderThread::~HybridRenderThread() { if (editMode) EndEdit(EditActionList()); if (started) Stop(); delete threadFilm; }
void ApplicationListDlg::OnProgramClick(LPNMITEMACTIVATE lpnmitem) { if (IsEditing()) EndEdit(); if (lpnmitem->iItem != -1 && lpnmitem->iSubItem == 1) BeginEdit(lpnmitem->iItem); }
void CReportCtrl::InsertItem(int nIndex,LPCTSTR lpText,COLORREF color) { EndEdit(TRUE); _UnsetSortedColumn(); const int IDX = CListCtrl::InsertItem(nIndex, lpText); _AllocItemMemory(IDX); SetItemTextColor(nIndex,-1,color,FALSE); }
BOOL CReportCtrl::DeleteColumn(int nCol) { EndEdit(TRUE); const BOOL RES = CListCtrl::DeleteColumn(nCol); if (RES) _UpdateColumn(nCol, FALSE); return RES; }
int CReportCtrl::InsertColumn(int nCol, const LVCOLUMN *pColumn) { EndEdit(TRUE); const int IDX = CListCtrl::InsertColumn(nCol, pColumn); if (IDX >= 0) _UpdateColumn(IDX, TRUE); return IDX; }
int CReportCtrl::InsertColumn(int nCol, LPCTSTR lpColumnHeading, int nFormat, int nWidth, int nSubItem) { EndEdit(TRUE); const int IDX = CListCtrl::InsertColumn(nCol, lpColumnHeading, nFormat, nWidth, nSubItem); if (IDX >= 0) _UpdateColumn(IDX, TRUE); return IDX; }
BOOL CReportCtrl::StartEdit(int nItem, int nSubItem) { // Get the grid width and height if (!m_bAllowEdit || !_IsValidIndex(nItem) || nSubItem < 0 || nSubItem >= GetColumnCount()) return FALSE; if (m_ptEditting.x == nItem && m_ptEditting.y == nSubItem) return TRUE; EndEdit(TRUE); m_ptEditting.x = nItem; m_ptEditting.y = nSubItem; SetAllItemStates(RC_ITEM_SELECTED, RC_ITEM_UNSELECTED); // unselect all SetItemStates(m_ptEditting.x, RC_ITEM_SELECTED | RC_ITEM_FOCUSED); // determine editbox font and alignment const DWORD FMT = _GetHeaderTextFormat(nSubItem); if (FMT != m_dwPrevEditFmt) { m_dwPrevEditFmt = FMT; // Funny thing: // Changing CEdit style among ES_LEFT, ES_CENTER, ES_RIGHT at runtime works // sometimes and fails other times. It just cannot guarantee to be succeed. // So I decided to destroy and recreate the CEdit every time when the text // format changes. if (m_pWndEdit->GetSafeHwnd() != NULL) m_pWndEdit->DestroyWindow(); if (!m_pWndEdit->Create(ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0)) return FALSE; } else { if (m_pWndEdit->GetSafeHwnd() == NULL && !m_pWndEdit->Create(ES_AUTOHSCROLL | ES_NOHIDESEL | WS_CHILD | WS_BORDER | FMT, CRect(0, 0, 1, 1), this, 0)) { return FALSE; } } m_pWndEdit->SetFont(GetFont()); CRect rcEdit; ListView_GetSubItemRect(GetSafeHwnd(), m_ptEditting.x, m_ptEditting.y, LVIR_LABEL, &rcEdit); if (m_ptEditting.y > 0 && GetImageList() != NULL && GetItemImage(m_ptEditting.x, m_ptEditting.y) >= 0) rcEdit.DeflateRect(16, 0, 0, 0); // Move the editbox to that grid, obtain text from the grid, display the // editbox, and, finally, highlights all text in the editbox and set the // windows focus to the editbox. m_pWndEdit->MoveWindow(&rcEdit); m_pWndEdit->SetWindowText(GetItemText(m_ptEditting.x, m_ptEditting.y)); m_pWndEdit->ShowWindow(SW_SHOW); m_pWndEdit->SetSel(0, -1); m_pWndEdit->SetFocus(); return TRUE; }
void CInPlaceDateTime::OnKillFocus(CWnd* pNewWnd) { CDateTimeCtrl::OnKillFocus(pNewWnd); if (GetSafeHwnd() == pNewWnd->GetSafeHwnd()) { return; } EndEdit(); }
CPURenderEngine::~CPURenderEngine() { if (editMode) EndEdit(EditActionList()); if (started) Stop(); for (size_t i = 0; i < renderThreads.size(); ++i) delete renderThreads[i]; }
int CReportCtrl::InsertItem(UINT nMask, int nItem, LPCTSTR lpItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam) { EndEdit(TRUE); _UnsetSortedColumn(); const int IDX = CListCtrl::InsertItem(nMask, nItem, lpItem, nState, nStateMask, nImage, lParam); if (IDX >= 0) _AllocItemMemory(IDX); return IDX; }
int CReportCtrl::InsertItem(int nItem, LPCTSTR lpItem, int nImage) { EndEdit(TRUE); _UnsetSortedColumn(); const int IDX = CListCtrl::InsertItem(nItem, lpItem, nImage); if (IDX >= 0) _AllocItemMemory(IDX); return IDX; }
int CReportCtrl::InsertItem(const LVITEM *pItem) { EndEdit(TRUE); _UnsetSortedColumn(); const int IDX = CListCtrl::InsertItem(pItem); if (IDX >= 0) _AllocItemMemory(IDX); return IDX; }
//------------------------------------------------------------------------ //! Hook to proces windows messages before they are dispatched. //! Catch keyboard events that can should cause the cell value editor to close //! //! @param pMsg Points to a MSG structure that contains the message to process //! @return Nonzero if the message was translated and should not be dispatched; 0 if the message was not translated and should be dispatched. //------------------------------------------------------------------------ BOOL CGridEditorDateTimeCtrl::PreTranslateMessage(MSG* pMsg) { switch(pMsg->message) { case WM_KEYDOWN: { switch(pMsg->wParam) { case VK_RETURN: EndEdit(true); return TRUE; case VK_TAB: EndEdit(true); return FALSE; case VK_ESCAPE: EndEdit(false);return TRUE; } break; }; case WM_MOUSEWHEEL: EndEdit(true); return FALSE; // Don't steal event } return CDateTimeCtrl::PreTranslateMessage(pMsg); }
void CReportCtrl::SetEditable(BOOL bSet) { if(!bSet) { EndEdit(TRUE); } m_bAllowEdit = bSet; }
RenderSession::~RenderSession() { if (editMode) EndEdit(); if (started) Stop(); delete film; delete renderConfig; }
bool TimeEditor::EndEdit(int row, int col, wxGrid *grid) { wxString newvalue; bool changed = EndEdit(row, col, grid, mOldString, &newvalue); if (changed) { ApplyEdit(row, col, grid); } return changed; }
//------------------------------------------------------------------------ //! WM_KILLFOCUS message handler called when CDateTimeCtrl is loosing focus //! to other control. Used register that cell value editor should close. //! //! @param pNewWnd Pointer to the window that receives the input focus (may be NULL or may be temporary). //------------------------------------------------------------------------ void CGridEditorDateTimeCtrl::OnKillFocus(CWnd *pNewWnd) { CDateTimeCtrl::OnKillFocus(pNewWnd); if (GetMonthCalCtrl()==NULL) { // Special case when a dynamic CEdit is created (DTS_APPCANPARSE) if (pNewWnd == NULL || pNewWnd->GetParent()!=this) EndEdit(true); } }
BOOL CReportCtrl::DeleteItem(int nItem, BOOL bSelectNextItem) { EndEdit(m_ptEditting.x != nItem); if (bSelectNextItem) SetItemStates(nItem + 1, RC_ITEM_SELECTED); _FreeItemMemory(nItem); return CListCtrl::DeleteItem(nItem); }
//------------------------------------------------------------------------ //! WM_DESTROY message handler called when CComboBox window is about to //! be destroyed. Used to unsubclass the internal CEdit control. //------------------------------------------------------------------------ void CGridEditorComboBox::OnDestroy() { if (!m_Completed) EndEdit(false); if (m_Edit.GetSafeHwnd() != NULL) m_Edit.UnsubclassWindow(); CComboBox::OnDestroy(); }