void HierTreeCtrl::OnRename() { wxArrayTreeItemIds selItems; GetSelections(selItems); wxTreeItemId selItem = selItems.Item(0); EditLabel(selItem); }
BOOL CTreeFileCtrl::Rename(HTREEITEM hItem) { if (!IsDrive(hItem) && m_bAllowRename) return (EditLabel(hItem) != NULL); else return FALSE; }
void WFileList::OnMenuFileRename(wxCommandEvent& WXUNUSED(event)) { long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == -1) return; EditLabel(item); }
void CLocalTreeView::OnMenuRename(wxCommandEvent& event) { if (!m_contextMenuItem.IsOk()) return; #ifdef __WXMSW__ if (m_contextMenuItem == m_desktop || m_contextMenuItem == m_documents) { wxBell(); return; } #endif wxString path = GetDirFromItem(m_contextMenuItem); #ifdef __WXMSW__ if (path.Len() == 3 && path.Mid(1) == _T(":\\")) { wxBell(); return; } #endif if (!m_pState->LocalDirHasParent(path) || !m_pState->LocalDirIsWriteable(path)) { wxBell(); return; } EditLabel(m_contextMenuItem); }
void CSourcesListBox::RenameSel() { int nIndex = -1; nIndex = GetNextItem( nIndex, wxLIST_NEXT_ALL , wxLIST_STATE_SELECTED ); if ( nIndex > -1 ) EditLabel( nIndex ); }
void wxSFEditTextShape::OnLeftDoubleClick(const wxPoint& pos) { // HINT: override it if neccessary... wxUnusedVar( pos ); EditLabel(); }
void CSensWeightListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult) { POSITION pos = GetFirstSelectedItemPosition(); int index = GetNextSelectedItem(pos); if (index>-1) { m_pTmpEdtitBox = EditLabel(index); m_pTmpEdtitBox->SetLimitText(7); } *pResult = 0; }
void CWatchList::OnLButtonDblClk(UINT nFlags, CPoint point) { SetFocus(); LVHITTESTINFO lvhti; lvhti.pt = point; SubItemHitTest(&lvhti); if (lvhti.flags & LVHT_ONITEMLABEL) EditLabel(lvhti.iItem); else CCJListCtrl::OnLButtonDblClk(nFlags, point); }
bool CEditTreeCtrl::NewItem(TVINSERTSTRUCT & ins) { TRACE1(_T("CEditTreeCtrl::NewItem('%s')\n"), ins.item.pszText ? ins.item.pszText : _T("NULL")); if(!CanInsertItem(ins.hParent)) return false; HTREEITEM hItem = InsertItem(&ins); if(hItem) { SelectItem(hItem); OnNewItem(hItem); EditLabel(hItem); } return hItem != 0; }
void wxFileCtrl::MakeDir() { wxString new_name( _("NewName") ); wxString path( m_dirName ); path += wxFILE_SEP_PATH; path += new_name; if (wxFileExists(path)) { // try NewName0, NewName1 etc. int i = 0; do { new_name = _("NewName"); wxString num; num.Printf( wxT("%d"), i ); new_name += num; path = m_dirName; path += wxFILE_SEP_PATH; path += new_name; i++; } while (wxFileExists(path)); } wxLogNull log; if (!wxMkdir(path)) { wxMessageDialog dialog(this, _("Operation not permitted."), _("Error"), wxOK | wxICON_ERROR ); dialog.ShowModal(); return; } wxFileData *fd = new wxFileData( path, new_name, wxFileData::is_dir, wxFileIconsTable::folder ); wxListItem item; item.m_itemId = 0; item.m_col = 0; long id = Add( fd, item ); if (id != -1) { SortItems(m_sort_field, m_sort_foward); id = FindItem( 0, (long)fd ); EnsureVisible( id ); EditLabel( id ); } else delete fd; }
void CTreeCtrlEx::OnTimer(UINT nIDEvent) { if (nIDEvent == TCEX_EDITLABEL) { // Stop the timer. KillTimer(m_idTimer); // Invoke label editing. if (m_bEditLabelPending) EditLabel(GetSelectedItem()); m_bEditLabelPending = FALSE; return; } CTreeCtrl::OnTimer(nIDEvent); }
void CRemoteTreeView::OnMenuRename(wxCommandEvent&) { if (!m_pState->IsRemoteIdle()) return; if (!m_contextMenuItem) return; const CServerPath& path = GetPathFromItem(m_contextMenuItem); if (path.empty()) return; if (!path.HasParent()) return; EditLabel(m_contextMenuItem); }
void CLocalListView::OnMenuRename(wxCommandEvent& event) { int item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item < 0 || (!item && m_hasParent)) { wxBell(); return; } if (GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED) != -1) { wxBell(); return; } EditLabel(item); }
bool wxSFEditTextShape::OnKey(int key) { // HINT: override it if neccessary... switch(key) { case WXK_F2: if(IsActive() && IsVisible()) { EditLabel(); } break; default: break; } return wxSFShapeBase::OnKey(key); }
void CEditListCtrl::OnLButtonDown(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default m_bFocus = TRUE; LVHITTESTINFO lvhit; lvhit.pt = point; int item = SubItemHitTest(&lvhit); //if (over a item/subitem) if (item != -1 && (lvhit.flags & LVHT_ONITEM)) { CListCtrl::OnLButtonDown(nFlags, point); if(m_bHighLight && m_iItem == lvhit.iItem && m_iSubItem == lvhit.iSubItem && (m_iSubItem==1 || m_iSubItem==2))//在这里只编辑坐标点 { //第二次单击 EditLabel(m_iItem); return; } else { //第一次单击 m_iItem = lvhit.iItem; m_iSubItem = lvhit.iSubItem; m_bHighLight = TRUE; } } else { if(m_edtItemEdit.m_hWnd == NULL) { //未出现文本编辑框时 m_bHighLight = FALSE; } CListCtrl::OnLButtonDown(nFlags, point); } Invalidate(); }
void wxGxTreeView::BeginRename(long nObjectID) { if(nObjectID == wxNOT_FOUND) return; wxTreeItemId ItemId = m_TreeMap[nObjectID]; if(!ItemId.IsOk()) { SetItemHasChildren(GetSelection()); Expand(GetSelection()); ItemId = m_TreeMap[nObjectID]; } if(ItemId.IsOk()) { SelectItem(ItemId);//, false SetFocus(); m_pSelection->Select(nObjectID, true, GetId()); EditLabel(GetSelection()); } }
void t_File::OnUknButton(int i) { switch (i) { case BTN_EDIT+0: case BTN_EDIT+1: case BTN_EDIT+2: case BTN_EDIT+3: EditSettings(i-BTN_EDIT); break; case BTN_LABEL+0: case BTN_LABEL+1: case BTN_LABEL+2: case BTN_LABEL+3: EditLabel(i-BTN_LABEL); break; default: myFile::OnUknButton(i); break; } }
void CLocalTreeView::OnMenuRename(wxCommandEvent& event) { if (!m_contextMenuItem.IsOk()) return; #ifdef __WXMSW__ if (m_contextMenuItem == m_desktop || m_contextMenuItem == m_documents) { wxBell(); return; } #endif CLocalPath path(GetDirFromItem(m_contextMenuItem)); if (!path.HasParent() || !path.IsWriteable()) { wxBell(); return; } EditLabel(m_contextMenuItem); }
void wxGxContentView::BeginRename(long nObjectID) { long nItem; LPITEMDATA pItemData = NULL; for(nItem = 0; nItem < GetItemCount(); ++nItem) { pItemData = (LPITEMDATA)GetItemData(nItem); if(pItemData == NULL) continue; if(pItemData->nObjectID == nObjectID) { SetItemState(nItem, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); //m_pSelection->Select(nObjectID, true, NOTFIRESELID); break; } } if (NULL != pItemData) { EditLabel(nItem); } }
void CColumnTreeCtrl::OnLButtonDblClk(UINT nFlags, CPoint point) { if (CheckHit(point)) { CTreeCtrl::OnLButtonDblClk(nFlags, point); UINT fFlags; HTREEITEM hItem = HitTest(point, &fFlags); CEdit *edit = EditLabel(hItem); //SetFocus(); class CMyEdit : public CEdit { public: virtual LRESULT DefWindowProc ( UINT message, WPARAM wParam, LPARAM lParam ) { switch(message) { case WM_GETDLGCODE: return DLGC_WANTALLKEYS; // has to do this, otherwise, ESC and RETURN don't work (don't know why ...) break; } return CEdit::DefWindowProc(message, wParam, lParam); } }; CString strSub; AfxExtractSubString(strSub, GetItemText(hItem), 0, '\t'); edit->SetWindowText(strSub); edit->SetSel(0, -1); CMyEdit *me = new CMyEdit; me->SubclassWindow(edit->Detach()); } }
void CMyListCtrl::OnLButtonUp(UINT nFlags, CPoint point) { LVHITTESTINFO lvhit; lvhit.pt = point; int item = SubItemHitTest(&lvhit); //if (over a subitem) if (item != -1 && lvhit.iSubItem && (lvhit.flags & LVHT_ONITEM )) { //mouse click outside the editbox in an allready editing cell cancels editing if (m_subitem == lvhit.iSubItem && item == m_item) { CListCtrl::OnLButtonUp(nFlags, point); } else { CListCtrl::OnLButtonUp(nFlags, point); m_subitem = lvhit.iSubItem; m_item = item; EditLabel(item); } } else CListCtrl::OnLButtonUp(nFlags, point); }
void WatchWindow::OnItemSelected(wxTreeEvent& event) { // Initiate the label editing. EditLabel(event.GetItem()); event.Skip(); }
void WatchWindow::OnKeyDown(wxTreeEvent& event) { if (event.GetKeyCode() == WXK_DELETE || event.GetKeyCode() == WXK_BACK) { wxTreeItemId item = GetSelection(); if (item.IsOk() && GetItemParent(item) == m_root) { wxTreeItemId next = GetNextSibling(item); Delete(item); CreateEmptySlotIfNeeded(); // Select the next item. if (!next.IsOk()) { wxTreeItemIdValue cookie; next = GetLastChild(GetRootItem(), cookie); } SelectItem(next); } } else { // If we're not currently editing a field, begin editing. This // eliminates the need to double click to begin editing. int code = event.GetKeyCode(); if (!m_editing && code < 256 && (isgraph(code) || IsSpace(code))) { // Get the currently selected item in the list. wxTreeItemId item = GetSelection(); if (item.IsOk()) { if (IsSpace(code)) { EditLabel(item, ""); } else { EditLabel(item, wxString(static_cast<char>(code))); } event.Skip(false); } } else { event.Skip(true); } } }
bool CImageTreeCtrl::DoEditLabel(HTREEITEM hItem) { m_hSelItem=hItem; return hItem ? (EditLabel(hItem) != 0) : false; }
bool CEditTreeCtrl::DoEditLabel(HTREEITEM hItem) { return hItem ? (EditLabel(hItem) != 0) : false; }
void HierTreeCtrl::OnCreateFile() { wxTreeItemId rootItem = GetRootItem(); wxTreeItemId newItem = AppendFile(rootItem, "New File"); EditLabel(newItem); }
void HierTreeCtrl::OnCreateDirectory() { wxTreeItemId rootItem = GetRootItem(); wxTreeItemId newItem = AppendDirectory(rootItem, "New Directory"); EditLabel(newItem); }
bool CFileBrowserListCtrl::Rename() { return(EditLabel(GetSelectionMark()) != NULL); }
INT_PTR Dlg_MemBookmark::MemBookmarkDialogProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { PMEASUREITEMSTRUCT pmis; PDRAWITEMSTRUCT pdis; int nSelect; HWND hList; int offset = 2; RECT rcBounds, rcLabel; switch ( uMsg ) { case WM_INITDIALOG: { GenerateResizes( hwnd ); m_hMemBookmarkDialog = hwnd; hList = GetDlgItem( m_hMemBookmarkDialog, IDC_RA_LBX_ADDRESSES ); SetupColumns( hList ); // Auto-import bookmark file when opening dialog if ( g_pCurrentGameData->GetGameID() != 0 ) { std::string file = RA_DIR_BOOKMARKS + std::to_string( g_pCurrentGameData->GetGameID() ) + "-Bookmarks.txt"; ImportFromFile( file ); } RestoreWindowPosition( hwnd, "Memory Bookmarks", true, false ); return TRUE; } case WM_GETMINMAXINFO: { LPMINMAXINFO lpmmi = (LPMINMAXINFO)lParam; lpmmi->ptMinTrackSize = pDlgMemBookmarkMin; } break; case WM_SIZE: { RARect winRect; GetWindowRect( hwnd, &winRect ); for ( ResizeContent content : vDlgMemBookmarkResize ) content.Resize( winRect.Width(), winRect.Height() ); //InvalidateRect( hwnd, NULL, TRUE ); RememberWindowSize(hwnd, "Memory Bookmarks"); } break; case WM_MOVE: RememberWindowPosition(hwnd, "Memory Bookmarks"); break; case WM_MEASUREITEM: pmis = (PMEASUREITEMSTRUCT)lParam; pmis->itemHeight = 16; return TRUE; case WM_DRAWITEM: { pdis = (PDRAWITEMSTRUCT)lParam; // If there are no list items, skip this message. if ( pdis->itemID == -1 ) break; switch ( pdis->itemAction ) { case ODA_SELECT: case ODA_DRAWENTIRE: hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); ListView_GetItemRect( hList, pdis->itemID, &rcBounds, LVIR_BOUNDS ); ListView_GetItemRect( hList, pdis->itemID, &rcLabel, LVIR_LABEL ); RECT rcCol ( rcBounds ); rcCol.right = rcCol.left + ListView_GetColumnWidth( hList, 0 ); // Draw Item Label - Column 0 wchar_t buffer[ 512 ]; if ( m_vBookmarks[ pdis->itemID ]->Decimal() ) swprintf_s ( buffer, 512, L"(D)%s", m_vBookmarks[ pdis->itemID ]->Description().c_str() ); else swprintf_s ( buffer, 512, L"%s", m_vBookmarks[ pdis->itemID ]->Description().c_str() ); if ( pdis->itemState & ODS_SELECTED ) { SetTextColor( pdis->hDC, GetSysColor( COLOR_HIGHLIGHTTEXT ) ); SetBkColor( pdis->hDC, GetSysColor( COLOR_HIGHLIGHT ) ); FillRect( pdis->hDC, &rcBounds, GetSysColorBrush( COLOR_HIGHLIGHT ) ); } else { SetTextColor( pdis->hDC, GetSysColor( COLOR_WINDOWTEXT ) ); COLORREF color; if ( m_vBookmarks[ pdis->itemID ]->Frozen() ) color = RGB( 255, 255, 160 ); else color = GetSysColor( COLOR_WINDOW ); HBRUSH hBrush = CreateSolidBrush( color ); SetBkColor( pdis->hDC, color ); FillRect( pdis->hDC, &rcBounds, hBrush ); DeleteObject( hBrush ); } if ( wcslen( buffer ) > 0 ) { rcLabel.left += ( offset / 2 ); rcLabel.right -= offset; DrawTextW( pdis->hDC, buffer, wcslen( buffer ), &rcLabel, DT_SINGLELINE | DT_LEFT | DT_NOPREFIX | DT_NOCLIP | DT_VCENTER | DT_END_ELLIPSIS ); } // Draw Item Label for remaining columns LV_COLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH; for ( size_t i = 1; ListView_GetColumn( hList, i, &lvc ); ++i ) { rcCol.left = rcCol.right; rcCol.right += lvc.cx; switch ( i ) { case CSI_ADDRESS: swprintf_s ( buffer, 512, L"%06x", m_vBookmarks[ pdis->itemID ]->Address() ); break; case CSI_VALUE: if ( m_vBookmarks[ pdis->itemID ]->Decimal() ) swprintf_s ( buffer, 512, L"%u", m_vBookmarks[ pdis->itemID ]->Value() ); else { switch ( m_vBookmarks[ pdis->itemID ]->Type() ) { case 1: swprintf_s ( buffer, 512, L"%02x", m_vBookmarks[ pdis->itemID ]->Value() ); break; case 2: swprintf_s ( buffer, 512, L"%04x", m_vBookmarks[ pdis->itemID ]->Value() ); break; case 3: swprintf_s ( buffer, 512, L"%08x", m_vBookmarks[ pdis->itemID ]->Value() ); break; } } break; case CSI_PREVIOUS: if ( m_vBookmarks[ pdis->itemID ]->Decimal() ) swprintf_s ( buffer, 512, L"%u", m_vBookmarks[ pdis->itemID ]->Previous() ); else { switch ( m_vBookmarks[ pdis->itemID ]->Type() ) { case 1: swprintf_s ( buffer, 512, L"%02x", m_vBookmarks[ pdis->itemID ]->Previous() ); break; case 2: swprintf_s ( buffer, 512, L"%04x", m_vBookmarks[ pdis->itemID ]->Previous() ); break; case 3: swprintf_s ( buffer, 512, L"%08x", m_vBookmarks[ pdis->itemID ]->Previous() ); break; } } break; case CSI_CHANGES: swprintf_s ( buffer, 512, L"%d", m_vBookmarks[ pdis->itemID ]->Count() ); break; default: swprintf_s ( buffer, 512, L"" ); break; } if ( wcslen( buffer ) == 0 ) continue; UINT nJustify = DT_LEFT; switch ( lvc.fmt & LVCFMT_JUSTIFYMASK ) { case LVCFMT_RIGHT: nJustify = DT_RIGHT; break; case LVCFMT_CENTER: nJustify = DT_CENTER; break; default: break; } rcLabel = rcCol; rcLabel.left += offset; rcLabel.right -= offset; DrawTextW( pdis->hDC, buffer, wcslen( buffer ), &rcLabel, nJustify | DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_END_ELLIPSIS ); } //if (pdis->itemState & ODS_SELECTED) //&& (GetFocus() == this) // DrawFocusRect(pdis->hDC, &rcBounds); break; case ODA_FOCUS: break; } return TRUE; } case WM_NOTIFY: { switch ( LOWORD( wParam ) ) { case IDC_RA_LBX_ADDRESSES: if ( ( (LPNMHDR)lParam )->code == NM_CLICK ) { hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); nSelect = ListView_GetNextItem( hList, -1, LVNI_FOCUSED ); if ( nSelect == -1 ) break; } else if ( ( (LPNMHDR)lParam )->code == NM_DBLCLK ) { hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); LPNMITEMACTIVATE pOnClick = (LPNMITEMACTIVATE)lParam; if ( pOnClick->iItem != -1 && pOnClick->iSubItem == CSI_DESC ) { nSelItemBM = pOnClick->iItem; nSelSubItemBM = pOnClick->iSubItem; EditLabel ( pOnClick->iItem, pOnClick->iSubItem ); } else if ( pOnClick->iItem != -1 && pOnClick->iSubItem == CSI_ADDRESS ) { g_MemoryDialog.SetWatchingAddress( m_vBookmarks[ pOnClick->iItem ]->Address() ); MemoryViewerControl::setAddress( ( m_vBookmarks[ pOnClick->iItem ]->Address() & ~( 0xf ) ) - ( (int)( MemoryViewerControl::m_nDisplayedLines / 2 ) << 4 ) + ( 0x50 ) ); } } } return TRUE; } case WM_COMMAND: { switch ( LOWORD( wParam ) ) { case IDOK: case IDCLOSE: case IDCANCEL: EndDialog( hwnd, true ); return TRUE; case IDC_RA_ADD_BOOKMARK: { if ( g_MemoryDialog.GetHWND() != nullptr ) AddAddress(); return TRUE; } case IDC_RA_DEL_BOOKMARK: { HWND hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); int nSel = ListView_GetNextItem( hList, -1, LVNI_SELECTED ); if ( nSel != -1 ) { while ( nSel >= 0 ) { MemBookmark* pBookmark = m_vBookmarks[ nSel ]; // Remove from vector m_vBookmarks.erase( m_vBookmarks.begin() + nSel ); // Remove from map std::vector<const MemBookmark*> *pVector; pVector = &m_BookmarkMap.find( pBookmark->Address() )->second; pVector->erase( std::find( pVector->begin(), pVector->end(), pBookmark ) ); if ( pVector->size() == 0 ) m_BookmarkMap.erase( pBookmark->Address() ); delete pBookmark; ListView_DeleteItem( hList, nSel ); nSel = ListView_GetNextItem( hList, -1, LVNI_SELECTED ); } InvalidateRect( hList, NULL, FALSE ); } return TRUE; } case IDC_RA_FREEZE: { if ( m_vBookmarks.size() > 0 ) { hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); unsigned int uSelectedCount = ListView_GetSelectedCount( hList ); if ( uSelectedCount > 0 ) { for ( int i = ListView_GetNextItem( hList, -1, LVNI_SELECTED ); i >= 0; i = ListView_GetNextItem( hList, i, LVNI_SELECTED ) ) m_vBookmarks[ i ]->SetFrozen( !m_vBookmarks[ i ]->Frozen() ); } ListView_SetItemState( hList, -1, LVIF_STATE, LVIS_SELECTED ); } return TRUE; } case IDC_RA_CLEAR_CHANGE: { if ( m_vBookmarks.size() > 0 ) { hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); int idx = -1; for ( MemBookmark* bookmark : m_vBookmarks ) { idx++; bookmark->ResetCount(); } InvalidateRect( hList, NULL, FALSE ); } return TRUE; } case IDC_RA_DECIMALBOOKMARK: { if ( m_vBookmarks.size() > 0 ) { hList = GetDlgItem( hwnd, IDC_RA_LBX_ADDRESSES ); unsigned int uSelectedCount = ListView_GetSelectedCount( hList ); if ( uSelectedCount > 0 ) { for ( int i = ListView_GetNextItem( hList, -1, LVNI_SELECTED ); i >= 0; i = ListView_GetNextItem( hList, i, LVNI_SELECTED ) ) m_vBookmarks[ i ]->SetDecimal( !m_vBookmarks[ i ]->Decimal() ); } ListView_SetItemState( hList, -1, LVIF_STATE, LVIS_SELECTED ); } return TRUE; } case IDC_RA_SAVEBOOKMARK: { ExportJSON(); return TRUE; } case IDC_RA_LOADBOOKMARK: { std::string file = ImportDialog(); if (file.length() > 0 ) ImportFromFile( file ); return TRUE; } default: return FALSE; } } default: break; } return FALSE; }