]> git.lizzy.rs Git - irrlicht.git/blob - include/IGUIEditBox.h
Fix COSOperator::getSystemMemory
[irrlicht.git] / include / IGUIEditBox.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __I_GUI_EDIT_BOX_H_INCLUDED__\r
6 #define __I_GUI_EDIT_BOX_H_INCLUDED__\r
7 \r
8 #include "IGUIElement.h"\r
9 #include "SColor.h"\r
10 \r
11 namespace irr\r
12 {\r
13 namespace gui\r
14 {\r
15         class IGUIFont;\r
16 \r
17         //! Single line edit box for editing simple text.\r
18         /** \par This element can create the following events of type EGUI_EVENT_TYPE:\r
19         \li EGET_EDITBOX_ENTER\r
20         \li EGET_EDITBOX_CHANGED\r
21         \li EGET_EDITBOX_MARKING_CHANGED\r
22         */\r
23         class IGUIEditBox : public IGUIElement\r
24         {\r
25         public:\r
26 \r
27                 //! constructor\r
28                 IGUIEditBox(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)\r
29                         : IGUIElement(EGUIET_EDIT_BOX, environment, parent, id, rectangle) {}\r
30 \r
31                 //! Sets another skin independent font.\r
32                 /** If this is set to zero, the button uses the font of the skin.\r
33                 \param font: New font to set. */\r
34                 virtual void setOverrideFont(IGUIFont* font=0) = 0;\r
35 \r
36                 //! Gets the override font (if any)\r
37                 /** \return The override font (may be 0) */\r
38                 virtual IGUIFont* getOverrideFont() const = 0;\r
39 \r
40                 //! Get the font which is used right now for drawing\r
41                 /** Currently this is the override font when one is set and the\r
42                 font of the active skin otherwise */\r
43                 virtual IGUIFont* getActiveFont() const = 0;\r
44 \r
45                 //! Sets another color for the text.\r
46                 /** If set, the edit box does not use the EGDC_BUTTON_TEXT color defined\r
47                 in the skin, but the set color instead. You don't need to call\r
48                 IGUIEditBox::enableOverrrideColor(true) after this, this is done\r
49                 by this function.\r
50                 If you set a color, and you want the text displayed with the color\r
51                 of the skin again, call IGUIEditBox::enableOverrideColor(false);\r
52                 \param color: New color of the text. */\r
53                 virtual void setOverrideColor(video::SColor color) = 0;\r
54 \r
55                 //! Gets the override color\r
56                 virtual video::SColor getOverrideColor() const = 0;\r
57 \r
58                 //! Sets if the text should use the override color or the color in the gui skin.\r
59                 /** \param enable: If set to true, the override color, which can be set\r
60                 with IGUIEditBox::setOverrideColor is used, otherwise the\r
61                 EGDC_BUTTON_TEXT color of the skin. */\r
62                 virtual void enableOverrideColor(bool enable) = 0;\r
63 \r
64                 //! Checks if an override color is enabled\r
65                 /** \return true if the override color is enabled, false otherwise */\r
66                 virtual bool isOverrideColorEnabled(void) const = 0;\r
67 \r
68                 //! Sets whether to draw the background\r
69                 virtual void setDrawBackground(bool draw) = 0;\r
70 \r
71                 //! Checks if background drawing is enabled\r
72                 /** \return true if background drawing is enabled, false otherwise */\r
73                 virtual bool isDrawBackgroundEnabled() const = 0;\r
74 \r
75                 //! Turns the border on or off\r
76                 /** \param border: true if you want the border to be drawn, false if not */\r
77                 virtual void setDrawBorder(bool border) = 0;\r
78 \r
79                 //! Checks if border drawing is enabled\r
80                 /** \return true if border drawing is enabled, false otherwise */\r
81                 virtual bool isDrawBorderEnabled() const = 0;\r
82 \r
83                 //! Sets text justification mode\r
84                 /** \param horizontal: EGUIA_UPPERLEFT for left justified (default),\r
85                 EGUIA_LOWERRIGHT for right justified, or EGUIA_CENTER for centered text.\r
86                 \param vertical: EGUIA_UPPERLEFT to align with top edge,\r
87                 EGUIA_LOWERRIGHT for bottom edge, or EGUIA_CENTER for centered text (default). */\r
88                 virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical) = 0;\r
89 \r
90                 //! Enables or disables word wrap.\r
91                 /** \param enable: If set to true, words going over one line are\r
92                 broken to the next line. */\r
93                 virtual void setWordWrap(bool enable) = 0;\r
94 \r
95                 //! Checks if word wrap is enabled\r
96                 /** \return true if word wrap is enabled, false otherwise */\r
97                 virtual bool isWordWrapEnabled() const = 0;\r
98 \r
99                 //! Enables or disables newlines.\r
100                 /** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,\r
101                 instead a newline character will be inserted. */\r
102                 virtual void setMultiLine(bool enable) = 0;\r
103 \r
104                 //! Checks if multi line editing is enabled\r
105                 /** \return true if multi-line is enabled, false otherwise */\r
106                 virtual bool isMultiLineEnabled() const = 0;\r
107 \r
108                 //! Enables or disables automatic scrolling with cursor position\r
109                 /** \param enable: If set to true, the text will move around with the cursor position */\r
110                 virtual void setAutoScroll(bool enable) = 0;\r
111 \r
112                 //! Checks to see if automatic scrolling is enabled\r
113                 /** \return true if automatic scrolling is enabled, false if not */\r
114                 virtual bool isAutoScrollEnabled() const = 0;\r
115 \r
116                 //! Sets whether the edit box is a password box. Setting this to true will\r
117                 /** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x\r
118                 \param passwordBox: true to enable password, false to disable\r
119                 \param passwordChar: the character that is displayed instead of letters */\r
120                 virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*') = 0;\r
121 \r
122                 //! Returns true if the edit box is currently a password box.\r
123                 virtual bool isPasswordBox() const = 0;\r
124 \r
125                 //! Gets the size area of the text in the edit box\r
126                 /** \return The size in pixels of the text */\r
127                 virtual core::dimension2du getTextDimension() = 0;\r
128 \r
129                 //! Sets the maximum amount of characters which may be entered in the box.\r
130                 /** \param max: Maximum amount of characters. If 0, the character amount is\r
131                 infinity. */\r
132                 virtual void setMax(u32 max) = 0;\r
133 \r
134                 //! Returns maximum amount of characters, previously set by setMax();\r
135                 virtual u32 getMax() const = 0;\r
136 \r
137                 //! Set the character used for the cursor.\r
138                 /** By default it's "_" */\r
139                 virtual void setCursorChar(const wchar_t cursorChar) = 0;\r
140 \r
141                 //! Get the character used for the cursor.\r
142                 virtual wchar_t getCursorChar() const = 0;\r
143 \r
144                 //! Set the blinktime for the cursor. 2x blinktime is one full cycle.\r
145                 //** \param timeMs Blinktime in milliseconds. When set to 0 the cursor is constantly on without blinking */\r
146                 virtual void setCursorBlinkTime(irr::u32 timeMs) = 0;\r
147 \r
148                 //! Get the cursor blinktime\r
149                 virtual irr::u32 getCursorBlinkTime() const = 0;\r
150         };\r
151 \r
152 \r
153 } // end namespace gui\r
154 } // end namespace irr\r
155 \r
156 #endif\r
157 \r