当前位置: 首页>>代码示例>>C++>>正文


C++ wt::WText类代码示例

本文整理汇总了C++中wt::WText的典型用法代码示例。如果您正苦于以下问题:C++ WText类的具体用法?C++ WText怎么用?C++ WText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WText类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadGrammar

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();
    }
}
开发者ID:cluo,项目名称:lpeg_tester,代码行数:32,代码来源:lpeg_tester.cpp

示例2: Input

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;
}
开发者ID:cluo,项目名称:lpeg_tester,代码行数:32,代码来源:lpeg_tester.cpp

示例3: resize

HeightLines::HeightLines()
{
  museums.set("mapbox://mapbox.2opop9hr");
  contours.set("mapbox://mapbox.mapbox-terrain-v2");

  museumLayer.set(&museums);
  museumLayer.sourceLayer("museum-cusco");
  museumLayer.radius(8);
  museumLayer.color(Wt::WColor(55, 148, 179));

  contourLayer.set(&contours);
  contourLayer.sourceLayer("contour");
  contourLayer.join(MapBox::JOIN::Round);
  contourLayer.cap(MapBox::CAP::Round);
  contourLayer.color(Wt::WColor("#877b59"));
  contourLayer.width(1);

  resize(250, 100);

  Wt::WVBoxLayout * vbox = new Wt::WVBoxLayout();
  setLayout(vbox);

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

  Wt::WText * t = new Wt::WText("Width: ", this);
  t->setMargin(10);
  hbox->addWidget(t);

  Wt::WSlider * slider = new Wt::WSlider(this);
  slider->resize(200, 12);
  slider->setMinimum(1);
  slider->setMaximum(10);
  slider->setValue(1);
  hbox->addWidget(slider);

  slider->valueChanged().connect(std::bind([=]() {
    contourLayer.width(slider->value());
  }));

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

  t = new Wt::WText("Blur: ", this);
  t->setMargin(10);
  hbox->addWidget(t);

  slider = new Wt::WSlider(this);
  slider->resize(200, 12);
  slider->setMinimum(0);
  slider->setMaximum(10);
  slider->setValue(0);
  hbox->addWidget(slider);

  slider->valueChanged().connect(std::bind([=]() {
    contourLayer.blur(slider->value());
  }));

}
开发者ID:yvanvds,项目名称:wtMapbox,代码行数:59,代码来源:demo05_HeightLines.cpp

示例4: setTitle

/**
  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
开发者ID:hpepper,项目名称:wt-test,代码行数:66,代码来源:View.cpp

示例5: TestGrammar

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);
    }
}
开发者ID:cluo,项目名称:lpeg_tester,代码行数:57,代码来源:lpeg_tester.cpp

示例6: createHeaderRow

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
void LocationTable::createHeaderRow()
{
    static const std::string captions[7] = {"Gebiet", "Name", "Höhe", "Position", "SP", "LP", "WP"};
    for(size_t i=0; i<sizeof(captions) / sizeof(std::string); ++i)
    {
        Wt::WText *labelText = new Wt::WText(captions[i]);
        labelText->setStyleClass("tableHeader");
        elementAt(0, i + 1)->addWidget(labelText);
    }
    rowAt(0)->setStyleClass("title");
}
开发者ID:ulrichard,项目名称:flugbuch,代码行数:12,代码来源:LocationTable.cpp

示例7: analyzers

void
WFunctionSummary::init() {
    Wt::WVBoxLayout *vbox = new Wt::WVBoxLayout;
    this->setLayout(vbox);

    analyzers().push_back(FunctionEntryAddress::instance());
    analyzers().push_back(FunctionName::instance());
    analyzers().push_back(FunctionSizeBytes::instance());
    analyzers().push_back(FunctionSizeInsns::instance());
    analyzers().push_back(FunctionSizeBBlocks::instance());
    analyzers().push_back(FunctionSizeDBlocks::instance());
    analyzers().push_back(FunctionNDiscontiguousBlocks::instance());
    analyzers().push_back(FunctionNIntervals::instance());
    analyzers().push_back(FunctionImported::instance());
    analyzers().push_back(FunctionExported::instance());
    analyzers().push_back(FunctionNCallers::instance());
    analyzers().push_back(FunctionNReturns::instance());
    analyzers().push_back(FunctionMayReturn::instance());
    analyzers().push_back(FunctionStackDelta::instance());

    // Build a table to hold analysis results. The results will be organized into NCOLS each occupying two table columns (one
    // for the name and one for the value).
    const size_t NROWS = (analyzers_.size() + NCOLS - 1) / NCOLS;
    wAnalysisResultTable_ = new Wt::WTable();
    vbox->addWidget(wAnalysisResultTable_);

    Wt::WCssDecorationStyle labelDecor;
    labelDecor.setBackgroundColor(toWt(Color::HSV(0, 0, 0.95)));
    for (size_t col=0, i=0; col<NCOLS && i<analyzers_.size(); ++col) {
        for (size_t row=0; row<NROWS && i<analyzers_.size(); ++row) {
            Wt::WText *wLabel = new Wt::WText("<b>" + analyzers_[i]->name() + "</b>");
            wLabel->setToolTip(analyzers_[i]->toolTip());
            wAnalysisResultTable_->elementAt(row, 2*col+0)->addWidget(wLabel);
            wAnalysisResultTable_->elementAt(row, 2*col+0)->setContentAlignment(Wt::AlignRight);
            wAnalysisResultTable_->elementAt(row, 2*col+0)->setDecorationStyle(labelDecor);

            Wt::WText *wValue = new Wt::WText;
            wValue->setTextFormat(Wt::PlainText);
            analyzerResults_.push_back(wValue);
            analyzerResults_.back()->setToolTip(analyzers_[i]->toolTip());
            wAnalysisResultTable_->elementAt(row, 2*col+1)->addWidget(analyzerResults_.back());
            wAnalysisResultTable_->elementAt(row, 2*col+1)->setPadding(Wt::WLength(1, Wt::WLength::FontEm), Wt::Left);
            wAnalysisResultTable_->elementAt(row, 2*col+1)->setPadding(Wt::WLength(10, Wt::WLength::FontEm), Wt::Right);
            ++i;
        }
    }

    // Text area to hold function comments
    wFunctionComments_ = new Wt::WTextArea;
    vbox->addWidget(wFunctionComments_, 1 /*stretch*/);

    // FIXME[Robb P. Matzke 2015-05-06]: We don't provide a way to save results yet, so don't allow comment editing
    wFunctionComments_->setEnabled(false);
}
开发者ID:JamesLinus,项目名称:rose,代码行数:54,代码来源:WFunctionSummary.C

示例8: WApplication

      WebApp::WebApp(const Wt::WEnvironment & env) : WApplication(env) {
        if (string(org::esb::config::Config::getProperty("hive.mode")) == "setup") {
          WApplication::instance()->redirect("/setup");
          WApplication::instance()->quit();
        }
        setTitle("Hive Webadmin");
        _isAuthenticated = false;
        Wt::Ext::Container *viewPort = new Wt::Ext::Container(root());
        Wt::WBorderLayout *layout = new Wt::WBorderLayout(viewPort);


        Wt::Ext::Panel *north = new Wt::Ext::Panel();
        north->setBorder(false);
        std::string h = "MediaEncodingCluster V-";
        h += MHIVE_VERSION;
        h += "($Rev$-"__DATE__ "-" __TIME__")";
        Wt::WText *head = new Wt::WText(h);
        head->setStyleClass("north");
        north->setLayout(new Wt::WFitLayout());
        north->layout()->addWidget(head);
        north->resize(Wt::WLength(), 35);
        layout->addWidget(north, Wt::WBorderLayout::North);

        /* West */
        west = new Wt::Ext::Panel();

        west->setTitle("Menu");
        west->resize(200, Wt::WLength());
        west->setResizable(true);
        west->collapse();
        west->setAnimate(true);
        west->setAutoScrollBars(true);
        layout->addWidget(west, Wt::WBorderLayout::West);


        /* Center */
        Wt::Ext::Panel *center = new Wt::Ext::Panel();
        center->setTitle("MediaEncodingCluster");
        center->layout()->addWidget(exampleContainer_ = new Wt::WContainerWidget());
        center->setAutoScrollBars(true);
        layout->addWidget(center, Wt::WBorderLayout::Center);

        exampleContainer_->setPadding(5);

        currentExample_ = login = new Login(exampleContainer_);
        login->authenticated.connect(SLOT(this, WebApp::authenticated));
        //        useStyleSheet("ext/resources/css/xtheme-gray.css");
        useStyleSheet("filetree.css");
        useStyleSheet("main.css");
        std::string res = std::string(Config::getProperty("hive.path"));
        res.append("/../res/messages");
        messageResourceBundle().use(res.c_str(), false);

      }
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:54,代码来源:WebApp.cpp

示例9: Result

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;
}
开发者ID:cluo,项目名称:lpeg_tester,代码行数:13,代码来源:lpeg_tester.cpp

示例10: resize

FeaturesBelowMouse::FeaturesBelowMouse()
{
  resize(290, 400);

  Wt::WText * text = new Wt::WText(this);

  mouseMove.trigger(MapBox::EVENT::MouseMove);
  mouseMove.code("function(e) {"
    "var features = " + APP->getMap()->jsRef() + ".map.queryRenderedFeatures(e.point);"
    "document.getElementById('" + text->id() + "').innerHTML = '<pre>' + JSON.stringify(features, null, 2) + '</pre>';"
    "}"
  );
}
开发者ID:yvanvds,项目名称:wtMapbox,代码行数:13,代码来源:demo17_FeaturesBelowMouse.cpp

示例11: setImplementation

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
LocationPanel::LocationPanel(boost::shared_ptr<FlightDatabase>  flightDb, Wt::WContainerWidget *parent)
 : Wt::WCompositeWidget(parent), flightDb_(flightDb), impl_(new Wt::WContainerWidget())
{
    setImplementation(impl_);
    setStyleClass("flb_detail_panel");
    impl_->setStyleClass("flb_detail_panel");

    cbArea_ = new Wt::Ext::ComboBox(impl_);
    cbTakeoff_ = new Wt::Ext::CheckBox(impl_);
	cbLanding_ = new Wt::Ext::CheckBox(impl_);
	cbWayPnt_  = new Wt::Ext::CheckBox(impl_);
    table_  = new LocationTable(flightDb, impl_);
    pglist_ = new PagesList(table_);
    // signals
    cbArea_->activated().connect(SLOT(this, LocationPanel::filter));
    cbTakeoff_->checked().connect(SLOT(this, LocationPanel::filter));
    cbLanding_->checked().connect(SLOT(this, LocationPanel::filter));
    cbWayPnt_->checked().connect(SLOT(this, LocationPanel::filter));
    cbTakeoff_->unChecked().connect(SLOT(this, LocationPanel::filter));
    cbLanding_->unChecked().connect(SLOT(this, LocationPanel::filter));
    cbWayPnt_->unChecked().connect(SLOT(this, LocationPanel::filter));

    // header
    Wt::WTable *topBar = new Wt::WTable();
    topBar->setStyleClass("FilterBar");
    Wt::WText *wtFilt = new Wt::WText("Filter : ");
    wtFilt->setStyleClass("FilterTitle");
    Wt::WText *wtArea = new Wt::WText("Fluggebiet");
    wtArea->setStyleClass("FilterSubTitle");
    cbTakeoff_->setText("Startplaetze");
    cbLanding_->setText("Landeplaetze");
    cbWayPnt_->setText("Wegpunkte");
    topBar->elementAt(0, 0)->addWidget(wtFilt);
    topBar->elementAt(0, 1)->addWidget(wtArea);
    topBar->elementAt(0, 2)->addWidget(cbArea_);
    topBar->elementAt(0, 3)->addWidget(cbTakeoff_);
    topBar->elementAt(0, 4)->addWidget(cbLanding_);
    topBar->elementAt(0, 5)->addWidget(cbWayPnt_);
    topBar->elementAt(0, 6)->addWidget(pglist_);

    Wt::WContainerWidget *botBar = new Wt::WContainerWidget();

    Wt::WBorderLayout *borderLayout = new Wt::WBorderLayout();
    impl_->setLayout(borderLayout);
    borderLayout->addWidget(topBar, Wt::WBorderLayout::North);
    borderLayout->addWidget(table_, Wt::WBorderLayout::Center);
    borderLayout->addWidget(botBar, Wt::WBorderLayout::South);

    load();
    filter();
}
开发者ID:ulrichard,项目名称:flugbuch,代码行数:54,代码来源:LocationTable.cpp

示例12:

Wt::WText *TopicWidget::addText(const Wt::WString& s,
				Wt::WContainerWidget *parent)
{
  Wt::WText *text = new Wt::WText(s, parent);
  bool literal;
#ifndef WT_TARGET_JAVA
  literal = s.literal();
#else
  literal = Wt::WString(s).literal();
#endif
  if (!literal)
    text->setInternalPathEncoding(true);
  return text;
}
开发者ID:913862627,项目名称:wt,代码行数:14,代码来源:TopicWidget.C

示例13: s

Upload::Upload( Wt::WContainerWidget* pcw ) {
  
  //Wt::WContainerWidget *container = new Wt::WContainerWidget();

  Wt::WFileUpload *fu = new Wt::WFileUpload( pcw );
  fu->setFileTextSize( 10000 ); // Set the maximum file size (in KB )
  fu->setProgressBar(new Wt::WProgressBar());
  fu->setMargin(10, Wt::Right);

  // Provide a button to start uploading.
  Wt::WPushButton *uploadButton = new Wt::WPushButton("Send", pcw );
  uploadButton->setMargin(10, Wt::Left | Wt::Right);

  Wt::WText *out = new Wt::WText( pcw );

  // Upload when the button is clicked.
  uploadButton->clicked().connect(std::bind([=] () {
      fu->upload();
      uploadButton->disable();
  }));

  // Upload automatically when the user entered a file.
  fu->changed().connect(std::bind([=] () {
      fu->upload();
      uploadButton->disable();
      std::string s( "File upload is changed." );
      out->setText( s );
  }));

  // React to a succesfull upload.
  fu->uploaded().connect(std::bind([=] () {
    std::string s( "File upload is finished: " );
    s += fu->clientFileName().toUTF8();
    s += ",";
    //s += fu->fileTextSize()
    s += fu->spoolFileName();
    //fu->stealSpooledFile()
    out->setText( s );
  }));

  // React to a file upload problem.
  fu->fileTooLarge().connect(std::bind([=] () {
      out->setText("File is too large.");
  }));
}
开发者ID:rburkholder,项目名称:nodestar,代码行数:45,代码来源:Upload.cpp

示例14:

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;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:19,代码来源:PopupChatWidget.C

示例15: select

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8/////////9/////////A
void PagesList::select(Wt::WMouseEvent mev)
{
    // first, we have to find out which text was clicked
    Wt::WObject *wobj = sender();
    Wt::WText *wtxt = dynamic_cast<Wt::WText*>(wobj);
    if(!wtxt)
        return;

    const string txt = wtxt->text().narrow();
    if(txt == "<" || txt == "&lt;")
        table_->loadPage(table_->pageNr() - 1);
    else if(txt == ">" || txt == "&gt;")
        table_->loadPage(table_->pageNr() + 1);
    else
        table_->loadPage(lexical_cast<unsigned int>(txt));

    // reflect the change on the pagelist itself
    load();
}
开发者ID:ulrichard,项目名称:flugbuch,代码行数:20,代码来源:DetailTableBase.cpp


注:本文中的wt::WText类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。