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

📄 uart_screen.cpp

📁 浙江大学的悟空嵌入式系统模拟器
💻 CPP
字号:
/*
*  Copyright (c) 2005 Zhejiang University, P.R.China
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ 

//=============================================================================
/**
*  \file    Device/LCD/UART_Screen.cpp
*
*  $Id: UART_Screen.cpp,v 1.1 2005/06/08 08:12:25 qilj Exp $
*
*  \author  Huacheng Ke <sese_zju@yahoo.com.cn>
*/
//=============================================================================

#include "stdafx.h"

#include <istream>
#include <ostream>
#include <fstream>
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif


#include "./UART_Widget.h"

#include "./UART_Screen.h"

namespace LCD {

	using Core::Observer;

	IMPLEMENT_DYNAMIC_CLASS(UART_Screen, Observer)

	UART_Screen::UART_Screen(void)
	{

		dialog_ = new LCD::UART_Widget(NULL);
	}

	UART_Screen::~UART_Screen(void)
	{
		delete dialog_;
	}

	void UART_Screen::show(void)
	{
		dialog_->Show(true);
	}

	void UART_Screen::hide(void)
	{
		dialog_->Show(false);
	}

	void UART_Screen::update(Core::Part & part)
	{
		if (!dialog_->IsShown())
			return;

		input_.clear();

		std::string text;
		char ch;
		while(input_.get(ch))
		{
			text += ch;
		}
		if (text != "")
		{
			dialog_->m_textctrl->AppendText(text.c_str());
		}

		return;
	}

	void UART_Screen::reset(Core::Part & part)
	{
		dialog_->m_textctrl->Clear();

	}

	void UART_Screen::on_create(void)
	{
		name_ = "UART_Screen";

		input_.open(Core::Log::instance().get_stdout_filepath().c_str());
	}
	
	void UART_Screen::on_destroy(void)
	{
		dialog_->Destroy();
		delete dialog_;
	}

}

⌨️ 快捷键说明

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