aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/source/Irrlicht/CGUIEditBox.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libraries/irrlicht-1.8/source/Irrlicht/CGUIEditBox.h364
1 files changed, 182 insertions, 182 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUIEditBox.h b/libraries/irrlicht-1.8/source/Irrlicht/CGUIEditBox.h
index b80aa0f..12c557e 100644
--- a/libraries/irrlicht-1.8/source/Irrlicht/CGUIEditBox.h
+++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUIEditBox.h
@@ -1,182 +1,182 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt 1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine". 2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h 3// For conditions of distribution and use, see copyright notice in irrlicht.h
4 4
5#ifndef __C_GUI_EDIT_BOX_H_INCLUDED__ 5#ifndef __C_GUI_EDIT_BOX_H_INCLUDED__
6#define __C_GUI_EDIT_BOX_H_INCLUDED__ 6#define __C_GUI_EDIT_BOX_H_INCLUDED__
7 7
8#include "IrrCompileConfig.h" 8#include "IrrCompileConfig.h"
9#ifdef _IRR_COMPILE_WITH_GUI_ 9#ifdef _IRR_COMPILE_WITH_GUI_
10 10
11#include "IGUIEditBox.h" 11#include "IGUIEditBox.h"
12#include "irrArray.h" 12#include "irrArray.h"
13#include "IOSOperator.h" 13#include "IOSOperator.h"
14 14
15namespace irr 15namespace irr
16{ 16{
17namespace gui 17namespace gui
18{ 18{
19 class CGUIEditBox : public IGUIEditBox 19 class CGUIEditBox : public IGUIEditBox
20 { 20 {
21 public: 21 public:
22 22
23 //! constructor 23 //! constructor
24 CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* environment, 24 CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* environment,
25 IGUIElement* parent, s32 id, const core::rect<s32>& rectangle); 25 IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);
26 26
27 //! destructor 27 //! destructor
28 virtual ~CGUIEditBox(); 28 virtual ~CGUIEditBox();
29 29
30 //! Sets another skin independent font. 30 //! Sets another skin independent font.
31 virtual void setOverrideFont(IGUIFont* font=0); 31 virtual void setOverrideFont(IGUIFont* font=0);
32 32
33 //! Gets the override font (if any) 33 //! Gets the override font (if any)
34 /** \return The override font (may be 0) */ 34 /** \return The override font (may be 0) */
35 virtual IGUIFont* getOverrideFont() const; 35 virtual IGUIFont* getOverrideFont() const;
36 36
37 //! Get the font which is used right now for drawing 37 //! Get the font which is used right now for drawing
38 /** Currently this is the override font when one is set and the 38 /** Currently this is the override font when one is set and the
39 font of the active skin otherwise */ 39 font of the active skin otherwise */
40 virtual IGUIFont* getActiveFont() const; 40 virtual IGUIFont* getActiveFont() const;
41 41
42 //! Sets another color for the text. 42 //! Sets another color for the text.
43 virtual void setOverrideColor(video::SColor color); 43 virtual void setOverrideColor(video::SColor color);
44 44
45 //! Gets the override color 45 //! Gets the override color
46 virtual video::SColor getOverrideColor() const; 46 virtual video::SColor getOverrideColor() const;
47 47
48 //! Sets if the text should use the overide color or the 48 //! Sets if the text should use the overide color or the
49 //! color in the gui skin. 49 //! color in the gui skin.
50 virtual void enableOverrideColor(bool enable); 50 virtual void enableOverrideColor(bool enable);
51 51
52 //! Checks if an override color is enabled 52 //! Checks if an override color is enabled
53 /** \return true if the override color is enabled, false otherwise */ 53 /** \return true if the override color is enabled, false otherwise */
54 virtual bool isOverrideColorEnabled(void) const; 54 virtual bool isOverrideColorEnabled(void) const;
55 55
56 //! Sets whether to draw the background 56 //! Sets whether to draw the background
57 virtual void setDrawBackground(bool draw); 57 virtual void setDrawBackground(bool draw);
58 58
59 //! Turns the border on or off 59 //! Turns the border on or off
60 virtual void setDrawBorder(bool border); 60 virtual void setDrawBorder(bool border);
61 61
62 //! Enables or disables word wrap for using the edit box as multiline text editor. 62 //! Enables or disables word wrap for using the edit box as multiline text editor.
63 virtual void setWordWrap(bool enable); 63 virtual void setWordWrap(bool enable);
64 64
65 //! Checks if word wrap is enabled 65 //! Checks if word wrap is enabled
66 //! \return true if word wrap is enabled, false otherwise 66 //! \return true if word wrap is enabled, false otherwise
67 virtual bool isWordWrapEnabled() const; 67 virtual bool isWordWrapEnabled() const;
68 68
69 //! Enables or disables newlines. 69 //! Enables or disables newlines.
70 /** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired, 70 /** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
71 instead a newline character will be inserted. */ 71 instead a newline character will be inserted. */
72 virtual void setMultiLine(bool enable); 72 virtual void setMultiLine(bool enable);
73 73
74 //! Checks if multi line editing is enabled 74 //! Checks if multi line editing is enabled
75 //! \return true if mult-line is enabled, false otherwise 75 //! \return true if mult-line is enabled, false otherwise
76 virtual bool isMultiLineEnabled() const; 76 virtual bool isMultiLineEnabled() const;
77 77
78 //! Enables or disables automatic scrolling with cursor position 78 //! Enables or disables automatic scrolling with cursor position
79 //! \param enable: If set to true, the text will move around with the cursor position 79 //! \param enable: If set to true, the text will move around with the cursor position
80 virtual void setAutoScroll(bool enable); 80 virtual void setAutoScroll(bool enable);
81 81
82 //! Checks to see if automatic scrolling is enabled 82 //! Checks to see if automatic scrolling is enabled
83 //! \return true if automatic scrolling is enabled, false if not 83 //! \return true if automatic scrolling is enabled, false if not
84 virtual bool isAutoScrollEnabled() const; 84 virtual bool isAutoScrollEnabled() const;
85 85
86 //! Gets the size area of the text in the edit box 86 //! Gets the size area of the text in the edit box
87 //! \return Returns the size in pixels of the text 87 //! \return Returns the size in pixels of the text
88 virtual core::dimension2du getTextDimension(); 88 virtual core::dimension2du getTextDimension();
89 89
90 //! Sets text justification 90 //! Sets text justification
91 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical); 91 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
92 92
93 //! called if an event happened. 93 //! called if an event happened.
94 virtual bool OnEvent(const SEvent& event); 94 virtual bool OnEvent(const SEvent& event);
95 95
96 //! draws the element and its children 96 //! draws the element and its children
97 virtual void draw(); 97 virtual void draw();
98 98
99 //! Sets the new caption of this element. 99 //! Sets the new caption of this element.
100 virtual void setText(const wchar_t* text); 100 virtual void setText(const wchar_t* text);
101 101
102 //! Sets the maximum amount of characters which may be entered in the box. 102 //! Sets the maximum amount of characters which may be entered in the box.
103 //! \param max: Maximum amount of characters. If 0, the character amount is 103 //! \param max: Maximum amount of characters. If 0, the character amount is
104 //! infinity. 104 //! infinity.
105 virtual void setMax(u32 max); 105 virtual void setMax(u32 max);
106 106
107 //! Returns maximum amount of characters, previously set by setMax(); 107 //! Returns maximum amount of characters, previously set by setMax();
108 virtual u32 getMax() const; 108 virtual u32 getMax() const;
109 109
110 //! Sets whether the edit box is a password box. Setting this to true will 110 //! Sets whether the edit box is a password box. Setting this to true will
111 /** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x 111 /** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
112 \param passwordBox: true to enable password, false to disable 112 \param passwordBox: true to enable password, false to disable
113 \param passwordChar: the character that is displayed instead of letters */ 113 \param passwordChar: the character that is displayed instead of letters */
114 virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*'); 114 virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*');
115 115
116 //! Returns true if the edit box is currently a password box. 116 //! Returns true if the edit box is currently a password box.
117 virtual bool isPasswordBox() const; 117 virtual bool isPasswordBox() const;
118 118
119 //! Updates the absolute position, splits text if required 119 //! Updates the absolute position, splits text if required
120 virtual void updateAbsolutePosition(); 120 virtual void updateAbsolutePosition();
121 121
122 //! Writes attributes of the element. 122 //! Writes attributes of the element.
123 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; 123 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
124 124
125 //! Reads attributes of the element 125 //! Reads attributes of the element
126 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); 126 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
127 127
128 protected: 128 protected:
129 //! Breaks the single text line. 129 //! Breaks the single text line.
130 void breakText(); 130 void breakText();
131 //! sets the area of the given line 131 //! sets the area of the given line
132 void setTextRect(s32 line); 132 void setTextRect(s32 line);
133 //! returns the line number that the cursor is on 133 //! returns the line number that the cursor is on
134 s32 getLineFromPos(s32 pos); 134 s32 getLineFromPos(s32 pos);
135 //! adds a letter to the edit box 135 //! adds a letter to the edit box
136 void inputChar(wchar_t c); 136 void inputChar(wchar_t c);
137 //! calculates the current scroll position 137 //! calculates the current scroll position
138 void calculateScrollPos(); 138 void calculateScrollPos();
139 //! calculated the FrameRect 139 //! calculated the FrameRect
140 void calculateFrameRect(); 140 void calculateFrameRect();
141 //! send some gui event to parent 141 //! send some gui event to parent
142 void sendGuiEvent(EGUI_EVENT_TYPE type); 142 void sendGuiEvent(EGUI_EVENT_TYPE type);
143 //! set text markers 143 //! set text markers
144 void setTextMarkers(s32 begin, s32 end); 144 void setTextMarkers(s32 begin, s32 end);
145 145
146 bool processKey(const SEvent& event); 146 bool processKey(const SEvent& event);
147 bool processMouse(const SEvent& event); 147 bool processMouse(const SEvent& event);
148 s32 getCursorPos(s32 x, s32 y); 148 s32 getCursorPos(s32 x, s32 y);
149 149
150 bool MouseMarking; 150 bool MouseMarking;
151 bool Border; 151 bool Border;
152 bool Background; 152 bool Background;
153 bool OverrideColorEnabled; 153 bool OverrideColorEnabled;
154 s32 MarkBegin; 154 s32 MarkBegin;
155 s32 MarkEnd; 155 s32 MarkEnd;
156 156
157 video::SColor OverrideColor; 157 video::SColor OverrideColor;
158 gui::IGUIFont *OverrideFont, *LastBreakFont; 158 gui::IGUIFont *OverrideFont, *LastBreakFont;
159 IOSOperator* Operator; 159 IOSOperator* Operator;
160 160
161 u32 BlinkStartTime; 161 u32 BlinkStartTime;
162 s32 CursorPos; 162 s32 CursorPos;
163 s32 HScrollPos, VScrollPos; // scroll position in characters 163 s32 HScrollPos, VScrollPos; // scroll position in characters
164 u32 Max; 164 u32 Max;
165 165
166 bool WordWrap, MultiLine, AutoScroll, PasswordBox; 166 bool WordWrap, MultiLine, AutoScroll, PasswordBox;
167 wchar_t PasswordChar; 167 wchar_t PasswordChar;
168 EGUI_ALIGNMENT HAlign, VAlign; 168 EGUI_ALIGNMENT HAlign, VAlign;
169 169
170 core::array< core::stringw > BrokenText; 170 core::array< core::stringw > BrokenText;
171 core::array< s32 > BrokenTextPositions; 171 core::array< s32 > BrokenTextPositions;
172 172
173 core::rect<s32> CurrentTextRect, FrameRect; // temporary values 173 core::rect<s32> CurrentTextRect, FrameRect; // temporary values
174 }; 174 };
175 175
176 176
177} // end namespace gui 177} // end namespace gui
178} // end namespace irr 178} // end namespace irr
179 179
180#endif // _IRR_COMPILE_WITH_GUI_ 180#endif // _IRR_COMPILE_WITH_GUI_
181#endif // __C_GUI_EDIT_BOX_H_INCLUDED__ 181#endif // __C_GUI_EDIT_BOX_H_INCLUDED__
182 182