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); }
MagicDialog::MagicDialog(): Window(_("Magic")) { setWindowName("Magic"); setCloseButton(true); setSaveVisible(true); setDefaultSize(255, 30, 175, 225); gcn::Button *spellButton1 = new Button(_("Cast Test Spell 1"), "spell_1", this); gcn::Button *spellButton2 = new Button(_("Cast Test Spell 2"), "spell_2", this); gcn::Button *spellButton3 = new Button(_("Cast Test Spell 3"), "spell_3", this); spellButton1->setPosition(10, 30); spellButton2->setPosition(10, 60); spellButton3->setPosition(10, 90); add(spellButton1); add(spellButton2); add(spellButton3); update(); setLocationRelativeTo(getParent()); loadWindowState(); }
void FTitleBar::initUI() { setTitleBarHeight(Title_Height); setLogoButton(":/skin/images/QFramer.png", "Logo"); setTitleLabel(tr("QFramer"), "TitleLabel"); setSettingButton(":/skin/icons/dark/appbar.control.down.png"); setSkinButton(":/skin/icons/dark/appbar.clothes.shirt.png"); setMinButton(":/skin/icons/dark/appbar.minus.png"); setMaxButton(":/skin/icons/dark/appbar.app.png"); setCloseButton(":/skin/icons/dark/appbar.close.png", "close"); QHBoxLayout* mainlayout = new QHBoxLayout; mainlayout->addWidget(logoButton); mainlayout->addWidget(titleLabel); mainlayout->addStretch(); mainlayout->addWidget(settingButton); mainlayout->addWidget(skinButton); mainlayout->addWidget(minButton); mainlayout->addWidget(maxButton); mainlayout->addWidget(closeButton); mainlayout->setContentsMargins(0, 0, 5, 0); mainlayout->setSpacing(0); setLayout(mainlayout); settingMenu = new FSettingMenu; setSettingMenu(settingMenu); }
SkillDialog::SkillDialog() : // TRANSLATORS: skills dialog name Window(_("Skills"), Modal_false, nullptr, "skills.xml"), ActionListener(), mSkills(), mDurations(), mTabs(CREATEWIDGETR(TabbedArea, this)), mDeleteTabs(), mPointsLabel(new Label(this, "0")), // TRANSLATORS: skills dialog button mUseButton(new Button(this, _("Use"), "use", this)), // TRANSLATORS: skills dialog button mIncreaseButton(new Button(this, _("Up"), "inc", this)), mDefaultModel(nullptr) { setWindowName("Skills"); setCloseButton(true); setResizable(true); setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); if (setupWindow) setupWindow->registerWindowForReset(this); mUseButton->setEnabled(false); mIncreaseButton->setEnabled(false); place(0, 0, mTabs, 5, 5); place(0, 5, mPointsLabel, 4); place(3, 5, mUseButton); place(4, 5, mIncreaseButton); }
DebugWindow::DebugWindow(): Window(_("Debug"), false, nullptr, "debug.xml") { setWindowName("Debug"); if (setupWindow) setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(400, 300, ImageRect::CENTER); mTabs = new TabbedArea; mMapWidget = new MapDebugTab; mTargetWidget = new TargetDebugTab; mNetWidget = new NetDebugTab; mTabs->addTab(std::string(_("Map")), mMapWidget); mTabs->addTab(std::string(_("Target")), mTargetWidget); mTabs->addTab(std::string(_("Net")), mNetWidget); mTabs->setDimension(gcn::Rectangle(0, 0, 600, 300)); add(mTabs); mMapWidget->resize(getWidth(), getHeight()); mTargetWidget->resize(getWidth(), getHeight()); mNetWidget->resize(getWidth(), getHeight()); 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(); }
EquipmentWindow::EquipmentWindow(Equipment *equipment): Window(_("Equipment")), mEquipBox(0), mSelected(-1), mEquipment(equipment), mBoxesNumber(0) { mItemPopup = new ItemPopup; setupWindow->registerWindowForReset(this); // Control that shows the Player PlayerBox *playerBox = new PlayerBox; playerBox->setDimension(gcn::Rectangle(50, 80, 74, 123)); playerBox->setPlayer(local_player); setWindowName("Equipment"); setCloseButton(true); setSaveVisible(true); setDefaultSize(180, 300, ImageRect::CENTER); loadWindowState(); mUnequip = new Button(_("Unequip"), "unequip", this); const gcn::Rectangle &area = getChildrenArea(); mUnequip->setPosition(area.width - mUnequip->getWidth() - 5, area.height - mUnequip->getHeight() - 5); mUnequip->setEnabled(false); add(playerBox); add(mUnequip); }
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(); }
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(); }
CharSelectDialog::CharSelectDialog(LoginData *loginData): Window(_("Account and Character Management")), mLocked(false), mUnregisterButton(0), mChangeEmailButton(0), mCharacterEntries(0), mLoginData(loginData), mCharHandler(Net::getCharHandler()) { setCloseButton(false); mAccountNameLabel = new Label(loginData->username); mSwitchLoginButton = new Button(_("Switch Login"), "switch", this); mChangePasswordButton = new Button(_("Change Password"), "change_password", this); int optionalActions = Net::getLoginHandler()->supportedOptionalActions(); ContainerPlacer place; place = getPlacer(0, 0); place(0, 0, mAccountNameLabel, 2); place(0, 1, mSwitchLoginButton); if (optionalActions & Net::LoginHandler::Unregister) { mUnregisterButton = new Button(_("Unregister"), "unregister", this); place(3, 1, mUnregisterButton); } place(0, 2, mChangePasswordButton); if (optionalActions & Net::LoginHandler::ChangeEmail) { mChangeEmailButton = new Button(_("Change Email"), "change_email", this); place(3, 2, mChangeEmailButton); } place = getPlacer(0, 1); for (int i = 0; i < (int)mLoginData->characterSlots; i++) { mCharacterEntries.push_back(new CharacterDisplay(this)); place(i % SLOTS_PER_ROW, (int)i / SLOTS_PER_ROW, mCharacterEntries[i]); } reflowLayout(); addKeyListener(this); center(); setVisible(true); Net::getCharHandler()->setCharSelectDialog(this); mCharacterEntries[0]->requestFocus(); }
WhoIsOnline::WhoIsOnline() : // TRANSLATORS: who is online window name Window(_("Who Is Online - Updating"), false, nullptr, "whoisonline.xml"), mThread(nullptr), mDownloadStatus(UPDATE_LIST), mDownloadComplete(true), mDownloadedBytes(0), mMemoryBuffer(nullptr), mCurlError(new char[CURL_ERROR_SIZE]), mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, false)), mUpdateTimer(0), mOnlinePlayers(), mOnlineNicks(), // TRANSLATORS: who is online. button. mUpdateButton(new Button(this, _("Update"), "update", this)), mAllowUpdate(true), mShowLevel(false), mUpdateOnlineList(config.getBoolValue("updateOnlineList")), mGroupFriends(true) { mCurlError[0] = 0; setWindowName("WhoIsOnline"); const int h = 350; const int w = 200; setDefaultSize(w, h, ImageRect::CENTER); setVisible(false); setCloseButton(true); setResizable(true); setStickyButtonLock(true); setSaveVisible(true); mUpdateButton->setEnabled(false); mUpdateButton->setDimension(gcn::Rectangle(5, 5, w - 10, 20 + 5)); mBrowserBox->setOpaque(false); mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); mScrollArea->setDimension(gcn::Rectangle(5, 20 + 10, w - 10, h - 10 - 30)); mScrollArea->setSize(w - 10, h - 10 - 30); mBrowserBox->setLinkHandler(this); add(mUpdateButton); add(mScrollArea); setLocationRelativeTo(getParent()); loadWindowState(); enableVisibleSound(true); download(); widgetResized(gcn::Event(nullptr)); config.addListener("updateOnlineList", this); config.addListener("groupFriends", this); mGroupFriends = config.getBoolValue("groupFriends"); }
void UIStorageScene::setUI() { setNormalBG(); _boxList = StorageBoxManager::create(); addChild(_boxList); setTopTitle("보관함"); setCloseButton(); setTrashCan(ratioPosition(7, 96)); }
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); }
Setup::Setup(): Window(_("Setup")) { setCloseButton(true); int width = 395; int height = 360; setContentSize(width, height); static const char *buttonNames[] = { N_("Apply"), N_("Cancel"), N_("Reset Windows"), 0 }; int x = width; for (const char **curBtn = buttonNames; *curBtn; ++curBtn) { Button *btn = new Button(gettext(*curBtn), *curBtn, this); x -= btn->getWidth() + 5; btn->setPosition(x, height - btn->getHeight() - 5); add(btn); // Store this button, as it needs to be enabled/disabled if (!strcmp(*curBtn, "Reset Windows")) mResetWindows = btn; } TabbedArea *panel = new TabbedArea; panel->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_Interface); mTabs.push_back(new Setup_Joystick); mTabs.push_back(new Setup_Keyboard); mTabs.push_back(new Setup_Colors); mTabs.push_back(new Setup_Players); for (std::list<SetupTab*>::iterator i = mTabs.begin(), i_end = mTabs.end(); i != i_end; ++i) { SetupTab *tab = *i; panel->addTab(tab->getName(), tab); } add(panel); Label *version = new Label(FULL_VERSION); version->setPosition(9, height - version->getHeight() - 9); add(version); center(); setInGame(false); }
EquipmentWindow::EquipmentWindow(Equipment *equipment, Being *being, bool foring): Window(_("Equipment"), false, nullptr, "equipment.xml"), mEquipment(equipment), mSelected(-1), mForing(foring), mImageSet(nullptr) { mBeing = being; mItemPopup = new ItemPopup; if (setupWindow) setupWindow->registerWindowForReset(this); // Control that shows the Player mPlayerBox = new PlayerBox; mPlayerBox->setDimension(gcn::Rectangle(50, 80, 74, 168)); mPlayerBox->setPlayer(being); if (foring) setWindowName("Being equipment"); else setWindowName("Equipment"); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(180, 345, ImageRect::CENTER); mBoxes.reserve(BOX_COUNT); for (int f = 0; f < BOX_COUNT; f ++) mBoxes.push_back(nullptr); fillBoxes(); loadWindowState(); mUnequip = new Button(_("Unequip"), "unequip", this); const gcn::Rectangle &area = getChildrenArea(); mUnequip->setPosition(area.width - mUnequip->getWidth() - 5, area.height - mUnequip->getHeight() - 5); mUnequip->setEnabled(false); add(mPlayerBox); add(mUnequip); mHighlightColor = Theme::getThemeColor(Theme::HIGHLIGHT); mBorderColor = Theme::getThemeColor(Theme::BORDER); setForegroundColor(Theme::getThemeColor(Theme::TEXT)); }
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)); }
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(); }
SpecialsWindow::SpecialsWindow(): Window(_("Specials")) { setWindowName("Specials"); setCloseButton(true); setResizable(true); setSaveVisible(true); setDefaultSize(windowContainer->getWidth() - 280, 30, 275, 425); setupWindow->registerWindowForReset(this); mTabs = new TabbedArea(); place(0, 0, mTabs, 5, 5); setLocationRelativeTo(getParent()); loadWindowState(); }
SetupWindow::SetupWindow() : // TRANSLATORS: setup window name Window(_("Setup"), false, nullptr, "setup.xml"), ActionListener(), mTabs(), mWindowsToReset(), mButtons(), mModsTab(nullptr), mResetWindows(nullptr), mPanel(new TabbedArea(this)), mVersion(new Label(this, FULL_VERSION)) { mPanel->postInit(); setCloseButton(true); setResizable(true); setStickyButtonLock(true); }
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(); }
SetupWindow::SetupWindow() : // TRANSLATORS: setup window name Window(_("Setup"), Modal_false, nullptr, "setup.xml"), ActionListener(), mTabs(), mWindowsToReset(), mButtons(), mModsTab(nullptr), mQuickTab(nullptr), mResetWindows(nullptr), mPanel(CREATEWIDGETR(TabbedArea, this)), mVersion(new Label(this, FULL_VERSION)), mButtonPadding(5) { setCloseButton(true); setResizable(true); setStickyButtonLock(true); }
DebugWindow::DebugWindow(): Window(_("Debug")) { setWindowName("Debug"); setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); setDefaultSize(400, 100, ImageRect::CENTER); #ifdef USE_OPENGL if (Image::getLoadAsOpenGL()) { mFPSText = _("%d FPS (OpenGL)"); } else #endif { mFPSText = _("%d FPS"); } mFPSLabel = new Label(strprintf(_("%d FPS"), 0)); mMusicFileLabel = new Label(strprintf(_("Music: %s"), "")); mMapLabel = new Label(strprintf(_("Map: %s"), "")); mMinimapLabel = new Label(strprintf(_("Minimap: %s"), "")); mTileMouseLabel = new Label(strprintf(_("Cursor: (%d, %d)"), 0, 0)); mParticleCountLabel = new Label(strprintf(_("Particle count: %d"), 88888)); mParticleDetailLabel = new Label(); mAmbientDetailLabel = new Label(); place(0, 0, mFPSLabel, 3); place(3, 0, mTileMouseLabel); place(0, 1, mMusicFileLabel, 3); place(3, 1, mParticleCountLabel); place(0, 2, mMapLabel, 4); place(3, 2, mParticleDetailLabel); place(0, 3, mMinimapLabel, 4); place(3, 3, mAmbientDetailLabel); loadWindowState(); }
void BuySellDialog::init() { setWindowName("BuySell"); setCloseButton(true); static const char *buttonNames[] = { // TRANSLATORS: shop window button N_("Buy"), // TRANSLATORS: shop window button N_("Sell"), // TRANSLATORS: shop window button N_("Cancel"), nullptr }; const int buttonPadding = getOption("buttonpadding", 10); int x = buttonPadding; const int y = buttonPadding; for (const char *const *curBtn = buttonNames; *curBtn; curBtn++) { Button *const btn = new Button(this, gettext(*curBtn), *curBtn, this); if (!mBuyButton) mBuyButton = btn; // For focus request btn->setPosition(x, y); add(btn); x += btn->getWidth() + buttonPadding; } if (mBuyButton) { mBuyButton->requestFocus(); setContentSize(x, 2 * y + mBuyButton->getHeight()); } center(); setDefaultSize(); loadWindowState(); enableVisibleSound(true); dialogInstances.push_back(this); setVisible(true); }
void WhoIsOnline::postInit() { Window::postInit(); const int h = 350; const int w = 200; setDefaultSize(w, h, ImagePosition::CENTER); setVisible(Visible_false); setCloseButton(true); setResizable(true); setStickyButtonLock(true); setSaveVisible(true); if (setupWindow) setupWindow->registerWindowForReset(this); mUpdateButton->setEnabled(false); mUpdateButton->setDimension(Rect(5, 5, w - 10, 20 + 5)); mBrowserBox->setOpaque(Opaque_false); mScrollArea->setDimension(Rect(5, 20 + 10, w - 10, h - 10 - 30)); mScrollArea->setSize(w - 10, h - 10 - 30); mScrollArea->setSelectable(false); mBrowserBox->setLinkHandler(this); add(mUpdateButton); add(mScrollArea); setLocationRelativeTo(getParent()); loadWindowState(); enableVisibleSound(true); download(); widgetResized(Event(nullptr)); config.addListener("updateOnlineList", this); config.addListener("groupFriends", this); mGroupFriends = config.getBoolValue("groupFriends"); }
DebugWindow::DebugWindow() : // TRANSLATORS: debug window name Window(_("Debug"), Modal_false, nullptr, "debug.xml"), mTabs(CREATEWIDGETR(TabbedArea, this)), mMapWidget(new MapDebugTab(this)), mTargetWidget(new TargetDebugTab(this)), mNetWidget(new NetDebugTab(this)) { setWindowName("Debug"); if (setupWindow) setupWindow->registerWindowForReset(this); setResizable(true); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); setDefaultSize(400, 300, ImagePosition::CENTER); mTabs->setSelectable(false); mTabs->getWidgetContainer()->setSelectable(false); mTabs->getTabContainer()->setSelectable(false); // TRANSLATORS: debug window tab mTabs->addTab(std::string(_("Map")), mMapWidget); // TRANSLATORS: debug window tab mTabs->addTab(std::string(_("Target")), mTargetWidget); // TRANSLATORS: debug window tab mTabs->addTab(std::string(_("Net")), mNetWidget); mTabs->setDimension(Rect(0, 0, 600, 300)); const int w = mDimension.width; const int h = mDimension.height; mMapWidget->resize(w, h); mTargetWidget->resize(w, h); mNetWidget->resize(w, h); loadWindowState(); enableVisibleSound(true); }
OutfitWindow::OutfitWindow(): Window(_("Outfits")), mBoxWidth(33), mBoxHeight(33), mGridWidth(3), mGridHeight(3), mItemClicked(false), mItemMoved(NULL), mItemSelected(-1), mCurrentOutfit(0) { setWindowName("Outfits"); setResizable(true); setCloseButton(true); setDefaultSize(250, 250, 118, 180); mPreviousButton = new Button(_("<"), "previous", this); mNextButton = new Button(_(">"), "next", this); mCurrentLabel = new Label(strprintf(_("Outfit: %d"), 1)); mCurrentLabel->setAlignment(gcn::Graphics::CENTER); mUnequipCheck = new CheckBox(_("Unequip first"), config.getValue("OutfitUnequip0", true)); mUnequipCheck->setActionEventId("unequip"); mUnequipCheck->addActionListener(this); place(0, 3, mPreviousButton, 1); place(1, 3, mCurrentLabel, 2); place(3, 3, mNextButton, 1); place(0, 4, mUnequipCheck, 4); Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); layout.setColWidth(4, Layout::CENTER); loadWindowState(); load(); }
BankWindow::BankWindow() : // TRANSLATORS: bank window name Window(_("Bank"), Modal_false, nullptr, "bank.xml"), ActionListener(), BankListener(), mBankMoneyLabel(new Label(this, strprintf( // TRANSLATORS: bank window money label _("Money in bank: %s"), " "))), mInputMoneyTextField(new IntTextField(this, 0, 0, 2147483647)), // TRANSLATORS: bank window button mWithdrawButton(new Button(this, _("Withdraw"), "withdraw", this)), // TRANSLATORS: bank window button mDepositButton(new Button(this, _("Deposit"), "deposit", this)) { setWindowName("Bank"); setCloseButton(true); if (setupWindow) setupWindow->registerWindowForReset(this); mBankMoneyLabel->adjustSize(); ContainerPlacer placer = getPlacer(0, 0); placer(0, 0, mBankMoneyLabel, 7); placer(0, 1, mInputMoneyTextField, 10); placer(0, 2, mDepositButton, 5); placer(5, 2, mWithdrawButton, 5); setContentSize(300, 100); setDefaultSize(300, 100, ImagePosition::CENTER, 0, 0); center(); setDefaultSize(); loadWindowState(); reflowLayout(300); enableVisibleSound(true); }
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)); }
EquipmentWindow::EquipmentWindow(Equipment *const equipment, Being *const being, const bool foring): // TRANSLATORS: equipment window name Window(_("Equipment"), false, nullptr, "equipment.xml"), gcn::ActionListener(), mEquipment(equipment), mItemPopup(new ItemPopup), mPlayerBox(new PlayerBox("equipment_playerbox.xml", "equipment_selectedplayerbox.xml")), // TRANSLATORS: equipment window button mUnequip(new Button(this, _("Unequip"), "unequip", this)), mSelected(-1), mForing(foring), mImageSet(nullptr), mBeing(being), mBoxes(), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), mBorderColor(getThemeColor(Theme::BORDER)), mLabelsColor(getThemeColor(Theme::LABEL)), mLabelsColor2(getThemeColor(Theme::LABEL_OUTLINE)), mSlotBackground(), mSlotHighlightedBackground(), mVertexes(new ImageCollection), mItemPadding(getOption("itemPadding")), mBoxSize(getOption("boxSize")), mButtonPadding(getOption("buttonPadding", 5)), mMinX(180), mMinY(345), mMaxX(0), mMaxY(0) { if (setupWindow) setupWindow->registerWindowForReset(this); if (!mBoxSize) mBoxSize = 36; // Control that shows the Player mPlayerBox->setDimension(gcn::Rectangle(50, 80, 74, 168)); mPlayerBox->setPlayer(being); if (foring) setWindowName("Being equipment"); else setWindowName("Equipment"); setCloseButton(true); setSaveVisible(true); setStickyButtonLock(true); mBoxes.reserve(BOX_COUNT); for (int f = 0; f < BOX_COUNT; f ++) mBoxes.push_back(nullptr); fillBoxes(); recalcSize(); loadWindowState(); const gcn::Rectangle &area = getChildrenArea(); mUnequip->setPosition(area.width - mUnequip->getWidth() - mButtonPadding, area.height - mUnequip->getHeight() - mButtonPadding); mUnequip->setEnabled(false); ImageRect rect; Theme::instance()->loadRect(rect, "equipment_background.xml", "", 0, 1); mSlotBackground = rect.grid[0]; mSlotHighlightedBackground = rect.grid[1]; add(mPlayerBox); add(mUnequip); enableVisibleSound(true); }