HelpWindow::HelpWindow(): Window(_("Help")) { setMinWidth(300); setMinHeight(250); setContentSize(455, 350); setWindowName("Help"); setResizable(true); setDefaultSize(500, 400, ImageRect::CENTER); mBrowserBox = new BrowserBox; mBrowserBox->setOpaque(false); mScrollArea = new ScrollArea(mBrowserBox); Button *okButton = new Button(_("Close"), "close", this); mScrollArea->setDimension(gcn::Rectangle(5, 5, 445, 335 - okButton->getHeight())); okButton->setPosition(450 - okButton->getWidth(), 345 - okButton->getHeight()); mBrowserBox->setLinkHandler(this); place(0, 0, mScrollArea, 5, 3).setPadding(3); place(4, 3, okButton); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); loadWindowState(); }
void TerrainProceduralDialog::opened() { setMapWidth(terrain->regionsX()*terrain->regionSize()); setMapDepth(terrain->regionsZ()*terrain->regionSize()); setHeightLimit(terrain->regionsY()*terrain->regionSize()); setMaxHeight(m_heightLimit); setMinHeight(0); m_imageProvider->setImage(QImage(m_mapWidth,m_mapDepth,QImage::Format_RGB888)); QFileInfo info; m_model->clear(); for(int i=0;i<terrain->materialCount();i++) { TerrainMaterial * material=terrain->getMaterial(i); if(material!=NULL && material->enabled()) { QStandardItem * item=new QStandardItem; info.setFile(material->texture_path.c_str()); if(material->name.empty()) item->setData(info.fileName(),TextRole); else item->setData(material->name.c_str(),TextRole); item->setData(material->id(),MaterialIdRole); m_model->appendRow(item); } } setWorking(false); emit modelChanged(); }
BuddyWindow::BuddyWindow(): Window(_("Buddy")) { setWindowName("BuddyWindow"); setCaption(_("Buddy List")); setResizable(true); setCloseButton(true); setSaveVisible(true); setMinWidth(110); setMinHeight(200); setDefaultSize(124, 41, 288, 330); Image *addImg = ResourceManager::getInstance()->getImage("buddyadd.png"); Image *delImg = ResourceManager::getInstance()->getImage("buddydel.png"); if (addImg && delImg) { Icon *addBuddy = new Icon(addImg); Icon *delBuddy = new Icon(delImg); add(addBuddy); add(delBuddy); } loadWindowState(); }
GuildWindow::GuildWindow(): Window(_("Guild")), mFocus(false) { setWindowName("Guild"); setCaption(_("Guild")); setResizable(false); setCloseButton(true); setSaveVisible(true); setMinWidth(200); setMinHeight(280); setDefaultSize(124, 41, 288, 330); setupWindow->registerWindowForReset(this); // Set button events Id mGuildButton[0] = new Button(_("Create Guild"), "CREATE_GUILD", this); mGuildButton[1] = new Button(_("Invite User"), "INVITE_USER", this); mGuildButton[2] = new Button(_("Quit Guild"), "QUIT_GUILD", this); mGuildButton[1]->setEnabled(false); mGuildButton[2]->setEnabled(false); mGuildTabs = new TabbedArea; place(0, 0, mGuildButton[0]); place(1, 0, mGuildButton[1]); place(2, 0, mGuildButton[2]); place(0, 1, mGuildTabs); Layout &layout = getLayout(); layout.setColWidth(0, 48); layout.setColWidth(1, 65); loadWindowState(); }
SkillDialog::SkillDialog(): Window(_("Skills")) { listen(Event::AttributesChannel); setWindowName("Skills"); setCloseButton(true); setResizable(true); setSaveVisible(true); setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); setMinHeight(113); setMinWidth(240); setupWindow->registerWindowForReset(this); mTabs = new TabbedArea(); mPointsLabel = new Label("0"); mIncreaseButton = new Button(_("Up"), "inc", this); place(0, 0, mTabs, 5, 5); place(0, 5, mPointsLabel, 4); place(4, 5, mIncreaseButton); center(); loadWindowState(); }
InventoryWindow::InventoryWindow(int invSize): Window(_("Inventory")), mMaxSlots(invSize), mSplit(false), mItemDesc(false) { setWindowName("Inventory"); setResizable(true); setCloseButton(true); setSaveVisible(true); setDefaultSize(387, 307, ImageRect::CENTER); setMinWidth(316); setMinHeight(179); addKeyListener(this); std::string longestUseString = getFont()->getWidth(_("Equip")) > getFont()->getWidth(_("Use")) ? _("Equip") : _("Use"); if (getFont()->getWidth(longestUseString) < getFont()->getWidth(_("Unequip"))) { longestUseString = _("Unequip"); } mUseButton = new Button(longestUseString, "use", this); mDropButton = new Button(_("Drop"), "drop", this); mSplitButton = new Button(_("Split"), "split", this); mItems = new ItemContainer(player_node->getInventory()); mItems->addSelectionListener(this); gcn::ScrollArea *invenScroll = new ScrollArea(mItems); invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mTotalWeight = -1; mMaxWeight = -1; mUsedSlots = -1; mSlotsLabel = new Label(_("Slots:")); mWeightLabel = new Label(_("Weight:")); mSlotsBar = new ProgressBar(0.0f, 100, 20, gcn::Color(225, 200, 25)); mWeightBar = new ProgressBar(0.0f, 100, 20, gcn::Color(0, 0, 255)); place(0, 0, mWeightLabel).setPadding(3); place(1, 0, mWeightBar, 3); place(4, 0, mSlotsLabel).setPadding(3); place(5, 0, mSlotsBar, 2); place(0, 1, invenScroll, 7).setPadding(3); place(0, 2, mUseButton); place(1, 2, mDropButton); place(2, 2, mSplitButton); Layout &layout = getLayout(); layout.setRowHeight(1, Layout::AUTO_SET); loadWindowState(); }
void Minimap::setMap(Map *map) { // Set the title for the Minimap std::string caption; if (map) caption = map->getName(); if (caption.empty()) caption = _("Map"); minimap->setCaption(caption); // Adapt the image if (mMapImage) { mMapImage->decRef(); mMapImage = 0; } if (map) { ResourceManager *resman = ResourceManager::getInstance(); mMapImage = resman->getImage(map->getProperty("minimap")); } if (mMapImage) { const int offsetX = 2 * getPadding(); const int offsetY = getTitleBarHeight() + getPadding(); const int titleWidth = getFont()->getWidth(getCaption()) + 15; const int mapWidth = mMapImage->getWidth() < 100 ? mMapImage->getWidth() + offsetX : 100; const int mapHeight = mMapImage->getHeight() < 100 ? mMapImage->getHeight() + offsetY : 100; setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth); setMinHeight(mapHeight); mWidthProportion = (float) mMapImage->getWidth() / map->getWidth(); mHeightProportion = (float) mMapImage->getHeight() / map->getHeight(); setMaxWidth(mMapImage->getWidth() > titleWidth ? mMapImage->getWidth() + offsetX : titleWidth); setMaxHeight(mMapImage->getHeight() + offsetY); setDefaultSize(getX(), getY(), getWidth(), getHeight()); resetToDefaultSize(); if (mShow) setVisible(true); } else { if (!isSticky()) setVisible(false); } }
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); }
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); }
void build(const Element& element, const Style& style) { MeshContext meshContext(*mesh_, style); auto geoCoordinate = GeoCoordinate(polygon_->points[1], polygon_->points[0]); double height = style.getValue(HeightKey); // NOTE do not allow height to be zero. This might happen due to the issues in input osm data. if (height == 0) height = 10; double minHeight = style.getValue(MinHeightKey); double elevation = context_.eleProvider.getElevation(geoCoordinate) + minHeight; height -= minHeight; // roof auto roofType = style.getString(RoofTypeKey); double roofHeight = style.getValue(RoofHeightKey); auto roofGradient = GradientUtils::evaluateGradient(context_.styleProvider, meshContext.style, element.tags, RoofColorKey); auto roofBuilder = RoofBuilderFactoryMap.find(*roofType)->second(context_, meshContext); roofBuilder->setHeight(roofHeight); roofBuilder->setMinHeight(elevation + height); roofBuilder->setColor(roofGradient, 0); roofBuilder->build(*polygon_); // facade auto facadeType = style.getString(FacadeTypeKey); auto facadeBuilder = FacadeBuilderFactoryMap.find(*facadeType)->second(context_, meshContext); auto facadeGradient = GradientUtils::evaluateGradient(context_.styleProvider, meshContext.style, element.tags, FacadeColorKey); facadeBuilder->setHeight(height); facadeBuilder->setMinHeight(elevation); facadeBuilder->setColor(facadeGradient, 0); facadeBuilder->build(*polygon_); polygon_.reset(); }
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)); }
BeingPopup::BeingPopup() : Popup("BeingPopup", "beingpopup.xml"), mBeingName(new Label(this, "A")), mBeingParty(new Label(this, "A")), mBeingGuild(new Label(this, "A")), mBeingRank(new Label(this, "A")), mBeingComment(new Label(this, "A")), mBeingBuyBoard(new Label(this, "A")), mBeingSellBoard(new Label(this, "A")), mBeingRoom(new Label(this, "A")), mBeingEffects(new Label(this, "A")) { // Being Name mBeingName->setFont(boldFont); mBeingName->setPosition(0, 0); const int fontHeight = mBeingName->getHeight(); setMinHeight(fontHeight); // Being's party mBeingParty->setPosition(0, fontHeight); // Being's party mBeingGuild->setPosition(0, 2 * fontHeight); mBeingRank->setPosition(0, 3 * fontHeight); mBeingBuyBoard->setPosition(0, 4 * fontHeight); mBeingSellBoard->setPosition(0, 4 * fontHeight); mBeingComment->setPosition(0, 5 * fontHeight); mBeingRoom->setPosition(0, 6 * fontHeight); mBeingEffects->setPosition(0, 7 * fontHeight); mBeingParty->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingGuild->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingRank->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingBuyBoard->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingSellBoard->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingComment->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingRoom->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); mBeingEffects->setForegroundColorAll(getThemeColor(ThemeColorId::POPUP), getThemeColor(ThemeColorId::POPUP_OUTLINE)); }
SpeechBubble::SpeechBubble() : Popup("Speech", "speechbubble.xml"), mText(), mSpacing(mSkin ? mSkin->getOption("spacing") : 2), mCaption(new Label(this)), mSpeechBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, "speechbrowserbox.xml")) { setContentSize(140, 46); setMinWidth(8); setMinHeight(8); mCaption->setFont(boldFont); mSpeechBox->setOpaque(false); mSpeechBox->setForegroundColorAll(getThemeColor(ThemeColorId::BUBBLE_TEXT), getThemeColor(ThemeColorId::BUBBLE_TEXT_OUTLINE)); }
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(); }
SpeechBubble::SpeechBubble(): Popup("Speech", "speechbubble.xml") { setContentSize(140, 46); setMinWidth(29); setMinHeight(29); mCaption = new Label; mCaption->setFont(boldFont); mSpeechBox = new TextBox; mSpeechBox->setEditable(false); mSpeechBox->setOpaque(false); mSpeechBox->setTextColor(&Theme::getThemeColor(Theme::CHAT)); add(mCaption); add(mSpeechBox); }
SpeechBubble::SpeechBubble(): Popup("Speech", "graphics/gui/speechbubble.xml") { setContentSize(140, 46); setMinWidth(29); setMinHeight(29); mCaption = new gcn::Label; mCaption->setFont(boldFont); mSpeechBox = new TextBox; mSpeechBox->setEditable(false); mSpeechBox->setOpaque(false); mSpeechBox->setTextColor(&guiPalette->getColor(Palette::CHAT)); add(mCaption); add(mSpeechBox); loadPopupConfiguration(); }
ShortcutWindow::ShortcutWindow(const std::string &title, ShortcutContainer *content) { setWindowName(title); // no title presented, title bar is padding so window can be moved. gcn::Window::setTitleBarHeight(gcn::Window::getPadding()); setShowTitle(false); setResizable(true); setDefaultVisible(false); setSaveVisible(true); setupWindow->registerWindowForReset(this); mItems = content; const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); setMinHeight(mItems->getBoxHeight() + border); setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border); setMaxHeight(mItems->getBoxHeight() * mItems->getMaxItems() + border); setDefaultSize(mItems->getBoxWidth() + border, mItems->getBoxHeight() * mItems->getMaxItems() + border, ImageRect::LOWER_RIGHT, mBoxesWidth, 0); mBoxesWidth += mItems->getBoxWidth() + border; mScrollArea = new ScrollArea(mItems); mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setOpaque(false); place(0, 0, mScrollArea, 5, 5).setPadding(0); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); layout.setMargin(0); loadWindowState(); }
ShortcutWindow::ShortcutWindow(ShortcutContainer *content): Window("", false, NULL, "graphics/gui/gui.xml", true) { // no title presented, title bar is padding so window can be moved. gcn::Window::setTitleBarHeight(gcn::Window::getPadding()); setWindowName(content->getShortcutHandler()->getPrefix()); setShowTitle(false); setResizable(true); mItems = content; const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); setMinHeight(mItems->getBoxHeight() + border); setMaxWidth(mItems->getBoxWidth() * mItems->getMaxShortcuts() + border); setMaxHeight(mItems->getBoxHeight() * mItems->getMaxShortcuts() + border); setDefaultSize(mItems->getBoxWidth() + border, (mItems->getBoxHeight() * mItems->getMaxShortcuts()) + border, ImageRect::LOWER_RIGHT, -mInstances * (mItems->getBoxWidth() + 2 * getPadding()), 0); mInstances++; mScrollArea = new ScrollArea(mItems); mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setOpaque(false); place(0, 0, mScrollArea, 5, 5).setPadding(0); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); layout.setMargin(0); loadWindowState(); }
ServerInfoWindow::ServerInfoWindow(ServerInfo &serverInfo) : // TRANSLATORS: servers dialog name Window(_("Server info"), Modal_false, nullptr, "serverinfo.xml"), LinkHandler(), mServerInfo(serverInfo), mBrowserBox(new StaticBrowserBox(this, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_true, "serverinfo_background.xml")) { setMinWidth(300); setMinHeight(220); setContentSize(455, 350); setWindowName("ServerInfoWindow"); setCloseButton(true); setResizable(true); setStickyButtonLock(true); 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->setEnableTabs(true); place(0, 0, mScrollArea, 5, 3).setPadding(3); Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); loadWindowState(); enableVisibleSound(true); widgetResized(Event(nullptr)); }
MailEditWindow::MailEditWindow() : // TRANSLATORS: mail edit window name Window(_("Edit mail"), Modal_false, nullptr, "mailedit.xml"), ActionListener(), // TRANSLATORS: mail edit window button mSendButton(new Button(this, _("Send"), "send", this)), // TRANSLATORS: mail edit window button mCloseButton(new Button(this, _("Close"), "close", this)), // TRANSLATORS: mail edit window button mAddButton(new Button(this, _("Add"), "add", this)), // TRANSLATORS: mail edit window label mToLabel(new Label(this, _("To:"))), // TRANSLATORS: mail edit window label mSubjectLabel(new Label(this, _("Subject:"))), // TRANSLATORS: mail edit window label mMoneyLabel(new Label(this, _("Money:"))), // TRANSLATORS: mail edit window label mItemLabel(new Label(this, _("Item:"))), // TRANSLATORS: mail edit window label mMessageLabel(new Label(this, _("Message:"))), mToField(new TextField(this)), mSubjectField(new TextField(this)), mMoneyField(new IntTextField(this, 0, 0, 10000000)), mMessageField(new TextField(this)), mInventory(new Inventory(InventoryType::MAIL, 1)), mItemContainer(new ItemContainer(this, mInventory)), mItemScrollArea(new ScrollArea(this, mItemContainer, getOptionBool("showitemsbackground"), "mailedit_listbackground.xml")) { setWindowName("MailEdit"); setCloseButton(true); setResizable(true); setCloseButton(true); setSaveVisible(false); setStickyButtonLock(true); setVisible(Visible_true); setDefaultSize(380, 200, ImageRect::CENTER); setMinWidth(200); setMinHeight(200); center(); ContainerPlacer placer; placer = getPlacer(0, 0); mToField->setWidth(100); mSubjectField->setWidth(100); mMessageField->setWidth(100); mItemScrollArea->setHeight(70); mItemScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mItemScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_NEVER); placer(0, 0, mToLabel); placer(1, 0, mToField, 3); placer(0, 1, mSubjectLabel); placer(1, 1, mSubjectField, 3); placer(0, 2, mMoneyLabel); placer(1, 2, mMoneyField, 3); placer(0, 3, mItemLabel); placer(1, 3, mItemScrollArea, 2, 2); placer(3, 4, mAddButton, 1); placer(0, 5, mMessageLabel); placer(1, 5, mMessageField, 3); placer(0, 6, mSendButton); placer(3, 6, mCloseButton); loadWindowState(); enableVisibleSound(true); }
TradeWindow::TradeWindow(): Window(_("Trade: You")), mMyInventory(new Inventory(INVENTORY_SIZE)), mPartnerInventory(new Inventory(INVENTORY_SIZE)), mStatus(PROPOSING) { setWindowName("Trade"); setResizable(true); setCloseButton(true); setDefaultSize(386, 180, ImageRect::CENTER); setMinWidth(386); setMinHeight(180); std::string longestName = getFont()->getWidth(_("OK")) > getFont()->getWidth(_("Trade")) ? _("OK") : _("Trade"); mAddButton = new Button(_("Add"), "add", this); mOkButton = new Button("", "", this); // Will be filled in later int width = std::max(mOkButton->getFont()->getWidth(CAPTION_PROPOSE), mOkButton->getFont()->getWidth(CAPTION_CONFIRMED)); width = std::max(width, mOkButton->getFont()->getWidth(CAPTION_ACCEPT)); width = std::max(width, mOkButton->getFont()->getWidth(CAPTION_ACCEPTED)); mOkButton->setWidth(8 + width); mMyItemContainer = new ItemContainer(mMyInventory.get()); mMyItemContainer->addSelectionListener(this); ScrollArea *myScroll = new ScrollArea(mMyItemContainer); myScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mPartnerItemContainer = new ItemContainer(mPartnerInventory.get()); mPartnerItemContainer->addSelectionListener(this); ScrollArea *partnerScroll = new ScrollArea(mPartnerItemContainer); partnerScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mMoneyLabel = new Label(strprintf(_("You get %s."), "")); gcn::Label *mMoneyLabel2 = new Label(_("You give:")); mMoneyField = new TextField; mMoneyField->setWidth(40); mMoneyChangeButton = new Button(_("Change"), "money", this); place(1, 0, mMoneyLabel); place(0, 1, myScroll).setPadding(3); place(1, 1, partnerScroll).setPadding(3); ContainerPlacer place; place = getPlacer(0, 0); place(0, 0, mMoneyLabel2); place(1, 0, mMoneyField); place(2, 0, mMoneyChangeButton).setHAlign(LayoutCell::LEFT); place = getPlacer(0, 2); place(0, 0, mAddButton); place(1, 0, mOkButton); Layout &layout = getLayout(); layout.extend(0, 2, 2, 1); layout.setRowHeight(1, Layout::AUTO_SET); layout.setRowHeight(2, 0); layout.setColWidth(0, Layout::AUTO_SET); layout.setColWidth(1, Layout::AUTO_SET); loadWindowState(); reset(); }
MailViewWindow::MailViewWindow(const MailMessage *const message) : // TRANSLATORS: mail view window name Window(_("View mail"), Modal_false, nullptr, "mailview.xml"), ActionListener(), mMessage(message), // TRANSLATORS: mail view window button mGetAttachButton(nullptr), // TRANSLATORS: mail view window button mCloseButton(new Button(this, _("Close"), "close", this)), mPrevButton(new Button(this, "<", "prev", this)), mNextButton(new Button(this, ">", "next", this)), // TRANSLATORS: mail view window button mReplyButton(new Button(this, _("Reply"), "reply", this)), // TRANSLATORS: mail view window label mTimeLabel(new Label(this, strprintf("%s %s", _("Time:"), message->strTime.c_str()))), mMoneyLabel(nullptr), // TRANSLATORS: mail view window label mFromLabel(new Label(this, strprintf("%s %s", _("From:"), message->sender.c_str()))), // TRANSLATORS: mail view window label mSubjectLabel(new Label(this, strprintf("%s %s", _("Subject:"), message->title.c_str()))), // TRANSLATORS: mail view window label mMessageLabel(new Label(this, strprintf("%s %s", _("Message:"), message->text.c_str()))), // TRANSLATORS: mail view window label mItemLabel(nullptr), mIcon(nullptr) { setWindowName("MailView"); setCloseButton(true); setResizable(true); setSaveVisible(false); setStickyButtonLock(true); setVisible(Visible_true); setDefaultSize(380, 230, ImageRect::CENTER); setMinWidth(200); setMinHeight(100); center(); ContainerPlacer placer; placer = getPlacer(0, 0); int n = 0; placer(0, n++, mTimeLabel); placer(0, n++, mFromLabel); placer(0, n++, mSubjectLabel); if (message->money) { // TRANSLATORS: mail view window label mMoneyLabel = new Label(this, strprintf("%s %d", _("Money:"), message->money)); placer(0, n++, mMoneyLabel); } placer(0, n++, mMessageLabel); if (message->itemId) { const ItemInfo &item = ItemDB::get(message->itemId); // +++ need use message->cards and ItemColorManager for colors Image *const image = resourceManager->getImage(combineDye2( paths.getStringValue("itemIcons").append( item.getDisplay().image), item.getDyeIconColorsString(ItemColor_one))); mIcon = new Icon(this, image); if (message->itemAmount != 1) { mItemLabel = new Label(this, std::string(_("Item:")).append( " (").append(toString(message->itemAmount)).append(") ")); } else { mItemLabel = new Label(this, std::string(_("Item:")).append(" ")); } placer(0, n, mItemLabel); placer(1, n++, mIcon); } if (message->money || message->itemId) { mGetAttachButton = new Button(this, _("Get attach"), "attach", this); placer(0, n++, mGetAttachButton); } ContainerPlacer placer2; placer2 = getPlacer(0, n); placer2(0, 0, mPrevButton); placer2(1, 0, mNextButton); placer2(3, 0, mReplyButton); placer2(4, 0, mCloseButton); loadWindowState(); enableVisibleSound(true); }
ServerDialog::ServerDialog(ServerInfo *const serverInfo, const std::string &dir) : // TRANSLATORS: servers dialog name Window(_("Choose Your Server"), Modal_false, nullptr, "server.xml"), ActionListener(), KeyListener(), SelectionListener(), mMutex(), mServers(ServerInfos()), mDir(dir), mDescription(new Label(this, std::string())), // TRANSLATORS: servers dialog button mQuitButton(new Button(this, _("Quit"), "quit", this)), // TRANSLATORS: servers dialog button mConnectButton(new Button(this, _("Connect"), "connect", this)), // TRANSLATORS: servers dialog button mAddEntryButton(new Button(this, _("Add"), "addEntry", this)), // TRANSLATORS: servers dialog button mEditEntryButton(new Button(this, _("Edit"), "editEntry", this)), // TRANSLATORS: servers dialog button mDeleteButton(new Button(this, _("Delete"), "remove", this)), // TRANSLATORS: servers dialog button mLoadButton(new Button(this, _("Load"), "load", this)), mServersListModel(new ServersListModel(&mServers, this)), mServersList(new ServersListBox(this, mServersListModel)), mDownload(nullptr), mServerInfo(serverInfo), mPersistentIPCheckBox(nullptr), mDownloadProgress(-1.0F), mDownloadStatus(DOWNLOADING_UNKNOWN) { mServersList->postInit(); if (isSafeMode) { // TRANSLATORS: servers dialog name setCaption(_("Choose Your Server *** SAFE MODE ***")); } setWindowName("ServerDialog"); setCloseButton(true); mPersistentIPCheckBox = new CheckBox(this, // TRANSLATORS: servers dialog checkbox _("Use same ip for game sub servers"), config.getBoolValue("usePersistentIP"), this, "persitent ip"); loadCustomServers(); mServersList->addMouseListener(this); ScrollArea *const usedScroll = new ScrollArea(this, mServersList, getOptionBool("showbackground"), "server_background.xml"); usedScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mServersList->addSelectionListener(this); usedScroll->setVerticalScrollAmount(0); place(0, 0, usedScroll, 7, 5).setPadding(3); place(0, 5, mDescription, 7); place(0, 6, mPersistentIPCheckBox, 7); place(0, 7, mAddEntryButton); place(1, 7, mEditEntryButton); place(2, 7, mLoadButton); place(3, 7, mDeleteButton); place(5, 7, mQuitButton); place(6, 7, mConnectButton); // Make sure the list has enough height getLayout().setRowHeight(0, 80); // Do this manually instead of calling reflowLayout so we can enforce a // minimum width. int width = 500; int height = 350; getLayout().reflow(width, height); setContentSize(width, height); setMinWidth(310); setMinHeight(220); setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER); setResizable(true); addKeyListener(this); loadWindowState(); }
EditServerDialog::EditServerDialog(ServerDialog *parent, ServerInfo server, int index) : Window(_("Edit Server"), true, parent), mServerDialog(parent), mServer(server), mIndex(index) { setWindowName("EditServerDialog"); Label *nameLabel = new Label(_("Name:")); Label *serverAdressLabel = new Label(_("Address:")); Label *portLabel = new Label(_("Port:")); Label *typeLabel = new Label(_("Server type:")); Label *descriptionLabel = new Label(_("Description:")); mServerAddressField = new TextField(std::string()); mPortField = new TextField(std::string()); mPortField->setNumeric(true); mPortField->setRange(1, 65535); mTypeListModel = new TypeListModel(); mTypeField = new DropDown(mTypeListModel); mTypeField->setSelected(0); // TmwAthena by default for now. mNameField = new TextField(std::string()); mDescriptionField = new TextField(std::string()); mOkButton = new Button(_("OK"), "addServer", this); mCancelButton = new Button(_("Cancel"), "cancel", this); mServerAddressField->addActionListener(this); mPortField->addActionListener(this); place(0, 0, nameLabel); place(1, 0, mNameField, 4).setPadding(3); place(0, 1, serverAdressLabel); place(1, 1, mServerAddressField, 4).setPadding(3); place(0, 2, portLabel); place(1, 2, mPortField, 4).setPadding(3); place(0, 3, typeLabel); place(1, 3, mTypeField).setPadding(3); place(0, 4, descriptionLabel); place(1, 4, mDescriptionField, 4).setPadding(3); place(4, 5, mOkButton); place(3, 5, mCancelButton); // Do this manually instead of calling reflowLayout so we can enforce a // minimum width. int width = 0, height = 0; getLayout().reflow(width, height); if (width < 300) { width = 300; getLayout().reflow(width, height); } if (height < 120) { height = 120; getLayout().reflow(width, height); } setContentSize(width, height); setMinWidth(getWidth()); setMinHeight(getHeight()); setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER); setResizable(false); addKeyListener(this); loadWindowState(); mNameField->setText(mServer.name); mDescriptionField->setText(mServer.description); mServerAddressField->setText(mServer.hostname); mPortField->setText(toString(mServer.port)); switch (mServer.type) { #ifdef EATHENA_SUPPORT case ServerInfo::EATHENA: mTypeField->setSelected(2); break; case ServerInfo::MANASERV: #ifdef MANASERV_SUPPORT mTypeField->setSelected(3); break; #endif #else case ServerInfo::MANASERV: #ifdef MANASERV_SUPPORT mTypeField->setSelected(2); break; #endif #endif default: case ServerInfo::UNKNOWN: case ServerInfo::TMWATHENA: mTypeField->setSelected(0); break; case ServerInfo::EVOL: mTypeField->setSelected(1); break; } setLocationRelativeTo(getParentWindow()); setVisible(true); mNameField->requestFocus(); }
void BuyDialog::init() { setWindowName("Buy"); setResizable(true); setCloseButton(true); setStickyButtonLock(true); setMinWidth(260); setMinHeight(220); setDefaultSize(260, 230, ImageRect::CENTER); if (setupWindow) setupWindow->registerWindowForReset(this); mShopItems = new ShopItems; mShopItemList = new ShopListBox(this, mShopItems, mShopItems); mShopItemList->postInit(); mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "buy_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mSlider = new Slider(this, 1.0, 1.0); mQuantityLabel = new Label(this, strprintf( "%d / %d", mAmountItems, mMaxItems)); mQuantityLabel->setAlignment(Graphics::CENTER); // TRANSLATORS: buy dialog label mMoneyLabel = new Label(this, strprintf( _("Price: %s / Total: %s"), "", "")); mAmountField = new IntTextField(this, 1, 1, 123); mAmountField->setActionEventId("amount"); mAmountField->addActionListener(this); mAmountField->setSendAlwaysEvents(true); mAmountField->setEnabled(false); // TRANSLATORS: buy dialog label mAmountLabel = new Label(this, _("Amount:")); mAmountLabel->adjustSize(); // TRANSLATORS: This is a narrow symbol used to denote 'increasing'. // You may change this symbol if your language uses another. mIncreaseButton = new Button(this, _("+"), "inc", this); // TRANSLATORS: This is a narrow symbol used to denote 'decreasing'. // You may change this symbol if your language uses another. mDecreaseButton = new Button(this, _("-"), "dec", this); // TRANSLATORS: buy dialog button mBuyButton = new Button(this, mNpcId == fromInt(Items, BeingId) ? _("Create") :_("Buy"), "buy", this); // TRANSLATORS: buy dialog button mQuitButton = new Button(this, _("Quit"), "quit", this); // TRANSLATORS: buy dialog button mAddMaxButton = new Button(this, _("Max"), "max", this); mDecreaseButton->adjustSize(); mDecreaseButton->setWidth(mIncreaseButton->getWidth()); mIncreaseButton->setEnabled(false); mDecreaseButton->setEnabled(false); mBuyButton->setEnabled(false); mSlider->setEnabled(false); mSlider->setActionEventId("slider"); mSlider->addActionListener(this); mShopItemList->setDistributeMousePressed(false); mShopItemList->setActionEventId("buy"); mShopItemList->addActionListener(this); mShopItemList->addSelectionListener(this); mFilterTextField->setWidth(100); ContainerPlacer placer = getPlacer(0, 0); placer(0, 0, mScrollArea, 9, 5).setPadding(3); placer(0, 5, mDecreaseButton); placer(1, 5, mSlider, 4); placer(5, 5, mIncreaseButton); placer(6, 5, mQuantityLabel, 2); placer(8, 5, mAddMaxButton); placer(0, 6, mAmountLabel, 2); placer(2, 6, mAmountField, 2); placer(0, 7, mMoneyLabel, 8); if (mSortDropDown) { placer(0, 8, mSortDropDown, 2); } else { // TRANSLATORS: buy dialog label mFilterLabel = new Label(this, _("Filter:")); mFilterLabel->adjustSize(); placer(0, 8, mFilterLabel, 2); } placer(2, 8, mFilterTextField, 2); placer(7, 8, mBuyButton); placer(8, 8, mQuitButton); Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); center(); loadWindowState(); enableVisibleSound(true); instances.push_back(this); setVisible(Visible_true); if (mSortDropDown) mSortDropDown->setSelected(config.getIntValue("buySortOrder")); }
ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): Window(_("Choose Your Server")), mDir(dir), mDownloadStatus(DOWNLOADING_PREPARING), mDownloadProgress(-1.0f), mServers(ServerInfos()), mServerInfo(serverInfo) { setWindowName("ServerDialog"); Label *serverLabel = new Label(_("Server:")); Label *portLabel = new Label(_("Port:")); Label *typeLabel = new Label(_("Server type:")); mServerNameField = new TextField(mServerInfo->hostname); mPortField = new TextField(toString(mServerInfo->port)); loadCustomServers(); mServersListModel = new ServersListModel(&mServers, this); mServersList = new ServersListBox(mServersListModel); ScrollArea *usedScroll = new ScrollArea(mServersList); usedScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mTypeListModel = new TypeListModel(); mTypeField = new DropDown(mTypeListModel); mTypeField->setSelected((serverInfo->type == ServerInfo::MANASERV) ? 1 : 0); mDescription = new Label(std::string()); mQuitButton = new Button(_("Quit"), "quit", this); mConnectButton = new Button(_("Connect"), "connect", this); mManualEntryButton = new Button(_("Custom Server"), "addEntry", this); mDeleteButton = new Button(_("Delete"), "remove", this); mServerNameField->setActionEventId("connect"); mPortField->setActionEventId("connect"); mServerNameField->addActionListener(this); mPortField->addActionListener(this); mManualEntryButton->addActionListener(this); mServersList->addSelectionListener(this); usedScroll->setVerticalScrollAmount(0); place(0, 0, serverLabel); place(1, 0, mServerNameField, 4).setPadding(3); place(0, 1, portLabel); place(1, 1, mPortField, 4).setPadding(3); place(0, 2, typeLabel); place(1, 2, mTypeField, 4).setPadding(3); place(0, 3, usedScroll, 5, 5).setPadding(3); place(0, 8, mDescription, 5); place(0, 9, mManualEntryButton); place(1, 9, mDeleteButton); place(3, 9, mQuitButton); place(4, 9, mConnectButton); // Make sure the list has enough height getLayout().setRowHeight(3, 80); // Do this manually instead of calling reflowLayout so we can enforce a // minimum width. int width = 0, height = 0; getLayout().reflow(width, height); if (width < 400) { width = 400; getLayout().reflow(width, height); } setContentSize(width, height); setMinWidth(getWidth()); setMinHeight(getHeight()); setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER); setResizable(true); addKeyListener(this); loadWindowState(); setFieldsReadOnly(true); mServersList->setSelected(0); // Do this after for the Delete button setVisible(true); if (mServerNameField->getText().empty()) { mServerNameField->requestFocus(); } else { if (mPortField->getText().empty()) mPortField->requestFocus(); else mConnectButton->requestFocus(); } downloadServerList(); }
void SocialWindow::postInit() { Window::postInit(); setWindowName("Social"); setVisible(Visible_false); setSaveVisible(true); setResizable(true); setSaveVisible(true); setCloseButton(true); setStickyButtonLock(true); setMinWidth(120); setMinHeight(55); setDefaultSize(590, 200, 180, 300); if (setupWindow) setupWindow->registerWindowForReset(this); place(0, 0, mCreateButton); place(1, 0, mInviteButton); place(2, 0, mLeaveButton); place(0, 1, mCountLabel); place(0, 2, mTabs, 4, 4); widgetResized(Event(nullptr)); loadWindowState(); mTabs->addTab(mPlayers, mPlayers->mScroll); mTabs->addTab(mFriends, mFriends->mScroll); mTabs->addTab(mNavigation, mNavigation->mScroll); if (config.getBoolValue("enableAttackFilter")) { mAttackFilter = new SocialAttackTab(this, getOptionBool("showtabbackground")); mTabs->addTab(mAttackFilter, mAttackFilter->mScroll); } else { mAttackFilter = nullptr; } if (config.getBoolValue("enablePickupFilter")) { mPickupFilter = new SocialPickupTab(this, getOptionBool("showtabbackground")); mTabs->addTab(mPickupFilter, mPickupFilter->mScroll); } else { mPickupFilter = nullptr; } if (localPlayer && localPlayer->getParty()) addTab(localPlayer->getParty()); if (localPlayer && localPlayer->getGuild()) addTab(localPlayer->getGuild()); enableVisibleSound(true); updateButtons(); player_relations.addListener(this); }
EditServerDialog::EditServerDialog(ServerDialog *const parent, ServerInfo server, const int index) : // TRANSLATORS: edit server dialog name Window(_("Edit Server"), Modal_true, parent), ActionListener(), KeyListener(), mServerAddressField(new TextField(this, std::string())), mPortField(new TextField(this, std::string())), mNameField(new TextField(this, std::string())), mDescriptionField(new TextField(this, std::string())), mOnlineListUrlField(new TextField(this, std::string())), mPacketVersionField(new IntTextField(this, 0, 0, maxPacketVersion)), // TRANSLATORS: edit server dialog button mConnectButton(new Button(this, _("Connect"), "connect", this)), // TRANSLATORS: edit server dialog button mOkButton(new Button(this, _("OK"), "addServer", this)), // TRANSLATORS: edit server dialog button mCancelButton(new Button(this, _("Cancel"), "cancel", this)), // TRANSLATORS: edit server dialog label mPersistentIp(new CheckBox(this, _("Use same ip"), true, this, "persistentIp")), mTypeListModel(new TypeListModel), mTypeField(new DropDown(this, mTypeListModel, false, Modal_true)), mServerDialog(parent), mServer(server), mIndex(index) { setWindowName("EditServerDialog"); // TRANSLATORS: edit server dialog label Label *const nameLabel = new Label(this, _("Name:")); // TRANSLATORS: edit server dialog label Label *const serverAdressLabel = new Label(this, _("Address:")); // TRANSLATORS: edit server dialog label Label *const portLabel = new Label(this, _("Port:")); // TRANSLATORS: edit server dialog label Label *const typeLabel = new Label(this, _("Server type:")); // TRANSLATORS: edit server dialog label Label *const descriptionLabel = new Label(this, _("Description:")); // TRANSLATORS: edit server dialog label Label *const onlineListUrlLabel = new Label(this, _("Online list url:")); // TRANSLATORS: edit server dialog label Label *const packetVersionLabel = new Label(this, _("Packet version:")); mPortField->setNumeric(true); mPortField->setRange(1, 65535); mTypeField->setSelected(0); // TmwAthena by default mServerAddressField->addActionListener(this); mPortField->addActionListener(this); place(0, 0, nameLabel); place(1, 0, mNameField, 4).setPadding(3); place(0, 1, serverAdressLabel); place(1, 1, mServerAddressField, 4).setPadding(3); place(0, 2, portLabel); place(1, 2, mPortField, 4).setPadding(3); place(0, 3, typeLabel); place(1, 3, mTypeField).setPadding(3); place(0, 4, descriptionLabel); place(1, 4, mDescriptionField, 4).setPadding(3); place(0, 5, onlineListUrlLabel); place(1, 5, mOnlineListUrlField, 4).setPadding(3); place(0, 6, packetVersionLabel); place(1, 6, mPacketVersionField, 4).setPadding(3); place(0, 7, mPersistentIp, 4).setPadding(3); place(0, 8, mConnectButton); place(4, 8, mOkButton); place(3, 8, mCancelButton); // Do this manually instead of calling reflowLayout so we can enforce a // minimum width. int width = 0; int height = 0; getLayout().reflow(width, height); if (width < 300) { width = 300; getLayout().reflow(width, height); } if (height < 120) { height = 120; getLayout().reflow(width, height); } setContentSize(width, height); setMinWidth(getWidth()); setMinHeight(getHeight()); setDefaultSize(getWidth(), getHeight(), ImagePosition::CENTER); setResizable(false); addKeyListener(this); loadWindowState(); mNameField->setText(mServer.name); mDescriptionField->setText(mServer.description); mOnlineListUrlField->setText(mServer.onlineListUrl); mServerAddressField->setText(mServer.hostname); mPacketVersionField->setValue(mServer.packetVersion); mPortField->setText(toString(mServer.port)); mPersistentIp->setSelected(mServer.persistentIp); switch (mServer.type) { case ServerType::EATHENA: #ifdef TMWA_SUPPORT mTypeField->setSelected(1); #else // TMWA_SUPPORT mTypeField->setSelected(0); #endif // TMWA_SUPPORT break; default: case ServerType::UNKNOWN: case ServerType::TMWATHENA: mTypeField->setSelected(0); break; case ServerType::EVOL2: #ifdef TMWA_SUPPORT mTypeField->setSelected(2); #else // TMWA_SUPPORT mTypeField->setSelected(1); #endif // TMWA_SUPPORT break; } setLocationRelativeTo(getParentWindow()); }
EquipmentWindow::EquipmentWindow(): Window(_("Equipment")), mSelected(-1) { setWindowName("Equipment"); setResizable(true); setCloseButton(true); setMinWidth(280); setMinHeight(300); setDefaultSize(280, 300, ImageRect::CENTER); if (mInstances == 0) { mConfigListener = new EquipmentConfigListener(); config.addListener("showItemPopups", mConfigListener); mShowItemInfo = config.getValue("showItemPopups", true); mItemPopup = new ItemPopup(); mItemPopup->setOpaque(false); mPopupMenu = new PopupMenu(INVENTORY); } mInstances++; // Control that shows the Player mBeingBox = new BeingBox(); mBeingBox->setDimension(gcn::Rectangle(50, 80, 74, 123)); mBeingBox->setBeing(player_node); mEquipment = player_node->mEquipment.get(); mInventory = player_node->getInventory(); // Control that shows equippable items mItems = new ItemContainer(mInventory, "showpopupmenu", this); mItems->setEquipSlotsFilter((1 << EQUIP_VECTOREND) - 1); mItems->addSelectionListener(this); mInvenScroll = new ScrollArea(mItems); mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); std::string longestUseString = getFont()->getWidth(_("Equip")) > getFont()->getWidth(_("Unequip")) ? _("Equip") : _("Unequip"); mEquipButton = new Button(longestUseString, "equip", this); mEquipButton->setEnabled(false); for (int i = EQUIP_LEGS_SLOT; i < EQUIP_VECTOREND; i++) { mEquipIcon[i] = new Icon(NULL, true); mEquipIcon[i]->setX(boxPosition[i][0]); mEquipIcon[i]->setY(boxPosition[i][1]); mEquipIcon[i]->setWidth(BOX_WIDTH); mEquipIcon[i]->setHeight(BOX_HEIGHT); add(mEquipIcon[i]); } add(mBeingBox); add(mInvenScroll); add(mEquipButton); loadWindowState(); }
ShopWindow::ShopWindow() : // TRANSLATORS: shop window name Window(_("Personal Shop"), Modal_false, nullptr, "shop.xml"), #ifdef EATHENA_SUPPORT VendingModeListener(), VendingSlotsListener(), BuyingStoreModeListener(), BuyingStoreSlotsListener(), #endif ActionListener(), SelectionListener(), // TRANSLATORS: shop window button mCloseButton(new Button(this, _("Close"), "close", this)), mBuyShopItems(new ShopItems), mSellShopItems(new ShopItems), mTradeItem(nullptr), mBuyShopItemList(CREATEWIDGETR(ShopListBox, this, mBuyShopItems, mBuyShopItems)), mSellShopItemList(CREATEWIDGETR(ShopListBox, this, mSellShopItems, mSellShopItems)), mCurrentShopItemList(nullptr), mScrollArea(new ScrollArea(this, mBuyShopItemList, getOptionBool("showbuybackground"), "shop_buy_background.xml")), // TRANSLATORS: shop window label mAddButton(new Button(this, _("Add"), "add", this)), // TRANSLATORS: shop window label mDeleteButton(new Button(this, _("Delete"), "delete", this)), mAnnounceButton(nullptr), mPublishButton(nullptr), mRenameButton(nullptr), mAnnounceLinks(nullptr), mTabs(nullptr), mAcceptPlayer(), mTradeNick(), mSellShopName(serverConfig.getStringValue("sellShopName")), mSelectedItem(-1), mAnnonceTime(0), mLastRequestTimeList(0), mLastRequestTimeItem(0), mRandCounter(0), mTradeMoney(0), mSellShopSize(0), mBuyShopSize(0), isBuySelected(true), mHaveVending(serverFeatures->haveVending()), mEnableBuyingStore(false), mEnableVending(false) { setWindowName("Personal Shop"); setResizable(true); setCloseButton(true); setStickyButtonLock(true); setMinWidth(300); setMinHeight(220); if (mainGraphics->mWidth > 600) setDefaultSize(500, 300, ImagePosition::CENTER); else setDefaultSize(380, 300, ImagePosition::CENTER); if (setupWindow) setupWindow->registerWindowForReset(this); const int size = config.getIntValue("fontSize") + getOption("tabHeightAdjust", 16); mTabs = new TabStrip(this, "shop", size); mTabs->addActionListener(this); mTabs->setActionEventId("tab_"); // TRANSLATORS: shop window tab name mTabs->addButton(_("Buy"), "buy", true); // TRANSLATORS: shop window tab name mTabs->addButton(_("Sell"), "sell", false); loadList(); mBuyShopItemList->setPriceCheck(false); mSellShopItemList->setPriceCheck(false); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mBuyShopItemList->addSelectionListener(this); mSellShopItemList->addSelectionListener(this); ContainerPlacer placer; placer = getPlacer(0, 0); placer(0, 0, mTabs, 8).setPadding(3); if (mHaveVending) { // TRANSLATORS: shop window button mPublishButton = new Button(this, _("Publish"), "publish", this); // TRANSLATORS: shop window button mRenameButton = new Button(this, _("Rename"), "rename", this); placer(2, 6, mPublishButton); placer(3, 6, mRenameButton); } else { // TRANSLATORS: shop window button mAnnounceButton = new Button(this, _("Announce"), "announce", this); // TRANSLATORS: shop window checkbox mAnnounceLinks = new CheckBox(this, _("Show links in announce"), false, this, "link announce"); placer(2, 6, mAnnounceButton); placer(0, 7, mAnnounceLinks, 7); } placer(0, 1, mScrollArea, 8, 5).setPadding(3); placer(0, 6, mAddButton); placer(1, 6, mDeleteButton); placer(7, 6, mCloseButton); Layout &layout = getLayout(); layout.setRowHeight(0, LayoutType::SET); center(); loadWindowState(); #ifdef EATHENA_SUPPORT updateShopName(); #endif instances.push_back(this); }