1 Star 0 Fork 0

yeyanhong/MYWXWIDGETS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
wx_designMain.cpp 6.20 KB
一键复制 编辑 原始数据 按行查看 历史
yeyanhong 提交于 2021-05-30 17:33 . 1st commit
/***************************************************************
* Name: wx_designMain.cpp
* Purpose: Code for Application Frame
* Author: yeyh ()
* Created: 2021-05-27
* Copyright: yeyh ()
* License:
**************************************************************/
#define _CRT_SECURE_NO_WARNINGS
#include "wx_designMain.h"
#include <wx/msgdlg.h>
//(*InternalHeaders(wx_designFrame)
#include <wx/artprov.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/intl.h>
#include <wx/string.h>
//*)
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(wx_designFrame)
const long wx_designFrame::ID_MENUBARCLEAR = wxNewId();
const long wx_designFrame::ID_MENUBARLOAD = wxNewId();
const long wx_designFrame::ID_MENUBARSAVE = wxNewId();
const long wx_designFrame::idMenuQuit = wxNewId();
const long wx_designFrame::ID_MENUBARCOPY = wxNewId();
const long wx_designFrame::ID_MENUBARDRAWTEXT = wxNewId();
const long wx_designFrame::ID_MENUBARCYCLE = wxNewId();
const long wx_designFrame::idMenuAbout = wxNewId();
const long wx_designFrame::ID_STATUSBAR1 = wxNewId();
const long wx_designFrame::ID_TOOLBARCLEAR = wxNewId();
const long wx_designFrame::ID_TOOLBARLOAD = wxNewId();
const long wx_designFrame::ID_TOOLBARITEM2 = wxNewId();
const long wx_designFrame::ID_TOOLBARITEM3 = wxNewId();
const long wx_designFrame::ID_MENUBARDRAWCIRCLE = wxNewId();
const long wx_designFrame::ID_TOOLBAR1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(wx_designFrame,wxFrame)
//(*EventTable(wx_designFrame)
//*)
END_EVENT_TABLE()
wx_designFrame::wx_designFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(wx_designFrame)
wxMenu* Menu1;
wxMenu* Menu2;
wxMenuBar* MenuBar1;
wxMenuItem* MenuItem1;
wxMenuItem* MenuItem2;
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
MenuBar1 = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem3 = new wxMenuItem(Menu1, ID_MENUBARCLEAR, _("&Clear"), wxEmptyString, wxITEM_NORMAL);
Menu1->Append(MenuItem3);
Menu1->AppendSeparator();
MenuItem4 = new wxMenuItem(Menu1, ID_MENUBARLOAD, _("&Load"), wxEmptyString, wxITEM_NORMAL);
Menu1->Append(MenuItem4);
Menu1->AppendSeparator();
MenuItem5 = new wxMenuItem(Menu1, ID_MENUBARSAVE, _("&Save"), wxEmptyString, wxITEM_NORMAL);
Menu1->Append(MenuItem5);
MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("&Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MenuBar1->Append(Menu1, _("&File"));
Menu3 = new wxMenu();
MenuItem6 = new wxMenuItem(Menu3, ID_MENUBARCOPY, _("&Copy"), wxEmptyString, wxITEM_NORMAL);
Menu3->Append(MenuItem6);
MenuItem7 = new wxMenuItem(Menu3, ID_MENUBARDRAWTEXT, _("&Draw Text"), wxEmptyString, wxITEM_NORMAL);
Menu3->Append(MenuItem7);
MenuItem8 = new wxMenuItem(Menu3, ID_MENUBARCYCLE, _("&Drawcycle"), wxEmptyString, wxITEM_NORMAL);
Menu3->Append(MenuItem8);
MenuBar1->Append(Menu3, _("&EDIT"));
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);
ToolBar1 = new wxToolBar(this, ID_TOOLBAR1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL, _T("ID_TOOLBAR1"));
ToolBarItem1 = ToolBar1->AddTool(ID_TOOLBARCLEAR, _("Clear"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_DELETE")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, _("Clear"), wxEmptyString);
ToolBarItem2 = ToolBar1->AddTool(ID_TOOLBARLOAD, _("Load"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_FILE_OPEN")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, _("Load"), wxEmptyString);
ToolBarItem3 = ToolBar1->AddTool(ID_TOOLBARITEM2, _("Save"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_FILE_SAVE")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, _("Save"), wxEmptyString);
ToolBarItem4 = ToolBar1->AddTool(ID_TOOLBARITEM3, _("Draw text"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_REPORT_VIEW")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, _("Draw text"), wxEmptyString);
ToolBarItem5 = ToolBar1->AddTool(ID_MENUBARDRAWCIRCLE, _("Draw circle"), wxArtProvider::GetBitmap(wxART_MAKE_ART_ID_FROM_STR(_T("wxART_REPORT_VIEW")),wxART_TOOLBAR), wxNullBitmap, wxITEM_NORMAL, _("Draw Circle"), wxEmptyString);
ToolBar1->Realize();
SetToolBar(ToolBar1);
Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wx_designFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wx_designFrame::OnAbout);
Connect(ID_MENUBARLOAD,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&wx_designFrame::OnLoad);
//*)
}
wx_designFrame::~wx_designFrame()
{
//(*Destroy(wx_designFrame)
//*)
}
void wx_designFrame::OnQuit(wxCommandEvent& event)
{
Close();
}
void wx_designFrame::OnAbout(wxCommandEvent& event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("Welcome to..."));
}
//YEYH
typedef struct Point
{
double x;
double y;
double z;
}MyPoint;
void wx_designFrame::OnLoad(wxCommandEvent& event)
{
char buf[1024];
strcpy(buf,"hello world");
MyPoint p1={12.2,22.0,0};
wxString msg = wxString::Format(wxT("%lf"),p1.x);// int %d; float %f; double %lf %le
char* pp1;
msg.Append(typeid(pp1).name, wxConvUTF8);
msg.Append(typeid(pp1).name, wxConvUTF8);
wxMessageBox(msg, _("Welcome to..."));
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/ye-yanhong/mywxwidgets.git
git@gitee.com:ye-yanhong/mywxwidgets.git
ye-yanhong
mywxwidgets
MYWXWIDGETS
master

搜索帮助