void CButtonBar::PushLabel(const std::string &n, const std::string &d) { CBox *lbox = new CBox(HORIZONTAL, false); CLabel *label = new CLabel(n + ": "); label->SetDFColors(GetFColors()); lbox->StartPack(label, false, false, 0, 0); label = new CLabel(d); label->SetDFColors(GetDFColors()); lbox->StartPack(label, false, false, 0, 0); m_pCurBox->StartPack(lbox, true, false, 0, 0); }
void CLuaGroup::AddLuaWidget(CLuaWidget *w) { if (m_bInitEnable) { m_bInitEnable = false; Enable(true); } // Update each widget's max size, this is necessary before adding new widget because they // may request too much width const TWidgetList &list = GetWidgetList(); const int size = SafeConvert<int>(list.size()) + 1; // +1 because new widget is not added yet const int maxwidgetsw = NNCurses::GetMaxWidth() - 6; const int maxwidth = (maxwidgetsw - (LuaWidgetSpacing() * (size-1))) / size; for (TWidgetList::const_iterator it=list.begin(); it!=list.end(); it++) { CLuaWidget *luaw = dynamic_cast<CLuaWidget *>(*it); if (luaw) luaw->SetMaxWidth(maxwidth); } CBox *box = new CBox(VERTICAL, false); box->StartPack(w, true, false, 0, 0); w->SetMaxWidth(maxwidth); StartPack(box, true, true, 0, 0); }