Esempio n. 1
0
Entry::Entry(size_t maxsize, const char *format, ...)
  : Widget(kEntryWidget)
  , m_timer(500, this)
  , m_maxsize(maxsize)
  , m_caret(0)
  , m_scroll(0)
  , m_select(0)
  , m_hidden(false)
  , m_state(false)
  , m_readonly(false)
  , m_password(false)
  , m_recent_focused(false)
  , m_lock_selection(false)
{
  char buf[4096];

  // formatted string
  if (format) {
    va_list ap;
    va_start(ap, format);
    vsprintf(buf, format, ap);
    va_end(ap);
  }
  // empty string
  else {
    buf[0] = 0;
  }

  // TODO support for text alignment and multi-line
  // widget->align = JI_LEFT | JI_MIDDLE;
  setText(buf);

  setFocusStop(true);
  initTheme();
}
Esempio n. 2
0
TextBox::TextBox(const char* text, int align)
 : Widget(JI_TEXTBOX)
{
  setFocusStop(true);
  setAlign(align);
  setText(text);
  initTheme();
}
Esempio n. 3
0
TextBox::TextBox(const std::string& text, int align)
 : Widget(kTextBoxWidget)
{
  setFocusStop(true);
  setAlign(align);
  setText(text);
  initTheme();
}
Esempio n. 4
0
ButtonBase::ButtonBase(const std::string& text,
                       WidgetType type,
                       WidgetType behaviorType,
                       WidgetType drawType)
  : Widget(type)
  , m_pressedStatus(false)
  , m_behaviorType(behaviorType)
  , m_handleSelect(true)
{
  setAlign(CENTER | MIDDLE);
  setText(text);
  setFocusStop(true);

  // Initialize theme
  setType(drawType);            // TODO Fix this nasty trick
  initTheme();
  setType(type);
}
Esempio n. 5
0
Entry::Entry(const int maxsize, const char* format, ...)
  : Widget(kEntryWidget)
  , m_timer(500, this)
  , m_maxsize(maxsize)
  , m_caret(0)
  , m_scroll(0)
  , m_select(0)
  , m_hidden(false)
  , m_state(false)
  , m_readonly(false)
  , m_recent_focused(false)
  , m_lock_selection(false)
  , m_translate_dead_keys(true)
{
  enableFlags(CTRL_RIGHT_CLICK);

  // formatted string
  char buf[4096];               // TODO buffer overflow
  if (format) {
    va_list ap;
    va_start(ap, format);
    vsprintf(buf, format, ap);
    va_end(ap);
  }
  // empty string
  else {
    buf[0] = 0;
  }

  // TODO support for text alignment and multi-line
  // widget->align = LEFT | MIDDLE;
  setText(buf);

  setFocusStop(true);
  initTheme();
}