// FolderView.cpp
//
// (c)1998-2025 Codejock Software, All Rights Reserved.
//
// THIS SOURCE FILE IS THE PROPERTY OF CODEJOCK SOFTWARE AND IS NOT TO BE
// RE-DISTRIBUTED BY ANY MEANS WHATSOEVER WITHOUT THE EXPRESSED WRITTEN
// CONSENT OF CODEJOCK SOFTWARE.
//
// THIS SOURCE CODE CAN ONLY BE USED UNDER THE TERMS AND CONDITIONS OUTLINED
// IN THE XTREME TOOLKIT PRO LICENSE AGREEMENT. CODEJOCK SOFTWARE GRANTS TO
// YOU (ONE SOFTWARE DEVELOPER) THE LIMITED RIGHT TO USE THIS SOFTWARE ON A
// SINGLE COMPUTER.
//
// CONTACT INFORMATION:
// support@codejock.com
// http://www.codejock.com
//
/////////////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "Resource.h"
#include "GridSampleDoc.h"
#include "FolderView.h"
#ifdef _DEBUG
# define new DEBUG_NEW
# undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFolderView
IMPLEMENT_DYNCREATE(CFolderView, CXTPGridView)
BEGIN_MESSAGE_MAP(CFolderView, CXTPGridView)
//{{AFX_MSG_MAP(CFolderView)
ON_WM_CREATE()
ON_WM_SETFOCUS()
ON_WM_DESTROY()
ON_COMMAND(ID_FILE_PRINT, OnFilePrint)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFolderView construction/destruction
CFolderView::CFolderView()
{
}
CFolderView::~CFolderView()
{
}
BOOL CFolderView::PreCreateWindow(CREATESTRUCT& cs)
{
if (!CXTPGridView::PreCreateWindow(cs))
return FALSE;
// cs.dwExStyle |= WS_EX_STATICEDGE;
cs.dwExStyle &= ~WS_EX_CLIENTEDGE;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFolderView diagnostics
#ifdef _DEBUG
void CFolderView::AssertValid() const
{
CXTPGridView::AssertValid();
}
void CFolderView::Dump(CDumpContext& dc) const
{
CXTPGridView::Dump(dc);
}
CGridSampleDoc* CFolderView::GetDocument() // non-debug version is inline
{
_ASSERTE(m_pDocument->IsKindOf(RUNTIME_CLASS(CGridSampleDoc)));
return (CGridSampleDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CGridSampleView message handlers
static const LPCTSTR Folder[] =
{ _T("Deleted Items"), _T("Drafts"),
_T("Inbox "),
_T("Junk E-mail "),
_T("Outbox") };
int CFolderView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CXTPGridView::OnCreate(lpCreateStruct) == -1)
return -1;
CXTPGridControl& wndGrid = GetGridCtrl();
wndGrid.ShowHeader(FALSE);
wndGrid.EnableMarkup(TRUE);
CXTPGridColumn* pColumn = new CXTPGridColumn(0, _T("Folder"), 180);
wndGrid.AddColumn(pColumn);
pColumn->SetTreeColumn(TRUE);
CXTPGridRecord* pFolder;
CXTPGridRecordItemText* pItem;
pFolder = wndGrid.AddRecord(new CXTPGridRecord());
pItem = new CXTPGridRecordItemText(_T("Personal Folders"));
// pItem->SetIconIndex();
pFolder->AddItem(pItem);
for (int nFolder = 0; nFolder < _countof(Folder); nFolder++)
{
CXTPGridRecord* pRecord = new CXTPGridRecord();
pItem = new CXTPGridRecordItemText(_T(""));
pRecord->AddItem(pItem);
pFolder->GetChilds()->Add(pRecord);
pItem->SetCaption(Folder[nFolder]);
}
wndGrid.Populate();
wndGrid.ExpandAll();
#if _XTPLIB_VERSION_PREFIX >= 1520
wndGrid.GetPaintManager()->SetGridStyle(FALSE, xtpGridLineStyleNone);
#else
wndGrid.GetPaintManager()->SetGridStyle(FALSE, xtpGridGridNoLines);
#endif
#if _XTPLIB_VERSION_PREFIX >= 1511
wndGrid.GetPaintManager()->SetColumnStyle(xtpGridColumnResource);
#else
wndGrid.GetPaintManager()->SetColumnStyle(xtpGridColumnOffice2007);
#endif
return 0;
}
void CFolderView::OnInitialUpdate()
{
CXTPGridView::OnInitialUpdate();
}
// Before self destroying destroy all child forms
void CFolderView::OnDestroy()
{
CXTPGridView::OnDestroy();
}
void CFolderView::OnSetFocus(CWnd* pOldWnd)
{
CXTPGridView::OnSetFocus(pOldWnd);
GetGridCtrl().SetFocus();
}
void CFolderView::OnFilePrint()
{
}