MenubarItemWidget::MenubarItemWidget(MenubarItem *item, MenubarItemSource *source, TBSelectItemViewer *source_viewer, int index) : m_source(source) , m_source_viewer(source_viewer) , m_index(index) { SetSkinBg(TBIDC("TBSelectItem")); SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY); SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP); SetPaintOverflowFadeout(false); TBWidget* root = GetContentRoot(); TBFontDescription fd; fd.SetID(TBIDC("Vera")); fd.SetSize(12); TBTextField* text = new TBTextField(); text->SetIgnoreInput(true); text->SetText(item->str); text->SetFontDescription(fd); root->AddChild(text); if (item->shortcut_.Length()) { TBWidget* spacer = new TBWidget(); spacer->SetIgnoreInput(true); spacer->SetGravity(WIDGET_GRAVITY_LEFT_RIGHT); root->AddChild(spacer); TBTextField* shortcut = new TBTextField(); shortcut->SetIgnoreInput(true); shortcut->SetText(item->shortcut_.CString()); shortcut->SetFontDescription(fd); shortcut->SetGravity(WIDGET_GRAVITY_RIGHT); root->AddChild(shortcut); } }