www.pudn.com > TabBar.rar > MainFrm.cpp
// mainfrm.cpp : implementation of the CMainFrame class.
#include "stdafx.h"
#include "mainview.h"
#include "mainfrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static CString _FolderText[] =
{
_T("File"),
_T("Edit"),
_T("Database"),
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame Construction\Destruction
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
CMainFrame::CMainFrame()
{
}
CMainFrame::~CMainFrame()
{
}
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMainFrame Overrides
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext *pContext)
{
// create splitter windows
m_wndSplitter.CreateStatic(this, 1, 2);
// create the main view
m_wndSplitter.CreateView(0, 1, pContext->m_pNewViewClass, CSize(0, 0), pContext);
// create the tabbarctrl
m_wndTabBar.Create(WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), &m_wndSplitter, m_wndSplitter.IdFromRowCol(0, 0));
m_wndTabBar.SetOwner(m_wndSplitter.GetPane(0, 1));
m_ImageList.Create(IDB_TOOLS, 16, 24, RGB(192, 192, 192));
m_wndTabBar.SetImageList(&m_ImageList);
for(int i = 0; i < 3; i++)
m_wndTabBar.AddFolder(_FolderText[i]);
m_wndTabBar.InsertItem(0, 0, "New", 0, 0);
m_wndTabBar.InsertItem(0, 1, "Open" , 1, 0);
m_wndTabBar.InsertItem(0, 2, "Close", 2, 0);
m_wndTabBar.InsertItem(0, 3, "Save", 3, 0);
m_wndTabBar.InsertItem(0, 4, "Save All", 4, 0);
m_wndTabBar.InsertItem(0, 5, "Print", 5, 0);
m_wndTabBar.InsertItem(0, 6, "Preview", 6, 0);
m_wndTabBar.InsertItem(1, 0, "Cut", 7, 0);
m_wndTabBar.InsertItem(1, 1, "Copy", 8, 0);
m_wndTabBar.InsertItem(1, 2, "Paste", 9, 0);
m_wndTabBar.InsertItem(1, 3, "Delete", 10, 0);
m_wndTabBar.InsertItem(1, 4, "Find", 11, 0);
m_wndTabBar.InsertItem(1, 5, "Find in File", 12, 0);
m_wndTabBar.InsertItem(1, 6, "Redo", 13, 0);
m_wndTabBar.InsertItem(2, 0, "DBOpen", 14, 0);
m_wndTabBar.InsertItem(2, 1, "DBClose", 15, 0);
m_wndTabBar.InsertItem(2, 2, "DBSelect", 16, 0);
m_wndTabBar.InsertItem(2, 3, "DBSQL", 17, 0);
m_wndTabBar.InsertItem(2, 4, "DBBrowser", 18, 0);
m_wndTabBar.InsertItem(2, 5, "DBUpdate", 19, 0);
m_wndTabBar.InsertItem(2, 6, "DBInsert", 20, 0);
m_wndTabBar.InsertItem(2, 7, "DBDelete", 21, 0);
m_wndTabBar.InsertItem(2, 8, "DBTransBegin", 22, 0);
m_wndTabBar.InsertItem(2, 9, "DBTransEnd", 23, 0);
// set the tabbar window width
m_wndSplitter.SetColumnInfo(0, 100, 0);
m_wndSplitter.RecalcLayout();
return TRUE;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.lpszClass = AfxRegisterWndClass(0);
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame Message handlers