home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ User's Journal & Wi…eveloper's Journal Tools
/
C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso
/
stingray
/
mainfrm.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-27
|
3KB
|
147 lines
// mainfrm.cpp : implementation of the CMainFrame class
//
// This is a part of the Objective Grid C++ Library.
// Copyright (C) 1995,1996 ClassWorks, Stefan Hoenig.
// All rights reserved.
//
// This source code is only intended as a supplement to
// the Objective Grid Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding
// the Objective Grid product.
//
#include "stdafx.h"
#include "gridapp.h"
#include "mainfrm.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CMainFrame, CGridMDIFrameWnd)
#define new DEBUG_NEW
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
BEGIN_MESSAGE_MAP(CMainFrame, CGridMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// arrays of IDs used to initialize control bars
// toolbar buttons - IDs are command buttons
static UINT BASED_CODE buttons[] =
{
// same order as in the bitmap 'toolbar.bmp'
ID_FILE_NEW,
ID_FILE_OPEN,
ID_FILE_SAVE,
ID_SEPARATOR,
ID_EDIT_CUT,
ID_EDIT_COPY,
ID_EDIT_PASTE,
ID_SEPARATOR,
ID_FILE_PRINT,
ID_SEPARATOR,
ID_EDIT_UNDO,
ID_EDIT_REDO,
ID_SEPARATOR,
ID_VIEW_ZOOMIN,
ID_VIEW_ZOOMOUT,
ID_VIEW_100,
ID_SEPARATOR,
ID_FORMAT_ALIGN_LEFT,
ID_FORMAT_ALIGN_CENTER,
ID_FORMAT_ALIGN_RIGHT,
ID_SEPARATOR,
ID_FORMAT_STYLE_BOLD,
ID_FORMAT_STYLE_ITALIC,
ID_FORMAT_STYLE_UNDERLINE,
ID_SEPARATOR,
ID_APP_ABOUT,
};
static UINT BASED_CODE indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CGridMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
!m_wndToolBar.SetButtons(buttons,
sizeof(buttons)/sizeof(UINT)))
{
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
}
#if _MFC_VER >= 0x0300
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
#endif
return 0;
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CGridMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CGridMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers