Exemplo n.º 1
0
WWidget *EventsDemo::wKeyEvent()
{
  WContainerWidget *result = new WContainerWidget();

  topic("WKeyEvent", result);
  addText(tr("events-WKeyEvent-1"), result);
  WLineEdit *l = new WLineEdit(result);
  l->setTextSize(50);
  l->keyWentUp().connect(this, &EventsDemo::showKeyWentUp);
  l->keyWentDown().connect(this, &EventsDemo::showKeyWentDown);
  
  addText(tr("events-WKeyEvent-2"), result);
  l = new WLineEdit(result);
  l->setTextSize(50);
  l->keyPressed().connect(this, &EventsDemo::showKeyPressed);
  
  addText(tr("events-WKeyEvent-3"), result);
  l = new WLineEdit(result);
  l->setTextSize(50);
  l->enterPressed().connect(this, &EventsDemo::showEnterPressed);
  l->escapePressed().connect(this, &EventsDemo::showEscapePressed);
  new WBreak(result);
  addText("Last event: ", result);
  keyEventType_ = new WText(result);
  new WBreak(result);
  keyEventDescription_ = new WText(result);

  return result;
}
Exemplo n.º 2
0
WWidget *FormWidgets::wSuggestionPopup()
{
  WContainerWidget *result = new WContainerWidget();

  topic("WSuggestionPopup", result);
  addText(tr("formwidgets-WSuggestionPopup"), result);

  // options for email address suggestions
  WSuggestionPopup::Options contactOptions;
  contactOptions.highlightBeginTag = "<span class=\"highlight\">";
  contactOptions.highlightEndTag = "</span>";
  contactOptions.listSeparator = ',';
  contactOptions.whitespace = " \\n";
  contactOptions.wordSeparators = "-., \"@\\n;";
  contactOptions.appendReplacedText = ", ";

  WSuggestionPopup *sp =
    new WSuggestionPopup(WSuggestionPopup::generateMatcherJS(contactOptions),
			 WSuggestionPopup::generateReplacerJS(contactOptions),
			 result);
  WLineEdit *le = new WLineEdit(result);
  le->setTextSize(50);
  le->setInline(false);
  sp->forEdit(le);
  sp->addSuggestion("John Tech <*****@*****.**>",
		    "John Tech <*****@*****.**>");
  sp->addSuggestion("Johnny Cash <*****@*****.**>", 
		    "Johnny Cash <*****@*****.**>");
  sp->addSuggestion("John Rambo <*****@*****.**>",
		    "John Rambo <*****@*****.**>");
  sp->addSuggestion("Johanna Tree <*****@*****.**>",
		    "Johanna Tree <*****@*****.**>");

  return result;
}
Exemplo n.º 3
0
WLineEdit *StyleExample::createColorLineEdit(int value)
{
  WLineEdit *le = new WLineEdit(boost::lexical_cast<std::wstring>(value),
				this);
  le->setTextSize(3);
  le->setValidator(new WIntValidator(0, 255));

  return le;
}