summaryrefslogtreecommitdiff
path: root/src/gui/intlGUIEditBox.h
blob: 007fe1c936ab6ca796d00f730f2ab3d493695987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (C) 2002-2013 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

#pragma once

#include "IrrCompileConfig.h"
//#ifdef _IRR_COMPILE_WITH_GUI_

#include "guiEditBox.h"
#include "irrArray.h"
#include "IOSOperator.h"

namespace irr
{
namespace gui
{
	class intlGUIEditBox : public GUIEditBox
	{
	public:

		//! constructor
		intlGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* environment,
			IGUIElement* parent, s32 id, const core::rect<s32>& rectangle,
			bool writable = true, bool has_vscrollbar = false);

		//! destructor
		virtual ~intlGUIEditBox() {}

		//! Sets whether to draw the background
		virtual void setDrawBackground(bool draw);

		virtual bool isDrawBackgroundEnabled() const { return true; }

		//! draws the element and its children
		virtual void draw();

		//! Updates the absolute position, splits text if required
		virtual void updateAbsolutePosition();

		virtual void setCursorChar(const wchar_t cursorChar) {}

		virtual wchar_t getCursorChar() const { return L'|'; }

		virtual void setCursorBlinkTime(u32 timeMs) {}

		virtual u32 getCursorBlinkTime() const { return 500; }

	protected:
		//! Breaks the single text line.
		virtual void breakText();
		//! sets the area of the given line
		virtual void setTextRect(s32 line);

		//! calculates the current scroll position
		void calculateScrollPos();

		s32 getCursorPos(s32 x, s32 y);

		//! Create a vertical scrollbar
		void createVScrollBar();
	};


} // end namespace gui
} // end namespace irr

//#endif // _IRR_COMPILE_WITH_GUI_