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


C++ WPushButton::setText方法代码示例

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


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

示例1:

Wt::WPushButton *createColorButton(const char *className, const Wt::WString& text)
{
  Wt::WPushButton *button = new Wt::WPushButton();
  button->setTextFormat(Wt::XHTMLText);
  button->setText(text);
  button->addStyleClass(className);
  return button;
}
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:8,代码来源:ProfileList.cpp

示例2: create

void studentPasswords::create() {
  Wt::WPanel * panel = new Wt::WPanel(this);
  
  panel->setStyleClass("panel panel-primary");
  panel->setTitle("<h3>Wachtwoorden Administratie</h3>");
  panel->setMinimumSize(800, 800);
  panel->setMaximumSize(800, Wt::WLength::Auto);
  panel->setMargin("0 auto");
  
  Wt::WContainerWidget * content = new Wt::WContainerWidget();
  panel->setCentralWidget(content);
  content->setPadding("1%");
  
  buttons = new Wt::WContainerWidget(content);
  Wt::WHBoxLayout * buttonLayout = new Wt::WHBoxLayout();
  buttons->setLayout(buttonLayout);
  
  Wt::WPopupMenu * popup = new Wt::WPopupMenu();
  Wt::WPushButton * button = new Wt::WPushButton();
  button->setMenu(popup);
  button->setText("Selecteer een klas");
  buttonLayout->addWidget(button);
  
  Wt::WPushButton * button2 = new Wt::WPushButton();
  button2->setText("Selectie Aanpassen");
  button2->setStyleClass("btn btn-success");
  buttonLayout->addWidget(button2);
  button2->clicked().connect(this, &studentPasswords::changePasswords);
  
  Wt::WContainerWidget * tableContent = new Wt::WContainerWidget(content);
  table = new Wt::WTable(tableContent);
  
  // add classes
  Wt::WPopupMenu * subMenu[7];
  
  for(int i = 0; i < 7; i++) {
    subMenu[i] = new Wt::WPopupMenu();
    if(i == 0) {
      popup->addMenu("1ste jaar", subMenu[i]);
    } else {
      string s = string(i+1) + "de jaar";
      popup->addMenu(s.wt(), subMenu[i]);
    }
  }
  
  CLASSES & classes = server->getClasses();
  
  for(int i = 0; i < classes.elms(); i++) {
    string name = classes[i].cn().get();
    if(name.empty()) continue;
    
    int year = -1;
    switch(name[0]) {
      case '1': year = 0; break;
      case '2': year = 1; break;
      case '3': year = 2; break;
      case '4': year = 3; break;
      case '5': year = 4; break;
      case '6': year = 5; break;
      case '7': year = 6; break;
    }
    if(year < 0) continue;
    
    subMenu[year]->addItem(name.wt())->triggered().connect(std::bind([=] () {
      showClass(name);
    }));
  }
  
  progress = new Wt::WProgressBar(content);
  progress->hide();
  
  anchor = new Wt::WAnchor(Wt::WLink(&pfile), "Download passwords", content);
  anchor->setTarget(Wt::TargetNewWindow);
  anchor->clicked().connect(this, &studentPasswords::reset);
  anchor->hide();
}
开发者ID:yvanvds,项目名称:yATools,代码行数:76,代码来源:studentPasswords.cpp

示例3: update

// Updates all ranks
void RecentMatchesContainer::update()
{
    this->clear();
    
    std::vector<RecentMatch> recent_matches = Spartan_->getRecentMatches();
    
    // Create halo api with an api key (get api key from 343i api site)
    //HaloAPI halo_api("05cdc66c52ca4465b0b6e3c56bb87b71");
    
    for (int i = 0; i < recent_matches.size() && i < 10; i++)
    {
        // CUSTOM CONTAINERS
        Wt::WContainerWidget *myContainer = new Wt::WContainerWidget();
        myContainer->decorationStyle().setBorder(Wt::WBorder(Wt::WBorder::Style::Solid, Wt::WBorder::Width::Thin, Wt::WColor(0, 0, 0)));
        myContainer->decorationStyle().setBackgroundColor(Wt::WColor(240, 240, 240));
        myContainer->setPadding(3);
        myContainer->setMargin(3, Wt::Bottom);
        
        std::string title_string = "<b>" + getNameFromHopper(recent_matches[i].hopper_id_) + " / </b>" + getNameFromBaseVariant(recent_matches[i].base_variant_) + "<b> / </b>" + getNameFromMap(recent_matches[i].map_id_) + "";
        Wt::WText *someText = new Wt::WText(title_string, myContainer);
        
        Wt::WPushButton *myButton = new Wt::WPushButton(" + ", myContainer);
        myButton->setFloatSide(Wt::Right);
        
        std::string game_time = time_from_double(recent_matches[i].match_length_);
        Wt::WText *someMoreText = new Wt::WText(game_time, myContainer);
        someMoreText->setFloatSide(Wt::Right);
        
        Wt::WStackedWidget *myStack = new Wt::WStackedWidget(myContainer);
        Wt::WText *text1 = new Wt::WText("text1", myStack);

        
        myButton->clicked().connect(std::bind([=]()
        {
            if (myStack->currentIndex() == 0)
            {
                myButton->setText(" - ");
                Wt::WContainerWidget *stats_table = new Wt::WContainerWidget(myStack);
                Wt::WTable *table = new Wt::WTable(stats_table);
                table->setHeaderCount(1);
                table->elementAt(0, 0)->addWidget(new Wt::WText("Gamertag"));
                HaloAPI halo_api("05cdc66c52ca4465b0b6e3c56bb87b71");
                std::vector<std::string> gamertags;
                
                std::string json_data = halo_api.getPostGameCarnageArena(recent_matches[i].match_id_);
                Json::Value root;   // will contains the root value after parsing.
                Json::Reader reader;
                bool parsingSuccessful = reader.parse( json_data, root );
                if ( !parsingSuccessful )
                {
                    // report to the user the failure and their locations in the document.
                    std::cout  << "Failed to parse configuration\n"
                    << reader.getFormattedErrorMessages();
                }
                const Json::Value plugins = root;
                
                for (int j = 0; j < plugins["PlayerStats"].size(); j++)
                {
                    std::string tag(
                                    plugins["PlayerStats"][j]["Player"]["Gamertag"].asString()
                                    );
                    gamertags.push_back(tag);
                    table->elementAt(j+1, 0)->addWidget(new Wt::WText(tag));
                }
                table->addStyleClass("table table-condensed");
                myStack->setCurrentIndex(1);
            } else
            {
                delete myStack->currentWidget();
                myStack->setCurrentIndex(0);
                myButton->setText(" + ");
            }
        }));
        this->addWidget(myContainer);
    }
}
开发者ID:cluoma,项目名称:HaloViewer,代码行数:77,代码来源:RecentMatchesContainer.cpp


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