// 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;
}
效果: