WLength WFont::sizeLength(double mediumSize) const { switch (size_) { case FixedSize: return sizeLength_; case XXSmall: return WLength(mediumSize / 1.2 / 1.2 / 1.2); case XSmall: return WLength(mediumSize / 1.2 / 1.2); case Small: return WLength(mediumSize / 1.2); case Medium: return WLength(mediumSize); case Large: return WLength(mediumSize * 1.2); case XLarge: return WLength(mediumSize * 1.2 * 1.2); case XXLarge: return WLength(mediumSize * 1.2 * 1.2 * 1.2); case Smaller: return WLength(1 / 1.2, WLength::FontEm); case Larger: return WLength(1.2, WLength::FontEm); } assert(false); return WLength(); }
WLength WFont::sizeLength(double mediumSize) const { switch (size_) { case FontSize::FixedSize: return sizeLength_; case FontSize::XXSmall: return WLength(mediumSize / 1.2 / 1.2 / 1.2); case FontSize::XSmall: return WLength(mediumSize / 1.2 / 1.2); case FontSize::Small: return WLength(mediumSize / 1.2); case FontSize::Medium: return WLength(mediumSize); case FontSize::Large: return WLength(mediumSize * 1.2); case FontSize::XLarge: return WLength(mediumSize * 1.2 * 1.2); case FontSize::XXLarge: return WLength(mediumSize * 1.2 * 1.2 * 1.2); case FontSize::Smaller: return WLength(1 / 1.2, LengthUnit::FontEm); case FontSize::Larger: return WLength(1.2, LengthUnit::FontEm); } assert(false); return WLength(); }
void HangmanWidget::newGame() { Word = RandomWord(Dict); Title->setText(L"Guess the word, " + User + L"!"); NewGameButton->hide(); // don't let the player chicken out // Bring widget to initial state resetImages(); resetButtons(); BadGuesses = DisplayedLetters = 0; HangmanImages[0]->show(); // Prepare the widgets for the new word WordContainer->clear(); WordLetters.clear(); for(unsigned int i = 0; i < Word.size(); ++i) { WText *c = new WText(L"-", WordContainer); WordLetters.push_back(c); } // resize appropriately so that the border nooks nice. WordContainer->resize(WLength(Word.size() * 1.5, WLength::FontEx), WLength()); StatusText->setText(L""); }
WLength WPainter::normalizedPenWidth(const WLength& penWidth, bool correctCosmetic) const { double w = penWidth.value(); if (w == 0 && correctCosmetic) { // cosmetic width -- must be untransformed 1 pixel const WTransform& t = combinedTransform(); if (!t.isIdentity()) { WTransform::TRSRDecomposition d; t.decomposeTranslateRotateScaleRotate(d); w = 2.0/(std::fabs(d.sx) + std::fabs(d.sy)); } else w = 1.0; return WLength(w, WLength::Pixel); } else if (w != 0 && !correctCosmetic) { // non-cosmetic width -- must be transformed const WTransform& t = combinedTransform(); if (!t.isIdentity()) { WTransform::TRSRDecomposition d; t.decomposeTranslateRotateScaleRotate(d); w *= (std::fabs(d.sx) + std::fabs(d.sy))/2.0; } return WLength(w, WLength::Pixel); } else return penWidth; }
WDialog *AuthWidget::showDialog(const WString& title, WWidget *contents) { delete dialog_; dialog_ = 0; if (contents) { dialog_ = new WDialog(title); dialog_->contents()->addWidget(contents); dialog_->contents()->childrenChanged() .connect(this, &AuthWidget::closeDialog); dialog_->footer()->hide(); if (!WApplication::instance()->environment().ajax()) { /* * try to center it better, we need to set the half width and * height as negative margins. */ dialog_->setMargin(WLength("-21em"), Left); // .Wt-form width dialog_->setMargin(WLength("-200px"), Top); // ??? } dialog_->show(); } return dialog_; }
WWidget *WItemDelegate::createEditor(const WModelIndex& index, WFlags<ViewItemRenderFlag> flags) const { IndexContainerWidget *const result = new IndexContainerWidget(index); result->setSelectable(true); WLineEdit *lineEdit = new WLineEdit(); lineEdit->setText(asString(index.data(EditRole), textFormat_)); lineEdit->enterPressed().connect (boost::bind(&WItemDelegate::doCloseEditor, this, result, true)); lineEdit->escapePressed().connect (boost::bind(&WItemDelegate::doCloseEditor, this, result, false)); lineEdit->escapePressed().preventPropagation(); if (flags & RenderFocused) lineEdit->setFocus(true); // We use a layout so that the line edit fills the entire cell. // Somehow, this does not work with konqueror, but it does respond // properly to width, height being set to 100% ! WApplication *app = WApplication::instance(); if (app->environment().agent() != WEnvironment::Konqueror) { result->setLayout(new WHBoxLayout()); result->layout()->setContentsMargins(1, 1, 1, 1); result->layout()->addWidget(lineEdit); } else { lineEdit->resize(WLength(100, WLength::Percentage), WLength(100, WLength::Percentage)); result->addWidget(lineEdit); } return result; }
void WSVFlexTable::InitRow(int nRow) { for(int i = 1,j = 0; i < dataTitleTable->numColumns() + 1; i+=2, j++) { dataGridTable->elementAt(nRow, i)->resize(WLength(4), WLength()); WImage * pTmpImage = new WImage("/Images/space.gif", "", (WContainerWidget *)dataGridTable->elementAt(nRow, i)); pTmpImage->resize(WLength(4), WLength()); dataGridTable->elementAt(nRow, i - 1)->resize(m_pColumnWidth[j], WLength()); dataGridTable->elementAt(nRow, i - 1)->setStyleClass(m_pRowDataCss[j]); } if((nRow%2) == 0) dataGridTable->GetRow(nRow)->setStyleClass("table_data_grid_item_bg"); }
//添加栏目 void WSPopTable::AppendRows(std::string strRowName) { int iLast = pFirstTable->numRows(); iLast++; //RowTitle WTable * pTitleTable = new WTable((WContainerWidget *)pFirstTable->elementAt(iLast,0)); pTitleTable->setStyleClass("padding_5"); pTitleTable->resize(WLength(100,WLength::Percentage),WLength()); pTitleTable->elementAt(0,0)->setStyleClass("textbold"); pTitleText = new WText(strRowName, pTitleTable->elementAt(0,0)); //Help if(bHelp) { pTitleTable->elementAt(0, 1)->setContentAlignment(AlignRight|AlignTop); pHelpImg = new WImage("/Images/help.png","", pTitleTable->elementAt(0, 1)); pHelpImg->setStyleClass("hand"); } //RowContent iLast++; pFirstTable->elementAt(iLast,0)->setStyleClass("padding_2"); WTable * pRowContentTable = new WTable((WContainerWidget *)pFirstTable->elementAt(iLast, 0)); pRowContentTable->resize(WLength(100,WLength::Percentage),WLength()); //top ShowTop(pRowContentTable); //content pRowContentTable->elementAt(1, 0)->setStyleClass("pop_table_mid_l"); WTable * pReturnTable = new WTable((WContainerWidget *)pRowContentTable->elementAt(1, 1)); pReturnTable->resize(WLength(100,WLength::Percentage),WLength()); pReturnTable->setStyleClass("bgcolor"); // pReturnTable->elementAt(0, 0)->setStyleClass("padding_5"); m_pListContentTable.push_back(new WTable((WContainerWidget *)pReturnTable->elementAt(0, 0))); //分隔线 pReturnTable->elementAt(1,0)->setStyleClass("padding_5"); WTable * pLineTable = new WTable((WContainerWidget *)pReturnTable->elementAt(1, 0)); pLineTable->resize(WLength(100,WLength::Percentage), WLength()); pLineTable->elementAt(0, 0)->setStyleClass("table_data_input_space"); new WImage("/Images/space.gif","",pLineTable->elementAt(0, 0)); //ActionTable pReturnTable->elementAt(2,0)->setStyleClass("padding_2"); m_pListActionTable.push_back(new WTable((WContainerWidget *)pReturnTable->elementAt(2,0))); pRowContentTable->elementAt(1, 2)->setStyleClass("pop_table_mid_r"); //bottom ShowBottom(pRowContentTable); }
WSPopTable::WSPopTable(WContainerWidget * parent, const bool bHelp_) :WTable(parent) { // this->setStyleClass("pop_bg"); this->resize(WLength(100, WLength::Percentage),WLength()); this->elementAt(0, 0)->setStyleClass("tr_align"); // pFirstTable = new WTable((WContainerWidget *)this->elementAt(0, 0)); pFirstTable->setStyleClass("padding_top"); pFirstTable->resize(WLength(100, WLength::Percentage), WLength()); bHelp = bHelp_; }
void WMenuItem::setContents(WWidget *contents, LoadPolicy policy) { delete contents_; contents_ = contents; #ifndef WT_CNOR if (contents) { // contents' ownership will be moved to a containerwidget once // it is in the widget tree (contentsLoaded). In any case, if // contents_ is destroyed elsewhere, we want to know about it. contentsDestroyedConnection_ = contents_->destroyed().connect(this, &WMenuItem::contentsDestroyed); } #endif // WT_CNOR if (contents && policy != PreLoading) { contents_ = contents; if (!contentsContainer_) { contentsContainer_ = new WContainerWidget(); contentsContainer_ ->setJavaScriptMember("wtResize", StdWidgetItemImpl::childrenResizeJS()); contentsContainer_->resize(WLength::Auto, WLength(100, WLength::Percentage)); } } }
void WTreeNode::setChildCountPolicy(ChildCountPolicy policy) { if (policy != Disabled && !childCountLabel_) { childCountLabel_ = new WText(); childCountLabel_->setMargin(WLength(7), Left); childCountLabel_->setStyleClass("Wt-childcount"); labelArea()->addWidget(childCountLabel_); } childCountPolicy_ = policy; if (childCountPolicy_ == Enabled) { WTreeNode *parent = parentNode(); if (parent && parent->isExpanded()) if (doPopulate()) update(); } if (childCountPolicy_ != Disabled) { for (unsigned i = 0; i < childNodes_.size(); ++i) childNodes_[i]->setChildCountPolicy(childCountPolicy_); } }
void WAutoCompleteLineEdit::create(WContainerWidget *parent) { setImplementation(layout_ = new WTable(parent)); setInline(true); setVerticalAlignment(AlignMiddle); lineEdit_ = new WLineEdit(layout_->elementAt(0, 0)); suggestionsList_ = new WTable(layout_->elementAt(1, 0)); suggestionsList_->setPopup(true); suggestionsList_->setPositionScheme(Absolute); WCssDecorationStyle& style = suggestionsList_->decorationStyle(); style.setCursor(WCssDecorationStyle::Default); style.font().setSize(WFont::Smaller); WBorder border(WBorder::Solid); border.setWidth(WBorder::Explicit, WLength(2)); style.setBorder(border); style.setBackgroundColor(Wt::white); connect(lineEdit_, SIGNAL(keyWentUp(int)), this, SLOT(lineEditKeyUp(int))); //connect(lineEdit_, SIGNAL(blurred()), // suggestionsList_, SLOT(hide()), STATIC); suggestionsList_->hide(); }
HangmanWidget::HangmanWidget(std::wstring user, Dictionary dict, WContainerWidget *parent): WContainerWidget(parent), MaxGuesses(9), User(user), Dict(dict) { setContentAlignment(AlignCenter); Title = new WText(L"Guess the word!", this); Title->decorationStyle().font().setSize(WFont::XLarge); WordContainer = new WContainerWidget(this); WordContainer->setMargin(WLength(20), Top | Bottom); WordContainer->setContentAlignment(AlignCenter); WCssDecorationStyle& style = WordContainer->decorationStyle(); style.setBorder(WBorder(WBorder::Solid)); style.font().setFamily(WFont::Monospace, L"courier"); style.font().setSize(WFont::XXLarge); StatusText = new WText(this); new WBreak(this); createHangmanImages(this); createAlphabet(this); new WBreak(this); NewGameButton = new WPushButton(L"New Game", this); NewGameButton->clicked.connect(SLOT(this, HangmanWidget::newGame)); // prepare for first game newGame(); }
void WTreeNode::setChildCountPolicy(ChildCountPolicy policy) { if (policy != Disabled && !childCountLabel_) { childCountLabel_ = new WText(); childCountLabel_->setMargin(WLength(7), Left); // "treenodechildcount" is for backwards compatibility. childCountLabel_->setStyleClass("Wt-childcount treenodechildcount"); layout_->elementAt(0, 1)->addWidget(childCountLabel_); } childCountPolicy_ = policy; if (childCountPolicy_ == Enabled) { WTreeNode *parent = parentNode(); if (parent && parent->isExpanded()) if (doPopulate()) update(); } if (childCountPolicy_ != Disabled) { for (unsigned i = 0; i < childNodes_.size(); ++i) childNodes_[i]->setChildCountPolicy(childCountPolicy_); } }
void HangmanWidget::createHangmanImages(WContainerWidget *parent) { for(unsigned int i = 0; i <= MaxGuesses; ++i) { std::string fname = "icons/hangman"; fname += boost::lexical_cast<std::string>(i) + ".png"; WImage *theImage = new WImage(fname, parent); HangmanImages.push_back(theImage); // Although not necessary, we can avoid flicker (on konqueror) // by presetting the image size. theImage->resize(WLength(256), WLength(256)); } HurrayImage = new WImage("icons/hangmanhurray.png", parent); resetImages(); // Hide all images }
WApplication *createApplication(const WEnvironment& env) { WApplication *app = new WApplication(env); app->setTitle(L"Hangman"); new HangmanGame(app->root()); /* * The application style sheet (only for the highscore widget) */ WCssDecorationStyle cellStyle; WBorder cellBorder; cellBorder.setStyle(WBorder::Solid); cellBorder.setWidth(WBorder::Explicit, WLength(1)); cellBorder.setColor(WColor(Wt::lightGray)); cellStyle.setBorder(cellBorder); app->styleSheet().addRule(".highscores * TD", cellStyle); cellStyle.font().setVariant(WFont::SmallCaps); app->styleSheet().addRule(".highscoresheader", cellStyle); cellStyle.font().setVariant(WFont::NormalVariant); cellStyle.font().setStyle(WFont::Italic); cellStyle.font().setWeight(WFont::Bold); app->styleSheet().addRule(".highscoresself", cellStyle); return app; }
WPainter::State::State() : renderHints_(0), clipping_(false) { currentFont_.setFamily(WFont::SansSerif); currentFont_.setSize(WFont::FixedSize, WLength(10, WLength::Point)); }
OptionsWidget::OptionsWidget(WContainerWidget *parent) : WContainerWidget(parent) { optionsText = new WText("Options of the server:", this); WBreak *break1 = new WBreak(this); optionsTable = new WTableView(this); optionsModel = new OptionsModel(this); optionsTable->setModel(optionsModel); optionsTable->setMinimumSize(WLength(100), WLength(100)); optionsTable->setSelectable(true); // /* Setting up channels widget main container */ // WVBoxLayout *mainLayout = new WVBoxLayout(); // mainLayout->addWidget(optionsText); // mainLayout->addWidget(optionsTable); // this->setLayout(mainLayout); }
void PaintedSlider::sliderResized(const WLength& width, const WLength& height) { if (slider_->orientation() == Orientation::Horizontal) { WLength w = width; if (!w.isAuto()) w = WLength(w.toPixels() - 10); resize(w, height); } else { WLength h = height; if (!h.isAuto()) h = WLength(h.toPixels() - 10); resize(width, h); } updateState(); }
void WMessageBox::create() { iconImage_ = 0; text_ = new WText(contents()); WContainerWidget *buttons = new WContainerWidget(contents()); buttons->setMargin(WLength(3), Top); buttons->setPadding(WLength(5), Left|Right); buttonContainer_ = new WContainerWidget(buttons); buttonMapper_ = new WSignalMapper<StandardButton>(this); buttonMapper_->mapped().connect(this, &WMessageBox::onButtonClick); //buttonMapper_->mapConnect(contents()->escapePressed, Cancel); //contents()->escapePressed.preventDefault(); buttonContainer_->setStyleClass("Wt-msgbox-buttons"); rejectWhenEscapePressed(); }
PaintBrush::PaintBrush(int width, int height, WContainerWidget *parent) : WPaintedWidget(parent) { setSelectable(false); interactionCount_ = 0; undo_ = false; // setPositionScheme(Absolute); resize(WLength(width), WLength(height)); decorationStyle().setCursor("icons/pencil.cur", CrossCursor); mouseWentDown().connect(this, &PaintBrush::mouseDown); color_ = WColor(black); // setPreferredMethod(InlineSvgVml); }
////////////////////////////////////////////////////////////////////////////////// // start receive widget element at CSVMainForm::CSVMainForm(WContainerWidget * parent): WTable(parent) { //Resource OBJECT objRes=LoadResource("default", "localhost"); if( objRes !=INVALID_VALUE ) { MAPNODE ResNode=GetResourceNode(objRes); if( ResNode != INVALID_VALUE ) { FindNodeValue(ResNode,"IDS_Report_Edit",strEditReport); FindNodeValue(ResNode,"IDS_Report_Add",strAddReport); } CloseResource(objRes); } setStyleClass("t6"); m_pfrSmsSend = NULL; m_pfrAddPhone = NULL; //elementAt(1, 0)->setContentAlignment(AlignCenter); elementAt(1, 0)->setVerticalAlignment(AlignTop); m_pmainStack = new WStackedWidget(elementAt(1, 0)); m_pmainStack->setPadding(WLength(0)); //m_pmainStack->addWidget(m_pfrSmsSet = new CSVTopnReportSet()); m_pfrSmsSet = new CSVTopnReportSet(); //m_pmainStack->addWidget(m_pfrSmsSet); //OutputDebugString("------CSVMainForm0---------\n"); //m_pmainStack->addWidget(m_pfrSmsSet = new CSVTopnReportSet()); //OutputDebugString("------CSVMainForm1---------\n"); if (!m_pfrAddPhone) { m_pmainStack->addWidget(m_pfrAddPhone = new CSVAddTopnReport()); WObject::connect(m_pfrAddPhone, SIGNAL(BackTo(std::string)), this, SLOT(ShowSetForm(std::string))); WObject::connect(m_pfrAddPhone, SIGNAL(SaveTopnReport(SAVE_REPORT_LIST)), this, SLOT(Save_Phone(SAVE_REPORT_LIST))); WObject::connect(m_pfrAddPhone, SIGNAL(ExChangeAddEvent()), this, SLOT(ExChangeRefresh())); } WObject::connect(m_pfrSmsSet, SIGNAL(AddNewPhone()), this, SLOT(ShowAddForm())); WObject::connect(m_pfrSmsSet, SIGNAL(EditPhone(SAVE_REPORT_LIST)), this, SLOT(Edit_Phone(SAVE_REPORT_LIST))); WObject::connect(m_pfrSmsSet, SIGNAL(ExChangeEvent()), this, SLOT(ExChangeRefresh())); m_pmainStack->addWidget(m_pfrSmsSet); showSmsSet(); }
void Home::readReleases(WTable *releaseTable) { std::ifstream f((filePrefix() + "releases.txt").c_str()); releaseTable->clear(); releaseTable->elementAt(0, 0) ->addWidget(new WText(tr("home.download.version"))); releaseTable->elementAt(0, 1) ->addWidget(new WText(tr("home.download.date"))); releaseTable->elementAt(0, 2) ->addWidget(new WText(tr("home.download.description"))); releaseTable->elementAt(0, 0)->resize(WLength(15, WLength::FontEx), WLength::Auto); releaseTable->elementAt(0, 1)->resize(WLength(15, WLength::FontEx), WLength::Auto); int row = 1; while (f) { std::string line; getline(f, line); if (f) { typedef boost::tokenizer<boost::escaped_list_separator<char> > CsvTokenizer; CsvTokenizer tok(line); CsvTokenizer::iterator i=tok.begin(); std::string fileName = *i; std::string description = *(++i); releaseTable->elementAt(row, 0)->addWidget (new WText(href("http://prdownloads.sourceforge.net/witty/" + fileName + "?download", description))); releaseTable->elementAt(row, 1)->addWidget(new WText(*(++i))); releaseTable->elementAt(row, 2)->addWidget(new WText(*(++i))); ++row; } } }
void WTreeTableNode::createExtraColumns(int numColumns) { if (!row_) { row_ = new WContainerWidget(); labelArea()->insertBefore(row_, labelArea()->children()[0]); row_->setFloatSide(Right); labelArea()->resize(WLength(100, WLength::Percentage), WLength::Auto); labelArea()->table()->resize(WLength(100, WLength::Percentage), WLength::Auto); } while (static_cast<int>(columnWidgets_.size()) < numColumns) { WText *w = new WText(WString::fromUTF8(" "), row_); w->setInline(false); columnWidgets_.push_back(ColumnWidget(w, false)); w->setFloatSide(Left); w->resize(columnWidth(columnWidgets_.size()), 1); } }
PasswordPromptDialog::PasswordPromptDialog(Login& login, AuthModel *model) : WDialog(tr("Wt.Auth.enter-password")), login_(login), model_(model) { impl_ = new WTemplateFormView(tr("Wt.Auth.template.password-prompt")); model_->setValue(AuthModel::LoginNameField, login_.user().identity(Identity::LoginName)); model_->setReadOnly(AuthModel::LoginNameField, true); WLineEdit *nameEdit = new WLineEdit(); impl_->bindWidget(AuthModel::LoginNameField, nameEdit); impl_->updateViewField(model_, AuthModel::LoginNameField); WLineEdit *passwordEdit = new WLineEdit(); passwordEdit->setEchoMode(WLineEdit::Password); passwordEdit->setFocus(true); impl_->bindWidget(AuthModel::PasswordField, passwordEdit); impl_->updateViewField(model_, AuthModel::PasswordField); WPushButton *okButton = new WPushButton(tr("Wt.WMessageBox.Ok")); WPushButton *cancelButton = new WPushButton(tr("Wt.WMessageBox.Cancel")); model_->configureThrottling(okButton); impl_->bindWidget("ok-button", okButton); impl_->bindWidget("cancel-button", cancelButton); okButton->clicked().connect(this, &PasswordPromptDialog::check); cancelButton->clicked().connect(this, &PasswordPromptDialog::reject); contents()->addWidget(impl_); if (!WApplication::instance()->environment().ajax()) { /* * try to center it better, we need to set the half width and * height as negative margins. */ setMargin(WLength("-21em"), Left); // .Wt-form width setMargin(WLength("-200px"), Top); // ??? } }
WWidget *WButtonTab::createButton() { WContainerWidget *result = new WContainerWidget(); tabButton_ = new WText(label(), result); connect(tabButton_, SIGNAL(clicked()), this, SLOT(tabSelected()), STATIC); tabButton_->setMargin(WLength(10)); return result; }
PaintBrush::PaintBrush(int width, int height, WContainerWidget *parent) : WPaintedWidget(parent) { setSelectable(false); resize(WLength(width), WLength(height)); decorationStyle().setCursor("icons/pencil.cur", CrossCursor); mouseDragged().connect(this, &PaintBrush::mouseDrag); mouseWentDown().connect(this, &PaintBrush::mouseDown); touchStarted().connect(this, &PaintBrush::touchStart); touchMoved().connect(this, &PaintBrush::touchMove); touchMoved().preventDefaultAction(); color_ = WColor(black); // setPreferredMethod(InlineSvgVml); }
void WSVFlexTable::AppendColumn(std::string strBigColName,std::string strSmallColName, WLength width_) { for (int i=0 ; i< 3; i++) { if(GetContentTable()!=NULL) { int iLast = dataTitleTable->numColumns(); if(iLast!=0) { new WImage("/Images/table_head_space.png","",(WContainerWidget *)dataTitleTable->elementAt(0,iLast)); WImage * pTmpImage = new WImage("/Images/space.gif","",(WContainerWidget *)dataGridTable->elementAt(0,iLast)); pTmpImage->resize(WLength(4), WLength()); dataGridTable->elementAt(1,iLast)->resize(WLength(4), WLength()); iLast = iLast+1; } //m_pColumnWidth[iLast] = width_; m_pColumnWidth.push_back(width_); dataTitleTable->elementAt(1,iLast)->setStyleClass("table_data_grid_header_text"); dataTitleTable->elementAt(1,iLast)->resize(width_,WLength()); dataTitleTable->elementAt(1,iLast)->setContentAlignment(AlignCenter); strcpy(dataTitleTable->elementAt(1,iLast)->contextmenu_,"nowrap"); dataTitleTable->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage)); new WText(strSmallColName,(WContainerWidget *)dataTitleTable->elementAt(1,iLast)); dataGridTable->elementAt(0,iLast)->setStyleClass("table_data_grid_header_text"); dataGridTable->elementAt(0,iLast)->resize(width_,WLength()); dataGridTable->elementAt(0,iLast)->setContentAlignment(AlignCenter); strcpy(dataGridTable->elementAt(0,iLast)->contextmenu_,"nowrap"); dataGridTable->resize(WLength(100,WLength::Percentage), WLength(100,WLength::Percentage)); //return new WText("",(WContainerWidget *)dataGridTable->elementAt(0,iLast)); } } //return NULL; }
WLength WText::padding(Side side) const { if (!padding_) return WLength::Auto; switch (side) { case Top: LOG_ERROR("padding(Top) is not supported."); return WLength(); case Right: return padding_[1]; case Bottom: LOG_ERROR("padding(Bottom) is not supported."); case Left: return padding_[3]; default: LOG_ERROR("padding(Side) with invalid side: " << (int)side); return WLength(); } }
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); }