// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "KrbManager.h"

#include "MainFrm.h"
#include "View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

static UINT NEAR update_cache = RegisterWindowMessage("krb4-update-cache");

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
    ON_REGISTERED_MESSAGE(update_cache, OnUpdateCache)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
}

CMainFrame::~CMainFrame()
{
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
    // I would really like to remove the SYSMENU thing, 
    // but that will (or so it seems) remove *all* stuff 
    // from the title bar
    cs.style = WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | 
        WS_MINIMIZEBOX | FWS_ADDTOTITLE;
    cs.cx = 600;
    cs.cy = 200;

	return CFrameWnd::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


LRESULT CMainFrame::OnUpdateCache(WPARAM wParam, LPARAM lParam)
{
    CKrbManagerView *view = (CKrbManagerView*)GetActiveView();
    if(view != NULL)
        view->UpdateCacheList();
    return 0;
}
