diff src/querystring_gui.h @ 20714:fdf6e212a787 draft

-Add: [OSX] Display the IME composition string ourself.
author Michael Lutz <michi@icosahedron.de>
date Fri, 26 Jul 2013 01:41:39 +0200 (2013-07-25)
parents 79930f9362c3
children db681959a377
line wrap: on
line diff
--- a/src/querystring_gui.h
+++ b/src/querystring_gui.h
@@ -55,6 +55,37 @@
 	void HandleEditBox(Window *w, int wid);
 
 	Point GetCaretPosition(const Window *w, int wid) const;
+
+	/**
+	 * Get the current text.
+	 * @return Current text.
+	 */
+	const char *GetText() const
+	{
+		return this->text.buf;
+	}
+
+	/**
+	 * Get the position of the caret in the text buffer.
+	 * @return Pointer to the caret in the text buffer.
+	 */
+	const char *GetCaret() const
+	{
+		return this->text.buf + this->text.caretpos;
+	}
+
+	/**
+	 * Get the currently marked text.
+	 * @param[out] length Length of the marked text.
+	 * @return Begining of the marked area or NULL if no text is marked.
+	 */
+	const char *GetMarkedText(size_t *length) const
+	{
+		if (this->text.markend == 0) return NULL;
+
+		*length = this->text.markend - this->text.markpos;
+		return this->text.buf + this->text.markpos;
+	}
 };
 
 void ShowOnScreenKeyboard(Window *parent, int button);