Example #1
0
Tempest::Widget* ListBox::createDropList() {
  if(!listDelegate)
    return nullptr;

  Panel *box = new Panel();

  box->setLayout( Tempest::Horizontal );
  box->layout().setMargin(6);
  box->setPosition( mapToRoot( Tempest::Point(0,h()) ) );

  ScrollWidget *sw = new ScrollWidget();
  ListView* list   = new ListView(Vertical);
  list->setDefaultItemRole(ListDelegate::R_ListBoxItem);
  list->setDelegate(ProxyDelegate(listDelegate));

  sw->centralWidget().layout().add(list);
  int wx = std::max(w(), list->minSize().w+box->margin().xMargin());
  box->resize(wx, list->h()+box->margin().yMargin());
  box->layout().add(sw);

  return box;
  }