20#include "sdl_input_widget_pair.hpp" 
   28#include <SDL3_ttf/SDL_ttf.h> 
   30#include "sdl_widget.hpp" 
   31#include "sdl_button.hpp" 
   32#include "sdl_buttons.hpp" 
   35                                       const std::string& label, 
const std::string& initial,
 
   36                                       Uint32 flags, 
size_t offset, 
size_t width, 
size_t height)
 
   37    : _flags(flags), _label(renderer, { 0, 
static_cast<float>(offset * (height + _vpadding)),
 
   38                                        static_cast<float>(width), 
static_cast<float>(height) }),
 
   39      _input(renderer, { 
static_cast<float>(width + _hpadding),
 
   40                         static_cast<float>(offset * (height + _vpadding)),
 
   41                         static_cast<float>(width), 
static_cast<float>(height) })
 
   43  _label.update_text(label);
 
   44  update_input_text(initial);
 
 
   49bool SdlInputWidgetPair::set_mouseover(
bool mouseOver)
 
   53  return _input.mouseover(mouseOver);
 
   56bool SdlInputWidgetPair::set_highlight(
bool highlight)
 
   60  return _input.highlight(highlight);
 
   63bool SdlInputWidgetPair::set_str(
const std::string& text)
 
   67  return update_input_text(text);
 
   70bool SdlInputWidgetPair::remove_str(
size_t count)
 
   79  auto newsize = text.size() - std::min<size_t>(text.size(), count);
 
   80  return update_input_text(text.substr(0, newsize));
 
   83bool SdlInputWidgetPair::append_str(
const std::string& text)
 
   90  return update_input_text(itext);
 
   93const SDL_FRect& SdlInputWidgetPair::input_rect()
 const 
   98std::string SdlInputWidgetPair::value()
 const 
  103bool SdlInputWidgetPair::readonly()
 const 
  105  return (_flags & SDL_INPUT_READONLY) != 0;
 
  108bool SdlInputWidgetPair::update()
 
  111  if (!_label.update())
 
  113  if (!_input.update())
 
  118bool SdlInputWidgetPair::update_input_text(
const std::string& txt)
 
  123  if (_flags & SDL_INPUT_MASK)
 
  125    std::fill(text.begin(), text.end(), 
'*');
 
  128  return _input.update_text(text);