Beispiel #1
0
void SimpleChatWidget::updateUsers()
{
  if (userList_) {
    userList_->clear();

    SimpleChatServer::UserSet users = server_.users();

    UserMap oldUsers = users_;
    users_.clear();

    for (SimpleChatServer::UserSet::iterator i = users.begin();
	 i != users.end(); ++i) {
      WCheckBox *w = new WCheckBox(escapeText(*i), userList_);
      w->setInline(false);

      UserMap::const_iterator j = oldUsers.find(*i);
      if (j != oldUsers.end())
	w->setChecked(j->second);
      else
	w->setChecked(true);

      users_[*i] = w->isChecked();
      w->changed().connect(this, &SimpleChatWidget::updateUser);

      if (*i == user_)
	w->setStyleClass("chat-self");
    }
  }
}
Beispiel #2
0
void CCheckBoxTreeView::ClearRightCellCheck()
{
    TreeRightMap::iterator lRight;
    for(lRight =mGroupRightMap.begin();lRight !=mGroupRightMap.end();lRight ++)
    {
        WCheckBox *pCheckbox;
        pCheckbox =(WCheckBox *) lRight->second;
        if( pCheckbox->isChecked())
            pCheckbox->setChecked(false);
    }
    for(lRight =mDeviceRightMap.begin();lRight !=mDeviceRightMap.end();lRight ++)
    {
        WCheckBox *pCheckbox;
        pCheckbox =(WCheckBox *) lRight->second;
        if( pCheckbox->isChecked())
            pCheckbox->setChecked(false);
    }
    for(lRight =mMonitorRightMap.begin();lRight !=mMonitorRightMap.end();lRight ++)
    {
        OutputDebugString("Tree_DEVICE\n");
        WCheckBox *pCheckbox;
        pCheckbox =(WCheckBox *) lRight->second;
        if( pCheckbox->isChecked())
            pCheckbox->setChecked(false);
    }



}
Beispiel #3
0
void AdsEditor::renderUI() {
  AdsApplication *app = AdsApplication::adsApplication();
  cppdb::session &db = app->db_;
  
  clear();
  WPushButton *btn = new WPushButton("Criar Anuncio", this);
  btn->clicked().connect(this, &AdsEditor::novoAnuncio);
  WPushButton *update = new WPushButton("Atualiza", this);
  update->clicked().connect(this, &AdsEditor::renderUI);
  new WBreak(this);
  new WBreak(this);
  new WText("<h3>Lista de Anuncios</h3>",this);
  
  Wt::WContainerWidget *w = new Wt::WContainerWidget(this);
  w->resize(600, WLength::Auto);
  WVBoxLayout *layout = new Wt::WVBoxLayout();
  cppdb::result res = db <<
    "select id, titulo, url, imagem, texto, ativo "
    " from anuncio";
  while(res.next()) {
    WContainerWidget *cont = new WContainerWidget();
    AdsAnuncio *anuncio = new AdsAnuncio(cont);
    
    res >>  anuncio->id >> anuncio->titulo_ >> anuncio->link_ >>
      anuncio->imagem_ >> anuncio->texto_ >> anuncio->ativo_;    
    
    WPushButton *tituloBtn = new WPushButton("Titulo",cont);
    tituloBtn->clicked().connect(anuncio, &AdsAnuncio::editarTitulo);
    
    WPushButton *urlBtn = new WPushButton("URL",cont);
    urlBtn->clicked().connect(anuncio, &AdsAnuncio::editarURL);
    
    WPushButton *imagemBtn = new WPushButton("Imagem",cont);
    imagemBtn->clicked().connect(anuncio, &AdsAnuncio::editarImagem);
    
    WPushButton *textoBtn = new WPushButton("Texto",cont);
    textoBtn->clicked().connect(anuncio, &AdsAnuncio::editarTexto);
    
    WCheckBox *ativoCheck = new Wt::WCheckBox("Ativo",cont);
    if(anuncio->ativo_ == 1)
      ativoCheck->setChecked(true);
    else 
      ativoCheck->setChecked(false);
    ativoCheck->changed().connect(anuncio, &AdsAnuncio::changeAtiva);

    WPushButton *deletaBtn = new WPushButton("Deleta",cont);
    deletaBtn->clicked().connect(anuncio, &AdsAnuncio::deletaAnuncio);

    anuncio->renderUI();
    layout->addWidget(cont);
  }
  w->setLayout(layout);
}
Beispiel #4
0
void WMenuItem::setChecked(bool checked)
{
  if (isCheckable()) {
    WCheckBox *cb = dynamic_cast<WCheckBox *>(anchor()->widget(0));
    cb->setChecked(checked);
  }
}
Beispiel #5
0
WWidget *FormWidgets::wCheckBox()
{
  WContainerWidget *result = new WContainerWidget();

  topic("WCheckBox", result);
  addText(tr("formwidgets-WCheckBox"), result);
  WCheckBox *cb = new WCheckBox("Check me!", result);
  cb->setChecked(true);
  ed_->showSignal(cb->checked(), "'Check me!' checked");
  ed_->showSignal(cb->unChecked(), "'Check me!' unchecked");
  new WBreak(result);
  cb = new WCheckBox("Check me too!", result);
  ed_->showSignal(cb->checked(), "'Check me too!' checked");
  new WBreak(result);
  cb = new WCheckBox("Check me, I'm tristate!", result);
  cb->setTristate();
  cb->setCheckState(PartiallyChecked);
  ed_->showSignal(cb->checked(), "'Check me, I'm tristate!' checked");

  return result;
}