📄 talkroomframe.cpp
字号:
// TalkRoomFrame.cpp : implementation file
//
#include "stdafx.h"
#include "Img_ListView1.h"
#include "TalkRoomFrame.h"
#include "TalkRoomHtmlView1.h"
#include "TalkRoomHtmlView2.h"
#include "TalkRoomHtmlView3.h"
#include "TalkRoomHtmlView4.h"
#include "TalkRoomListView1.h"
#include "TalkRoomEditView1.h"
#include "TalkRoomRichView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CQicqTalkSplitterWnd, CSplitterWnd)
CQicqTalkSplitterWnd::CQicqTalkSplitterWnd()
{
}
CQicqTalkSplitterWnd::~CQicqTalkSplitterWnd()
{
}
CWnd* CQicqTalkSplitterWnd::GetActivePane(int* pRow, int* pCol)
{
ASSERT_VALID(this);
// attempt to use active view of frame window
CWnd* pView = NULL;
CFrameWnd* pFrameWnd = GetParentFrame();
ASSERT_VALID(pFrameWnd);
pView = pFrameWnd->GetActiveView();
// failing that, use the current focus
if (pView == NULL)
pView = GetFocus();
return pView;
}
/////////////////////////////////////////////////////////////////////////////
// CTalkRoomFrame
IMPLEMENT_DYNCREATE(CTalkRoomFrame, CFrameWnd)
CTalkRoomFrame::CTalkRoomFrame()
{
}
CTalkRoomFrame::~CTalkRoomFrame()
{
}
BEGIN_MESSAGE_MAP(CTalkRoomFrame, CFrameWnd)
//{{AFX_MSG_MAP(CTalkRoomFrame)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CTalkRoomFrame message handlers
BOOL CTalkRoomFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
int Width,Height;
Width =::GetSystemMetrics (SM_CXFULLSCREEN);
Height =::GetSystemMetrics (SM_CYFULLSCREEN);
if (!m_wndSplitter1.CreateStatic(this, 2, 1))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if (!m_wndSplitter1.CreateView(0, 0,
RUNTIME_CLASS(TalkRoomHtmlView1), CSize(Width/5,max(Height/8,40)), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter2.CreateStatic(
&m_wndSplitter1,
1, 2,
WS_CHILD | WS_VISIBLE | WS_BORDER,
m_wndSplitter1.IdFromRowCol(1, 0)
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(0, 0,
RUNTIME_CLASS(TalkRoomListView1), CSize(Width/10,0), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter3.CreateStatic(
&m_wndSplitter2,
4, 1,
WS_CHILD | WS_VISIBLE | WS_BORDER,
m_wndSplitter2.IdFromRowCol(0, 1)
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(0, 0,
RUNTIME_CLASS(TalkRoomListView1), CSize(0, (int)(Height/22.0)), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(1, 0,
RUNTIME_CLASS(TalkRoomRichView), CSize(0,(int)(Height/1.7)), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter3.CreateView(2, 0,
RUNTIME_CLASS(TalkRoomEditView1), CSize(0,max((int)(Height/27.0),24)), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter4.CreateStatic(
&m_wndSplitter3, // our parent window is the first splitter
1, 3, // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
m_wndSplitter3.IdFromRowCol(3, 0)
// new splitter is in the first row, 2nd column of first splitter
))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
if (!m_wndSplitter4.CreateView(0, 0,
RUNTIME_CLASS(TalkRoomHtmlView2), CSize((int)((Width-Width/10)/3), 0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter4.CreateView(0, 1,
RUNTIME_CLASS(TalkRoomHtmlView3), CSize((int)((Width-Width/10)/3),0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
if (!m_wndSplitter4.CreateView(0, 2,
RUNTIME_CLASS(TalkRoomHtmlView4), CSize(0,0), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
//这里,应将活动窗口设为文本输入窗口
SetActiveView((CView*)m_wndSplitter3.GetPane(2,0));
return TRUE;
// return CFrameWnd::OnCreateClient(lpcs, pContext);
}
BOOL CTalkRoomFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
char *tempString="aaaaaaaaaaaa";
cs.style =WS_MAXIMIZE|WS_THICKFRAME|WS_SYSMENU|WS_MAXIMIZEBOX|WS_MINIMIZEBOX;
cs.lpszName =tempString;
cs.cx =::GetSystemMetrics (SM_CXFULLSCREEN);
cs.cy =::GetSystemMetrics (SM_CYFULLSCREEN);
return CFrameWnd::PreCreateWindow(cs);
}
void CTalkRoomFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
SendMessage(Y_TALKROOM_CLOSE);
CFrameWnd::OnClose();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -