void EtagStore::update_image() { clear(); WImage* image = new WImage(resource_->url()); addWidget(image); image->resize(0, 0); wApp->triggerUpdate(); }
WImage *WItemDelegate::iconWidget(WidgetRef& w, const WModelIndex& index, bool autoCreate) { WImage *image = dynamic_cast<WImage *>(w.w->find("i")); if (image || !autoCreate) return image; IndexContainerWidget *wc = dynamic_cast<IndexContainerWidget *>(w.w->find("a")); if (!wc) wc = dynamic_cast<IndexContainerWidget *>(w.w->find("o")); if (!wc) { wc = new IndexContainerWidget(index); wc->setObjectName("o"); wc->addWidget(w.w); w.w = wc; } image = new WImage(); image->setObjectName("i"); image->setStyleClass("icon"); wc->insertWidget(wc->count() - 1, image); // IE does not want to center vertically without this: if (wApp->environment().agentIsIE()) { WImage *inv = new WImage(wApp->onePixelGifUrl()); inv->setStyleClass("rh w0 icon"); inv->resize(0, WLength::Auto); wc->insertWidget(wc->count() -1, inv); } return image; }
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 WDatePicker::createDefault(WLineEdit *forEdit) { WImage *icon = new WImage(WApplication::relativeResourcesUrl() + "calendar_edit.png"); icon->resize(16, 16); icon->setVerticalAlignment(AlignMiddle); if (!forEdit) { forEdit = new WLineEdit(); create(icon, forEdit); layout_->insertWidget(0, forEdit); } else create(icon, forEdit); }
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 }
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; }
WSTreeAndPanTable::WSTreeAndPanTable(WContainerWidget * parent) :WTable(parent) { this->setStyleClass("panel_view"); this->elementAt(0, 0)->setStyleClass("tree_bg"); //TreeTable 可以在引用时再添加 //new WText("<div id='tree_panel' name='tree_panel' class='panel_tree'>", this->elementAt(0, 0)); //new WText("</div>", this->elementAt(0, 0)); //DragTable Cell this->elementAt(0, 1)->setStyleClass("resize"); strcpy(this->elementAt(0, 1)->contextmenu_, "onMouseDown='this.setCapture()' onMouseUp='this.releaseCapture();'"); WImage * pTmpImage = new WImage("/Images/space.gif", this->elementAt(0, 1)); pTmpImage->resize(WLength(5), WLength()); //PanTable Cell 可以在引用时再添加 //new WText("<div id='view_panel' class='panel_view'>", this->elementAt(0, 2)); //new WText("</div>", this->elementAt(0, 2)); }
DetailManipulation::DetailManipulation(bool enhance, WContainerWidget *parent) : WContainerWidget(parent), onlySmooth(!enhance) { resize(WLength::Auto, WLength::Auto); // Image bar prepareInputImages(); WContainerWidget *imageBar = new WContainerWidget; WVBoxLayout *imageBarLayout = new WVBoxLayout(); for (size_t i = 0; i < inputImages.size(); ++i) { WImage *img = inputImages[i]->getOriginalImage(); img->setStyleClass("image_button"); img->resize(160, 120); img->setAttributeValue("onMouseOver", "this.width=192; this.height=144;"); img->setAttributeValue("onMouseOut", "this.width=160; this.height=120;"); img->clicked().connect( boost::bind(&DetailManipulation::selectImage, this, i ) ); imageBarLayout->addWidget(img); } imageBar->resize(200, WLength::Auto); imageBar->setLayout(imageBarLayout); selectedImageId = 0; // Main component imageTab = new WTabWidget(); imageTab->addTab(inputImages[selectedImageId]->getOriginalImage(), "Original"); if (onlySmooth) { imageTab->addTab(new WImage(smoothedResult[selectedImageId].second), smoothedResult[selectedImageId].first); } else { imageTab->addTab(new WImage(enhancedResult[selectedImageId].second), enhancedResult[selectedImageId].first); } imageTab->resize(600, WLength::Auto); WGridLayout *controllerLayout = new WGridLayout(); WSlider *rSlider = new WSlider(Wt::Vertical); rSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM); rSlider->setTickPosition(Wt::WSlider::TicksBothSides); WDoubleSpinBox *rSpinBox = new WDoubleSpinBox(); rSpinBox->setMinimum(R_MINIMUM); rSpinBox->setMaximum(R_MAXIMUM); rSlider->sliderMoved().connect( boost::bind(&DetailManipulation::changeDoubleSpinBoxValue, this, rSpinBox, true, _1) ); rSpinBox->valueChanged().connect( boost::bind(&DetailManipulation::changeSliderValue, this, rSlider, 1.f/(R_MAXIMUM-R_MINIMUM), _1) ); controllerLayout->addWidget(rSlider, 2, 0, 6, 1); controllerLayout->addWidget(rSpinBox, 9, 0); controllerLayout->addWidget(new WText("radius"), 10, 0); WSlider *epsSlider = new WSlider(Wt::Vertical); epsSlider->setMinimum(SLIDER_MINIMUM); epsSlider->setMaximum(SLIDER_MAXIMUM); epsSlider->setRange(SLIDER_MINIMUM, SLIDER_MAXIMUM); epsSlider->setTickPosition(WSlider::TicksBothSides); WDoubleSpinBox *epsSpinBox = new WDoubleSpinBox(); epsSpinBox->setMinimum(EPS_MINIMUM); epsSpinBox->setMaximum(EPS_MAXIMUM); epsSlider->sliderMoved().connect( boost::bind(&DetailManipulation::changeDoubleSpinBoxValue, this, epsSpinBox, false, _1) ); epsSpinBox->valueChanged().connect( boost::bind(&DetailManipulation::changeSliderValue, this, epsSlider, 1.f/(EPS_MAXIMUM-EPS_MINIMUM), _1) ); controllerLayout->addWidget(epsSlider, 2, 1, 6, 1); controllerLayout->addWidget(epsSpinBox, 9, 1); controllerLayout->addWidget(new WText("epsilon"), 10, 1); WPushButton *apply = new WPushButton("Apply"); apply->clicked().connect( boost::bind(&DetailManipulation::applyEnhancement, this, rSpinBox, epsSpinBox ) ); controllerLayout->addWidget(apply, 1, 0, 1, 2); WContainerWidget *controller = new WContainerWidget(); controller->resize(120, WLength::Auto); controller->setLayout(controllerLayout); WBorderLayout *mainLayout = new WBorderLayout(this); mainLayout->addWidget(imageBar, WBorderLayout::West); mainLayout->addWidget(imageTab, WBorderLayout::Center); mainLayout->addWidget(controller, WBorderLayout::East); //setLayout(mainLayout, Wt::AlignTop | Wt::AlignJustify); /* doJavaScript( "(function () { \ var imageTags = document.getElementsByClassName(\"image_button\"); \ for (var i=0; image=imageTags[i]; ++i) { \ if (image.width>200 && image.height>0) { \ image.width = 192; \ } \ }\ })();" );*/ }