// RibbonSample.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <wx/wx.h>
#include "wx/wxprec.h"
#include "wx/app.h"
#include "wx/frame.h"
#include "wx/textctrl.h"
#include "wx/ribbon/bar.h"
#include "wx/ribbon/buttonbar.h"
#include "wx/ribbon/gallery.h"
#include "wx/ribbon/toolbar.h"
#include "wx/sizer.h"
#include "wx/menu.h"
#include "wx/msgdlg.h"
#include "wx/dcbuffer.h"
#include "wx/colordlg.h"
#include "wx/artprov.h"
#include "wx/combobox.h"
#include "wx/tglbtn.h"
#include "wx/wrapsizer.h"
class MyApp : public wxApp
{
public:
bool OnInit() wxOVERRIDE;
};
wxDECLARE_APP(MyApp);
wxIMPLEMENT_APP(MyApp);
class MyFrame : public wxFrame
{
public:
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(800, 600))
{
wxRibbonBar* mainMenu = new wxRibbonBar(this, -1, wxDefaultPosition, wxSize(20, 40));
wxRibbonPage* home = new wxRibbonPage(mainMenu, wxID_ANY, wxT("Home"));
wxRibbonPanel *test_panel1 = new wxRibbonPanel(home, wxID_ANY, wxT("Panel 1"),
wxNullBitmap, wxDefaultPosition, wxSize(40, 60));
wxRibbonPanel *test_panel2 = new wxRibbonPanel(home, wxID_ANY, wxT("Panel 2"),
wxNullBitmap, wxDefaultPosition, wxSize(40, 60));
wxRibbonPage* page = new wxRibbonPage(mainMenu, wxID_ANY, wxT("Another Page"));
wxRibbonPanel *test_panel3 = new wxRibbonPanel(page, wxID_ANY, wxT("Panel 3"),
wxNullBitmap, wxDefaultPosition, wxSize(640, 60));
mainMenu->Realize();
Centre();
}
~MyFrame(){};
};
bool MyApp::OnInit()
{
if (!wxApp::OnInit())
return false;
wxFrame* frame = new MyFrame(wxT("Ribbon Sample"));
frame->Show();
return true;
}
效果:文章来源:https://www.toymoban.com/news/detail-623349.html
文章来源地址https://www.toymoban.com/news/detail-623349.html
到了这里,关于wxwidgets Ribbon使用简单实例的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!