예제 #1
0
void CTreeFileCtrl::ExpandFill()
{
  HTREEITEM hSelItem = GetSelectedItem();
  CString sItem  = ItemToPath(hSelItem);
  if (sItem.GetLength())
    hSelItem = SetSelectedPath(sItem, TRUE);
  OnViewRefresh();
}
예제 #2
0
LRESULT CTreeFileCtrl::OnPopulateTree(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
  //attach the image list to the tree control
  SetImageList(&m_SysImageList.GetImageList(), TVSIL_NORMAL);

  //Force a refresh
  OnViewRefresh();

  return 0L;
}
예제 #3
0
void CTreeFileCtrl::SetRootFolder(const CString& sPath)
{
  int nLength = sPath.GetLength();
  if (nLength)
  {
    if (sPath.GetAt(nLength-1) == _T('\\'))
      m_sRootFolder = sPath.Left(nLength-1);
	else
		m_sRootFolder = sPath;
  }
  else
    m_sRootFolder = sPath;
  if (IsWindow(GetSafeHwnd()))
	OnViewRefresh();
}
예제 #4
0
void CFileAndFolder::OnRefreshDrives() 
{
	OnViewRefresh();
	
}
예제 #5
0
void CFileAndFolder::SetShowFiles(BOOL bFiles) 
{ 
  m_bShowFiles = bFiles; 
  if (IsWindow(GetSafeHwnd()))
    OnViewRefresh();
}
예제 #6
0
BOOL CTreeFileCtrl::PreTranslateMessage(MSG* pMsg) 
{
  // When an item is being edited make sure the edit control
  // receives certain important key strokes
  if (GetEditControl())
  {
    ::TranslateMessage(pMsg);
    ::DispatchMessage(pMsg);
    return TRUE; // DO NOT process further
  }

  //Context menu via the keyboard
	if ((((pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN) && // If we hit a key and
    	(pMsg->wParam == VK_F10) && (GetKeyState(VK_SHIFT) & ~1)) != 0) ||   // it's Shift+F10 OR
		  (pMsg->message == WM_CONTEXTMENU))						                   	   // Natural keyboard key
	{
		CRect rect;
		GetItemRect(GetSelectedItem(), rect, TRUE);
		ClientToScreen(rect);
		OnContextMenu(NULL, rect.CenterPoint());
		return TRUE;
	}
  //Hitting the Escape key, Cancelling drag & drop
	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_ESCAPE && IsDragging())
  {
    EndDragging(TRUE);
    return TRUE;
  }
  //Hitting the Alt-Enter key combination, show the properties sheet 
	else if (pMsg->message == WM_SYSKEYDOWN && pMsg->wParam == VK_RETURN)
  {
    OnFileProperties();
    return TRUE;
  }
  //Hitting the Enter key, open the item
	else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
  {
    OnFileOpen();
    return TRUE;
  }
  //Hitting the delete key, delete the item
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_DELETE)
  {
    OnFileDelete();
    return TRUE;
  }
  //hitting the backspace key, go to the parent folder
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_BACK)
  {
    UpOneLevel();
    return TRUE;
  }
  //hitting the F2 key, being in-place editing of an item
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F2)
  {
    OnFileRename();
    return TRUE;
  }
  //hitting the F5 key, force a refresh of the whole tree
  else if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_F5)
  {
    OnViewRefresh();
    return TRUE;
  }

  //Let the parent class do its thing
	return CTreeCtrl::PreTranslateMessage(pMsg);
}
예제 #7
0
void CTreeFileCtrl::SetShowFiles(BOOL bFiles) 
{ 
  m_bShowFiles = bFiles; 
  if (IsWindow(GetSafeHwnd()))
    OnViewRefresh();
}