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

📄 mainfrm.cpp

📁 中科院开源的ictprop源码,使用方法: 1、修改源码中的InputComboBox.cpp文件 InvokeAction里面的txt文件路径换成你的本地路径; 2、入口在帮助里面
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "prop.h"

#include "MainFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
	ON_WM_CREATE()
	ON_COMMAND(ID_RUN, OnRun)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	CreateInputBar();

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);


	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CMDIFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CMDIFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CMDIFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


BOOL CMainFrame::CreateInputBar()
{
	const int nDropHeight = 150;
	if(!m_wndInputBar.Create(this, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM, IDS_INPUT)   
		|| !m_wndInputBar.LoadToolBar(IDR_INPUTBAR))
	{
		TRACE0("Failed to create inputbar\n");
		return FALSE;
	}
	
	CRect rect;
	m_wndInputBar.GetItemRect(0,&rect);
	rect.top = 0;
	rect.bottom = rect.top + nDropHeight;
	rect.left=100;
	rect.right = rect.left + 300;
	if(!m_wndInputBar.m_comboBox.Create(WS_CHILD| WS_VSCROLL |  
		CBS_DROPDOWN | WS_VISIBLE | WS_TABSTOP | WS_HSCROLL | CBS_AUTOHSCROLL |
		LBS_SORT,
		rect, &m_wndInputBar, IDS_INPUT))
	{
		TRACE0("Failed to create combo-box\n");
		return FALSE;
	}

	m_wndInputBar.m_comboBox.AddString("build [gf]");
	m_wndInputBar.m_comboBox.AddString("parse [sf]");
	m_wndInputBar.m_comboBox.AddString("quit ");
	m_wndInputBar.m_comboBox.SetCurSel(0);
	m_wndInputBar.m_comboBox.m_strInput="build [gf]";
    
	m_wndInputBar.SetBarStyle(m_wndInputBar.GetBarStyle() |
	CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

	m_wndInputBar.ModifyStyle(0,TBSTYLE_FLAT);
	//m_wndInputBar.EnableDocking(CBRS_ALIGN_ANY);
	//EnableDocking(CBRS_ALIGN_ANY);

	//  Create a font for the combobox
	LOGFONT logFont;
	memset(&logFont, 0, sizeof(logFont));

	if (!::GetSystemMetrics(SM_DBCSENABLED))
	{
		// Since design guide says toolbars are fixed height so is the font.
		logFont.lfHeight = -12;
		logFont.lfWeight = FW_BOLD;
		logFont.lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
		CString strDefaultFont;
		strDefaultFont.LoadString(IDS_DEFAULT_FONT);
		lstrcpy(logFont.lfFaceName, strDefaultFont);
		if (!m_wndInputBar.m_font.CreateFontIndirect(&logFont))
			TRACE0("Could Not create font for combo\n");
		else
			m_wndInputBar.m_comboBox.SetFont(&m_wndInputBar.m_font);
	}
	else
	{
		m_wndInputBar.m_font.Attach(::GetStockObject(SYSTEM_FONT));
		m_wndInputBar.m_comboBox.SetFont(&m_wndInputBar.m_font);
	}

	/*
	HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
	if (hFont == NULL)
		hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);

  	m_cmbInput.SendMessage(WM_SETFONT, (WPARAM)hFont);
	*/
	return TRUE;
}

void CMainFrame::OnRun() 
{
	// TODO: Add your command handler code here
	m_wndInputBar.m_comboBox.OnCmd(0);
}

⌨️ 快捷键说明

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