// MainFrm.cpp : implementation of the MainFrame class // // (C) COPYRIGHT John Henckel, mailto:henckel@iname.com Aug 1998 // // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies. // // Visit my website! http://www.GeoCities.com/Paris/6502 #include "stdafx.h" #include "Poetry.h" #include "MainFrm.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // MainFrame IMPLEMENT_DYNAMIC(MainFrame, CMDIFrameWnd) BEGIN_MESSAGE_MAP(MainFrame, CMDIFrameWnd) //{{AFX_MSG_MAP(MainFrame) ON_WM_CREATE() ON_COMMAND(ID_WINDOW_NEW, OnWindowNew) //}}AFX_MSG_MAP END_MESSAGE_MAP() static UINT indicators[] = { ID_SEPARATOR, // status line indicator ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; ///////////////////////////////////////////////////////////////////////////// // MainFrame construction/destruction MainFrame::MainFrame() { // TODO: add member initialization code here } MainFrame::~MainFrame() { } int MainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.Create(this) || !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 } // TODO: Remove this if you don't want tool tips or a resizeable toolbar m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); // TODO: Delete these three lines if you don't want the toolbar to // be dockable m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); return 0; } BOOL MainFrame::PreCreateWindow(CREATESTRUCT& cs) { // Create a window without min/max buttons or sizable border // cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER; // Size the window to 1/3 screen size and center it cs.cy = ::GetSystemMetrics(SM_CYSCREEN) / 2; cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 5; cs.y = cs.cy / 2; cs.x = 5; // ((cs.cx * 3) - cs.cx) / 2; return CMDIFrameWnd::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // MainFrame diagnostics #ifdef _DEBUG void MainFrame::AssertValid() const { CMDIFrameWnd::AssertValid(); } void MainFrame::Dump(CDumpContext& dc) const { CMDIFrameWnd::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // MainFrame message handlers void MainFrame::OnWindowNew() { CMDIFrameWnd::OnWindowNew(); }