Mercurial > fife-parpg
diff engine/core/gui/widgets/utf8textbox.h @ 697:ecaa4d98f05f tip
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
* Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring.
* GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass.
* The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class.
* The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged.
* Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author | M. George Hansen <technopolitica@gmail.com> |
---|---|
date | Sat, 18 Jun 2011 00:28:40 -1000 |
parents | e201abd8c807 |
children |
line wrap: on
line diff
--- a/engine/core/gui/widgets/utf8textbox.h Fri Jun 10 23:37:46 2011 -1000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by the FIFE team * - * http://www.fifengine.de * - * This file is part of FIFE. * - * * - * FIFE is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Lesser General Public * - * License as published by the Free Software Foundation; either * - * version 2.1 of the License, or (at your option) any later version. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this library; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef RAVERON_UTF8TEXTBOX_HPP -#define RAVERON_UTF8TEXTBOX_HPP - -// Standard C++ library includes - -// 3rd party library includes -#include <guichan/widgets/textbox.hpp> - -// FIFE includes -// These includes are split up in two parts, separated by one empty line -// First block: files included from the FIFE root src directory -// Second block: files included from the same folder -#include "util/utf8/utf8stringeditor.h" - -namespace gcn { - - /** - * UTF-8 aware version of the TextBox class. - * - * Using UTF8StringEditor, it is able to correctly edit UTF-8 multiline texts. - * - * You will also need an UTF-8 aware font to be able to correctly - * display such text (so gcn::ImageFont can not be used). - * - * TextBox::setCaretColumn(), TextBox::setCaretRow(), - * TextBox::setCaretRowColumn(), TextBox::getCaretColumn() - * and TextBox::getCaretRow() addresses byte offsets of the text. - * Use character versions of those methods with UTF8 suffix, they - * will correctly access real character positions in UTF-8 texts. - * - * @author Przemyslaw Grzywacz - */ - class UTF8TextBox: public TextBox { - public: - /** - * Constructor. - * @param text Initial text. - */ - UTF8TextBox(const std::string& text = ""); - - /** - * Destructor. - */ - virtual ~UTF8TextBox(); - - /** - * Key pressed handler. - * - * Overides gcn::TextField to handle UTF-8 character codes. - * - * @param keyEvent Keyboard event. - */ - virtual void keyPressed(KeyEvent& keyEvent); - - /** - * Sets caret column (UTF-8 aware). - * @param column Caret column. - */ - void setCaretColumnUTF8(int column); - - /** - * Sets caret row (UTF-8 aware). - * @param row Caret row - */ - void setCaretRowUTF8(int row); - - /** - * Sets caret row and column (UTF-8 aware). - * @param row Caret row. - * @param column Caret column. - */ - void setCaretRowColumnUTF8(int row, int column); - - /** - * Gets caret column (UTF-8 aware). - * @return Caret column. - */ - int getCaretColumnUTF8(); - - /** - * Gets caret column (UTF-8 aware). - * @return Caret row. - */ - int getCaretRowUTF8(); - - protected: - - /** - * UTF-8 string editor suppor. - * - * It allows the UTF8TextBox to easly traverse UTF-8 strings - * as well as inserting and deleting characters. - */ - UTF8StringEditor* mStringEditor; - }; - -}; - -#endif // !RAVERON_UTF8TEXTBOX_HPP