MailWindow::MailWindow() : // TRANSLATORS: mail window name Window(_("Mail"), Modal_false, nullptr, "mail.xml"), ActionListener(), mMessages(), mMessagesMap(), mMailModel(new ExtendedNamesModel), mListBox(CREATEWIDGETR(ExtendedListBox, this, mMailModel, "extendedlistbox.xml")), mListScrollArea(new ScrollArea(this, mListBox, fromBool(getOptionBool("showlistbackground"), Opaque), "mail_listbackground.xml")), // TRANSLATORS: mail window button mRefreshButton(new Button(this, _("Refresh"), "refresh", this)), // TRANSLATORS: mail window button mNewButton(new Button(this, _("New"), "new", this)), // TRANSLATORS: mail window button mDeleteButton(new Button(this, _("Delete"), "delete", this)), // TRANSLATORS: mail window button mReturnButton(new Button(this, _("Return"), "return", this)), // TRANSLATORS: mail window button mOpenButton(new Button(this, _("Open"), "open", this)) { setWindowName("Mail"); setCloseButton(true); setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); if (setupWindow) setupWindow->registerWindowForReset(this); setDefaultSize(310, 180, ImagePosition::CENTER); setMinWidth(310); setMinHeight(250); center(); mListScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); ContainerPlacer placer; placer = getPlacer(0, 0); placer(0, 0, mListScrollArea, 4, 5).setPadding(3); placer(4, 0, mRefreshButton); placer(4, 1, mOpenButton); placer(4, 2, mNewButton); placer(4, 3, mDeleteButton); placer(4, 4, mReturnButton); Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); loadWindowState(); enableVisibleSound(true); }
View* Config::getView( const ViewPath& path ) { Layout* layout = getLayout( path ); LBASSERT( layout ); if( layout ) return layout->getView( path ); return 0; }
size_t nodeSize(const Word* node) { const Layout* l = getLayout(*node); switch (l->type) { case LAYOUT_INDIRECT: return 2; case LAYOUT_SMALL_NOPTRS: case LAYOUT_LARGE_NOPTRS: return l->x.noPtrs.nWords; case LAYOUT_SMALL_PTRSFIRST: case LAYOUT_LARGE_PTRSFIRST: return l->x.ptrsFirst.nWords; default: return 0; // error } }
Frame::Frame(sf::RenderWindow& window,const ActionMap<int>& map) : Container(nullptr), ActionTarget(map), _window(window), _view(_window.getDefaultView()) { ActionTarget::bind(Action(sf::Event::Resized),[this](const sf::Event& event){ sf::FloatRect visibleArea(0, 0, event.size.width, event.size.height); this->_view = sf::View(visibleArea); if(Layout* layout = getLayout()) layout->updateShape(); }); }
//-------------------------------------------------------------------------------- void UICharacterLogin::setEvent() { //IEdit* name = getLayout()->getEdit("Edit_name"); //name->setSelectAcceptEvent(onSelectAcceptEvent); //IEdit* password = getLayout()->getEdit("Edit_password"); //password->setSelectAcceptEvent(onSelectAcceptEvent); //IText* textname = getLayout()->getText("Text_name"); //textname->getWidget()->setCaption(L"Õ˺Å"); //IText* textpassword = getLayout()->getText("Text_password"); //textpassword->getWidget()->setCaption(L"ÃÜÂë"); IButton* btnLogin = getLayout()->getButton("Btn_3"); btnLogin->setMouseButtonClickEvent(onClickLoginFrontServer); btnLogin = getLayout()->getButton("Btn_1"); btnLogin->setMouseButtonClickEvent(onClickSelectPlayerCharacter); }
//-------------------------------------------------------------------------------- void TemplateSimplePro::setName() { IText* pTextName = getLayout()->getText("Text_name"); assert(pTextName); std::wstring name = pTextName->getWidget()->getCaption(); if (name.length() < 2) { name = L"kitty"; pTextName->getWidget()->setCaption(name); } }
ConfDirBrowser::ConfDirBrowser(QWidget *parent, const QString &name, const QString &placeholderText, const QVariant &value, const QString &buttonText, const QString ¶meterName) : BaseConfComponent(parameterName, parent) { lineEdit = new QLineEdit(); connect(lineEdit, SIGNAL(textChanged(QString)), this, SLOT(lineEditTextChanged(QString))); lineEdit->setText(value.toString()); lineEdit->setPlaceholderText(placeholderText); if (name.length() != 0) { lineEdit->setObjectName(name); } else { QMessageBox::warning(parent, STRS::incorrectName, QtUtils::stringFormat(STRS::specifyName, STRS::browserLineEdit)); } pushButton = new QPushButton(buttonText); connect(pushButton, SIGNAL(clicked()), this, SLOT(pushButtonClicked())); getLayout()->addWidget(lineEdit); getLayout()->addWidget(pushButton); setLayout(getLayout()); }
const Config* View::getConfig() const { const Layout* layout = getLayout(); if( layout ) return layout->getConfig(); if( _pipe ) return _pipe->getConfig(); EQUNREACHABLE; return 0; }
Config* View::getConfig() { Layout* layout = getLayout(); if (layout) return layout->getConfig(); if (_pipe) return _pipe->getConfig(); LBUNREACHABLE; return 0; }
void QSysMessagePanel::addMessage(const QString &from, const QString &msg) { int width = QAppUtils::ref().getScreenWid(); QMessageWidgets *msgWidget = dynamic_cast<QMessageWidgets*> (QWinFactory::ref().createWindow(QWinFactory::MsgWidget,this)); msgWidget->setMinimumWidth(width/4.2); msgWidget->setWindowTitle(from); msgWidget->setMessage(msg); msgWidget->setAttribute(Qt::WA_TranslucentBackground); getLayout()->addWidget(msgWidget,m_currow++,0,1,1,Qt::AlignHCenter); }
DidYouKnowWindow::DidYouKnowWindow() : // TRANSLATORS: did you know window name Window(_("Did You Know?"), Modal_false, nullptr, "didyouknow.xml"), ActionListener(), mItemLinkHandler(new ItemLinkHandler), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_true, "didyouknow_background.xml")), // TRANSLATORS: did you know window button mButtonPrev(new Button(this, _("< Previous"), "prev", this)), // TRANSLATORS: did you know window button mButtonNext(new Button(this, _("Next >"), "next", this)), // TRANSLATORS: did you know window checkbox mOpenAgainCheckBox(new CheckBox(this, _("Auto open this window"), config.getBoolValue("showDidYouKnow"), this, "openagain")) { setMinWidth(300); setMinHeight(220); setContentSize(455, 350); setWindowName("DidYouKnow"); setCloseButton(true); setResizable(true); setStickyButtonLock(true); if (setupWindow) setupWindow->registerWindowForReset(this); setDefaultSize(500, 400, ImagePosition::CENTER); mBrowserBox->setOpaque(Opaque_false); // TRANSLATORS: did you know window button Button *const okButton = new Button(this, _("Close"), "close", this); mBrowserBox->setLinkHandler(mItemLinkHandler); if (gui) mBrowserBox->setFont(gui->getHelpFont()); mBrowserBox->setProcessVars(true); mBrowserBox->setEnableImages(true); mBrowserBox->setEnableKeys(true); mBrowserBox->setEnableTabs(true); place(0, 0, mScrollArea, 5, 3).setPadding(3); place(0, 3, mOpenAgainCheckBox, 5); place(1, 4, mButtonPrev, 1); place(2, 4, mButtonNext, 1); place(4, 4, okButton); Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); loadWindowState(); enableVisibleSound(true); }
ViewPath View::getPath() const { const Layout* layout = getLayout(); LBASSERT( layout ); ViewPath path( layout->getPath( )); const Views& views = layout->getViews(); Views::const_iterator i = std::find( views.begin(), views.end(), this ); LBASSERT( i != views.end( )); path.viewIndex = std::distance( views.begin(), i ); return path; }
//############################################################################## //# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //############################################################################## void xContainerInternal::doLayout() { //first our layout xDimension dim; getSize(dim); getLayout().getInternal()->setClientSize(dim,0,0); getLayout().getInternal()->doLayout(); //then childs //automatically called for every child when resized /* smartPtr<xIterator> iter = m_components.iterator(); while(iter->hasNext()) { xContainer* c = dynamic_cast<xContainer*>(&(iter->next())); if(c != NULL) c->doLayout(); } */ }
void TextWidget::preRender() { if (data.empty()) { if(getLayout() == NULL) { setLayout(new NormalTextLayout(align, 1.0)); } return; } stringTexture.setString( data, Render::FontManager::getInstance()->getCurrentFont(), color, true); int w = stringTexture.getWidth(); int h = stringTexture.getHeight(); widthFactor = double(w) / (double) stringTexture.getOriginalWidth(); heightFactor = double(h) / (double) stringTexture.getOriginalHeight(); double aspectRatio = (double) stringTexture.getOriginalHeight() / (double) stringTexture.getOriginalWidth(); aspectRatio *= SDL::Projector::getInstance()->getAspectRatio(); if (getLayout() == NULL) { setLayout(new NormalTextLayout(align, aspectRatio)); } else { NormalTextLayout *normal = dynamic_cast<NormalTextLayout *>(getLayout().get()); if(normal) normal->setAspectRatio(aspectRatio); getLayout()->update(); } dirty = false; }
ConfLineEdit::ConfLineEdit(QWidget *parent, const QString &name, const QString &placeholderText, const QVariant &value, QString &mask, const QString ¶meterName) : BaseConfComponent(parameterName, parent) { lineEdit = new QLineEdit(); connect(lineEdit, SIGNAL(textChanged(QString)), this, SLOT(lineEditTextChanged(QString))); lineEdit->setText(value.toString()); if (name.length() != 0) { lineEdit->setObjectName(name); } else { QMessageBox::warning(parent, STRS::incorrectName, QtUtils::stringFormat(STRS::specifyName, STRS::lineEdit)); } lineEdit->setPlaceholderText(placeholderText); QRegExpValidator* validator = new QRegExpValidator(QRegExp(mask), this); lineEdit->setValidator(validator); getLayout()->addWidget(lineEdit); setLayout(getLayout()); }
void UIAliveRpg::UIShowGeneralInfo() { CPlayerCharacter* myPlayerCharacter = CPlayer::getInstance().getMainGenreal(); if (NULL == myPlayerCharacter) { return; } //名字 { IText* name = getLayout()->getText("edt_name"); DYNAMIC_ASSERT(name); name->getWidget()->setCaption(myPlayerCharacter->getNormalName()); } //时间 { ITimeText* time = getLayout()->getTimeText("edt_time"); DYNAMIC_ASSERT(time); time->setCoolDownTime(30*1000); } }
void UIGameOptions::setEvent() { IButton* pButton = getLayout()->getButton("button_exit"); pButton->getWidget()->setMouseButtonClickEvent(onClickExit); getLayout()->getButton("button_rlogin")->getWidget()->setMouseButtonClickEvent(onClickRlogin); getLayout()->getButton("button_return")->getWidget()->setMouseButtonClickEvent(onClickReturn); getLayout()->getButton("button_func")->getWidget()->setMouseButtonClickEvent(onClickFuncSet); getLayout()->getButton("button_video")->getWidget()->setMouseButtonClickEvent(onClickVideoSet); getLayout()->getButton("button_audio")->getWidget()->setMouseButtonClickEvent(onClickAudioSet); getLayout()->getButton("button_network")->getWidget()->setMouseButtonClickEvent(onClickNetworkSet); }
void QMessageWidgets::initUI() { QGridLayout *gridLay = getLayout(); QFrame *hline = new QFrame(getCenterPanel()); m_lbmsg = new QLabel(this); m_lbmsg->setWordWrap(true); gridLay->setContentsMargins(5,2,2,10); hline->setFrameShape(QFrame::HLine); hline->setFrameShadow(QFrame::Sunken); gridLay->addWidget(hline,0,0,1,1); gridLay->addWidget(m_lbmsg,1,0,1,1); setTitleStyle("font: 75 12pt \"Aharoni\";"); }
void View::trigger( const Canvas* canvas, const bool active ) { const Mode mode = getMode(); Config* config = getConfig(); // (De)activate destination compounds for canvas/eye(s) for( Channels::const_iterator i = _channels.begin(); i != _channels.end(); ++i ) { Channel* channel = *i; const Canvas* channelCanvas = channel->getCanvas(); const Layout* canvasLayout = channelCanvas->getActiveLayout(); if(( canvas && channelCanvas != canvas ) || ( !canvas && canvasLayout != getLayout( ))) { continue; } const Segment* segment = channel->getSegment(); const uint32_t segmentEyes = segment->getEyes(); const uint32_t eyes = ( mode == MODE_MONO ) ? EYE_CYCLOP & segmentEyes : EYES_STEREO & segmentEyes; if( eyes == 0 ) continue; ConfigDestCompoundVisitor visitor( channel, true /*activeOnly*/ ); config->accept( visitor ); const Compounds& compounds = visitor.getResult(); for( Compounds::const_iterator j = compounds.begin(); j != compounds.end(); ++j ) { Compound* compound = *j; if( active ) { compound->activate( eyes ); LBLOG( LOG_VIEW ) << "Activate " << compound->getName() << std::endl; } else { compound->deactivate( eyes ); LBLOG( LOG_VIEW ) << "Deactivate " << compound->getName() << std::endl; } } } }
//-------------------------------------------------------------------------------- void TemplateSimplePro::setLv() { IText* pTextlv = getLayout()->getText("Text_Lv"); assert(pTextlv); std::wstring Lv = pTextlv->getWidget()->getCaption(); int curLv = _wtoi( Lv.c_str() ); if ( curLv >= 100 ) curLv = 10; else curLv += 1; wchar_t temp[10] = L""; Lv.clear(); Lv = _itow(curLv, temp, 10); pTextlv->getWidget()->setCaption(Lv); }
HelpWindow::HelpWindow() : // TRANSLATORS: help window name Window(_("Help"), Modal_false, nullptr, "help.xml"), LinkHandler(), ActionListener(), // TRANSLATORS: help window. button. mDYKButton(new Button(this, _("Did you know..."), "DYK", BUTTON_SKIN, this)), mBrowserBox(new StaticBrowserBox(this, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_true, "help_background.xml")), mTagFileMap() { setMinWidth(300); setMinHeight(220); setContentSize(455, 350); setWindowName("Help"); setCloseButton(true); setResizable(true); setStickyButtonLock(true); if (setupWindow != nullptr) setupWindow->registerWindowForReset(this); setDefaultSize(500, 400, ImagePosition::CENTER, 0, 0); mBrowserBox->setOpaque(Opaque_false); mBrowserBox->setLinkHandler(this); if (gui != nullptr) mBrowserBox->setFont(gui->getHelpFont()); mBrowserBox->setProcessVars(true); mBrowserBox->setEnableImages(true); mBrowserBox->setEnableKeys(true); mBrowserBox->setEnableTabs(true); place(4, 3, mDYKButton, 1, 1); place(0, 0, mScrollArea, 5, 3).setPadding(3); Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); loadWindowState(); loadTags(); enableVisibleSound(true); widgetResized(Event(nullptr)); }
//-------------------------------------------------------------------------------- void UICharacterLogin::setPanelValue( Char16* frontServerName, Char* ip, I32 port) { IText* text = getLayout()->getText("Text_cha"); std::wstring ipStr; Char16 temp[2048] ={0}; MGStrOp::toString(ip,ipStr); MGStrOp::sprintf(temp,2048, L"Õ˺ÅÃû%s£¬\tIP%s,\nPort%d,\n", frontServerName,ipStr.c_str(),port); if (text) { text->getWidget()->setCaption(temp); } }
Setup::Setup(): Window(_("Setup")) { setWindowName("Setup"); saveVisibility(false); setCloseButton(true); int width = 340 + 2 * getPadding(); int height = 340 + 2 * getPadding() + getTitleBarHeight(); static const char *buttonNames[] = { N_("Reset Windows"), N_("Cancel"), N_("Apply"), 0 }; mPanel = new TabbedArea(); mPanel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); mTabs.push_back(new Setup_Video()); mTabs.push_back(new Setup_Audio()); mTabs.push_back(new Setup_Input()); mTabs.push_back(new Setup_Colors()); for (std::list<SetupTabContainer*>::iterator i = mTabs.begin(), i_end = mTabs.end(); i != i_end; ++i) { SetupTabContainer *tab = *i; mPanel->addTab(tab->getName(), tab); } place(0, 0, mPanel, 7, 6).setPadding(2); for (int i = 0; buttonNames[i] != NULL; ++i) { Button *btn = new Button(gettext(buttonNames[i]), buttonNames[i], this); place(i + 4, 6, btn); // Store this button, as it needs to be enabled/disabled if (!strcmp(buttonNames[i], N_("Reset Windows"))) mResetWindows = btn; } setDefaultSize(width, height, ImageRect::CENTER); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); loadWindowState(); }
void TextInputDialog::adjustSize() { const int titleWidth = 3 * getFont()->getWidth(getCaption()) / 2; const int fontHeight = getFont()->getHeight(); setWidth(titleWidth + 4 * getPadding()); setHeight(fontHeight + mOkButton->getHeight() + mValueField->getHeight() + 8 * getPadding()); setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); layout.setRowHeight(1, Layout::AUTO_SET); layout.setColWidth(2, Layout::AUTO_SET); layout.setColWidth(3, Layout::AUTO_SET); }
StorageWindow::StorageWindow(int invSize): Window(_("Storage")), mMaxSlots(invSize), mItemDesc(false) { setWindowName("Storage"); setResizable(true); saveVisibility(false); setCloseButton(true); setDefaultSize(375, 300, ImageRect::CENTER); mRetrieveButton = new Button(_("Retrieve"), "retrieve", this); mRetrieveButton->setEnabled(false); Button *closeButton = new Button(_("Close"), "close", this); mItems = new ItemContainer(player_node->getStorage(), "showpopupmenu", this); mItems->addSelectionListener(this); mInvenScroll = new ScrollArea(mItems); mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mUsedSlots = player_node->getStorage()->getNumberOfSlotsUsed(); mSlotsLabel = new Label(_("Slots:")); mSlotsBar = new ProgressBar(1.0f, 100, 20, gcn::Color(225, 200, 25)); mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots)); mSlotsBar->setProgress((float) mUsedSlots / mMaxSlots); setMinHeight(130); setMinWidth(200); place(0, 0, mSlotsLabel).setPadding(3); place(1, 0, mSlotsBar, 3); place(0, 1, mInvenScroll, 4, 4); place(2, 5, closeButton); place(3, 5, mRetrieveButton); Layout &layout = getLayout(); layout.setRowHeight(0, mRetrieveButton->getHeight()); loadWindowState(); }
void Circuit::writeCellSizesFile(string filename){ ofstream file; file.open(filename.c_str()); // Write if ((!file)) throw AstranError("Could not save file: " + filename); map<string,CellNetlst>::iterator cells_it; for(cells_it=cellNetlsts.begin(); cells_it!=cellNetlsts.end(); cells_it++){ CLayout* l=getLayout(cells_it->first); if(!l) throw AstranError("Cell Layout " + cells_it->first + " not found"); file << cells_it->first << endl; file << l->getWidth()/currentRules->getIntValue(getHPitch()) << endl; file << l->getHeight()/currentRules->getIntValue(getVPitch()) << endl; } }
void StorageWindow::fontChanged() { Window::fontChanged(); if (mWidgets.size() > 0) clear(); place(0, 0, mSlotsLabel).setPadding(3); place(1, 0, mSlotsBar, 3); place(0, 1, mInvenScroll, 4, 4); place(2, 5, mCloseButton); place(3, 5, mRetrieveButton); Layout &layout = getLayout(); layout.setRowHeight(0, mRetrieveButton->getHeight()); restoreFocus(); }
void UIWidget::destroyChildren() { UILayoutPtr layout = getLayout(); if(layout) layout->disableUpdates(); m_focusedChild = nullptr; m_lockedChildren.clear(); while(!m_children.empty()) { UIWidgetPtr child = m_children.front(); m_children.pop_front(); child->setParent(nullptr); m_layout->removeWidget(child); child->destroy(); } layout->enableUpdates(); }
docstring InsetCaption::xhtml(XHTMLStream & xs, OutputParams const & rp) const { if (rp.html_disable_captions) return docstring(); InsetLayout const & il = getLayout(); string const tag = il.htmltag(); string attr = il.htmlattr(); if (!type_.empty()) { string const our_class = "float-caption-" + type_; size_t const loc = attr.find("class='"); if (loc != string::npos) attr.insert(loc + 1, our_class); } xs << html::StartTag(tag, attr); docstring def = getCaptionAsHTML(xs, rp); xs << html::EndTag(tag); return def; }
WorldSelectDialog::WorldSelectDialog(Worlds worlds) : // TRANSLATORS: world select dialog name Window(_("Select World"), Modal_false, nullptr, "world.xml"), ActionListener(), KeyListener(), mWorldListModel(new WorldListModel(worlds)), mWorldList(new ListBox(this, mWorldListModel, "")), // TRANSLATORS: world dialog button mChangeLoginButton(new Button(this, _("Change Login"), "login", this)), // TRANSLATORS: world dialog button mChooseWorld(new Button(this, _("Choose World"), "world", this)) { mWorldList->postInit(); ScrollArea *const worldsScroll = new ScrollArea(this, mWorldList, getOptionBool("showbackground"), "world_background.xml"); worldsScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); place(0, 0, worldsScroll, 3, 5).setPadding(2); place(1, 5, mChangeLoginButton); place(2, 5, mChooseWorld); // Make sure the list has enough height getLayout().setRowHeight(0, 60); reflowLayout(0, 0); if (worlds.empty()) { // Disable Ok button mChooseWorld->setEnabled(false); } else { // Select first server mWorldList->setSelected(0); } addKeyListener(this); center(); }