📄 uart_widget.cpp
字号:
/////////////////////////////////////////////////////////////////////////////
// Name: UART_Widget.cpp
// Purpose:
// Author: Shen Gejun <dragonsn@163.com>
// Modified by:
// Created: 03/08/05 15:48:55
// RCS-ID:
// Copyright: GNU Public Licence
// Licence:
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "UART_Widget.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
////@end includes
#include "UART_Widget.h"
////@begin XPM images
////@end XPM images
#include <Core/Helper.h>
#include <Core/System.h>
namespace LCD {
IMPLEMENT_DYNAMIC_CLASS( MyTextCtrl, wxTextCtrl )
BEGIN_EVENT_TABLE(MyTextCtrl, wxTextCtrl)
EVT_CHAR(MyTextCtrl::OnChar)
// EVT_KEY_DOWN(Mainframe::OnChar)
END_EVENT_TABLE()
void MyTextCtrl::OnChar(wxKeyEvent& event)
{
// AppendText("Fuck")
// ungetc('l', stdin);
Core::System::Key_Event evt;
evt.keycode = event.KeyCode();
evt.alt_pressed = event.AltDown();
evt.ctrl_pressed = event.ControlDown();
evt.shift_pressed = event.ShiftDown();
evt.has_modifier = event.HasModifiers();
Core::Wukong_Get_System().push_key_event(evt);
}
/*!
* UART_Widget type definition
*/
IMPLEMENT_CLASS( UART_Widget, wxFrame )
/*!
* UART_Widget event table definition
*/
BEGIN_EVENT_TABLE( UART_Widget, wxFrame )
////@begin UART_Widget event table entries
////@end UART_Widget event table entries
EVT_CLOSE ( UART_Widget::OnClose )
END_EVENT_TABLE()
/*!
* UART_Widget constructors
*/
UART_Widget::UART_Widget( )
{
}
UART_Widget::UART_Widget( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Create( parent, id, caption, pos, size, style );
}
/*!
* UART_Widget creator
*/
bool UART_Widget::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin UART_Widget member initialisation
////@end UART_Widget member initialisation
////@begin UART_Widget creation
wxFrame::Create( parent, id, caption, pos, size, style );
CreateControls();
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
Centre();
////@end UART_Widget creation
return TRUE;
}
/*!
* Control creation for UART_Widget
*/
void UART_Widget::CreateControls()
{
std::string filepath
= Core::Host_Machine::gen_fullpath(Core::Host_Machine::get_plugin_path(), "LCD.XRC");
// wxXmlResource::Get()->Load(filepath.c_str());
////@begin UART_Widget content construction
UART_Widget* itemFrame1 = this;
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
itemFrame1->SetSizer(itemBoxSizer4);
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer4->Add(itemBoxSizer5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
MyTextCtrl* itemTextCtrl6 = new MyTextCtrl( itemFrame1, ID_TEXTCTRL, _("-UART Screen-\n"), wxDefaultPosition, wxSize(480, 360), wxTE_MULTILINE );
itemTextCtrl6->SetForegroundColour(wxColour(224, 224, 224));
itemTextCtrl6->SetBackgroundColour(wxColour(0, 0, 0));
itemBoxSizer5->Add(itemTextCtrl6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_textctrl = itemTextCtrl6;
wxMenuBar* menuBar = new wxMenuBar;
wxMenu* itemMenu3 = new wxMenu;
menuBar->Append(itemMenu3, _("File"));
itemFrame1->SetMenuBar(menuBar);
////@end UART_Widget content construction
// Create custom windows not generated automatically here.
////@begin UART_Widget content initialisation
////@end UART_Widget content initialisation
}
/*!
* Should we show tooltips?
*/
bool UART_Widget::ShowToolTips()
{
return TRUE;
}
/*!
* Get bitmap resources
*/
wxBitmap UART_Widget::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin UART_Widget bitmap retrieval
return wxNullBitmap;
////@end UART_Widget bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon UART_Widget::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin UART_Widget icon retrieval
return wxNullIcon;
////@end UART_Widget icon retrieval
}
/*!
* wxEVT_CLOSE event handler for ID_BUTTON
*/
void UART_Widget::OnClose( wxCloseEvent &event )
{
this->Hide();
}
} //namespace
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -