3dPageTTF.cpp
资源名称:gloop.zip [点击查看]
上传用户:shxiangxiu
上传日期:2007-01-03
资源大小:1101k
文件大小:3k
源码类别:
OpenGL
开发平台:
Visual C++
- /////////////////////////////////////////////////////////////////////////////
- // 3dPageTTF.cpp : implementation file
- //
- // glOOP (OpenGL Object Oriented Programming library)
- // Copyright (c) Craig Fahrnbach 1997, 1998
- //
- // OpenGL is a registered trademark of Silicon Graphics
- //
- //
- // This program is provided for educational and personal use only and
- // is provided without guarantee or warrantee expressed or implied.
- //
- // Commercial use is strickly prohibited without written permission
- // from ImageWare Development.
- //
- // This program is -not- in the public domain.
- //
- /////////////////////////////////////////////////////////////////////////////
- #include "stdafx.h"
- #include "glOOP.h"
- #include "3dObjectDialog.h"
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
- //////////////////////////////////////////////////////////////////
- // C3dPageTTF
- IMPLEMENT_DYNCREATE(C3dPageTTF, CPropertyPage)
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageTTF dialog construction
- C3dPageTTF::C3dPageTTF()
- : CPropertyPage(C3dPageTTF::IDD)
- {
- //{{AFX_DATA_INIT(C3dPageTTF)
- m_fCharDepth = 0.0f;
- m_szName = _T("");
- m_szFontName = _T("");
- //}}AFX_DATA_INIT
- }
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageTTF Destructor
- C3dPageTTF::~C3dPageTTF()
- {
- }
- void C3dPageTTF::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(C3dPageTTF)
- DDX_Text(pDX, IDC_CHAR_DEPTH, m_fCharDepth);
- DDX_Text(pDX, IDC_NAME, m_szName);
- DDV_MaxChars(pDX, m_szName, 40);
- DDX_Text(pDX, IDC_FONT_NAME, m_szFontName);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(C3dPageTTF, CPropertyPage)
- //{{AFX_MSG_MAP(C3dPageTTF)
- ON_BN_CLICKED(IDC_CHOOSEFONT, OnChooseFont)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // C3dPageTTF message handlers
- BOOL C3dPageTTF::OnInitDialog()
- {
- // let the base class do the default work
- CPropertyPage::OnInitDialog();
- // Set our local values to the Objects' values
- m_szName = m_pObject->m_szName;
- m_fCharDepth = m_pObject->m_fCharDepth;
- m_szFontName = m_pObject->m_LogFont.lfFaceName;
- // Disable the data window (display only)
- GetDlgItem(IDC_FONT_NAME)->EnableWindow(FALSE);
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(FALSE);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void C3dPageTTF::OnOK()
- {
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(TRUE);
- if(m_fCharDepth != m_pObject->m_fCharDepth)
- // Force a rebuild of the True Type Font Glyphs
- m_pObject->m_bBuildLists = TRUE;
- // Set our Objects' values to the local values
- m_pObject->m_szName = m_szName;
- m_pObject->m_fCharDepth = m_fCharDepth;
- CPropertyPage::OnOK();
- }
- void C3dPageTTF::OnChooseFont()
- {
- if(m_pObject)
- {
- // Create the font dialog
- CFontDialog dlg(&m_pObject->m_LogFont, CF_EFFECTS | CF_SCREENFONTS | CF_TTONLY, NULL, this);
- if(dlg.DoModal() == IDOK)
- {
- m_szFontName = m_pObject->m_LogFont.lfFaceName;
- // Dialog box is being initialized (FALSE)
- // or data is being retrieved (TRUE).
- UpdateData(FALSE);
- // Force the object to rebuild the display list
- m_pObject->m_bBuildLists = TRUE;
- }
- }
- }