/*==========================================================================*/
/* Copyright (c) 1999 - Sykes Enterprises Inc. - All rights reserved        */
/*--------------------------------------------------------------------------*/
/* Sykes grants you ("Licensee") a non-exclusive, royalty free, license to  */
/* use, modify and redistribute this software in source and binary code     */
/* form, provided that i) this copyright notice and license appear on all   */
/* copies of the software; and ii) Licensee does not utilize the software   */
/* in a manner which is disparaging to Sykes.                               */
/*                                                                          */
/* This software is provided "AS IS", without a warranty of any kind. ALL   */
/* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING */
/* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR        */
/* PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SYKES AND ITS          */
/* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A  */
/* RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS           */
/* DERIVATIVES. IN NO EVENT WILL SYKES OR ITS LICENSORS BE LIABLE FOR ANY   */
/* LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,          */
/* CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND        */
/* REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR      */
/* INABILITY TO USE SOFTWARE, EVEN IF SYKES HAS BEEN ADVISED OF THE         */
/* POSSIBILITY OF SUCH DAMAGES.                                             */
/*==========================================================================*/

#include "stdafx.h"
#include "Waikoloa.h"
#include "MainFrm.h"

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


int                     g_nMinCX = -1;
int                     g_nMinCY = -1;



/*--------------------------------------------------------------------------*/

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_WM_GETMINMAXINFO()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};


/*--------------------------------------------------------------------------*/

CMainFrame::CMainFrame()
{
}


/*--------------------------------------------------------------------------*/

CMainFrame::~CMainFrame()
{
}


/*--------------------------------------------------------------------------*/

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	//EnableDocking(CBRS_ALIGN_ANY);
	//DockControlBar(&m_wndToolBar);

	return 0;
}



/*--------------------------------------------------------------------------*/

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) ) return(FALSE);

	// Add the opened TM at the end of the title, not the start
	cs.style &= ~(LONG)FWS_PREFIXTITLE;

	return(TRUE);
}


/*--------------------------------------------------------------------------*/

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

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

#endif //_DEBUG


/*--------------------------------------------------------------------------*/

void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) 
{
	lpMMI->ptMinTrackSize.x = g_nMinCX
		+ (4*GetSystemMetrics(SM_CXSIZEFRAME));

	lpMMI->ptMinTrackSize.y = g_nMinCY
		+ (3*GetSystemMetrics(SM_CYMENU))
		+ (10*GetSystemMetrics(SM_CYSIZEFRAME));

	CFrameWnd::OnGetMinMaxInfo(lpMMI);
}

