void UiObjectQuantityPicker::SetQuantity(unsigned short value)
{
  Rocket::Controls::ElementFormControl* control = reinterpret_cast<Rocket::Controls::ElementFormControl*>(_line_edit);
  std::stringstream                     stream;
  std::string                           str;

  if (value > _max_quantity)
    value = _max_quantity;
  stream << value;
  stream >> str;
  control->SetValue(str.c_str());
}
예제 #2
0
void Console::ProcessEvent(Rocket::Core::Event& event)
{
    String controlId(event.GetCurrentElement()->GetId().CString());
    if (controlId == "cmd")
    {
        int key = event.GetParameters()->Get<int>("key_identifier", 0);
        Rocket::Controls::ElementFormControl* inputBox =
            static_cast<Rocket::Controls::ElementFormControl*>(event.GetCurrentElement());
        if (key == Rocket::Core::Input::KI_RETURN)
        {
            String command = inputBox->GetValue().CString();
            inputBox->SetValue("");
            Execute(command);
        }
    }
}