aboutsummaryrefslogtreecommitdiff
path: root/data/mods/default/textures/default_jungletree.png
blob: ccd20ac7403a35d9d288524afaf94e6e50939d26 (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 06 00 00 00 1f f3 ff .PNG........IHDR................
0020 61 00 00 00 04 73 42 49 54 08 08 08 08 7c 08 64 88 00 00 00 09 70 48 59 73 00 00 0e c4 00 00 0e a....sBIT....|.d.....pHYs.......
0040 eb 01 87 37 36 76 00 00 01 98 49 44 41 54 38 8d 7d 93 b1 4b c3 40 18 c5 7f 86 0e 5d 4a e9 62 02 ...76v....IDAT8.}..K.@.....]J.b.
0060 76 10 92 c9 22 42 45 28 14 94 0e 2e 2a 42 c1 a5 b8 59 f4 2f 10 8a 82 6b c1 ad a3 20 b8 95 2e 82 v..."BE(....*B...Y./...k........
0080 20 ea a0 60 71 28 14 a4 42 11 9d 12 70 b0 90 b8 94 d2 a5 9b 0e fa 5d 2f 8d fa a6 ef 72 df bd f7 ...`q(..B...p.........]/....r...
00a0 be 97 bb a9 fd f2 f2 67 32 11 07 e0 a8 76 cb 82 93 a2 5a 29 62 d9 26 37 97 1d 06 c3 11 82 bb 87 .......g2....v....Z)b.&7........
00c0 67 ba 6e 9f ce fd 01 3b 7b 27 54 2b 45 0c d9 3c aa dd 02 d0 75 fb 58 b6 49 a3 de 22 9b 49 53 c8 g.n....;{'T+E..<....u.X.I..".IS.
00e0 39 88 80 8e ad 8d 25 00 8c 42 ce 61 30 1c b1 e0 a4 00 e8 dc 1f d0 a8 b7 00 68 b6 dd c8 a1 fd f2 9.....%..B.a0............h......
0100 32 00 83 e1 88 66 db fd 76 a0 5b d3 d1 eb 7d 28 92 64 22 4e 36 93 8e b8 89 59 b6 a9 94 7d 2f 40 2....f..v.[...}(.d"N6....Y...}/@
0120 d6 bd de 87 6a ca 66 d2 bf d6 c0 38 03 80 f5 dd b3 d0 e6 eb 5b 5f d5 4f 2f ef aa f6 bd 80 d2 76 ....j.f....8........[_.O/......v
0140 7e 4c 50 ad 14 f1 bd 80 ff b0 b6 b9 18 c9 24 99 88 13 9b 54 9f 24 92 99 6f 2e 3b c0 38 d8 92 6d ~LP...........$....T.$..o.;.8..m
0160 92 cd a4 31 7c 2f e0 f0 f8 e2 4f e5 c1 70 84 f5 d3 0c df 81 03 34 ea 2d 2c db 0c 67 30 89 b9 d9 ...1|/....O..p.......4.-,..g0...
0180 94 aa 9b 6d 57 b9 11 12 00 43 9f 4b ee 82 8e 42 ce 09 b9 99 84 a1 b3 e9 87 66 66 a6 01 b0 6c 53 ...mW....C.K...B.........ff...lS
01a0 e5 22 bd 5d b7 af dc 18 f2 41 a0 ff 2e 21 d1 5d 4a af 64 12 c9 e0 fc ea 31 e2 e8 37 88 b3 08 81 .".].....A...!.]J.d.....1..7....
01c0 3c 12 41 a3 de a2 b4 9d 0f 05 77 7d ba a3 ea 08 81 04 95 4c c4 d5 9c be 17 b0 ba 32 1f 52 97 7b <.A.......w}.......L.......2.R.{
01e0 f1 05 5d 9e a4 77 11 df 61 95 00 00 00 00 49 45 4e 44 ae 42 60 82 ..]..w..a.....IEND.B`.
id='n132' href='#n132'>132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
/*
Part of Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2013 Ciaran Gultnieks <ciaran@ciarang.com>

Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "guiPasswordChange.h"
#include "debug.h"
#include "serialization.h"
#include <string>
#include <IGUICheckBox.h>
#include <IGUIEditBox.h>
#include <IGUIButton.h>
#include <IGUIStaticText.h>
#include <IGUIFont.h>

#include "gettext.h"

const int ID_oldPassword = 256;
const int ID_newPassword1 = 257;
const int ID_newPassword2 = 258;
const int ID_change = 259;
const int ID_message = 260;

GUIPasswordChange::GUIPasswordChange(gui::IGUIEnvironment* env,
		gui::IGUIElement* parent, s32 id,
		IMenuManager *menumgr,
		Client* client
):
	GUIModalMenu(env, parent, id, menumgr),
	m_client(client)
{
}

GUIPasswordChange::~GUIPasswordChange()
{
	removeChildren();
}

void GUIPasswordChange::removeChildren()
{
	{
		gui::IGUIElement *e = getElementFromId(ID_oldPassword);
		if(e != NULL)
			e->remove();
	}
	{
		gui::IGUIElement *e = getElementFromId(ID_newPassword1);
		if(e != NULL)
			e->remove();
	}
	{
		gui::IGUIElement *e = getElementFromId(ID_newPassword2);
		if(e != NULL)
			e->remove();
	}
	{
		gui::IGUIElement *e = getElementFromId(ID_change);
		if(e != NULL)
			e->remove();
	}
}

void GUIPasswordChange::regenerateGui(v2u32 screensize)
{
	/*
		Remove stuff
	*/
	removeChildren();
	
	/*
		Calculate new sizes and positions
	*/
	core::rect<s32> rect(
			screensize.X/2 - 580/2,
			screensize.Y/2 - 300/2,
			screensize.X/2 + 580/2,
			screensize.Y/2 + 300/2
	);
	
	DesiredRect = rect;
	recalculateAbsolutePosition(false);

	v2s32 size = rect.getSize();
	v2s32 topleft_client(40, 0);

	/*
		Add stuff
	*/
	s32 ypos = 50;
	changeCtype("");
	{
		core::rect<s32> rect(0, 0, 110, 20);
		rect += topleft_client + v2s32(35, ypos+6);
		wchar_t* text = wgettext("Old Password");
		Environment->addStaticText(text, rect, false, true, this, -1);
		delete[] text;
	}
	changeCtype("C");
	{
		core::rect<s32> rect(0, 0, 230, 30);
		rect += topleft_client + v2s32(160, ypos);
		gui::IGUIEditBox *e = 
		Environment->addEditBox(L"", rect, true, this, ID_oldPassword);
		Environment->setFocus(e);
		e->setPasswordBox(true);
	}
	ypos += 50;
	changeCtype("");
	{
		core::rect<s32> rect(0, 0, 110, 20);
		rect += topleft_client + v2s32(35, ypos+6);
		wchar_t* text = wgettext("New Password");
		Environment->addStaticText(text, rect, false, true, this, -1);
		delete[] text;
	}
	changeCtype("C");
	{
		core::rect<s32> rect(0, 0, 230, 30);
		rect += topleft_client + v2s32(160, ypos);
		gui::IGUIEditBox *e = 
		Environment->addEditBox(L"", rect, true, this, ID_newPassword1);
		e->setPasswordBox(true);
	}
	ypos += 50;
	changeCtype("");
	{
		core::rect<s32> rect(0, 0, 110, 20);
		rect += topleft_client + v2s32(35, ypos+6);
		wchar_t* text = wgettext("Confirm Password");
		Environment->addStaticText(text, rect, false, true, this, -1);
		delete[] text;
	}
	changeCtype("C");
	{
		core::rect<s32> rect(0, 0, 230, 30);
		rect += topleft_client + v2s32(160, ypos);
		gui::IGUIEditBox *e = 
		Environment->addEditBox(L"", rect, true, this, ID_newPassword2);
		e->setPasswordBox(true);
	}

	ypos += 50;
	changeCtype("");
	{
		core::rect<s32> rect(0, 0, 140, 30);
		rect = rect + v2s32(size.X/2-140/2, ypos);
		wchar_t* text = wgettext("Change");
		Environment->addButton(rect, this, ID_change, text);
		delete[] text;
	}

	ypos += 50;
	{
		core::rect<s32> rect(0, 0, 300, 20);
		rect += topleft_client + v2s32(35, ypos);
		wchar_t* text = wgettext("Passwords do not match!");
		IGUIElement *e = 
		Environment->addStaticText(
			text,
			rect, false, true, this, ID_message);
		e->setVisible(false);
		delete[] text;
	}
	changeCtype("C");

}

void GUIPasswordChange::drawMenu()
{
	gui::IGUISkin* skin = Environment->getSkin();
	if (!skin)
		return;
	video::IVideoDriver* driver = Environment->getVideoDriver();
	
	video::SColor bgcolor(140,0,0,0);
	driver->draw2DRectangle(bgcolor, AbsoluteRect, &AbsoluteClippingRect);

	gui::IGUIElement::draw();
}

bool GUIPasswordChange::acceptInput()
{
		std::wstring oldpass;
		std::wstring newpass;
		gui::IGUIElement *e;
		e = getElementFromId(ID_oldPassword);
		if(e != NULL)
			oldpass = e->getText();
		e = getElementFromId(ID_newPassword1);
		if(e != NULL)
			newpass = e->getText();