/* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. */

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

#include "stdafx.h"
#include "clientUI.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

#define TOOLBAR_HEIGHT 24

const DWORD dwAdornmentFlags = 0; // exit button

// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	ON_WM_CREATE()
	ON_WM_CLOSE()
END_MESSAGE_MAP()


// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	SHDoneButton(SHDB_SHOW);

	// Create the menu bar as command bar.
	if (!m_wndCommandBar.Create(this) ||
	    !m_wndCommandBar.InsertMenuBar(IDR_MENU) ||
	    !m_wndCommandBar.AddAdornments(dwAdornmentFlags)) {
		TRACE0("Failed to create CommandBar\n");
		return -1;      // fail to create
	}
	
	m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() | 
	    CBRS_ALIGN_LEFT | CBRS_FLOAT_MULTI);

	return 0;
}

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

	return TRUE;
}

void CMainFrame::OnClose()
{
	// Give a warning to close the window.
	if (MessageBox(TEXT("Sure to quit?"), TEXT("Close"), MB_OKCANCEL) ==
	    IDOK) 
		CFrameWnd::OnClose();
   
}

// CMainFrame diagnostics

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

// CMainFrame message handlers



