Ejemplo n.º 1
0
void FileListBox::_updateItemText(gfx::Engine& painter, ListBoxItem& item, const Rect& textRect, Font font, const Rect& frameRect )
{
  ListBox::_updateItemText( painter, item, textRect, font, frameRect );

  if( !isFlag( showExtension ) )
  {
    item.clear();

    std::string text = vfs::Path( item.text() ).baseName( false ).toString();
    Rect finalRect = font.getTextRect( text, Rect( Point(), frameRect.size() ), align::upperLeft, align::center );

    item.draw( text, font, finalRect.lefttop() + Point( 10, 0)  );
  }

  if( isFlag( showTime ) )
  {
    Font f = Font::create( FONT_1 );

    std::string timeStr = item.data( "time" ).toString();
    Rect finalRect = f.getTextRect( timeStr, Rect( Point(), frameRect.size() ), align::lowerRight, align::center );

    item.draw( timeStr, f, finalRect.lefttop() - Point( 10, 0)  );
  }
}
Ejemplo n.º 2
0
void LoadFileDialog::Impl::resolveItemSelected(const ListBoxItem& item)
{
  saveItemText = item.text();
  if( btnLoad ) btnLoad->setEnabled( !saveItemText.empty() );
  if( btnDelete ) btnDelete->setEnabled( !saveItemText.empty() );
}