std::vector<std::string> v_pos = split(parts[0],',');
std::vector<std::string> v_geom = split(parts[1],',');
std::string name = parts[2];
- std::vector<std::string> items = split(parts[3],',');
+ std::vector<std::string> items = split(parts[3],',',true);
std::string str_initial_selection = "";
std::string str_transparent = "false";
}
void GUIFormSpecMenu::parseField(parserData* data,std::string element,std::string type) {
- std::vector<std::string> parts = split(element,';');
+ std::vector<std::string> parts = split(element,';',true);
if (parts.size() == 3) {
parseSimpleField(data,parts);
void GUIFormSpecMenu::parseImageButton(parserData* data,std::string element,std::string type) {
std::vector<std::string> parts = split(element,';');
- if ((parts.size() == 5) || (parts.size() == 7)) {
+ if ((parts.size() == 5) || (parts.size() == 7) || (parts.size() == 8)) {
std::vector<std::string> v_pos = split(parts[0],',');
std::vector<std::string> v_geom = split(parts[1],',');
std::string image_name = parts[2];
bool noclip = false;
bool drawborder = true;
- if ((parts.size() == 7)) {
+ if ((parts.size() >= 7)) {
if (parts[5] == "true")
noclip = true;
if (parts[6] == "false")
drawborder = false;
}
+
+ std::string pressed_image_name = "";
+
+ if ((parts.size() == 8)) {
+ pressed_image_name = parts[7];
+ }
core::rect<s32> rect = core::rect<s32>(pos.X, pos.Y, pos.X+geom.X, pos.Y+geom.Y);
label = unescape_string(label);
+ wchar_t* wlabel = 0;
+
+ if (m_use_gettext)
+ wlabel = wgettext(label.c_str());
+ else
+ wlabel = (wchar_t*) narrow_to_wide(label.c_str()).c_str();
+
FieldSpec spec = FieldSpec(
narrow_to_wide(name.c_str()),
- narrow_to_wide(label.c_str()),
+ wlabel,
narrow_to_wide(image_name.c_str()),
258+m_fields.size()
);
spec.is_exit = true;
video::ITexture *texture = 0;
+ video::ITexture *pressed_texture = 0;
//if there's no gamedef specified try to get direct
//TODO check for possible texture leak
- if (m_gamedef != 0)
+ if (m_gamedef != 0) {
texture = m_gamedef->tsrc()->getTexture(image_name);
- else {
+ if ((parts.size() == 8)) {
+ pressed_texture = m_gamedef->tsrc()->getTexture(pressed_image_name);
+ }
+ } else {
if (fs::PathExists(image_name)) {
texture = Environment->getVideoDriver()->getTexture(image_name.c_str());
m_Textures.push_back(texture);
}
+ if (fs::PathExists(pressed_image_name)) {
+ pressed_texture = Environment->getVideoDriver()->getTexture(pressed_image_name.c_str());
+ m_Textures.push_back(pressed_texture);
+ }
}
+ if (parts.size() < 8)
+ pressed_texture = texture;
gui::IGUIButton *e = Environment->addButton(rect, this, spec.fid, spec.flabel.c_str());
e->setUseAlphaChannel(true);
e->setImage(texture);
- e->setPressedImage(texture);
+ e->setPressedImage(pressed_texture);
e->setScaleImage(true);
e->setNotClipped(noclip);
e->setDrawBorder(drawborder);
m_fields.push_back(spec);
+ if (m_use_gettext)
+ delete[] wlabel;
return;
}
}
void GUIFormSpecMenu::parseElement(parserData* data,std::string element) {
+
//some prechecks
if (element == "")
return;