void GuildWindow::newGuildTab(const std::string &guildName) { // Create new tab GuildListBox *list = new GuildListBox; list->setListModel(player_node->getGuild(guildName)); ScrollArea *sa = new ScrollArea(list); sa->setDimension(gcn::Rectangle(5, 5, 135, 250)); // Add the listbox to the map mGuildLists.insert(std::pair<std::string, GuildListBox*>(guildName, list)); mGuildTabs->addTab(guildName, sa); mGuildTabs->setDimension(gcn::Rectangle(28,35,140,250)); updateTab(); }
NpcPostDialog::NpcPostDialog(int npcId): Window(_("NPC")), mNpcId(npcId) { setContentSize(400, 180); // create text field for receiver gcn::Label *senderText = new Label(_("To:")); senderText->setPosition(5, 5); mSender = new TextField; mSender->setPosition(senderText->getWidth() + 5, 5); mSender->setWidth(65); // create button for sending Button *sendButton = new Button(_("Send"), "send", this); sendButton->setPosition(400 - sendButton->getWidth(), 170 - sendButton->getHeight()); Button *cancelButton = new Button(_("Cancel"), "cancel", this); cancelButton->setPosition(sendButton->getX() - (cancelButton->getWidth() + 2), sendButton->getY()); // create textfield for letter mText = new TextBox; mText->setHeight(400 - (mSender->getHeight() + sendButton->getHeight())); mText->setEditable(true); // create scroll box for letter text ScrollArea *scrollArea = new ScrollArea(mText); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); scrollArea->setDimension(gcn::Rectangle( 5, mSender->getHeight() + 5, 380, 140 - (mSender->getHeight() + sendButton->getHeight()))); add(senderText); add(mSender); add(scrollArea); add(sendButton); add(cancelButton); center(); instances.push_back(this); setVisible(true); PlayerInfo::setNPCPostCount(PlayerInfo::getNPCPostCount() + 1); }
ServerSelectDialog::ServerSelectDialog(LoginData *loginData, State nextState): Window(_("Select Server")), mLoginData(loginData), mNextState(nextState) { mServerListModel = new ServerListModel; mServerList = new ListBox(mServerListModel); ScrollArea *mScrollArea = new ScrollArea(mServerList); mOkButton = new Button(_("OK"), "ok", this); Button *mCancelButton = new Button(_("Cancel"), "cancel", this); setContentSize(200, 100); mCancelButton->setPosition( 200 - mCancelButton->getWidth() - 5, 100 - mCancelButton->getHeight() - 5); mOkButton->setPosition( mCancelButton->getX() - mOkButton->getWidth() - 5, 100 - mOkButton->getHeight() - 5); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setDimension(gcn::Rectangle( 5, 5, 200 - 2 * 5, 100 - 3 * 5 - mCancelButton->getHeight() - mScrollArea->getFrameSize())); mServerList->setActionEventId("ok"); //mServerList->addActionListener(this); add(mScrollArea); add(mOkButton); add(mCancelButton); if (n_server == 0) // Disable Ok button mOkButton->setEnabled(false); else // Select first server mServerList->setSelected(0); center(); setVisible(true); mOkButton->requestFocus(); }