TreeViewExample::TreeViewExample(WStandardItemModel *model, const WString& titleText) : model_(model) { belgium_ = model_->item(0, 0)->child(0, 0); new WText(titleText, this); /* * Now create the view */ WPanel *panel = new WPanel(this); panel->resize(600, 300); panel->setCentralWidget(treeView_ = new WTreeView()); if (!WApplication::instance()->environment().ajax()) treeView_->resize(WLength::Auto, 290); treeView_->setAlternatingRowColors(true); treeView_->setRowHeight(25); treeView_->setModel(model_); treeView_->setColumnWidth(1, WLength(100)); treeView_->setColumnAlignment(1, AlignCenter); treeView_->setColumnWidth(3, WLength(100)); treeView_->setColumnAlignment(3, AlignCenter); /* treeView_->setRowHeaderCount(1); treeView_->setColumnWidth(0, 300); */ /* * Expand the first (and single) top level node */ treeView_->setExpanded(model->index(0, 0), true); treeView_->setExpanded(model->index(0, 0, model->index(0, 0)), true); /* * Setup some buttons to manipulate the view and the model. */ WContainerWidget *wc = new WContainerWidget(this); WPushButton *b; b = new WPushButton("Toggle row height", wc); b->clicked().connect(this, &TreeViewExample::toggleRowHeight); b->setToolTip("Toggles row height between 31px and 25px"); b = new WPushButton("Toggle stripes", wc); b->clicked().connect(this, &TreeViewExample::toggleStripes); b->setToolTip("Toggle alternating row colors"); b = new WPushButton("Toggle root", wc); b->clicked().connect(this, &TreeViewExample::toggleRoot); b->setToolTip("Toggles root item between all and the first continent."); b = new WPushButton("Add rows", wc); b->clicked().connect(this, &TreeViewExample::addRows); b->setToolTip("Adds some cities to Belgium"); }
void CSVBatchAdd::CreateOperater() { WTable * pSub = new WTable(this); if(pSub) { WPushButton * pSave = new WPushButton(m_szSave, pSub->elementAt(0, 0)); if(pSave) { pSave->setToolTip(m_szSaveTip); } WPushButton * pCancel = new WPushButton(m_szCancel, pSub->elementAt(0,1)); if(pCancel) { pCancel->setToolTip(m_szCancelTip); WObject::connect(pCancel, SIGNAL(clicked()), "window.close();", WObject::ConnectionType::JAVASCRIPT); } } }
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())); } }
void CSVSortList::createOperate() { int nRow = numRows(); WPushButton *pSave = new WPushButton(SVResString::getResString("IDS_OK"), elementAt(nRow, 0)); if(pSave) { WObject::connect(pSave, SIGNAL(clicked()) , "showbar();", this, SLOT(saveList()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); pSave->setToolTip(SVResString::getResString("IDS_Save_Sort_Tip")); } new WText(" ", elementAt(nRow, 0)); WPushButton *pCancel = new WPushButton(SVResString::getResString("IDS_Cancel"), elementAt(nRow,0)); if(pCancel) { pCancel->setToolTip(SVResString::getResString("IDS_Cancel_Sort_Tip")); WObject::connect(pCancel, SIGNAL(clicked()), "showbar();", this, SLOT(cancelEdit()), WObject::ConnectionType::JAVASCRIPTDYNAMIC); } elementAt(nRow, 0)->setContentAlignment(AlignCenter); }