DlgConfigStatusBar.cpp
上传用户:rubberdam
上传日期:2007-01-10
资源大小:43k
文件大小:3k
- // DlgConfigStatusBar.cpp : implementation file
- //
- #include "stdafx.h"
- #include "MPCStatusBar_Demo.h"
- #include "DlgConfigStatusBar.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #include "MPCStatusBar.h"
- #include "MPCLogoPane.h"
- #include "mainfrm.h"
- /////////////////////////////////////////////////////////////////////////////
- // CDlgConfigStatusBar dialog
- CDlgConfigStatusBar::CDlgConfigStatusBar(CWnd* pParent /*=NULL*/)
- : CDialog(CDlgConfigStatusBar::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CDlgConfigStatusBar)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CDlgConfigStatusBar::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CDlgConfigStatusBar)
- DDX_Control(pDX, IDC_CHECK_logo, m_chk_logo);
- DDX_Control(pDX, IDC_CHECK_ledit, m_chk_edit);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CDlgConfigStatusBar, CDialog)
- //{{AFX_MSG_MAP(CDlgConfigStatusBar)
- ON_BN_CLICKED(IDC_CHECK_logo, OnCHECKlogo)
- ON_BN_CLICKED(IDC_CHECK_ledit, OnCHECKledit)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CDlgConfigStatusBar message handlers
- void CDlgConfigStatusBar::OnCHECKlogo()
- {
- // TODO: Add your control notification handler code here
- CMainFrame * pMainframe = (CMainFrame *) AfxGetApp()->m_pMainWnd;
- if( m_chk_logo.GetCheck() )
- {
- // Add an indicator, with width, ..
- pMainframe->m_wndStatusBar.AddIndicator(0,INDICATOR_LOGO);
-
-
- int idx = pMainframe->m_wndStatusBar.CommandToIndex(INDICATOR_LOGO);
- pMainframe->m_wndStatusBar.SetPaneWidth(idx,120);
- pMainframe->m_wndStatusBar.SetPaneStyle(idx, pMainframe->m_wndStatusBar.GetPaneStyle(idx) | SBPS_NOBORDERS );
- // Create a log pane window, and append it to status bar
- MPCLogoPane * pLogo = new MPCLogoPane;
- pLogo->Create("Your App Name ",WS_CHILD|WS_VISIBLE,&pMainframe->m_wndStatusBar,120);
- pLogo->SetLogoFont("Arial", 18);
- pMainframe->m_wndStatusBar.AddControl(pLogo,INDICATOR_LOGO);
-
- }
- else
- {
- pMainframe->m_wndStatusBar.RemovePane(INDICATOR_LOGO);
- }
-
- }
- void CDlgConfigStatusBar::OnCHECKledit()
- {
- // TODO: Add your control notification handler code here
- CMainFrame * pMainframe = (CMainFrame *) AfxGetApp()->m_pMainWnd;
- if( m_chk_edit.GetCheck() )
- {
- // Add an indicator, with width, ..
- pMainframe->m_wndStatusBar.AddIndicator(4,INDICATOR_EDIT);
-
-
- int idx = pMainframe->m_wndStatusBar.CommandToIndex(INDICATOR_EDIT);
- pMainframe->m_wndStatusBar.SetPaneWidth(idx,100);
- pMainframe->m_wndStatusBar.SetPaneStyle(idx, pMainframe->m_wndStatusBar.GetPaneStyle(idx) | SBPS_NOBORDERS );
- // Create a pane window, and append it to status bar
- CEdit * edit = new CEdit;
- edit->Create(WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),&pMainframe->m_wndStatusBar,INDICATOR_EDIT);
- edit->SetWindowText("Hello");
- // create a font
- static CFont font;
- font.DeleteObject();
- font.CreatePointFont(80,"Arial");
- edit->SetFont(&font);
-
- pMainframe->m_wndStatusBar.AddControl(edit,INDICATOR_EDIT);
- }
- else
- {
- pMainframe->m_wndStatusBar.RemovePane(INDICATOR_EDIT);
- }
-
- }