home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Troubleshooting Netware Systems
/
CSTRIAL0196.BIN
/
attach
/
msj
/
v10n04
/
multilin.exe
/
MAINFRM.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-01
|
4KB
|
188 lines
// mainfrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "global.h"
//my includes
#include "dateform.h"
#include "timeform.h"
#include "settings.h"
#include "translat.h"
#include "numbform.h"
#include "langlist.h"
#include "mainfrm.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
ON_COMMAND(ID_LANGUAGE_TRANSLATION, OnLanguageTranslation)
ON_COMMAND(ID_LOCALE_CURRENCY, OnLocaleCurrency)
ON_COMMAND(ID_LOCALE_DATE, OnLocaleDate)
ON_COMMAND(ID_LOCALE_LIST, OnLocaleList)
ON_COMMAND(ID_LOCALE_NUMBER, OnLocaleNumber)
ON_COMMAND(ID_LOCALE_TIME, OnLocaleTime)
ON_COMMAND(ID_LANGUAGE_SYSTEM, OnLanguageSystem)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// arrays of IDs used to initialize control bars
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 (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
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
}
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style = WS_OVERLAPPED | WS_CAPTION | FWS_ADDTOTITLE
| WS_SYSMENU | WS_MINIMIZEBOX;
return CFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers
void CMainFrame::OnLanguageTranslation()
{
// TODO: Add your command handler code here
CTranslations translations;
translations.DoModal();
}
void CMainFrame::OnLocaleCurrency()
{
// TODO: Add your command handler code here
}
void CMainFrame::OnLocaleDate()
{
// TODO: Add your command handler code here
CDateFormat dateformat;
dateformat.DoModal();
}
void CMainFrame::OnLocaleList()
{
// TODO: Add your command handler code here
CLanglist langlist;
if( IDOK==langlist.DoModal())
{
//IDOK means we selected a new set of resources and
// now we need to reload the MenuBar to get the new
// language reflected on the menu
// Create the new menu and try to load it
CMenu menu;
if( menu.LoadMenu(IDR_MAINFRAME))
{
CMenu *pMenu = GetMenu();
if( pMenu && m_hMenuDefault != pMenu->m_hMenu )
{
// Destroy the no longer used menu unless it's the default
// menu as MFC insists on restoring that at close
pMenu->DestroyMenu();
}
// Set the frame to the new menu and detach it from
// the local variable
SetMenu(&menu);
menu.Detach();
}
// Exercise: Add invalidation of client window
}
}
// prototype, we hope
void Test();
int GetNumberFormat(LCID lcid, DWORD dwFlags, LPCTSTR lpValue, LPCTSTR lpFormat, LPTSTR lpNumber, UINT cchNumber);
void CMainFrame::OnLocaleNumber()
{
// TODO: Add your command handler code here
CNumbFormat numberformat;
numberformat.DoModal();
}
void CMainFrame::OnLocaleTime()
{
// TODO: Add your command handler code here
CTimeFormat timeformat;
timeformat.DoModal();
}
void CMainFrame::OnLanguageSystem()
{
// TODO: Add your command handler code here
CSettings *cs = new CSettings;
if( cs)
{
cs->DoModal();
}
delete cs;
}