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


C++ WPushButton类代码示例

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


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

示例1: WTable

void menuWidget::revengeProposed()
{
    WApplication *app = WApplication::instance();
    information->setText("Revenge was proposed. Press start to begin");
    startGame->enable();
    revenge->disable();
    giveUp->disable();
    endGame->enable();
    gameButtons.clear();
    everything->clear();
    delete everything;
    everything = new WTable(this);
    for(int i = 0; i<SIZE; i++)
    {
        for(int j = 0; j<SIZE; j++) {
            WPushButton * newButton = new WPushButton();
            newButton->disable();
            newButton->resize(35,35); //images are 30x30, just in case
            newButton->setVerticalAlignment(Wt::AlignMiddle);
            newButton->clicked().connect(boost::bind(&menuWidget::processClickButton,this,newButton,i,j));
            everything->elementAt(i,j)->addWidget(newButton);
            gameButtons.insert(make_pair(Coordinates(j,i),newButton));
        }//adding the noughts&crosses buttons (225)
    }

    app->triggerUpdate();
}
开发者ID:micp,项目名称:ZPR,代码行数:27,代码来源:menuWidget.cpp

示例2: WPushButton

WInteractWidget *WNavigationBar::createExpandButton()
{
  WPushButton *result = new WPushButton(tr("Wt.WNavigationBar.expand-button"));
  result->setTextFormat(XHTMLText);
  wApp->theme()->apply(this, result, NavbarBtn);
  return result;
}
开发者ID:GuLinux,项目名称:wt,代码行数:7,代码来源:WNavigationBar.C

示例3: WApplication

/*
 * 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.
 */
HelloApplication::HelloApplication(const WEnvironment& env)
: WApplication(env)
{
  setTitle("Hello world");              // application title

                                        // show some text
  root()->addWidget(new WText("Your name, please ? "));
  nameEdit_ = new WLineEdit(root());    // allow text input
  nameEdit_->setFocus();                // give focus

                                        // create a button
  WPushButton *b = new WPushButton("Greet me.", root());
  b->setMargin(5, Left);                // add 5 pixels margin

  root()->addWidget(new WBreak());      // insert a line break

  greeting_ = new WText(root());        // empty text

  /*
   * Connect signals with slots
   *
   * - simple Wt-way
   */
  //b->clicked().connect(this, &HelloApplication::greet);

  /*
   * - using an arbitrary function object (binding values with boost::bind())
   */
  //nameEdit_->enterPressed().connect(boost::bind(&HelloApplication::greet, this));
}
开发者ID:4ukuta,项目名称:core,代码行数:36,代码来源:main.cpp

示例4: WApplication

WebGLDemo::WebGLDemo(const WEnvironment& env)
  : WApplication(env)
{
  setTitle("WebGL Demo");

  root()->addWidget(new WText("If your browser supports WebGL, you'll "
    "see a teapot below.<br/>Use your mouse to move around the teapot.<br/>"
    "Edit the shaders below the teapot to change how the teapot is rendered."));
  root()->addWidget(new WBreak());

  paintWidget_ = 0;

  glContainer_ = new WContainerWidget(root());
  glContainer_->resize(500, 500);
  glContainer_->setInline(false);

  WPushButton *updateButton = new WPushButton("Update shaders", root());
  updateButton->clicked().connect(this, &WebGLDemo::updateShaders);
  WPushButton *resetButton = new WPushButton("Reset shaders", root());
  resetButton->clicked().connect(this, &WebGLDemo::resetShaders);

  WTabWidget *tabs = new WTabWidget(root());

  fragmentShaderText_ = new WTextArea;
  fragmentShaderText_->resize(750, 250);
  tabs->addTab(fragmentShaderText_, "Fragment Shader");
  WText *shaderInfo = new WText(root());
  vertexShaderText_ = new WTextArea;
  vertexShaderText_->resize(750, 250);
  tabs->addTab(vertexShaderText_, "Vertex Shader");

  resetShaders();
}
开发者ID:913862627,项目名称:wt,代码行数:33,代码来源:teapot.C

示例5: WContainerWidget

WWidget *MvcWidgets::viewsCombo()
{
  WContainerWidget *result = new WContainerWidget();

  // WComboBox
#if !defined(WT_TARGET_JAVA)
  topic("WComboBox", "WSelectionBox", "Ext::ComboBox", result);
#else
  topic("WComboBox", "WSelectionBox", result);
#endif
  addText(tr("mvc-stringlistviews"), result);
  addText("<h3>WComboBox</h3>", result);
  (new WComboBox(result))->setModel(stringList_);

  // WSelectionBox
  addText("<h3>WSelectionBox</h3>", result);
  (new WSelectionBox(result))->setModel(stringList_);

#ifndef WT_TARGET_JAVA
  // Ext::ComboBox
  addText("<h3>Ext::ComboBox</h3>", result);
  extComboBox_ = new Ext::ComboBox(result);
  extComboBox_->setModel(stringList_);
  extComboBox_->setEditable(true);
  WPushButton *pb = new WPushButton("Press here to add the edited value "
				    "to the model", result);
  pb->clicked().connect(this, &MvcWidgets::comboBoxAdd);
#endif
  
  return result;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:31,代码来源:MvcWidgets.C

示例6: bindPanelTemplates

  void bindPanelTemplates() {
    if (!session_.user())
      return;

    dbo::Transaction t(session_);

    if (authorPanel_) {
      WPushButton *newPost = new WPushButton(tr("new-post"));
      newPost->clicked().connect(SLOT(this, BlogImpl::newPost));
      WContainerWidget *unpublishedPosts = new WContainerWidget();
      showPosts(session_.user()->allPosts(Post::Unpublished), unpublishedPosts);

      authorPanel_->bindString("user", session_.user()->name);
      authorPanel_->bindInt("unpublished-count",
			    (int)session_.user()->allPosts(Post::Unpublished)
			    .size());
      authorPanel_->bindInt("published-count",
			    (int)session_.user()->allPosts(Post::Published)
			    .size());
      authorPanel_->bindWidget("new-post", newPost);
      authorPanel_->bindWidget("unpublished-posts", unpublishedPosts);
    }

    t.commit();
  }
开发者ID:DTidd,项目名称:wt,代码行数:25,代码来源:BlogView.C

示例7: disconnect

void SimpleChatWidget::letLogin()
{
  disconnect();

  clear();

  WVBoxLayout *vLayout = new WVBoxLayout();
  setLayout(vLayout, AlignLeft | AlignTop);

  WHBoxLayout *hLayout = new WHBoxLayout();
  vLayout->addLayout(hLayout);

  hLayout->addWidget(new WLabel("User name:"), 0, AlignMiddle);
  hLayout->addWidget(userNameEdit_ = new WLineEdit(user_), 0, AlignMiddle);
  userNameEdit_->setFocus();

  WPushButton *b = new WPushButton("Login");
  hLayout->addWidget(b, 0, AlignMiddle);

  b->clicked().connect(this, &SimpleChatWidget::login);
  userNameEdit_->enterPressed().connect(this, &SimpleChatWidget::login);

  vLayout->addWidget(statusMsg_ = new WText());
  statusMsg_->setTextFormat(PlainText);
}
开发者ID:bvanhauwaert,项目名称:wt,代码行数:25,代码来源:SimpleChatWidget.C

示例8: WApplication

ChatApplication::ChatApplication(const WEnvironment& env,
				 SimpleChatServer& server)
  : WApplication(env),
    server_(server),
    env_(env)
{
  setTitle("Wt Chat");
  useStyleSheet("chatapp.css");

  messageResourceBundle().use(appRoot() + "simplechat");

  javaScriptTest();

  root()->addWidget(new WText(WString::tr("introduction")));

  SimpleChatWidget *chatWidget =
      new SimpleChatWidget(server_, root());
  chatWidget->setStyleClass("chat");

  root()->addWidget(new WText(WString::tr("details")));

  WPushButton *b = new WPushButton("I'm schizophrenic ...", root());
  b->clicked().connect(b, &WPushButton::hide);
  b->clicked().connect(this, &ChatApplication::addChatWidget);
}
开发者ID:913862627,项目名称:wt,代码行数:25,代码来源:simpleChat.C

示例9: WPushButton

WPushButton *WMessageBox::addButton(const WString& text, StandardButton result)
{
  WPushButton *b = new WPushButton(text, buttonContainer_);
  buttonMapper_->mapConnect(b->clicked(), result);

  return b;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:7,代码来源:WMessageBox.C

示例10: WApplication

WApplication *createApplication(const WEnvironment& env)
{
  WApplication *appl = new WApplication(env);

  new WText("<h1>Your mission</h1>", appl->root());
  WText *secret 
    = new WText("Your mission, Jim, should you accept, is to create solid "
		"web applications.",
		appl->root());

  new WBreak(appl->root()); new WBreak(appl->root());

  new WText("This program will quit in ", appl->root());
  CountDownWidget *countdown = new CountDownWidget(10, 0, 1000, appl->root());
  new WText(" seconds.", appl->root());

  new WBreak(appl->root()); new WBreak(appl->root());

  WPushButton *cancelButton = new WPushButton("Cancel!", appl->root());
  WPushButton *quitButton = new WPushButton("Quit", appl->root());
  quitButton->clicked().connect(appl, &WApplication::quit);

  countdown->done().connect(appl, &WApplication::quit);
  cancelButton->clicked().connect(countdown, &CountDownWidget::cancel);
  cancelButton->clicked().connect(cancelButton, &WFormWidget::disable);
  cancelButton->clicked().connect(secret, &WWidget::hide);

  return appl;
}
开发者ID:913862627,项目名称:wt,代码行数:29,代码来源:impossible.C

示例11:

WPopupMenu::~WPopupMenu()
{
  if (button_) {
    WPushButton *b = dynamic_cast<WPushButton *>(button_);
    if (b)
      b->setMenu(0);
  }
}
开发者ID:yarmola,项目名称:wt,代码行数:8,代码来源:WPopupMenu.C

示例12: WContainerWidget

CommentsContainerWidget::CommentsContainerWidget(string videoId, Session* session, WContainerWidget* parent)
  : WContainerWidget(parent), d(videoId, session)
{
  string querysql = "select content,last_updated,\
      auth_info.email as email,\
    auth_identity.identity as identity\
    from comment\
    inner join auth_info on comment.user_id = auth_info.user_id\
    inner join auth_identity on auth_info.id = auth_identity.auth_info_id\
  ";
  wApp->log("notice") << "comments query: " << querysql;
  auto query = d->session->query<CommentTuple>(querysql);
  query.where("media_id = ?").bind(videoId);
  query.where("auth_identity.provider = 'loginname'");
  query.orderBy("last_updated DESC");
  addWidget(WW<WText>(wtr("comments.label")).css("label").setInline(false));
  
  WTextArea* newCommentContent = new WTextArea();
  newCommentContent->setRows(3);
  newCommentContent->setInline(false);
  WPushButton* insertComment = WW<WPushButton>(wtr("comments.addcomment.button")).css("btn btn-primary btn-sm").onClick([=](WMouseEvent){
    if(newCommentContent->text().empty())
      return;
    Comment *comment = new Comment(videoId, d->session->user(), newCommentContent->text().toUTF8());
    Dbo::Transaction t(*d->session);
    Dbo::ptr< Comment > newComment = d->session->add(comment);
    t.commit();
    newCommentContent->setText("");
    commentViewers.commentAdded(videoId, newComment.id());
  });
  newCommentContent->keyWentUp().connect([=](WKeyEvent){
    insertComment->setEnabled(!newCommentContent->text().empty());
  });
  insertComment->setEnabled(false);
  
//     newCommentContent->setWidth(500);
  newCommentContent->addStyleClass("col-md-8");

  addWidget(WW<WContainerWidget>().css("add-comment-box row").add(newCommentContent).add(insertComment).setContentAlignment(AlignCenter));
  
  addWidget(d->commentsContainer = WW<WContainerWidget>().css("container") );

  Dbo::Transaction t(*d->session);
  for(CommentTuple comment : query.resultList())
    d->commentsContainer->addWidget(new CommentView(comment) );
  
  auto commentAdded = [=] (string commentVideoId, long commentId) {
    if(commentVideoId != videoId) return;
    Dbo::Transaction t(*d->session);
    auto query = d->session->query<CommentTuple>(querysql).where("comment.id = ?").bind(commentId);
    query.where("auth_identity.provider = 'loginname'");
    d->commentsContainer->insertWidget(0, new CommentView(query.resultValue()));
    d->commentsContainer->refresh();
    wApp->triggerUpdate();
  };
  
  commentViewers.addClient(wApp->sessionId(), commentAdded);
}
开发者ID:GuLinux,项目名称:Pandorica,代码行数:58,代码来源:commentscontainerwidget.cpp

示例13: WContainerWidget

void BasePage::addBook(){
	WContainerWidget *container = new WContainerWidget();
	Wt::WTemplate *t = new Wt::WTemplate(Wt::WString::tr("addBookForm"));
	
	WLineEdit *editTitle = new WLineEdit(container);
	editTitle->setPlaceholderText("title");
	t->bindWidget("title", editTitle);
	
	WLineEdit *editAuthor = new WLineEdit(container);
	editAuthor->setPlaceholderText("author");
	t->bindWidget("author", editAuthor);
	
	WLineEdit *editAuthorYears = new WLineEdit(container);
	editAuthorYears->setPlaceholderText("years of life");
	t->bindWidget("years", editAuthorYears);
	
	WLineEdit *editGenre = new WLineEdit(container);
	editGenre->setPlaceholderText("genre");
	t->bindWidget("genre", editGenre);
	
	WLineEdit *editYear = new WLineEdit(container);
	editYear->setPlaceholderText("year");
	t->bindWidget("year", editYear);
	
	WLineEdit *editSeria = new WLineEdit(container);
	editSeria->setPlaceholderText("seria");
	t->bindWidget("seria", editSeria);
	
	WLineEdit *editNumOfBooks = new WLineEdit(container);
	editNumOfBooks->setPlaceholderText("num of books");
	t->bindWidget("numOfBooks", editNumOfBooks);
	
	WLineEdit *editNumInSeria = new WLineEdit(container);
	editNumInSeria->setPlaceholderText("number in seria");
	t->bindWidget("numInSeria", editNumInSeria);
	
	WLineEdit *editMark = new WLineEdit(container);
	editMark->setPlaceholderText("mark");
	editMark->setValidator(new Wt::WIntValidator(1, 10));
	t->bindWidget("mark", editMark);
	
	WPushButton *button = new WPushButton("Add book", container);
	button->setMargin(10, Top | Bottom);

	button->clicked().connect(std::bind([=] () {BookManager bm; bm.addBook(editTitle->valueText().toUTF8(),
																		   editAuthor->valueText().toUTF8(),
																		   editAuthorYears->valueText().toUTF8(),
																		   editGenre->valueText().toUTF8(),
																		   intoInt(editYear),
																		   editSeria->valueText().toUTF8(),
																		   intoInt(editNumOfBooks),
																		   intoInt(editNumInSeria),
																		   intoInt(editMark)); }));
	
	t->bindWidget("button", button);
	_pagecontent->addWidget(t);	
}
开发者ID:leshkajou,项目名称:bookrate,代码行数:57,代码来源:basepage.cpp

示例14: WContainerWidget

void Reports::createUi()
{

    WContainerWidget *dateSelectForm = new WContainerWidget(this);
    dateSelectForm ->setStyleClass("form-inline");
    dateSelectForm ->setId("dateselectform");

    WLabel *label;

    label = new WLabel(tr("reports.begindate"), dateSelectForm );
    m_pBeginDateEdit = new WDateEdit(dateSelectForm );
    //label->setBuddy(m_pBeginDateEdit->lineEdit());
    label->setBuddy(m_pBeginDateEdit);


    //m_pBeginDateEdit->setBottom(WDate(WDate::currentDate().year(), WDate::currentDate().month(), 1));
    m_pBeginDateEdit->setFormat("dd.MM.yyyy");
    m_pBeginDateEdit->setDate(WDate(WDate::currentDate().year(), WDate::currentDate().month(), 1));
    m_pBeginDateEdit->setTop(WDate::currentDate());
    //m_pBeginDateEdit->lineEdit()->validator()->setMandatory(true);
    m_pBeginDateEdit->validator()->setMandatory(true);
    m_pBeginDateEdit->setStyleClass("input-medium");
    //m_pBeginDateEdit->setWidth(120);


    label = new WLabel(tr("reports.enddate"), dateSelectForm );
    m_pEndDateEdit = new WDateEdit(dateSelectForm );
    //label->setBuddy(m_pEndDateEdit->lineEdit());
    label->setBuddy(m_pEndDateEdit);
    //m_pEndDateEdit->setBottom(WDate::currentDate());
    m_pEndDateEdit->setFormat("dd.MM.yyyy");
    m_pEndDateEdit->setDate(WDate::currentDate());
    m_pEndDateEdit->setTop(WDate::currentDate());
    //m_pEndDateEdit->lineEdit()->validator()->setMandatory(true);
    m_pEndDateEdit->validator()->setMandatory(true);
    m_pEndDateEdit->setStyleClass("input-medium");

    /*
    WContainerWidget *corner_kick = new WContainerWidget(dateSelectForm );
    corner_kick->setStyleClass("corner_kick get_filter");
    WTemplate *button = new WTemplate("<ins class=\"i1\"></ins><ins class=\"i2\"></ins><ins class=\"i3\"></ins><ins class=\"i4\"></ins>${anchor}",corner_kick);
    LineEdit *submitBtn = new LineEdit(0,LineEdit::Submit);
    submitBtn->setValueText(tr("reports.filtered"));
    submitBtn->clicked().connect(boost::bind(&Reports::changed, this, submitBtn));
    button->bindWidget("anchor",submitBtn);
    */

    //WTemplate *button = new WTemplate("<ins class=\"i1\"></ins><ins class=\"i2\"></ins><ins class=\"i3\"></ins><ins class=\"i4\"></ins>${anchor}",dateSelectForm);
    WPushButton *anchor = new WPushButton(tr("reports.filtered"),dateSelectForm);
    anchor->clicked().connect(boost::bind(&Reports::changed, this, dateSelectForm));
    //button->bindWidget("anchor",anchor);
    //button->setStyleClass("corner_kick get_filter");


    //(new WLabel(tr("reports.filtered"), corner_kick))->setBuddy(new LineEdit(corner_kick,LineEdit::Submit));

}
开发者ID:ineron,项目名称:fit-zakaz-portal,代码行数:57,代码来源:Reports.cpp

示例15: WText

void SVConditionParam::createAddButton(int nRow)
{
    WText("  " , (WContainerWidget*) m_pOperate->elementAt(nRow, 1));
    WPushButton * pAdd = new WPushButton(SVResString::getResString("IDS_Add"), (WContainerWidget*) m_pOperate->elementAt(nRow, 1));
    if(pAdd)
    {
        pAdd->setToolTip(SVResString::getResString("IDS_Add_Title"));
        WObject::connect(pAdd, SIGNAL(clicked()), this, SLOT(addCondition()));
    }
}
开发者ID:,项目名称:,代码行数:10,代码来源:


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