예제 #1
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);
}
예제 #2
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);
}
예제 #3
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;
  }
예제 #4
0
LatestCommentsDialog::LatestCommentsDialog(Session* session, MediaCollection *mediaCollection, WObject* parent): WDialog{parent}
{
  setResizable(true);
  setWindowTitle(wtr("menu.latest.comments"));
  setClosable(true);
  setTransient(true);
  setMaximumSize(700, WLength::Auto);
  Dbo::Transaction t(*session);
  Dbo::collection<CommentPtr> latestComments = session->find<Comment>().orderBy("last_updated desc").limit(5);
  if(!latestComments.size())
    contents()->addWidget(new WText{wtr("comments.empty")});
  for(CommentPtr comment: latestComments) {
    WContainerWidget* commentWidget = new WContainerWidget;
    Media media = mediaCollection->media(comment->mediaId());
      
    WContainerWidget *header = WW<WContainerWidget>();
    header->setContentAlignment(AlignCenter);
    
    WAnchor *videoLink = WW<WAnchor>("", media.title(t)).css("link-hand label label-info comment-box-element");
    header->addWidget(videoLink);
    Dbo::ptr<AuthInfo> authInfo = session->find<AuthInfo>().where("user_id = ?").bind(comment->user().id());
    header->addWidget(WW<WText>(WString("{1} ({2})").arg(authInfo->identity("loginname")).arg(comment->lastUpdated().toString()))
    .css("label label-success comment-box-element"));
    commentWidget->addWidget(header);
    videoLink->clicked().connect([=](WMouseEvent){
      _mediaClicked.emit(media);
      accept();
    });
    commentWidget->addWidget(WW<WText>(WString::fromUTF8(comment->content())).css("well comment-text comment-box-element").setInline(false));
    contents()->addWidget(WW<WContainerWidget>().css("comment-text").add(commentWidget));
  }
}
예제 #5
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);
}
예제 #6
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);
}
예제 #7
0
WWidget *WCartesianChart::createLegendItemWidget(int index)
{
  WContainerWidget *legendItem = new WContainerWidget();

  legendItem->addWidget(new IconWidget(this, index));
  WText *label = new WText(asString(model()->headerData(index)));
  label->setVerticalAlignment(AlignTop);
  legendItem->addWidget(label);

  return legendItem;
}
예제 #8
0
Playlist::Playlist(Session* session, Settings* settings, WContainerWidget* parent)
: WPanel(parent), d(this, session)
{
  setCentralWidget(d->container = new WContainerWidget);
  setTitleBar(true);
  addStyleClass("playlist");
  setHeaderCollapsible(this);
  titleBarWidget()->addStyleClass("playtlist-titlebar");
  setCollapsible(false);

  d->container->hide();
  d->container->setList(true);
  d->container->addStyleClass("nav nav-pills nav-stacked");
  d->container->setMargin(5, Side::Bottom);
  WText *showHideButtonText = WW<WText>();
  
  d->setPlaylistVisible = [=](bool visible) {
    if(!visible) {
      showHideButtonText->setText(wtr("playlist.show"));
      settings->animateHide(Settings::PlaylistAnimation, d->container);
    }
    else {
      showHideButtonText->setText(wtr("playlist.hide"));
      settings->animateShow(Settings::PlaylistAnimation, d->container);
    }
  };
  
  d->playSignal.connect([=](PlaylistItem*,_n5){ d->setPlaylistVisible(false); });

  WContainerWidget *firstGroup = WW<WContainerWidget>().css("btn-group");
  firstGroup->addWidget(WW<WAnchor>().css("btn btn-xs")
    .setImage(WW<WImage>(Settings::staticPath("/icons/actions/playlist.png")).setMargin(5, Side::Right))
    .add(showHideButtonText)
    .onClick([=](WMouseEvent){
      d->setPlaylistVisible(!d->container->isVisible());
    }));
  firstGroup->addWidget(WW<WAnchor>().css("btn btn-xs")
    .setImage(WW<WImage>(Settings::staticPath("/icons/actions/playlist.clear.png")).setMargin(5, Side::Right))
    .setText(wtr("playlist.clear"))
    .onClick([=](WMouseEvent){
    for(auto item: d->internalQueue)
      delete item;
    d->internalQueue.clear();
  }));

  WContainerWidget *secondGroup = WW<WContainerWidget>().css("btn-group");
  WWidget *prev = WW<WAnchor>(secondGroup).css("btn btn-xs")
    .add(new WImage{Settings::staticPath("/icons/actions/previous.png")}).onClick(boost::bind(&Playlist::previous, this));
  WWidget *next = WW<WAnchor>(secondGroup).css("btn btn-xs")
    .add(new WImage{Settings::staticPath("/icons/actions/next.png")}).onClick(boost::bind(&Playlist::next, this));
  WContainerWidget *playlistButtonsContainer = WW<WContainerWidget>(titleBarWidget()).css("btn-toolbar")
  .add(firstGroup).add(secondGroup);
  d->setPlaylistVisible(false);
}
예제 #9
0
파일: WSubMenuItem.C 프로젝트: ReWeb3D/wt
WWidget *WSubMenuItem::createItemWidget()
{
  if (subMenu_) {
    WContainerWidget *contents = new WContainerWidget();
    WWidget *anchor = WMenuItem::createItemWidget();
    contents->addWidget(anchor);
    contents->addWidget(subMenu_);

    return contents;
  } else
    return WMenuItem::createItemWidget();
}
예제 #10
0
QueueItem::QueueItem(Media media, std::list< QueueItem* >& queue, WContainerWidget* container, Session* session, WContainerWidget* parent)
  : WContainerWidget(parent), PlaylistItem(media)
{
  QueueItem *queueItem = this;
  Dbo::Transaction t(*session);
  WAnchor *anchor = new WAnchor{this};
  anchor->addWidget(WW<WText>(media.title(t)).css("link-hand").onClick([=](WMouseEvent&){ playSignal.emit(this); }));
  WContainerWidget *actionsContainer = WW<WContainerWidget>(anchor).css("pull-right");
  auto fixButtons = [=,&queue] {
    for(QueueItem *item: queue) {
      item->upButton->setHidden(item == queue.front());
      item->downButton->setHidden(item == queue.back());
    }
  };
  
  auto moveElement = [=,&queue](int direction) {
    auto element = std::find(begin(queue), end(queue), queueItem);
    auto nextElement = element;
    direction>0 ? nextElement++ : nextElement--;
    swap(*nextElement, *element);
    int index = container->indexOf(queueItem);
    container->removeWidget(queueItem);
    container->insertWidget(index + direction, queueItem);
    fixButtons();
  };
  
  actionsContainer->addWidget(upButton = WW<WImage>(Settings::staticPath("/icons/actions/up.png"))
    .css("link-hand").onClick([=,&queue](WMouseEvent){
    if(queue.front() == queueItem) return;
    moveElement(-1);
  }));
  actionsContainer->addWidget(downButton = WW<WImage>(Settings::staticPath("/icons/actions/down.png"))
    .css("link-hand").onClick([=,&queue](WMouseEvent){
    if(queue.back() == queueItem) return;
    moveElement(+1);
  }));
  actionsContainer->addWidget(removeButton = WW<WImage>(Settings::staticPath("/icons/actions/delete.png"))
    .css("link-hand").onClick([=,&queue](WMouseEvent){
    queue.erase(std::remove(begin(queue), end(queue), queueItem));
    delete queueItem;
    fixButtons();
  }));
  upButton->setHiddenKeepsGeometry(true);
  downButton->setHiddenKeepsGeometry(true);
  container->addWidget(this);
  queue.push_back(this);
  fixButtons();
}
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);
}
예제 #12
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;
    }
  }
예제 #13
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));
  }
}
예제 #14
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); 
}
예제 #15
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);
}
예제 #16
0
WImage *WItemDelegate::iconWidget(WidgetRef& w, bool autoCreate)
{
  WImage *image = dynamic_cast<WImage *>(w.w->find("i"));
  if (image || !autoCreate)
    return image;

  WContainerWidget *wc = dynamic_cast<WContainerWidget *>(w.w->find("a"));

  if (!wc)
    wc = dynamic_cast<WContainerWidget *>(w.w->find("o"));

  if (!wc) {
    wc = new WContainerWidget();
    wc->setObjectName("o");
    wc->addWidget(w.w);
    w.w = wc;
  }

  image = new WImage();
  image->setObjectName("i");
  image->setStyleClass("icon");
  wc->insertWidget(wc->count() - 1, image);

  // IE does not want to center vertically without this:
  if (wApp->environment().agentIsIE()) {
    WImage *inv = new WImage(wApp->onePixelGifUrl());
    inv->setStyleClass("rh w0 icon");
    inv->resize(0, WLength::Auto);
    wc->insertWidget(wc->count() -1, inv);
  }

  return image;
}
예제 #17
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;
}
예제 #18
0
파일: WNavigationBar.C 프로젝트: GuLinux/wt
void WNavigationBar::addWrapped(WWidget *widget, AlignmentFlag alignment,
				const char *wrapClass)
{
  WContainerWidget *contents = resolve<WContainerWidget *>("contents");

  WContainerWidget *wrap = new WContainerWidget(contents);
  wrap->setStyleClass(wrapClass);
  align(wrap, alignment);
  wrap->addWidget(widget);
}
예제 #19
0
파일: WNavigationBar.C 프로젝트: GuLinux/wt
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);
}
예제 #20
0
파일: WTreeTable.C 프로젝트: LifeGo/wt
void WTreeTable::setTree(WTree *root, const WString& h)
{
  WContainerWidget *parent = dynamic_cast<WContainerWidget *>(tree_->parent());

  delete tree_;
  parent->addWidget(tree_ = root);
  header(0)->setText(h);
  tree_->resize(WLength(100, WLength::Percentage), WLength::Auto);

  treeRoot()->setTable(this);
}
예제 #21
0
파일: CommentView.C 프로젝트: LifeGo/wt
void CommentView::renderView()
{
  clear();

  bool isRootComment = !comment_->parent;
  setTemplateText(isRootComment ? tr("blog-root-comment")
		  : tr("blog-comment"));

  bindString("collapse-expand", WString::Empty); // NYI

  WText *replyText = new WText(isRootComment ? tr("comment-add")
			       : tr("comment-reply"));
  replyText->setStyleClass("link");
  replyText->clicked().connect(this, &CommentView::reply);
  bindWidget("reply", replyText);

  bool mayEdit = session_.user()
    && (comment_->author == session_.user()
	|| session_.user()->role == User::Admin);

  if (mayEdit) {
    WText *editText = new WText(tr("comment-edit"));
    editText->setStyleClass("link");
    editText->clicked().connect(this, &CommentView::edit);
    bindWidget("edit", editText);
  } else
    bindString("edit", WString::Empty);

  bool mayDelete
    = (session_.user() && session_.user() == comment_->author)
    || session_.user() == comment_->post->author; 

  if (mayDelete) {
    WText *deleteText = new WText(tr("comment-delete"));
    deleteText->setStyleClass("link");
    deleteText->clicked().connect(this, &CommentView::rm);
    bindWidget("delete", deleteText);
  } else
    bindString("delete", WString::Empty);

  typedef std::vector< dbo::ptr<Comment> > CommentVector;
  CommentVector comments;
  {
    dbo::collection<dbo::ptr<Comment> > cmts
      = comment_->children.find().orderBy("date");
    comments.insert(comments.end(), cmts.begin(), cmts.end());
  }

  WContainerWidget *children = new WContainerWidget();
  for (int i = (int)comments.size() - 1; i >= 0; --i)
    children->addWidget(new CommentView(session_, comments[i]));

  bindWidget("children", children);
}
예제 #22
0
파일: WNavigationBar.C 프로젝트: GuLinux/wt
void WNavigationBar::addWidget(WWidget *widget, AlignmentFlag alignment)
{
  if (dynamic_cast<WMenu *>(widget)) {
    align(widget, alignment);

    WContainerWidget *contents = resolve<WContainerWidget *>("contents");
    contents->addWidget(widget);
    contents->setLoadLaterWhenInvisible(false);
  } else
    addWrapped(widget, alignment, "navbar-form");
}
예제 #23
0
파일: MvcWidgets.C 프로젝트: ReWeb3D/wt
WWidget *MvcWidgets::viewsTree()
{
  WContainerWidget *result = new WContainerWidget();

  topic("WTreeView", result);

  WStandardItemModel *model1 = TreeViewExample::createModel(false, this);
  TreeViewExample *tv1 
    = new TreeViewExample(model1, tr("mvc-WTreeView"));
  result->addWidget(tv1);
  
  WStandardItemModel *model2 = TreeViewExample::createModel(false, this);
  TreeViewExample *tv2 
    = new TreeViewExample(model2, tr("mvc-WTreeView-column1Fixed"));
  result->addWidget(tv2);

  tv2->treeView()->setRowHeaderCount(1);
  tv2->treeView()->setColumnWidth(0, 300);

  return result;
}
예제 #24
0
파일: WTreeTable.C 프로젝트: kdeforche/wt
void WTreeTable::setTree(std::unique_ptr<WTree> root, const WString& h)
{
  WContainerWidget *parent = dynamic_cast<WContainerWidget *>(tree_->parent());
  parent->removeWidget(tree_);
  tree_ = root.get();
  parent->addWidget(std::move(root));

  header(0)->setText(h);
  tree_->resize(WLength(100, LengthUnit::Percentage), WLength::Auto);

  treeRoot()->setTable(this);
}
예제 #25
0
파일: WtHome.C 프로젝트: ReWeb3D/wt
WWidget *WtHome::examples()
{
  WContainerWidget *result = new WContainerWidget();

  WText *intro = new WText(tr("home.examples"));
  intro->setInternalPathEncoding(true);
  result->addWidget(intro);

  examplesMenu_ = new WTabWidget(result);

  WAnimation animation(WAnimation::SlideInFromRight, WAnimation::EaseIn);
  examplesMenu_->contentsStack()->setTransitionAnimation(animation, true);

  /*
   * The following code is functionally equivalent to:
   *
   *   examplesMenu_->addTab(helloWorldExample(), "Hello world");
   *
   * However, we optimize here for memory consumption (it is a homepage
   * after all, and we hope to be slashdotted some day)
   *
   * Therefore, we wrap all the static content (including the tree
   * widgets), into WViewWidgets with static models. In this way the
   * widgets are not actually stored in memory on the server.
   */

  // The call ->setPathComponent() is to use "/examples/" instead of
  // "/examples/hello_world" as internal path
  examplesMenu_->addTab(wrapView(&WtHome::helloWorldExample),
			tr("hello-world"))->setPathComponent("");
  examplesMenu_->addTab(wrapView(&WtHome::chartExample),
  			tr("charts"));
  examplesMenu_->addTab(wrapView(&WtHome::homepageExample),
			tr("wt-homepage"));
  examplesMenu_->addTab(wrapView(&WtHome::treeviewExample),
			tr("treeview"));
  examplesMenu_->addTab(wrapView(&WtHome::gitExample),
			tr("git"));
  examplesMenu_->addTab(wrapView(&WtHome::chatExample),
			tr("chat"));
  examplesMenu_->addTab(wrapView(&WtHome::composerExample),
			tr("mail-composer"));
  examplesMenu_->addTab(wrapView(&WtHome::hangmanExample),
			tr("hangman"));
  examplesMenu_->addTab(wrapView(&WtHome::widgetGalleryExample),
			tr("widget-gallery"));

  // Enable internal paths for the example menu
  examplesMenu_->setInternalPathEnabled("/examples");
  examplesMenu_->currentChanged().connect(this, &Home::googleAnalyticsLogger);

  return result;
}
예제 #26
0
void SettingsPage::addSetting(const string& settingName, WFormWidget* widget)
{
  WString label = wtr(settingName + ".label");
  WString helpText = wtr(settingName + ".description");
  
  WLabel *labelWidget = WW<WLabel>(label).css("control-label");
  labelWidget->setBuddy(widget);
  WContainerWidget *control = WW<WContainerWidget>().css("controls").add(widget);
  if(!helpText.empty()) {
    control->addWidget(WW<WText>(helpText).css("help-block") );
  }
  addWidget(WW<WContainerWidget>().css("control-group")
    .add(labelWidget)
    .add( control ));
}
예제 #27
0
/*
 * The env argument contains information about the new session, and
 * the initial request. It must be passed to the WApplication
 * constructor so it is typically also an argument for your custom
 * application constructor.
*/
DataAnalyzer::DataAnalyzer(const WEnvironment& env)
  : WApplication(env)
{
  setTitle(WString::fromUTF8("行车数据管理平台",true));
  WContainerWidget *w = new WContainerWidget(root());
  w->resize(WLength::Auto, WLength::Auto);
  HomeUI* home = new HomeUI(w);
  w->addWidget(home);
  root()->addWidget(w);
  setLocale(WT_LOCALE("cn"));
  WMessageResourceBundle* pTranslate = new WMessageResourceBundle();
  pTranslate->use(appRoot()+"resources/auth");
  setLocalizedStrings(pTranslate);
  useStyleSheet("resources/analyzer.css");
  log("info") << "constructed" ;
}
예제 #28
0
gdWPrintersDialog::gdWPrintersDialog(WString title, gdWPrintersDialogData* refData)
  : gdWDialog(title, refData), m_refData(refData)
{
  if ( WString::tr("byObjectStyleSheet").narrow() == "true" )
    wApp->useStyleSheet(wApp->theme()->resourcesUrl() + "gdwtcore/Css/gdWPrintersDialog.css");
  wApp->messageResourceBundle().use(wApp->docRoot() + wApp->resourcesUrl() + "/gdwtcore/Transl/gdWPrintersDialog");
  addStyleClass("gdWPrintersDialog");
  m_refData->saveDataCallback = boost::bind(&gdWPrintersDialog::saveData, boost::ref(*this), m_refData);
  printers();
  WContainerWidget* content = getContent();
  m_pSelBox = new WSelectionBox();
  for (int i = 0; i < m_vPrinters.size(); i++)
    m_pSelBox->addItem(m_vPrinters[i]);
  m_pSelBox->setVerticalSize(9);
  m_pSelBox->setSelectionMode(Wt::SingleSelection);
  m_pSelBox->setCurrentIndex(m_refData->m_selectedPrinter);
  content->addWidget(m_pSelBox);
  resize(250, 300);
}
예제 #29
0
파일: Home.C 프로젝트: GuLinux/wt
WWidget *Home::quoteForm()
{
  WContainerWidget *result = new WContainerWidget();
  result->setStyleClass("quote");

  WTemplate *requestTemplate = new WTemplate(tr("quote.request"), result);

  WPushButton *quoteButton = new WPushButton(tr("quote.requestbutton"));
  requestTemplate->bindWidget("button", quoteButton);

  WWidget *quoteForm = createQuoteForm();
  result->addWidget(quoteForm);

  quoteButton->clicked().connect(quoteForm, &WWidget::show);
  quoteButton->clicked().connect(requestTemplate, &WWidget::hide);

  quoteForm->hide();

  return result;
}
예제 #30
0
IndexCheckBox *WItemDelegate::checkBox(WidgetRef& w, const WModelIndex& index,
				      bool autoCreate, bool triState)
{
  IndexCheckBox *checkBox = dynamic_cast<IndexCheckBox *>(w.w->find("c"));

  if (!checkBox) {
    if (autoCreate) {
      IndexCheckBox * const result = checkBox = new IndexCheckBox(index);

      checkBox->setObjectName("c");
      checkBox->clicked().preventPropagation();

      WContainerWidget *wc = dynamic_cast<WContainerWidget *>(w.w->find("o"));
      if (!wc) {
	wc = new WContainerWidget();
	wc->setObjectName("o");
	w.w->setInline(true);
	w.w->setStyleClass(WString::Empty);

	/* We first remove to avoid reparenting warnings */
	WContainerWidget *p = dynamic_cast<WContainerWidget *>(w.w->parent());
	if (p)
	  p->removeWidget(w.w);

	wc->addWidget(w.w);
	w.w = wc;
      }
      
      wc->insertWidget(0, checkBox);
      checkBox->changed().connect
	(boost::bind(&WItemDelegate::onCheckedChange, this, result));
    } else
      return 0;
  }

  checkBox->setTristate(triState);

  return checkBox;
}