166 lines
3.4 KiB
C++
166 lines
3.4 KiB
C++
#include "stdafx.h"
|
|
#include "Resource.h"
|
|
#include "ChildFrame.h"
|
|
#include "MyListView.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
#define IDC_INPLACE_MYCHILDBAR 10004
|
|
|
|
IMPLEMENT_DYNCREATE(CChildFrame, CFrameWnd)
|
|
BEGIN_MESSAGE_MAP(CChildFrame, CFrameWnd)
|
|
//{{AFX_MSG_MAP(CChildFrame)
|
|
ON_WM_CREATE()
|
|
ON_WM_LBUTTONUP()
|
|
ON_WM_PAINT()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
CChildFrame::CChildFrame()
|
|
{
|
|
}
|
|
|
|
CChildFrame::~CChildFrame()
|
|
{
|
|
}
|
|
|
|
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
{
|
|
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
|
return -1;
|
|
if (!m_wndPreViewBar.Create(_T("ͼ¿éÔ¤ÀÀ"), this, CSize(100,140),
|
|
TRUE,IDC_INPLACE_MYCHILDBAR))
|
|
{
|
|
TRACE0(_T("Failed to create mybar\n"));
|
|
return -1;
|
|
}
|
|
|
|
if (!m_wndExplainBar.Create(_T("ͼ¿é˵Ã÷"), this, CSize(100,100),
|
|
TRUE,IDC_INPLACE_MYCHILDBAR+1))
|
|
{
|
|
TRACE0(_T("Failed to create mybar\n"));
|
|
return -1;
|
|
}
|
|
AfxSetResourceHandle (acedGetAcadResourceInstance ());
|
|
|
|
m_wndPreViewBar.SetBarStyle(m_wndPreViewBar.GetBarStyle() |
|
|
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
|
|
m_wndExplainBar.SetBarStyle(m_wndExplainBar.GetBarStyle() |
|
|
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
|
|
|
|
m_wndPreViewBar.EnableDocking(CBRS_ALIGN_ANY);
|
|
m_wndExplainBar.EnableDocking(CBRS_ALIGN_ANY);
|
|
|
|
EnableDocking(CBRS_ALIGN_ANY);
|
|
DockControlBar(&m_wndPreViewBar, AFX_IDW_DOCKBAR_BOTTOM);
|
|
DockControlBar(&m_wndExplainBar, AFX_IDW_DOCKBAR_BOTTOM);
|
|
return 0;
|
|
}
|
|
|
|
|
|
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
|
|
CCreateContext* pContext)
|
|
{
|
|
if (!m_wndSplitter.CreateStatic(this, 1, 1))
|
|
return FALSE;
|
|
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CMyListView),
|
|
CSize(150, 100), pContext))
|
|
{
|
|
m_wndSplitter.DestroyWindow();
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
|
|
{
|
|
if( !CFrameWnd::PreCreateWindow(cs) )
|
|
return FALSE;
|
|
cs.dwExStyle |= WS_EX_CLIENTEDGE;
|
|
return TRUE;
|
|
}
|
|
#ifdef _DEBUG
|
|
void CChildFrame::AssertValid() const
|
|
{
|
|
CFrameWnd::AssertValid();
|
|
}
|
|
|
|
void CChildFrame::Dump(CDumpContext& dc) const
|
|
{
|
|
CFrameWnd::Dump(dc);
|
|
}
|
|
#endif
|
|
|
|
|
|
void CChildFrame::ShowPreViewCtrl()
|
|
{
|
|
if(m_wndPreViewBar.IsVisible())
|
|
m_wndPreViewBar.ShowWindow(SW_HIDE);
|
|
else
|
|
{
|
|
m_wndPreViewBar.ShowWindow(SW_SHOW);
|
|
DockControlBar(&m_wndPreViewBar, AFX_IDW_DOCKBAR_BOTTOM);
|
|
}
|
|
UpdateData();
|
|
this->RecalcLayout();
|
|
}
|
|
void CChildFrame::hidePreViewCtrlAndExplainCtrl()
|
|
{
|
|
m_wndPreViewBar.ShowWindow(SW_HIDE);
|
|
|
|
ShowControlBar(&m_wndExplainBar, FALSE, FALSE);
|
|
}
|
|
BOOL CChildFrame::IsShowPreViewCtrl()
|
|
{
|
|
if(m_wndPreViewBar.GetSafeHwnd() == NULL)
|
|
return TRUE;
|
|
|
|
if(m_wndPreViewBar.IsVisible())
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
void CChildFrame::ShowExplainCtrl()
|
|
{
|
|
if(m_wndExplainBar.IsVisible())
|
|
ShowControlBar(&m_wndExplainBar, FALSE, FALSE);
|
|
//m_wndExplainBar.ShowWindow(SW_HIDE);
|
|
else
|
|
{
|
|
ShowControlBar(&m_wndExplainBar, TRUE, FALSE);
|
|
//m_wndExplainBar.ShowWindow(SW_SHOW);
|
|
DockControlBar(&m_wndExplainBar, AFX_IDW_DOCKBAR_BOTTOM);
|
|
}
|
|
UpdateData();
|
|
this->RecalcLayout();
|
|
}
|
|
|
|
BOOL CChildFrame::IsShowExplainCtrl()
|
|
{
|
|
if(m_wndExplainBar.GetSafeHwnd() == NULL)
|
|
return TRUE;
|
|
|
|
if(m_wndExplainBar.IsVisible())
|
|
return TRUE;
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
void CChildFrame::OnLButtonUp(UINT nFlags, CPoint point)
|
|
{
|
|
// TODO: Add your message handler code here and/or call default
|
|
|
|
CFrameWnd::OnLButtonUp(nFlags, point);
|
|
}
|
|
|
|
void CChildFrame::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
}
|