diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-07 22:09:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-07 22:09:11 +0300 |
commit | b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (patch) | |
tree | ee27a5a1ace7e5dbc588466dc623013e4d5cea99 /src/gui/npcdialog.cpp | |
parent | 7d3059516fc25134d0d29b497e546f2846162399 (diff) | |
download | manaplus-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.tar.gz manaplus-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.tar.bz2 manaplus-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.tar.xz manaplus-b7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2.zip |
Improve constructors in some classes.
Diffstat (limited to 'src/gui/npcdialog.cpp')
-rw-r--r-- | src/gui/npcdialog.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 36eb0528f..35c219846 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -61,9 +61,25 @@ NpcDialog::DialogList NpcDialog::instances; NpcDialog::NpcDialog(const int npcId) : Window(_("NPC"), false, nullptr, "npc.xml"), + ActionListener(), mNpcId(npcId), mLogInteraction(config.getBoolValue("logNpcInGui")), mDefaultInt(0), + mTextBox(new BrowserBox(BrowserBox::AUTO_WRAP)), + mScrollArea(new ScrollArea(mTextBox, + getOptionBool("showtextbackground"), "npc_textbackground.xml")), + mItemList(new ExtendedListBox(this)), + mListScrollArea(new ScrollArea(mItemList, + getOptionBool("showlistbackground"), "npc_listbackground.xml")), + mItemLinkHandler(new ItemLinkHandler), + mTextField(new TextField("")), + mIntField(new IntTextField), + mPlusButton(new Button(_("+"), "inc", this)), + mMinusButton(new Button(_("-"), "dec", this)), + mClearButton(new Button(_("Clear"), "clear", this)), + mButton(new Button("", "ok", this)), + mButton2(new Button(_("Close"), "close", this)), + mResetButton(new Button(_("Reset"), "reset", this)), mInputState(NPC_INPUT_NONE), mActionState(NPC_ACTION_WAIT), mLastNextTime(0), @@ -89,21 +105,16 @@ NpcDialog::NpcDialog(const int npcId) : mPlayerBox->setWidth(70); mPlayerBox->setHeight(100); - mItemLinkHandler = new ItemLinkHandler; // Setup output text box - mTextBox = new BrowserBox(BrowserBox::AUTO_WRAP); mTextBox->setOpaque(false); mTextBox->setMaxRow(config.getIntValue("ChatLogLength")); mTextBox->setLinkHandler(mItemLinkHandler); mTextBox->setFont(gui->getNpcFont()); - mScrollArea = new ScrollArea(mTextBox, - getOptionBool("showtextbackground"), "npc_textbackground.xml"); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); // Setup listbox - mItemList = new ExtendedListBox(this); mItemList->setWrappingEnabled(true); mItemList->setActionEventId("ok"); mItemList->addActionListener(this); @@ -116,29 +127,20 @@ NpcDialog::NpcDialog(const int npcId) : setContentSize(260, 175); - mListScrollArea = new ScrollArea(mItemList, - getOptionBool("showlistbackground"), "npc_listbackground.xml"); mListScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mItemList->setVisible(true); // Setup string input box - mTextField = new TextField(""); mTextField->setVisible(true); // Setup int input box - mIntField = new IntTextField; mIntField->setVisible(true); - mClearButton = new Button(_("Clear"), "clear", this); // Setup button - mButton = new Button("", "ok", this); - mButton2 = new Button(_("Close"), "close", this); //Setup more and less buttons (int input) - mPlusButton = new Button(_("+"), "inc", this); - mMinusButton = new Button(_("-"), "dec", this); const gcn::Font *const fnt = mButton->getFont(); int width = std::max(fnt->getWidth(CAPTION_WAITING), @@ -148,7 +150,6 @@ NpcDialog::NpcDialog(const int npcId) : mButton->setWidth(8 + width); - mResetButton = new Button(_("Reset"), "reset", this); // Place widgets buildLayout(); |