summaryrefslogtreecommitdiff
path: root/src/guiFormSpecMenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r--src/guiFormSpecMenu.cpp42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 9d97821f0..f62b6e3de 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -53,6 +53,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/string.h" // for parseColorString()
#include "irrlicht_changes/static_text.h"
#include "guiscalingfilter.h"
+#include "guiEditBoxWithScrollbar.h"
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
#include "intlGUIEditBox.h"
@@ -1072,6 +1073,7 @@ void GUIFormSpecMenu::parseTextArea(parserData* data, std::vector<std::string>&
std::string name = parts[2];
std::string label = parts[3];
std::string default_val = parts[4];
+ bool has_vscrollbar = parts.size() > 5 ? is_yes(parts[5]) : false;
MY_CHECKPOS(type,0);
MY_CHECKGEOM(type,1);
@@ -1114,29 +1116,31 @@ void GUIFormSpecMenu::parseTextArea(parserData* data, std::vector<std::string>&
258+m_fields.size()
);
- if (name.empty()) {
- // spec field id to 0, this stops submit searching for a value that isn't there
- addStaticText(Environment, spec.flabel.c_str(), rect, false, true, this, spec.fid);
- } else {
- spec.send = true;
+ bool is_editable = !name.empty();
+ if (is_editable) {
+ spec.send = true;
+ }
+
gui::IGUIEditBox *e;
#if USE_FREETYPE && IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 9
- if (g_settings->getBool("freetype")) {
- e = (gui::IGUIEditBox *) new gui::intlGUIEditBox(spec.fdefault.c_str(),
- true, Environment, this, spec.fid, rect);
- e->drop();
- } else {
+ if (g_settings->getBool("freetype")) {
+ e = (gui::IGUIEditBox *) new gui::intlGUIEditBox(spec.flabel.c_str(),
+ true, Environment, this, spec.fid, rect, is_editable, has_vscrollbar);
+ e->drop();
+ } else {
#else
- {
+ {
#endif
- e = Environment->addEditBox(spec.fdefault.c_str(), rect, true, this, spec.fid);
- }
+ e = new GUIEditBoxWithScrollBar(spec.flabel.c_str(), true,
+ Environment, this, spec.fid, rect, is_editable, has_vscrollbar);
+ }
- if (spec.fname == data->focused_fieldname) {
- Environment->setFocus(e);
- }
+ if (is_editable && spec.fname == data->focused_fieldname) {
+ Environment->setFocus(e);
+ }
+ if (e) {
if (type == "textarea")
{
e->setMultiLine(true);
@@ -1152,9 +1156,9 @@ void GUIFormSpecMenu::parseTextArea(parserData* data, std::vector<std::string>&
evt.KeyInput.PressedDown = true;
e->OnEvent(evt);
}
-
- if (label.length() >= 1)
- {
+ }
+ if (is_editable) {
+ if (label.length() >= 1) {
int font_height = g_fontengine->getTextHeight();
rect.UpperLeftCorner.Y -= font_height;
rect.LowerRightCorner.Y = rect.UpperLeftCorner.Y + font_height;