本人学的是wxWidgets,就以它为例了。
#include <wx/app.h>
#include <wx/image.h>
#include <wx/msgdlg.h>
#include <wx/string.h>
#include <wx/intl.h>
#include <wx/menu.h>
#include <wx/statusbr.h>
#include <wx/frame.h>
//*)
class SampleApp : public wxApp
{
public:
virtual bool OnInit()
}
IMPLEMENT_APP(SampleApp)
bool SampleApp::OnInit()
{
//(*AppInitialize
bool wxsOK = true
wxInitAllImageHandlers()
if ( wxsOK )
{
SampleFrame* Frame = new SampleFrame(0)
Frame->Show()
SetTopWindow(Frame)
}
return wxsOK
}
class SampleFrame: public wxFrame
{
public:
SampleFrame(wxWindow* parent,wxWindowID id = -1)
virtual ~SampleFrame()
private:
//(*Handlers(SampleFrame)
void OnQuit(wxCommandEvent&event)
void OnAbout(wxCommandEvent&event)
//*)
//(*Identifiers(SampleFrame)
static const long idMenuQuit
static const long idMenuAbout
static const long ID_STATUSBAR1
//*)
//(*Declarations(SampleFrame)
wxStatusBar* StatusBar1
//*)
DECLARE_EVENT_TABLE()
}
//(*IdInit(SampleFrame)
const long SampleFrame::idMenuQuit = wxNewId()
const long SampleFrame::idMenuAbout = wxNewId()
const long SampleFrame::ID_STATUSBAR1 = wxNewId()
//*)
BEGIN_EVENT_TABLE(SampleFrame,wxFrame)
//(*EventTable(SampleFrame)
//*)
END_EVENT_TABLE()
SampleFrame::SampleFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(SampleFrame)
wxMenuItem* MenuItem2
wxMenuItem* MenuItem1
wxMenu* Menu1
wxMenuBar* MenuBar1
wxMenu* Menu2
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"))
MenuBar1 = new wxMenuBar()
Menu1 = new wxMenu()
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL)
Menu1->Append(MenuItem1)
MenuBar1->Append(Menu1, _("&File"))
Menu2 = new wxMenu()
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL)
Menu2->Append(MenuItem2)
MenuBar1->Append(Menu2, _("Help"))
SetMenuBar(MenuBar1)
StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"))
int __wxStatusBarWidths_1[1] = { -1 }
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL }
StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1)
StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1)
SetStatusBar(StatusBar1)
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SampleFrame::OnQuit)
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&SampleFrame::OnAbout)
//*)
}
SampleFrame::~SampleFrame()
{
//(*Destroy(SampleFrame)
//*)
}
void SampleFrame::OnQuit(wxCommandEvent&event)
{
Close()
}
void SampleFrame::OnAbout(wxCommandEvent&event)
{
wxString msg = wxT("This is a sample windows!")
wxMessageBox(msg, _("Welcome to..."))
}
这是我的解决方案:开启FrameBuffer,然后安装fbterm,
不光完美解决中文乱码,还能看图片、看电影——前提是,你禁得起折腾~
不过其实也不是太麻烦,只是相关资料太零散。
这里作了一个汇总:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)