示例#1
0
boost::any WItemDelegate::editState(WWidget *editor) const
{
  WContainerWidget *w = dynamic_cast<WContainerWidget *>(editor);
  WLineEdit *lineEdit = dynamic_cast<WLineEdit *>(w->widget(0));

  return boost::any(lineEdit->text());
}
示例#2
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); 
}
示例#3
0
DragExample::DragExample(WContainerWidget *parent):
  WContainerWidget(parent)
{
  new WText("<p>Help these people with their decision by dragging one of "
	    "the pills.</p>", this);

  if (!wApp->environment().javaScript()) {
    new WText("<i>This examples requires that javascript support is "
	      "enabled.</i>", this);
  }

  WContainerWidget *pills = new WContainerWidget(this);
  pills->setContentAlignment(AlignCenter);

  createDragImage("icons/blue-pill.jpg",
		  "icons/blue-pill-small.png",
		  "blue-pill", pills);
  createDragImage("icons/red-pill.jpg",
		  "icons/red-pill-small.png",
		  "red-pill", pills);

  WContainerWidget *dropSites = new WContainerWidget(this);

  new Character("Neo", dropSites);
  new Character("Morpheus", dropSites);
  new Character("Trinity", dropSites);

}
示例#4
0
gdWColorDialog::gdWColorDialog(WString title, gdWColorDialogData* refData)
    : gdWDialog(title, refData), m_refData(refData), m_pColorTable(0)
{
    if ( WString::tr("byObjectStyleSheet").narrow() == "true" )
        wApp->useStyleSheet(wApp->theme()->resourcesUrl() + "gdwtcore/Css/gdWColorDialog.css");
    wApp->messageResourceBundle().use(wApp->docRoot() + wApp->resourcesUrl() + "/gdwtcore/Transl/gdWColorDialog");
    addStyleClass("gdWColorDialog");
    m_refData->saveDataCallback = boost::bind(&gdWColorDialog::saveData, boost::ref(*this), m_refData);
    WContainerWidget* content = getContent();
    int row    = 0;
    int column = 0;
    m_pColorTable = new WTable(content);
    m_pColorTable->addStyleClass("gdWColorTable");
    for (int red = 255; red > -1; red -= 51) {
        for (int green = 255, column = 0; green > -1; green -= 51) {
            for (int blue = 255; blue > -1; blue -= 51) {
                addColor(m_pColorTable->elementAt(row, column), WColor(red, green, blue));
                column++;
            }
            if ( green == 153 ) {
                row++;
                column = 0;
            }
        }
        row++;
    }
    content->addWidget(m_pColorTable);
    content->addWidget(new WBreak());
    m_pText = new WText();
    setColor(m_refData->m_color);
    content->addWidget(m_pText);
    resize(400, 450);
}
示例#5
0
void WItemDelegate::setEditState(WWidget *editor, const boost::any& value) const
{
  WContainerWidget *w = dynamic_cast<WContainerWidget *>(editor);
  WLineEdit *lineEdit = dynamic_cast<WLineEdit *>(w->widget(0));

  lineEdit->setText(boost::any_cast<WT_USTRING>(value));
}
示例#6
0
文件: WTabWidget.C 项目: Spencerx/wt
void WTabWidget::create(WFlags<AlignmentFlag> layoutAlignment)
{
  setImplementation(layout_ = new WContainerWidget());

  WT_DEBUG( setObjectName("WTabWidget") );

  menu_ = new WMenu(new WStackedWidget(), Horizontal);
  menu_->setRenderAsList(true);

  WContainerWidget *menuDiv = new WContainerWidget();
  menuDiv->setStyleClass("Wt-tabs");
  menuDiv->addWidget(menu_);

  layout_->addWidget(menuDiv);
  layout_->addWidget(menu_->contentsStack());

  setJavaScriptMember
    (WT_RESIZE_JS, std::string() +
     "function(self, w, h) {"
     """self.style.height= h + 'px';"
     """var c = self.firstChild;"
     """var t = self.lastChild;"
     """h -= c.offsetHeight + " WT_CLASS ".px(c, 'marginTop') "
     ""   "+ " WT_CLASS ".px(c, 'marginBottom');"
     """if (h > 0)"
     ""  "t." + WT_RESIZE_JS + "(t, w, h);"
     "};");

  menu_->itemSelected().connect(this, &WTabWidget::onItemSelected);
  menu_->itemClosed().connect(this, &WTabWidget::onItemClosed);
}
示例#7
0
mapboxApplication::mapboxApplication(const WEnvironment & env) : WApplication(env)
{
  if (appRoot().empty()) {
    std::cerr << "!!!!!!!!!!" << std::endl
      << "!! Warning: read the README.md file for hints on deployment,"
      << " the approot looks suspect!" << std::endl
      << "!!!!!!!!!!" << std::endl;
  }

  setTheme(new WBootstrapTheme());
  this->useStyleSheet(WLink("wtMapExample.css"));

  setTitle("Mapbox Examples");

  WContainerWidget * mainContent = new WContainerWidget(root());
  mainContent->setStyleClass("examplemap");
  map = new MapBox::Map(mainContent, true);
  map->setMapStyle(MapBox::MAPSTYLE::Streets);
  map->zoom(14).center(MapBox::Coordinate(51.515823, -0.124331));

  // add all controls
  // map->addNavigationControl();
  // map->addGeoLocateControl();
  // map->addGeoCoderControl();

  menuBar = new MenuBar(root());

}
示例#8
0
void FlexLayoutImpl::update()
{
  WContainerWidget *c = container();

  if (c)
    c->layoutChanged(false);
}
示例#9
0
void WWidgetItem::setParentWidget(WWidget *parent)
{
  if (!widget_)
    return;

  if (parent) {
    WContainerWidget *pc = dynamic_cast<WContainerWidget *>(parent);

    if (widget_->parent()) {
      if (widget_->parent() != pc)
	throw WException("Cannot move a WWidgetItem to another container");
    } else
      pc->widgetAdded(widget_.get());

    bool flexLayout = dynamic_cast<FlexLayoutImpl *>
      (parentLayout_->impl()) != 0;

    if (flexLayout)
      impl_ = cpp14::make_unique<FlexItemImpl>(this);
    else
      impl_ = cpp14::make_unique<StdWidgetItemImpl>(this);
  } else {
    WContainerWidget *pc = dynamic_cast<WContainerWidget *>(widget_->parent());

    if (pc)
      pc->widgetRemoved(widget_.get(), true);

    impl_.reset();
  }
}
示例#10
0
文件: WToolBar.C 项目: ChowZenki/wt
WWidget *WToolBar::widget(int index) const
{
  if (compact_)
    return impl_->widget(index);
  else {
    int current = 0;
    for (int i = 0; i < impl_->count(); ++i) {
      WWidget *w = impl_->widget(i);

      if (dynamic_cast<WSplitButton *>(w)) {
	if (index == current)
	  return w;
	++current;
      } else {
	WContainerWidget *group = dynamic_cast<WContainerWidget *>(w);

	if (index < current + group->count())
	  return group->widget(index - current);

	current += group->count();
      }
    }

    return 0;
  }
}
示例#11
0
WApplication *createApplication(const WEnvironment& env)
{
  WApplication *app = new WApplication(env);
  app->setTitle(L"Drag & drop");
  new WText("<h1>Wt Drag &amp; drop example.</h1>", app->root());

  new WText("<p>Help these people with their decision by dragging one of "
	    "the pills.</p>", app->root());

  if (!env.javaScript()) {
    new WText("<i>This examples requires that javascript support is "
	      "enabled.</i>", app->root());
  }

  WContainerWidget *pills = new WContainerWidget(app->root());
  pills->setContentAlignment(WWidget::AlignCenter);

  createDragImage("blue-pill.jpg",
		  "blue-pill-small.png",
		  "blue-pill", pills);
  createDragImage("red-pill.jpg",
		  "red-pill-small.png",
		  "red-pill", pills);

  WContainerWidget *dropSites = new WContainerWidget(app->root());

  new Character(L"Neo", dropSites);
  new Character(L"Morpheus", dropSites);
  new Character(L"Trinity", dropSites);

  app->useStyleSheet("dragdrop.css");

  return app;
}
示例#12
0
WWidget *ProductMenuItem::createItemWidget()
{        
    //<div class="collection" style="background: url(productimages/QEES_Dimmer_billed_tekst_01_thumb.jpg) no-repeat;">
    WAnchor *result = new WAnchor();    
    WContainerWidget *collection = new WContainerWidget(result);
    result->mouseWentOver().connect(SLOT(this, ProductMenuItem::_mouseWentOver));
    result->mouseWentOut().connect(SLOT(this, ProductMenuItem::_mouseWentOut));

    collection->setStyleClass("collection");
    WString imageName = _product->imageThumbName("var/www/", "resources/images/productimages/");
    collection->decorationStyle().setBackgroundImage(imageName.toUTF8());

    _faderInvisible = new WContainerWidget(collection);
    _faderInvisible->setStyleClass("fader invisible");

    WContainerWidget *faderInvisible2 = new WContainerWidget(_faderInvisible);
    new WText(_description(), faderInvisible2);

    // @todo: Add this? Change picutre
    // <!--<div class="sale_label"></div>-->
    //WContainerWidget *salesLabel = new WContainerWidget(collection);
    //salesLabel->setStyleClass("sale_label");

    // @todo: Add this? Change picutre
    // <!--<div class="sale_label"></div>-->
    //WContainerWidget *offerLabel = new WContainerWidget(collection);
    //offerLabel->setStyleClass("offer_label");

  return result;
}
示例#13
0
void WSuggestionPopup::modelDataChanged(const WModelIndex& topLeft,
					const WModelIndex& bottomRight)
{
  if (topLeft.parent().isValid())
    return;

  if (modelColumn_ < topLeft.column() || modelColumn_ > bottomRight.column())
    return;

  for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
    WContainerWidget *w = dynamic_cast<WContainerWidget *>(impl_->widget(i));
    WAnchor *anchor = dynamic_cast<WAnchor *>(w->widget(0));
    WText *value = dynamic_cast<WText *>(anchor->widget(0));

    WModelIndex index = model_->index(i, modelColumn_);

    boost::any d = index.data();
    value->setText(asString(d));

    TextFormat format = index.flags() & ItemIsXHTMLText ? XHTMLText : PlainText;
    value->setTextFormat(format);

    boost::any d2 = model_->data(i, modelColumn_, UserRole);
    if (d2.empty())
      d2 = d;

    value->setAttributeValue("sug", asString(d2));
  }
}
示例#14
0
  /*! \brief Setup the user interface.
   */
  void createUI() {
    WContainerWidget *w = root();
    w->setStyleClass("maindiv");

    /*
     * The main layout is a 3x2 grid layout.
     */
    WGridLayout *layout = new WGridLayout();
    layout->addWidget(createTitle("Folders"), 0, 0);
    layout->addWidget(createTitle("Files"), 0, 1);
    layout->addWidget(folderView(), 1, 0);
    layout->setColumnResizable(0);

    // select the first folder
    folderView_->select(folderModel_->index(0, 0, folderModel_->index(0, 0)));

    WVBoxLayout *vbox = new WVBoxLayout();
    vbox->addWidget(fileView(), 1);
    vbox->addWidget(pieChart(), 1);
    vbox->setResizable(0);

    layout->addLayout(vbox, 1, 1);

    layout->addWidget(aboutDisplay(), 2, 0, 1, 2);

    /*
     * Let row 1 and column 1 take the excess space.
     */
    layout->setRowStretch(1, 1);
    layout->setColumnStretch(1, 1);

    w->setLayout(layout);
  }
示例#15
0
文件: StyleLayout.C 项目: ReWeb3D/wt
WWidget *StyleLayout::wGridLayout()
{
  WContainerWidget *result = new WContainerWidget();
  topic("WGridLayout", result);

  addText(tr("layout-WGridLayout"), result);

  WContainerWidget *container;

  container = new WContainerWidget(result);
  container->resize(WLength::Auto, 400);
  container->setStyleClass("yellow-box");
  WGridLayout *grid = new WGridLayout();
  container->setLayout(grid);

  for (int row = 0; row < 3; ++row) {
    for (int column = 0; column < 4; ++column) {
      WText *t = addText(tr("grid-item").arg(row).arg(column));
      if (row == 1 || column == 1 || column == 2)
	t->setStyleClass("blue-box");
      else
	t->setStyleClass("green-box");
      grid->addWidget(t, row, column);
    }
  }

  grid->setRowStretch(1, 1);
  grid->setColumnStretch(1, 1);
  grid->setColumnStretch(2, 1);

  return result;
}
示例#16
0
  /*! \brief Creates the chart.
   */
  WWidget *pieChart() {
    using namespace Chart;

    WPieChart *chart = new WPieChart();
    chart->setModel(fileFilterModel_);
    chart->setTitle("File sizes");

    chart->setLabelsColumn(1); // Name
    chart->setDataColumn(3);   // Size

    chart->setPerspectiveEnabled(true, 0.2);
    chart->setDisplayLabels(Outside | TextLabel);

    if (!WApplication::instance()->environment().ajax()) {
      chart->resize(500, 200);
      chart->setMargin(WLength::Auto, Left | Right);
      WContainerWidget *w = new WContainerWidget();
      w->addWidget(chart);
      w->setStyleClass("about");
      return w;
    } else {
      chart->setStyleClass("about");
      return chart;
    }
  }
CookiesLawDisclaimer::CookiesLawDisclaimer(WContainerWidget* parent, const std::function<void()> &runOnAccepted)
    : WCompositeWidget(parent)
{
  WContainerWidget *content = new WContainerWidget;
  content->addStyleClass("alert alert-danger");
  content->addWidget(new WText("cookies_law_disclaimer"_wtr));
  auto readMoreButton = new WPushButton("cookies_law_readmore"_wtr, content);
  readMoreButton->setStyleClass("btn-link");
  readMoreButton->clicked().connect([=](const WMouseEvent &){
    WMessageBox *messageBox = new WMessageBox("cookies_law_readmore_caption"_wtr, "cookies_law_readmore_text"_wtr, Information, Ok, this);
    messageBox->contents()->setOverflow(WContainerWidget::OverflowAuto);
    messageBox->setHeight(500);
    messageBox->buttonClicked().connect([=](StandardButton, _n5){
      delete messageBox;
    });
    messageBox->show();
  });
  auto agreeButton = new WPushButton("cookies_law_agree"_wtr, content);
  agreeButton->setStyleClass("btn-link");
  agreeButton->clicked().connect([=](const WMouseEvent&){
    wApp->setCookie(COOKIES_LAW_COOKIE_NAME, COOKIES_LAW_COOKIE_VALUE, 60 * 60 * 24 * 365);
    runOnAccepted();
    delete this;
  });
  content->addStyleClass("cookies_law_agreement");
  setImplementation(content);
}
示例#18
0
void WSuggestionPopup::modelRowsInserted(const WModelIndex& parent,
					 int start, int end)
{
  if (filterLength_ != 0 && !filtering_)
    return;

  if (modelColumn_ >= model_->columnCount())
    return;

  if (parent.isValid())
    return;

  for (int i = start; i <= end; ++i) {
    WContainerWidget *line = new WContainerWidget();
    content_->insertWidget(i, line);

    boost::any d = model_->data(i, modelColumn_);
    WText *value = new WText(asString(d), PlainText);

    boost::any d2 = model_->data(i, modelColumn_, UserRole);
    if (d2.empty())
      d2 = d;

    line->addWidget(value);
    value->setAttributeValue("sug", asString(d2));
  }
}
示例#19
0
FormExample::FormExample()
    : WContainerWidget()
{
  WContainerWidget *langLayout = this->addWidget(cpp14::make_unique<WContainerWidget>());
  langLayout->setContentAlignment(AlignmentFlag::Right);
  langLayout->addWidget(cpp14::make_unique<WText>(tr("language")));

  const char *lang[] = { "en", "nl" };

  for (int i = 0; i < 2; ++i) {
    WText *t = langLayout->addWidget(cpp14::make_unique<WText>(lang[i]));
    t->setMargin(5);
    t->clicked().connect(std::bind(&FormExample::changeLanguage, this, t));

    languageSelects_.push_back(t);
  }

  /*
   * Start with the reported locale, if available
   */
  setLanguage(wApp->locale().name());

  Form *form = this->addWidget(cpp14::make_unique<Form>());
  form->setMargin(20);
}
示例#20
0
文件: AuthWidget.C 项目: 913862627/wt
void AuthWidget::createOAuthLoginView()
{
  if (!model_->oAuth().empty()) {
    setCondition("if:oauth", true);

    WContainerWidget *icons = new WContainerWidget();
    icons->setInline(isInline());

    for (unsigned i = 0; i < model_->oAuth().size(); ++i) {
      const OAuthService *auth = model_->oAuth()[i];

      WImage *w = new WImage("css/oauth-" + auth->name() + ".png", icons);
      w->setToolTip(auth->description());
      w->setStyleClass("Wt-auth-icon");
      w->setVerticalAlignment(AlignMiddle);

      OAuthProcess *const process 
	= auth->createProcess(auth->authenticationScope());
#ifndef WT_TARGET_JAVA
      w->clicked().connect(process, &OAuthProcess::startAuthenticate);
#else
      process->connectStartAuthenticate(w->clicked());
#endif

      process->authenticated().connect
	(boost::bind(&AuthWidget::oAuthDone, this, process, _1));

      WObject::addChild(process);
    }

    bindWidget("icons", icons);
  }
}
示例#21
0
MainPage::MainPage( const WEnvironment& env)    
    : WApplication(env)
{

    setTitle("Main page");

    this->useStyleSheet(AppPaths::cssFile);

    // Remove this 2 lines???
    userList = new WContainerWidget(root());
    userList->setStyleClass("list");


    // Remove it?
    WContainerWidget *t = new WContainerWidget();
    t->setInline(false);
    t->show();
    t->setStyleClass("big");    

    // Remove it?
    WStackedWidget *main = new WStackedWidget(root());
    main->setStyleClass("");    

    root()->removeWidget(main);




    Wt::WHBoxLayout *loginLayout = new Wt::WHBoxLayout(root());
    LoginWidget *login = new LoginWidget();
    loginLayout->addWidget(login);
    login->loggedIn().connect(this,&MainPage::setMainPage);
}
示例#22
0
  WContainerWidget *WForm::addControl(WWidget *w, const string &labelKey, bool isFormControl) {
    string controlSize = (boost::format("col-sm-%d") % (12-d->labelColumns)).str();
    string labelSize = (boost::format("col-sm-%d") % (d->labelColumns)).str();
    string controlOffset = (boost::format("col-sm-offset-%d") % (d->labelColumns)).str();
    if(d->type == Inline) {
      controlSize = "";
      labelSize = "";
      controlOffset = "";
    }
    WContainerWidget *container = WW<WContainerWidget>().addCss("form-group");
    if(isFormControl)
      w->addStyleClass("form-control");

    if(!labelKey.empty()) {
      WLabel *label = WW<WLabel>(WString::tr(labelKey), container).addCss("control-label").addCss(labelSize);
      if(dynamic_cast<WFormWidget*>(w))
        label->setBuddy(dynamic_cast<WFormWidget*>(w));
    }
    if(d->type == Inline)
      container->addWidget(w);
    else
      container->addWidget(WW<WContainerWidget>().addCss(controlSize).addCss(labelKey.empty() ? controlOffset : "").add(w));
    addWidget(container);
    return container;
  }
示例#23
0
void StdLayoutImpl::update(WLayoutItem *item)
{
  WContainerWidget *c = container();

  if (c)
    c->layoutChanged();
}
示例#24
0
文件: WtHome.C 项目: ReWeb3D/wt
WWidget *WtHome::example(const char *textKey, const std::string& sourceDir)
{
  WContainerWidget *result = new WContainerWidget();
  WText *w = new WText(tr(textKey), result);
  w->setInternalPathEncoding(true);
  result->addWidget(linkSourceBrowser(sourceDir));
  return result;
}
示例#25
0
void StdGridLayoutImpl2::update(WLayoutItem *item)
{
  WContainerWidget *c = container();

  if (c)
    c->layoutChanged(false, false);

  needConfigUpdate_ = true;
}
示例#26
0
文件: login.C 项目: rupindar/witty
About::About() {
	WContainerWidget *cw = new 	WContainerWidget();
	cw->addWidget(new WText("<b>About</b> "));
	cw->addWidget(new WBreak());
	cw->addWidget(new WBreak());
        cw->addWidget(new WImage("/images/cartoon_87.gif "));
	cw->addWidget(new WText(WDateTime::currentDateTime().toString()));
	this->addWidget(cw);
}
示例#27
0
文件: WSubMenuItem.C 项目: ReWeb3D/wt
void WSubMenuItem::updateItemWidget(WWidget *itemWidget)
{
  if (subMenu_) {
    WContainerWidget *contents = dynamic_cast<WContainerWidget *>(itemWidget);
    WWidget *anchor = contents->widget(0);
    WMenuItem::updateItemWidget(anchor);
  } else
    WMenuItem::updateItemWidget(itemWidget);
}
示例#28
0
文件: login.C 项目: rupindar/witty
GREATDEVELOPERS::GREATDEVELOPERS() {
	WContainerWidget *cw = new 	WContainerWidget();
	
	
        cw->addWidget(new WText(" Always rise yourself for sky"));
        cw->addWidget(new WBreak());
	cw->addWidget(new WText("Nothing is impossible because impossible itself says i am possible"));
	this->addWidget(cw);
}
示例#29
0
文件: CommentView.C 项目: LifeGo/wt
void CommentView::reply()
{
  dbo::Transaction t(session_);

  WContainerWidget *c = resolve<WContainerWidget *>("children");
  c->insertWidget(0, new CommentView(session_, comment_.id()));

  t.commit();
}
示例#30
0
void WNavigationBar::addWrapped(WWidget *widget, WWidget* parent, int role,
                AlignmentFlag alignment)
{
  WContainerWidget *contents = resolve<WContainerWidget *>("contents");

  WContainerWidget *wrap = new WContainerWidget(contents);
  wApp->theme()->apply(widget, parent, role);
  align(wrap, alignment);
  wrap->addWidget(widget);
}