void CommentContainerWidget::onTokenReady(uint32_t token, bool ok)
{
    if(ok)
    {
        clear();
        std::vector<RsGxsComment> comments;
        //_CommentService->getRelatedComments(token, comments);
        _CommentService->getCommentData(token, comments);
        for(std::vector<RsGxsComment>::iterator vit = comments.begin(); vit != comments.end(); vit++)
        {
            RsGxsComment& comment = *vit;
            Wt::WContainerWidget* outerContainer = new Wt::WContainerWidget(this);
            Wt::WBorderLayout *layout = new Wt::WBorderLayout();
            outerContainer->setLayout(layout);
            AvatarWidgetWt* avatar = new AvatarWidgetWt(true);
            avatar->setIdentity(comment.mMeta.mAuthorId);
            layout->addWidget(avatar, Wt::WBorderLayout::West);
            Wt::WLabel* text = new Wt::WLabel(Wt::WString::fromUTF8(comment.mComment));
            layout->addWidget(text, Wt::WBorderLayout::Center);
        }
        // note: the widgets the pointers where pointing to where deleted by clear()
        _TextArea = new Wt::WTextArea(this);
        _TextArea->setEmptyText("your comment");
        //_IdChooser = new GxsIdChooserWt(this);
        _SubmitButton = new Wt::WPushButton("submit", this);
        _SubmitButton->clicked().connect(this, &CommentContainerWidget::onSubmitComment);
    }
    else
    {
        clear();
        new Wt::WLabel("FAIL", this);
    }
}
Example #2
0
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
Wt::WWidget * WelcomeScreen::makeRegistrationTab()
{
    Wt::WContainerWidget *cont = new Wt::WContainerWidget();
    rg_txt_ = new Wt::WText("Hier koennen Sie ihr neues Flugbuch eroeffnen.", cont);
    cont->addWidget(new Wt::WBreak());
    cont->addWidget(new Wt::WBreak());


    Wt::WTable *layout = new Wt::WTable(cont);

    Wt::WLabel *usernameLabel = new Wt::WLabel("Benutzername: ", layout->elementAt(0, 0));
    layout->elementAt(0, 0)->resize(Wt::WLength(14, Wt::WLength::FontEx), Wt::WLength());
    rg_username_ = new Wt::WLineEdit(layout->elementAt(0, 1));
    usernameLabel->setBuddy(rg_username_);

    Wt::WLabel *passwordLabel = new Wt::WLabel("Passwort: ", layout->elementAt(1, 0));
    rg_password_ = new Wt::WLineEdit(layout->elementAt(1, 1));
    rg_password_->setEchoMode(Wt::WLineEdit::Password);
    passwordLabel->setBuddy(rg_password_);

    Wt::WLabel *passwordLabel2 = new Wt::WLabel("wiederholen: ", layout->elementAt(2, 0));
    rg_password2_ = new Wt::WLineEdit(layout->elementAt(2, 1));
    rg_password2_->setEchoMode(Wt::WLineEdit::Password);
    rg_password2_->enterPressed().connect(SLOT(this, WelcomeScreen::doRegister));
    passwordLabel2->setBuddy(rg_password2_);

    Wt::WLabel *stdflareas = new Wt::WLabel("Standardfluggebiete importieren: ", layout->elementAt(3, 0));
    rg_useStdLoc_ = new Wt::WCheckBox(layout->elementAt(3, 1));
    stdflareas->setBuddy(rg_useStdLoc_);

    Wt::WPushButton *LoginButton = new Wt::WPushButton("Registrieren", layout->elementAt(4, 1));
    LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doRegister));

    return cont;
}
Example #3
0
Tester::Tester(const Wt::WEnvironment& env)
    : Wt::WApplication(env)
{

    setTheme(new Wt::WBootstrapTheme());
    useStyleSheet("resources/lpeg_tester.css");

    Wt::WContainerWidget* container = new Wt::WContainerWidget();
    container->setStyleClass("page");

    Wt::WVBoxLayout* vbox = new Wt::WVBoxLayout();
    container->setLayout(vbox);

    vbox->addWidget(Title(), 1);

    Wt::WHBoxLayout* hbox = new Wt::WHBoxLayout();
    vbox->addLayout(hbox);

    hbox->addWidget(Input(), 1);
    hbox->addWidget(Result(), 1);

    root()->addWidget(container);

    HandleInternalPath(internalPath());
    internalPathChanged().connect(this, &Tester::HandleInternalPath);
}
Example #4
0
About::About() {
	WContainerWidget *cw = new 	WContainerWidget();
	
	cw->addWidget(new WBreak());
	cw->addWidget(new WBreak());

	
	this->addWidget(cw);
Wt::WContainerWidget *j = new Wt::WContainerWidget(this);
 j->resize(WLength::Auto, 200);

Wt::WGridLayout *lay = new Wt::WGridLayout();
store="<p>jonny jonny yes papa," 
      " Eating sugar no papa "
      "Telling lie, no papa " 
      "Open your mouth .</p>haha. ";


//lay->addWidget(new Wt::WText("this site is made by parvinder rajput. \n who are pursuing is b.tech from gndec ludhiana."),0,0);
// lay->addWidget(new Wt::WText("this is dean of consultancy cell"), 0, 2);
 //lay->addWidget(new Wt::WText("Hello"), 0, 0);
 
//lay->addWidget(new Wt::WImage("/images/Footer.jpg"), 0,0);
lay->addWidget(new Wt::WText(store ), 0,3);
lay->addWidget(new Wt::WImage("/images/jj.jpg"), 0,0);
lay->addWidget(new Wt::WImage("/images/uu.gif"), 0,2);
j->setLayout(lay); 
}
Example #5
0
void WMenuItem::setMenu(WMenu *menu)
{
  subMenu_ = menu;
  subMenu_->parentItem_ = this;

  Wt::WContainerWidget *sparent
    = dynamic_cast<Wt::WContainerWidget *>(subMenu_->parent());
  if (sparent)
    sparent->removeWidget(subMenu_);

  addWidget(subMenu_);
  if (subMenu_->isPopup() &&
      parentMenu() && parentMenu()->isPopup()) {
    subMenu_->webWidget()->setZIndex(std::max(parentMenu()->zIndex() + 100, subMenu_->zIndex()));
  }

  WPopupMenu *popup = dynamic_cast<WPopupMenu *>(subMenu_);
  if (popup) {
    popup->setJavaScriptMember("wtNoReparent", "true");
    setSelectable(false);
    popup->setButton(anchor());
    updateInternalPath();
    // WPopupMenus are hidden by default, 'show' this WPopupMenu
    // but not really, since the parent is still hidden. This fixes
    // an issue where child widgets would remain unexposed, even
    // though this submenu was open (e.g. in a submenu where items
    // are checkable)
    if (dynamic_cast<WPopupMenu*>(menu_))
      popup->show();
  }
}
Example #6
0
Wt::WWidget* Tester::Input()
{

    Wt::WContainerWidget* container = new Wt::WContainerWidget();
    container->setStyleClass("input_container");

    Wt::WText* t = new Wt::WText("Input", container);
    t->setStyleClass("area_title");
    new Wt::WBreak(container);
    mInput = new Wt::WTextArea(container);
    mInput->setText("20131220T094700");

    new Wt::WBreak(container);

    t = new Wt::WText("Grammar", container);
    t->setStyleClass("area_title");
    new Wt::WBreak(container);
    mGrammar = new Wt::WTextArea(container);
    mGrammar->setRows(15);
    mGrammar->setText("local l = require 'lpeg'\nl.locale(l)\ngrammar = l.C(l.digit^-4)");

    Wt::WPushButton* button = new Wt::WPushButton("Test Grammar", container);
    button->clicked().connect(this, &Tester::GrammarButton);

    button = new Wt::WPushButton("Benchmark Grammar", container);
    button->clicked().connect(this, &Tester::BenchmarkButton);

    button = new Wt::WPushButton("Share Grammar", container);
    button->clicked().connect(this, &Tester::ShareGrammar);

    return container;
}
Wt::WWidget * ribi::con3::WtMenuDialog::CreateNewSelectPlayersDialog()
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  dialog->addWidget(m_select);
  return dialog;
}
Example #8
0
/**
  Constructor for View

  /usr/lib/Wt/examples/widgetgallery/examples/ComboBoxModel.cpp
  https://www.webtoolkit.eu/widgets/forms/combo-box
  https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WComboBox.html

 */
View::View(const Wt::WEnvironment& env)
    : Wt::WApplication(env)
{
  setTitle("DropDown Demo");


  log("info") << "Test";

  // This is the container for the full screen.
  Wt::WContainerWidget *pScreenContainer = new Wt::WContainerWidget();
  pScreenContainer->resize(Wt::WLength::Auto, Wt::WLength::Auto);
  // Add the primary container to the root widget?
  root()->addWidget(pScreenContainer);

  // Choose the grid layout.
  Wt::WGridLayout *pScreenLayout = new Wt::WGridLayout();
  pScreenContainer->setLayout(pScreenLayout);

  int nRow = 0;
  int nColoumn = 0;

 
  // Create the label
  Wt::WText *lblSeriesChoice = new Wt::WText("Series:");
  // set right align the label
  lblSeriesChoice->setTextAlignment(Wt::AlignRight);
  pScreenLayout->addWidget(lblSeriesChoice, nRow, nColoumn+0);

  // Create the dropdown
  Wt::WComboBox *cbSeries = new Wt::WComboBox();
  cbSeries->addItem("");
  cbSeries->addItem("New");
  cbSeries->addItem("Krakken awoke");
  cbSeries->addItem("Appocalypse survival");
  cbSeries->setCurrentIndex(0); // Empty string
  pScreenLayout->addWidget(cbSeries, nRow, nColoumn+1);


  // Create the connection
  cbSeries->activated().connect(this, &View::DropDownSelectionChangeOtherDropDown);
  cbSeries->activated().connect(this, &View::DropDownSelectionChangeTab);
  /* Signals connect to Slots.
  * You may specify up to 6 arguments which may be of arbitrary types that are Copyable, that may be passed through the signal to connected slots.
  *   https://www.webtoolkit.eu/wt/doc/reference/html/group__signalslot.html
  * I think the 
  *   first parm - is a pointer to the target class.
  *   second parm - is the name of the method?
  * 
  * See: Wt::Signal.
  */


  /*
  * Let row 1 and column 1 take the excess space.?
  */
  pScreenLayout->setRowStretch(0, 0);
  pScreenLayout->setColumnStretch(0, 0);
} // end
 void WebApp::authenticated() {
   _isAuthenticated = true;
   _user_id = login->getUserId();
   west->layout()->addWidget(menu = createMenuTree());
   west->expand();
   Wt::WContainerWidget *container = new Wt::WContainerWidget(exampleContainer_);
   container->addWidget(new Wt::WText(Wt::WString::tr("about")));
   login->setHidden(true);
   currentExample_ = container;
 }
 void WebApp::logout() {
   _isAuthenticated = false;
   _user_id = 0;
   west->layout()->removeWidget(menu);
   delete menu;
   west->collapse();
   Wt::WContainerWidget *container = new Wt::WContainerWidget(exampleContainer_);
   container->addWidget(new Wt::WText(Wt::WString::tr("logged_out")));
   setContent(container);
 }
Example #11
0
void AdsEditor::renderUI() {
  AdsApplication *app = AdsApplication::adsApplication();
  cppdb::session &db = app->db_;
  
  clear();
  WPushButton *btn = new WPushButton("Criar Anuncio", this);
  btn->clicked().connect(this, &AdsEditor::novoAnuncio);
  WPushButton *update = new WPushButton("Atualiza", this);
  update->clicked().connect(this, &AdsEditor::renderUI);
  new WBreak(this);
  new WBreak(this);
  new WText("<h3>Lista de Anuncios</h3>",this);
  
  Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
  w->resize(600, WLength::Auto);
  WVBoxLayout *layout = new Wt::WVBoxLayout();
  cppdb::result res = db <<
    "select id, titulo, url, imagem, texto, ativo "
    " from anuncio";
  while(res.next()) {
    WContainerWidget *cont = new WContainerWidget();
    AdsAnuncio *anuncio = new AdsAnuncio(cont);
    
    res >>  anuncio->id >> anuncio->titulo_ >> anuncio->link_ >>
      anuncio->imagem_ >> anuncio->texto_ >> anuncio->ativo_;    
    
    WPushButton *tituloBtn = new WPushButton("Titulo",cont);
    tituloBtn->clicked().connect(anuncio, &AdsAnuncio::editarTitulo);
    
    WPushButton *urlBtn = new WPushButton("URL",cont);
    urlBtn->clicked().connect(anuncio, &AdsAnuncio::editarURL);
    
    WPushButton *imagemBtn = new WPushButton("Imagem",cont);
    imagemBtn->clicked().connect(anuncio, &AdsAnuncio::editarImagem);
    
    WPushButton *textoBtn = new WPushButton("Texto",cont);
    textoBtn->clicked().connect(anuncio, &AdsAnuncio::editarTexto);
    
    WCheckBox *ativoCheck = new Wt::WCheckBox("Ativo",cont);
    if(anuncio->ativo_ == 1)
      ativoCheck->setChecked(true);
    else 
      ativoCheck->setChecked(false);
    ativoCheck->changed().connect(anuncio, &AdsAnuncio::changeAtiva);

    WPushButton *deletaBtn = new WPushButton("Deleta",cont);
    deletaBtn->clicked().connect(anuncio, &AdsAnuncio::deletaAnuncio);

    anuncio->renderUI();
    layout->addWidget(cont);
  }
  w->setLayout(layout);
}
Example #12
0
Wt::WWidget* Tester::Result()
{
    Wt::WContainerWidget* c = new Wt::WContainerWidget();
    c->setStyleClass("result_container");

    Wt::WText* t = new Wt::WText("Results", c);
    t->setStyleClass("area_title");

    mResult = new Wt::WContainerWidget(c);
    mResult->setStyleClass("result_output");

    return c;
}
Example #13
0
void
WHexDump::init() {
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
    setLayout(vbox);

    Wt::WContainerWidget *actionsBox = new Wt::WContainerWidget;
    vbox->addWidget(actionsBox);
    {
        new Wt::WText("Goto: ", actionsBox);
        wAddressEdit_ = new Wt::WLineEdit(actionsBox);
        wAddressEdit_->enterPressed().connect(this, &WHexDump::handleGoto);

        new Wt::WBreak(actionsBox);
        new Wt::WText("Search: ", actionsBox);
        wSearchEdit_ = new Wt::WLineEdit(actionsBox);
        wSearchEdit_->keyPressed().connect(this, &WHexDump::resetSearch);
        wSearchNext_ = new Wt::WPushButton("Find", actionsBox);
        wSearchNext_->clicked().connect(this, &WHexDump::handleSearch);
        wSearchResults_ = new Wt::WText("Enter a big-endian hexadecimal value", actionsBox);
        
    }

    Wt::WContainerWidget *tableContainer = new Wt::WContainerWidget;
    vbox->addWidget(tableContainer, 1 /*stretch*/);
    Wt::WHBoxLayout *hbox = new Wt::WHBoxLayout;        // so the table scrolls horizontally
    tableContainer->setLayout(hbox);

    model_ = new HexDumpModel;

    tableView_ = new Wt::WTableView;
    tableView_->setModel(model_);
    tableView_->setRowHeaderCount(1);                   // this must be first property set
    tableView_->setHeaderHeight(28);
    tableView_->setSortingEnabled(false);
    tableView_->setAlternatingRowColors(false);         // true interferes with our blacking out unmapped addresses
    tableView_->setColumnResizeEnabled(true);
    tableView_->setSelectionMode(Wt::SingleSelection);
    tableView_->setEditTriggers(Wt::WAbstractItemView::NoEditTrigger);
    tableView_->setColumnWidth(addressColumn, Wt::WLength(6, Wt::WLength::FontEm));
    tableView_->setColumnWidth(sep1Column, Wt::WLength(1, Wt::WLength::FontEm));
    tableView_->setColumnWidth(sep2Column, Wt::WLength(1, Wt::WLength::FontEm));
    for (size_t i=0; i<bytesPerRow; ++i) {
        int extra = 7==i%8 && i+1<bytesPerRow ? 1 : 0;
        tableView_->setColumnWidth(bytesColumn + i, Wt::WLength(2+extra, Wt::WLength::FontEm));
        tableView_->setColumnWidth(asciiColumn + i, Wt::WLength(2+extra, Wt::WLength::FontEm));
    }
    tableView_->clicked().connect(boost::bind(&WHexDump::handleClick, this, _1));
    hbox->addWidget(tableView_);
}
      PresetFilterPanel::PresetFilterPanel(org::esb::hive::PresetReader::FilterList &filter) :_filterlist(filter),  Wt::Ext::Panel() {
        setLayout(new Wt::WFitLayout());

        Wt::WContainerWidget * main = new Wt::WContainerWidget();
        grid = new Wt::WGridLayout();
        main->setLayout(grid);
        layout()->addWidget(main);

        grid->addWidget(filter_table = new PresetFilterTable(filter), 0, 0);
        _cont=new Wt::WContainerWidget();
        _cont->setLayout(new Wt::WBorderLayout());
        _cont->resize(600,300);
        grid->addWidget(_cont, 1, 0);
        filter_table->itemSelectionChanged().connect(SLOT(this,PresetFilterPanel::filterSelected));
      }
Wt::WWidget * ribi::WtAsciiArterMainDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to AsciiArter",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("AsciiArter is a tool to convert images to ascii art.",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolAsciiArterWelcome.png"));
  return dialog;
}
//---------------------------------------------------------------------------
Wt::WWidget * WtTestEncrangerMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to TestEncranger",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("TestEncranger demonstrates the Encranger encryption and de-encryption algorithm",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolTestEncrangerWelcome.png"));
  return dialog;
}
//---------------------------------------------------------------------------
Wt::WWidget * ribi::ToolTestServerPusher::WtMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to TestServerPusher",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("TestServerPusher demonstrates how to view the same changing info",dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("from different browsers and/or computers",dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("using the WtServerPusher and WtServerPusherClient classes",dialog);
  return dialog;
}
Wt::WWidget * ribi::ToolTestEntrance::WtMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to TestEntrance",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("TestEntrance demonstrates the WtEntrance class",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolTestEntranceWelcome.png"));
  return dialog;
}
Wt::WWidget * ribi::tgrw::WtMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to TestGroupWidget",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("TestGroupWidget tests and displays the GroupWidget class",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolTestGroupWidgetWelcome.png"));
  return dialog;
}
//---------------------------------------------------------------------------
Wt::WWidget * WtTestToggleButtonMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to TestToggleButton",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("TestToggleButton tests and displays the ToggleButton and WtToggleButtonWidget classes",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolTestToggleButtonWelcome.png"));
  return dialog;
}
Wt::WWidget * ribi::WtRandomCodeMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to RandomCode",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("The goal of RandomCode is to generate random C++ code",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  Wt::WGroupBox * const box = new Wt::WGroupBox("Explanation",dialog);
  box->addWidget(new Wt::WImage("ToolRandomCodeWelcome.png"));
  return dialog;
}
Example #22
0
Home::Home() {
	
Wt::WContainerWidget *p = new Wt::WContainerWidget(this);
 p->resize(WLength::Auto, 200);

 Wt::WGridLayout *lay = new Wt::WGridLayout();
//lay->addWidget(new Wt::WText("this site is made by parvinder rajput. \n who are pursuing is b.tech from gndec ludhiana."),0,0);
// lay->addWidget(new Wt::WText("this is dean of consultancy cell"), 0, 2);
 //lay->addWidget(new Wt::WText("Hello"), 0, 0);
 
//lay->addWidget(new Wt::WImage("/images/Footer.jpg"), 0,0);
lay->addWidget(new Wt::WText("HERE GOES A SMALL RHYMES WEBSITE FOR NURSERY KIDS TO MAKE THEIR LEARNING INTERESTING."), 0,0);
lay->addWidget(new Wt::WImage("/images/images.jpeg"), 0,2);
lay->addWidget(new Wt::WImage("/images/images8.jpeg"), 0,1);
p->setLayout(lay);
}
Example #23
0
void Tester::LoadGrammar()
{
    string h = internalPathNextPart("/share/");
    fs::path input = fs::path(appRoot()) / "share" / (h + ".data");
    mInput->setText("");
    mGrammar->setText("");
    mResult->clear();

    ifstream data_fs(input.string().c_str());
    if (data_fs) {
        data_fs.unsetf(std::ios::skipws);
        string data((istream_iterator<char>(data_fs)), istream_iterator<char>());
        mInput->setText(data);
        data_fs.close();
    } else {
        stringstream ss;
        ss << "share not found: " << h;
        Wt::WText* t = new Wt::WText(ss.str(), mResult);
        t->setStyleClass("result_error");
        Wt::log("info") << ss.str();
        return;
    }

    fs::path grammar = fs::path(appRoot()) / "share" / (h + ".lua");
    ifstream grammar_fs(grammar.string().c_str());
    if (grammar_fs) {
        grammar_fs.unsetf(std::ios::skipws);
        string data((istream_iterator<char>(grammar_fs)), istream_iterator<char>());
        mGrammar->setText(data);
        grammar_fs.close();
    }
}
Example #24
0
MainPage::MainPage(Wt::WApplication* app): WContainerWidget()
{
	app_ = app;
	contentsStack_ = new Wt::WStackedWidget();
	contentsStack_->setOverflow(WContainerWidget::OverflowAuto);
	contentsStack_->setStyleClass("contents");

	/*
	* Setup the menu (and submenus)
	*/
	Wt::WMenu *menu = new Wt::WMenu(contentsStack_, Wt::Vertical, 0);
	menu->setRenderAsList(true);
	menu->setStyleClass("menu");
	menu->setInternalPathEnabled();
	menu->setInternalBasePath("/");
	menu->itemSelected().connect(this, &MainPage::selectedMenuItem);
	
	Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
	Wt::WBorderLayout *layout = new Wt::WBorderLayout();
	layout->addWidget(new Wt::WText("North-side is best"), Wt::WBorderLayout::North);
	layout->addWidget(new Wt::WText("South-side is best"), Wt::WBorderLayout::South);
	layout->addWidget(menu, Wt::WBorderLayout::West);
	layout->addWidget(contentsStack_, Wt::WBorderLayout::Center);

	// use layout but do not justify vertically
	w->setLayout(layout, Wt::AlignTop | Wt::AlignJustify);
	
	menu->addItem("Basics", new ClientsPage(this, &session_));
	menu->addItem("Form Widgets", new CommonPage(this, &session_));
	menu->addItem("Form Validators", new CommonPage(this, &session_));

	Wt::WSubMenuItem *smi = new Wt::WSubMenuItem("Sub menu", new CommonPage(this, &session_));
	Wt::WMenu *subMenu = new Wt::WMenu(contentsStack_, Wt::Vertical, 0);
	subMenu->setRenderAsList(true);

	smi->setSubMenu(subMenu);
	
	menu->addItem(smi);

	subMenu->setInternalPathEnabled();
	subMenu->setInternalBasePath("/" + smi->pathComponent());
	subMenu->setStyleClass("menu submenu");
	subMenu->itemSelected().connect(this, &MainPage::selectedMenuItem);
	
	subMenu->addItem("Sub Item 1", new CommonPage(this, &session_));
	subMenu->addItem("Sub Item 2", new CommonPage(this, &session_));
}
Example #25
0
void Tester::TestGrammar(bool benchmark)
{
    mResult->clear();

    fs::path grammar = fs::path("/tmp") / (sessionId() + ".lua");
    ofstream ofs(grammar.string().c_str());
    if (ofs) {
        ofs << mGrammar->text();
        ofs.close();
    } else {
        stringstream ss;
        ss << "failed to open: " << grammar;
        Wt::WText* t = new Wt::WText(ss.str(), mResult);
        t->setStyleClass("result_error");
        Wt::log("error") << ss.str();
        return;
    }
    lua_sandbox* sb = lsb_create(NULL, grammar.string().c_str(), "modules",
                                 8*1024*1024, 1e6, 1024*63);
    if (!sb) {
        stringstream ss;
        ss << "lsb_create() failed";
        Wt::WText* t = new Wt::WText(ss.str(), mResult);
        t->setStyleClass("result_error");
        Wt::log("error") << ss.str();
        return;
    }
    if (lsb_init(sb, nullptr)) {
        stringstream ss;
        string error = lsb_get_error(sb);
        size_t pos = error.find_first_of(':');
        if (pos != string::npos) {
            ss << "line " << error.substr(pos + 1);
        } else {
            ss << error;
        }
        Wt::WText* t = new Wt::WText(ss.str(), mResult);
        t->setStyleClass("result_error");
        Wt::log("info") << ss.str();
        return;

    }
    if (benchmark) {
        Benchmark(sb, mInput->text().narrow());
    } else {
        Match(sb, mInput->text().narrow());
    }
    char* e = lsb_destroy(sb, nullptr);
    if (e) {
        stringstream ss;
        ss << "lsb_destroy() failed: " << e;
        Wt::WText* t = new Wt::WText(ss.str(), mResult);
        t->setStyleClass("result_error");
        Wt::log("info") << ss.str();
        free(e);
    }
}
Example #26
0
Wt::WContainerWidget *PopupChatWidget::createBar() 
{
  Wt::WContainerWidget *bar = new Wt::WContainerWidget();
  bar->setStyleClass("chat-bar");

  Wt::WText *toggleButton = new Wt::WText();
  toggleButton->setInline(false);
  toggleButton->setStyleClass("chat-minmax");
  bar->clicked().connect(this, &PopupChatWidget::toggleSize);
  bar->clicked().connect(this, &PopupChatWidget::goOnline);

  bar->addWidget(toggleButton);

  title_ = new Wt::WText(bar);

  bar_ = bar;

  return bar;
}
Example #27
0
File: WMenuItem.C Project: bend/wt
void WMenuItem::setMenu(WMenu *menu)
{
  subMenu_ = menu;
  subMenu_->parentItem_ = this;

  Wt::WContainerWidget *sparent
    = dynamic_cast<Wt::WContainerWidget *>(subMenu_->parent());
  if (sparent)
    sparent->removeWidget(subMenu_);

  addWidget(subMenu_);

  WPopupMenu *popup = dynamic_cast<WPopupMenu *>(subMenu_);
  if (popup) {
    popup->setJavaScriptMember("wtNoReparent", "true");
    setSelectable(false);
    popup->setButton(anchor());
    updateInternalPath();
  }
}
Example #28
0
void ContactList::showFullList()
{
    WtUtilFuns::removeChildWidgets(this);
    clearPanels();

    for(std::map<ContactGroup,Wt::WPanel*>::iterator it = mContactPanels.begin(); it != mContactPanels.end(); ++it)
    {

        //uto& contacts = it->;
        const ContactGroup &group = it->first;
        auto panel = it->second;
        Wt::WContainerWidget* container = static_cast<Wt::WContainerWidget*>(panel->centralWidget());
        BOOST_FOREACH(const ContactInfo& info, group.contacts)
        {
            ContactEntry *entry = mUinToEntry[info.uin];
            container->addWidget(entry);
        }
        if(container->count())
            addWidget(panel);
    }
}
Wt::WWidget * ribi::con3::WtMenuDialog::CreateNewWelcomeDialog() const
{
  Wt::WContainerWidget * dialog = new Wt::WContainerWidget;
  dialog->setContentAlignment(Wt::AlignCenter);
  dialog->addWidget(new Wt::WBreak);
  new Wt::WLabel("Welcome to ConnectThree",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("The goal of ConnectThree is to get three in a row horizontally or vertically:",dialog);
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("Good #1",dialog);
  new Wt::WBreak(dialog);
  dialog->addWidget(new Wt::WImage(
    m_resources.GetInstructionsGoodFilenames()[0],"Good #1"));
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("Good #2",dialog);
  new Wt::WBreak(dialog);
  dialog->addWidget(new Wt::WImage(
    m_resources.GetInstructionsGoodFilenames()[1],"Good #2"));
  new Wt::WBreak(dialog);
  new Wt::WBreak(dialog);
  new Wt::WLabel("Wrong",dialog);
  new Wt::WBreak(dialog);
  dialog->addWidget(new Wt::WImage(
    m_resources.
     GetInstructionsWrongFilename(),
     "Wrong"));
  return dialog;
}
Example #30
0
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
Wt::WWidget * WelcomeScreen::makeNormalLoginTab()
{
    Wt::WContainerWidget *cont = new Wt::WContainerWidget();
    nl_txt_ = new Wt::WText("Hier koennen Sie ihr bestehendes Flugbuch aufrufen.", cont);
    cont->addWidget(new Wt::WBreak());
    cont->addWidget(new Wt::WBreak());

    Wt::WTable *layout = new Wt::WTable(cont);
    Wt::WLabel *usernameLabel = new Wt::WLabel("Benutzername: ", layout->elementAt(0, 0));
    layout->elementAt(0, 0)->resize(Wt::WLength(14, Wt::WLength::FontEx), Wt::WLength());
    nl_username_ = new Wt::WLineEdit(layout->elementAt(0, 1));
    usernameLabel->setBuddy(nl_username_);

    Wt::WLabel *passwordLabel = new Wt::WLabel("Password: "******"Login", layout->elementAt(2, 1));
    LoginButton->clicked().connect(SLOT( this, WelcomeScreen::doLogin));

    return cont;
}