예제 #1
0
  void SettingComboBox::Update()
  {
    CEGUI::Combobox* box = getComboBoxW();

    if (settings.GetSize())
    {
      csRef<Setting> setting = settings.Get(0);
      if (setting->IsValid())
      {
        if (setting->IsDefault())
          box->getEditbox()->setText("Default");
        else
          box->getEditbox()->setText(GetKey(setting->GetAsString().c_str()));
      }
    }

    if (box->getItemCount() == 0)
    {
      Values::const_iterator it = values.begin();
      for (size_t i = 0; it != values.end(); it++, i++)
      {
        CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem(it->first.c_str(), (CEGUI::uint)i);
        item->setTextColours(CEGUI::colour(0.f, 0.f, 0.f)); 
        box->getDropList()->addItem(item);
      }
    }
  }
예제 #2
0
  void SettingComboBox::onSized(CEGUI::WindowEventArgs& e)
  {
    CEGUI::Window::onSized(e);
    CEGUI::Combobox* box = getComboBoxW();
    box->getEditbox()->setReadOnly(true);

    // Calculate height.
    float h = box->getEditbox()->getPixelSize().d_height+5.0f;
    for (size_t i =0; i < box->getItemCount(); i++)
    {
      h += box->getListboxItemFromIndex(i)->getPixelSize().d_height;
    }

    box->setHeight(CEGUI::UDim(0.0f, h));
    box->setClippedByParent(false);
    box->getDropList()->getVertScrollbar()->setEnabled(false);
    box->getDropList()->getVertScrollbar()->setAlpha(0.0f);
  }