void CppLayoutPreviewer::CreatePreviewRibbonTools(wxRibbonButtonBar & buttonBar) { bool hideLabels = false; wxConfigBase::Get()->Read( _T( "/Skin/HideLabels" ), &hideLabels ); buttonBar.AddButton(idRibbonPlay, !hideLabels ? _("Play") : gd::String(), gd::SkinHelper::GetRibbonIcon("start"), _("Start the preview")); buttonBar.AddButton(idRibbonPlayWin, !hideLabels ? _("Play in a window") : gd::String(), gd::SkinHelper::GetRibbonIcon("startwindow"), _("Start the preview in an external window")); buttonBar.AddButton(idRibbonPause, !hideLabels ? _("Pause") : gd::String(), gd::SkinHelper::GetRibbonIcon("pause"), _("Pause the preview")); buttonBar.AddButton(idRibbonDebugger, !hideLabels ? _("Debugger") : gd::String(), gd::SkinHelper::GetRibbonIcon("bug"), _("Show the debugger to view the state of the game")); buttonBar.AddButton(idRibbonProfiler, !hideLabels ? _("Profiling") : gd::String(), gd::SkinHelper::GetRibbonIcon("profiler"), _("Show the profiler to monitor performances")); }
bool ICtl_ribbon_buttonbar::AddCtrlItem(EvtGroup* pevt) { const BitmapBundle& bundle(pevt->GetBundle(16, 1)); wxRibbonButtonBarButtonBase* item = m_p_wx_impl->AddButton(pevt->m_nId, str2wx(pevt->MakeLabel()),bundle.bmp_normal,"", wxRIBBON_BUTTON_DROPDOWN); InitToolItem(pevt, item); return true; }
ICtl_ribbon_buttonbar(IWindowPtr p, EvtGroup* pevt, int wd) :ICtl_ribbon_panel(pevt) { Create(p, pevt->m_nId, str2wx(Translate(name)), wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxRIBBON_PANEL_NO_AUTO_MINIMISE | wxRIBBON_PANEL_EXT_BUTTON); wd = 16; m_p_wx_impl = new wxRibbonButtonBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_p_wx_impl->SetName(str2wx(m_pGroup->m_sId)); for (size_t i = 0; i<pevt->size(); i++) { EvtCommand* pCommand = (*pevt)[i].get(); if (pCommand->flags.get(EvtBase::FLAG_HIDE_UI)) continue; if (pCommand->flags.get(EvtBase::FLAG_SEPARATOR)) { continue; } pCommand->CreateCtrlItem(this); } bool flag = m_p_wx_impl->Realize(); if (!flag) { System::LogMessage("wxRibbonButtonBar realize failed!"); } if (pevt->flags.get(EvtBase::FLAG_HIDE_UI)) m_p_wx_impl->Show(false); if (pevt->flags.get(EvtBase::FLAG_DISABLE)) m_p_wx_impl->Enable(false); pevt->flags.set(EvtBase::FLAG_CHECKED, !pevt->flags.get(EvtBase::FLAG_HIDE_UI)); m_p_wx_impl->SetName(str2wx(pevt->m_sId)); this->Connect(wxID_ANY, wxEVT_RIBBONBUTTONBAR_CLICKED, wxRibbonButtonBarEventHandler(ICtl_ribbon_buttonbar::OnRibbonButtonClick)); this->Connect(wxID_ANY, wxEVT_RIBBONBUTTONBAR_DROPDOWN_CLICKED, wxRibbonButtonBarEventHandler(ICtl_ribbon_buttonbar::OnRibbonButtonDropdown)); }
bool ICtl_ribbon_buttonbar::AddCtrlItem(EvtCommand* pevt) { if (pevt->flags.get(EvtCommand::FLAG_SEPARATOR)) { return true; } wxRibbonButtonKind kind = wxRIBBON_BUTTON_NORMAL; if (pevt->flags.get(EvtCommand::FLAG_CHECK)) kind = wxRIBBON_BUTTON_TOGGLE; const BitmapBundle& bundle(pevt->GetBundle(16, 1)); wxRibbonButtonBarButtonBase* item = m_p_wx_impl->AddButton(pevt->m_nId, str2wx(pevt->MakeLabel()),bundle.bmp_normal,"", kind); InitToolItem(pevt, item); return true; }