⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mybar.cpp

📁 PL0的编译系统,使用MFC编写界面,采用浮动窗口来仿VC的环境
💻 CPP
字号:
// mybar.cpp : implementation file
//

#include "stdafx.h"
#include "My1.h"
#include "mybar.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// mybar

mybar::mybar()
{
}
void mybar::OnUpdateCmdUI(CFrameWnd *pTarget, BOOL bDisableIfNoHndler)
{
	UpdateDialogControls(pTarget, bDisableIfNoHndler);
}
mybar::~mybar()
{
}

void mybar::SetFlag(int flag1)
{
	flag=flag1;
}
BEGIN_MESSAGE_MAP(mybar, CSizingControlBar)
	//{{AFX_MSG_MAP(mybar)
	ON_WM_CREATE()
	ON_WM_SIZE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// mybar message handlers

int mybar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CSizingControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// TODO: Add your specialized creation code here
	if(!flag) m_Output.Create(ES_LEFT |  ES_NOHIDESEL |WS_CHILD | WS_VISIBLE
			| WS_TABSTOP | ES_MULTILINE | ES_AUTOVSCROLL
			| ES_AUTOHSCROLL | ES_AUTOVSCROLL  | WS_THICKFRAME| WS_BORDER
			| ES_WANTRETURN | WS_VSCROLL,
			CRect(2, 2, 750, 90),this,1000);
	else{
		m_Function.Create(WS_VISIBLE | WS_TABSTOP | WS_CHILD | WS_BORDER 
			| TVS_HASBUTTONS | TVS_LINESATROOT | TVS_HASLINES 
			| TVS_DISABLEDRAGDROP|TVS_EDITLABELS|TVS_TRACKSELECT , 
			CRect( 10,  10, 180, 320), this, 1001); 
		CFont *font = CFont::FromHandle((HFONT)::GetStockObject(DEFAULT_GUI_FONT)); 
		m_Function.SetFont(font); 
		HTREEITEM root = m_Function.InsertItem("Wordspace",0,0); 
		HTREEITEM subroot1=m_Function.InsertItem("VarDeclare",1,1,root); 
		HTREEITEM subroot2=m_Function.InsertItem("ConstDeclare",1,1,root); 
		//HTREEITEM subroot3=m_Function.InsertItem("CMy1App",1,1,root); 
		//HTREEITEM subroot4=m_Function.InsertItem("CMy1Doc",1,1,root); 
		//HTREEITEM subroot5=m_Function.InsertItem("CMy1View",1,1,root); 
		//HTREEITEM subroot6=m_Function.InsertItem("COutput",1,1,root); 

		//m_Function.InsertItem("CFunction()",1,1,subroot1); 
		//m_Function.InsertItem("~CFunction()",1,1,subroot1); 		

		//m_Function.InsertItem("AssertValid()",1,1,subroot2); 
		//m_Function.InsertItem("CMainFrame()",1,1,subroot2); 
		//m_Function.InsertItem("~CMainFrame()",1,1,subroot2); 
		//m_Function.InsertItem("Dump(CDumpContext)",1,1,subroot2); 
		//m_Function.InsertItem("OnCreate(LPCREATESTRUCT lpCreateStruct)",1,1,subroot2); 


		//m_Function.InsertItem("CMy1App()",1,1,subroot3); 
	
		//m_Function.InsertItem("CMy1Doc()",1,1,subroot4); 

		//m_Function.InsertItem("AssertValid()",1,1,subroot5); 
		//m_Function.InsertItem("CMy1View()",1,1,subroot5); 
		//m_Function.InsertItem("~CMy1View()",1,1,subroot5); 
		//m_Function.InsertItem("Dump()",1,1,subroot5); 
		//m_Function.InsertItem("GetDocument()",1,1,subroot5); 
		///m_Function.InsertItem("OnDraw(CDC *pDC)",1,1,subroot5); 
		//m_Function.InsertItem("PreCreateWindow(CREATESTRUCT &cs)",1,1,subroot5); 

		m_Function.SelectItem(root); 
		m_Function.Expand(root, TVE_EXPAND); 
		}
	return 0;
}

void mybar::OnSize(UINT nType, int cx, int cy) 
{
	CSizingControlBar::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	CRect rc; 
	GetClientRect(&rc); 
	if(flag)
		m_Function.MoveWindow(&rc); 
	else{
		m_Output.MoveWindow(&rc);
		///m_Output.SetWindowText("sda");
		}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -