CHANGED: #1471 CGroupEditBox is now in the NELGUI library and is under the NLGUI namespace.

--HG--
branch : gui-refactoring
This commit is contained in:
dfighter1985 2012-06-23 03:27:49 +02:00
parent 3213e52b60
commit 595999580b
36 changed files with 1884 additions and 1879 deletions

View file

@ -0,0 +1,364 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RZ_CTRL_EDITBOX_H
#define RZ_CTRL_EDITBOX_H
#include "nel/gui/interface_group.h"
#include "nel/gui/group_editbox_base.h"
#include "nel/3d/u_texture.h"
namespace NLGUI
{
class CEventDescriptor;
class CViewText;
// ----------------------------------------------------------------------------
class CGroupEditBox : public CGroupEditBoxBase
{
public:
class IComboKeyHandler
{
public:
virtual ~IComboKeyHandler(){}
virtual bool isComboKeyChat( const NLGUI::CEventDescriptorKey &edk ) const = 0;
};
enum TEntryType { Text, Integer, PositiveInteger, Float, PositiveFloat, Alpha, AlphaNum, AlphaNumSpace, Password, Filename, PlayerName }; // the type of entry this edit bot can deal with
DECLARE_UI_CLASS( CGroupEditBox )
/// Constructor
CGroupEditBox(const TCtorParam &param);
/// Dtor
~CGroupEditBox();
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void draw();
virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc);
/// Accessors
ucstring getInputString() const { return _InputString; }
const ucstring &getInputStringRef() const { return _InputString; }
const ucstring &getPrompt() const { return _Prompt; }
/** Set the prompt
* NB : line returns are encoded as '\n', not '\r\n'
*/
void setPrompt(const ucstring &s) { _Prompt = s; }
void setInputString(const ucstring &str);
void setInputStringRef(const ucstring &str) {_InputString = str; };
void setInputStringAsInt(sint32 val);
sint32 getInputStringAsInt() const;
void setInputStringAsInt64(sint64 val);
sint64 getInputStringAsInt64() const;
void setInputStringAsFloat(float val);
float getInputStringAsFloat() const;
void setInputStringAsStdString(const std::string &str);
std::string getInputStringAsStdString() const;
void setInputStringAsUtf8(const std::string &str);
std::string getInputStringAsUtf8() const;
void setColor(NLMISC::CRGBA col);
/// force the selection of all the text
void setSelectionAll();
virtual void checkCoords();
virtual void updateCoords();
virtual void clearViews ();
virtual void setActive (bool state);
static CGroupEditBox *getMenuFather() { return _MenuFather; }
void setCommand(const ucstring &command, bool execute);
// Stop parent from blinking
void stopParentBlink() { if (_Parent) _Parent->disableBlink(); }
// Get / set cursor position
sint32 getCursorPos () const {return _CursorPos;}
void setCursorPos (sint32 pos) {_CursorPos=pos;}
// Get / set cursor at previous line end
bool isCursorAtPreviousLineEnd () const {return _CursorAtPreviousLineEnd;}
void setCursorAtPreviousLineEnd (bool setCursor) {_CursorAtPreviousLineEnd=setCursor;}
// Get / set current selection position
static sint32 getSelectCursorPos () {return _SelectCursorPos;}
static void setSelectCursorPos (sint32 pos) {_SelectCursorPos=pos;}
// Get the view text
const CViewText *getViewText () const {return _ViewText;}
// Get the historic information
sint32 getMaxHistoric() const {return _MaxHistoric;}
sint32 getCurrentHistoricIndex () const {return _CurrentHistoricIndex;}
void setCurrentHistoricIndex (sint32 index) {_CurrentHistoricIndex=index;}
const ucstring &getHistoric(uint32 index) const {return _Historic[index];}
uint32 getNumHistoric() const {return (uint32)_Historic.size ();}
// Get on change action handler
const std::string &getAHOnChange() const {return _AHOnChange;}
const std::string &getParamsOnChange() const {return _ParamsOnChange;}
void cutSelection();
/// From CInterfaceElement
sint32 getMaxUsedW() const;
sint32 getMinUsedW() const;
// Copy the selection into buffer
void copy();
// Paste the selection into buffer
void paste();
// Write the string into buffer
void writeString(const ucstring &str, bool replace = true, bool atEnd = true);
// Expand the expression (true if there was a '/' at the start of the line)
bool expand();
// Back space
void back();
// ignore the next char/key event -> useful when a key set the focus on an editbox (keydown is received, the focus, then keychar is received by the editbox again, but is irrelevant)
void bypassNextKey() { _BypassNextKey = true; }
// True if the editBox loose the focus on enter
bool getLooseFocusOnEnter() const {return _LooseFocusOnEnter;}
//
virtual void clearAllEditBox();
// From CInterfaceElement
virtual bool wantSerialConfig() const;
// From CInterfaceElement
virtual void serialConfig(NLMISC::IStream &f);
// From CInterfaceElement
virtual void onQuit();
// From CInterfaceElement
virtual void onLoadConfig();
// from CCtrlBase
virtual void elementCaptured(CCtrlBase *capturedElement);
// from CCtrlBase
virtual void onKeyboardCaptureLost();
// set the input string as "default". will be reseted at first click (used for user information)
void setDefaultInputString(const ucstring &str);
// For Interger and PositiveInteger, can specify min and max values
void setIntegerMinValue(sint32 minValue) {_IntegerMinValue=minValue;}
void setIntegerMaxValue(sint32 maxValue) {_IntegerMaxValue=maxValue;}
void setPositiveIntegerMinValue(uint32 minValue) {_PositiveIntegerMinValue=minValue;}
void setPositiveIntegerMaxValue(uint32 maxValue) {_PositiveIntegerMaxValue=maxValue;}
void setFocusOnText();
int luaSetSelectionAll(CLuaState &ls);
int luaSetupDisplayText(CLuaState &ls);
int luaSetFocusOnText(CLuaState &ls);
int luaCancelFocusOnText(CLuaState &ls);
REFLECT_EXPORT_START(CGroupEditBox, CGroupEditBoxBase)
REFLECT_LUA_METHOD("setupDisplayText", luaSetupDisplayText);
REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll);
REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText);
REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText);
REFLECT_STRING("input_string", getInputStringAsStdString, setInputStringAsStdString);
REFLECT_UCSTRING("uc_input_string", getInputString, setInputString);
REFLECT_EXPORT_END
/** Restore the original value of the edit box.
* This value is captured when the edit box get focus
* (return true if no undo was available)
* Will always fails ifthe edito box do not have the focus
*/
bool undo();
/** Cancel last undo operation
* Return true if redo operation is available
*/
bool redo();
/// freeze the control (loose focus, and cannot edit)
void setFrozen (bool state);
bool getFrozen () const { return _Frozen; }
protected:
// Cursor infos
float _BlinkTime;
sint32 _CursorPos;
uint32 _MaxNumChar;
uint32 _MaxNumReturn;
uint32 _MaxFloatPrec; // used in setInputStringAsFloat() only
sint32 _MaxCharsSize;
sint32 _FirstVisibleChar;
sint32 _LastVisibleChar;
// Text selection
static sint32 _SelectCursorPos;
bool _SelectingText;
NLMISC::CRGBA _TextSelectColor;
NLMISC::CRGBA _BackSelectColor;
// Text info
ucstring _Prompt;
ucstring _InputString;
CViewText *_ViewText;
// undo / redo
ucstring _StartInputString; // value of the input string when focus was acuired first
ucstring _ModifiedInputString;
// Historic info
typedef std::deque<ucstring> THistoric;
THistoric _Historic;
uint32 _MaxHistoric;
sint32 _CurrentHistoricIndex;
sint32 _PrevNumLine;
// Action Handler
std::string _AHOnChange;
std::string _ParamsOnChange;
std::string _ListMenuRight;
std::string _AHOnFocusLost;
std::string _AHOnFocusLostParams;
// entry type
TEntryType _EntryType;
bool _Setupped : 1; // setup
bool _BypassNextKey : 1;
bool _BlinkState : 1;
bool _CursorAtPreviousLineEnd : 1; // force the cursor to be displayed at the end of the previous line end (if END has beeen pressed while in a string split accross 2 lines)
bool _LooseFocusOnEnter : 1;
bool _ResetFocusOnHide : 1;
bool _BackupFatherContainerPos : 1; // Backup father container position when characters are typed.
// If the edit box is at the bottom of the screen and if it expands on y
// because of multiline, thz parent container will be moved to top
// The good position can be restored by a press on enter then
bool _WantReturn : 1; // Want return char, don't call the enter action handler
bool _Savable : 1; // should content be saved ?
bool _DefaultInputString : 1; // Is the current input string the default one (should not be edited)
bool _Frozen : 1; // is the control frozen? (cannot edit in it)
bool _CanRedo : 1;
bool _CanUndo : 1;
std::vector<char> _NegativeFilter;
sint _CursorTexID;
sint32 _CursorWidth;
sint32 _IntegerMinValue;
sint32 _IntegerMaxValue;
uint32 _PositiveIntegerMinValue;
uint32 _PositiveIntegerMaxValue;
sint32 _ViewTextDeltaX;
private:
void setupDisplayText();
void makeTopWindow();
void handleEventChar(const NLGUI::CEventDescriptorKey &event);
void handleEventString(const NLGUI::CEventDescriptorKey &event);
void setup();
void triggerOnChangeAH();
void appendStringFromClipboard(const ucstring &str);
ucstring getSelection();
static CGroupEditBox *_MenuFather;
static bool isValidAlphaNumSpace(ucchar c)
{
if (c > 255) return false;
char ac = (char) c;
return (ac >= '0' && ac <= '9') ||
(ac >= 'a' && ac <= 'z') ||
(ac >= 'A' && ac <= 'Z') ||
ac==' ';
}
static bool isValidAlphaNum(ucchar c)
{
if (c > 255) return false;
char ac = (char) c;
return (ac >= '0' && ac <= '9') ||
(ac >= 'a' && ac <= 'z') ||
(ac >= 'A' && ac <= 'Z');
}
static bool isValidAlpha(ucchar c)
{
if (c > 255) return false;
char ac = (char) c;
return (ac >= 'a' && ac <= 'z') ||
(ac >= 'A' && ac <= 'Z');
}
static bool isValidPlayerNameChar(ucchar c)
{
// valid player name (with possible shard prefix / suffix format
return isValidAlpha(c) || c=='.' || c=='(' || c==')';
}
static bool isValidFilenameChar(ucchar c)
{
if (c == '\\' ||
c == '/' ||
c == ':' ||
c == '*' ||
c == '?' ||
c == '\"' ||
c == '<' ||
c == '>' ||
c == '|') return false;
return true;
}
//
bool isFiltered(ucchar c)
{
uint length = (uint)_NegativeFilter.size();
for (uint k = 0; k < length; ++k)
{
if ((ucchar) _NegativeFilter[k] == c) return true;
}
return false;
}
static IComboKeyHandler *comboKeyHandler;
public:
static void setComboKeyHandler( IComboKeyHandler *handler ){ comboKeyHandler = handler; }
};
}
#endif // RZ_CTRL_EDITBOX_H
/* End of ctrl_editbox.h */

File diff suppressed because it is too large Load diff

View file

@ -30,7 +30,7 @@
#include "entity_cl.h"
#include "nel/gui/action_handler.h"
#include "entities.h"
#include "interface_v3/group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "permanent_ban.h"
#include "global.h"
#include "nel/gui/ctrl_text_button.h"

View file

@ -63,7 +63,7 @@
#include "init_main_loop.h"
#include "sheet_manager.h"
#include "sound_manager.h"
#include "interface_v3/group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "debug_client.h"
#include "user_entity.h"
#include "time_client.h"

View file

@ -66,7 +66,7 @@
#include "interface_v3/character_3d.h"
#include "nel/gui/ctrl_button.h"
#include "interface_v3/input_handler_manager.h"
#include "interface_v3/group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "nel/gui/interface_expr.h"
#include "init_main_loop.h"
#include "continent_manager.h"

View file

@ -71,7 +71,7 @@
#include "continent_manager.h"
#include "continent.h"
#include "sky_render.h"
#include "interface_v3/group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "interface_v3/inventory_manager.h"
#include "interface_v3/bot_chat_page_all.h"
#include "main_loop.h"

View file

@ -21,7 +21,7 @@
#include "interface_manager.h"
#include "group_container.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "dbctrl_sheet.h"
#include "interface_3d_scene.h"
#include "character_3d.h"

View file

@ -23,7 +23,7 @@ using namespace std;
using namespace NLMISC;
#include "nel/gui/action_handler.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "interface_manager.h"
#include "../client_chat_manager.h"
#include "people_interraction.h"

View file

@ -39,7 +39,7 @@
#include "nel/gui/interface_expr.h"
#include "group_menu.h"
#include "group_container.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "inventory_manager.h"
#include "guild_manager.h"
#include "../net_manager.h"

View file

@ -27,7 +27,7 @@
#include "dbctrl_sheet.h"
#include "nel/gui/interface_expr.h"
#include "group_container.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_quick_help.h"
#include "nel/gui/view_text_id.h"
#include "../user_entity.h"

View file

@ -24,7 +24,7 @@
#include "../sheet_manager.h"
#include "dbctrl_sheet.h"
#include "dbgroup_list_sheet.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "nel/gui/interface_expr.h"
#include "player_trade.h"
#include "../user_entity.h"

View file

@ -19,7 +19,7 @@
#include "interface_manager.h"
#include "nel/gui/ctrl_button.h"
#include "group_container.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "people_interraction.h"
#include "nel/misc/algo.h"
#include "nel/gui/interface_expr.h"

View file

@ -27,7 +27,7 @@
#include "macrocmd_manager.h"
#include "chat_window.h"
#include "people_interraction.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_html.h"
#include "inventory_manager.h"

View file

@ -30,7 +30,7 @@
#include "../net_manager.h"
#include "sbrick_manager.h"
#include "sphrase_manager.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "dbview_bar.h"
#include "skill_manager.h"
#include "game_share/bot_chat_types.h"

View file

@ -22,7 +22,7 @@
#include "guild_manager.h"
#include "nel/gui/interface_group.h"
#include "nel/gui/action_handler.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "dbctrl_sheet.h"
#include "bot_chat_manager.h"
#include "bot_chat_page_all.h"

View file

@ -34,7 +34,7 @@
#include "bot_chat_page_all.h"
#include "bot_chat_manager.h"
#include "dbctrl_sheet.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_tab.h"
#include "group_container.h"
#include "action_handler_help.h"

View file

@ -31,7 +31,7 @@
#include "../connection.h"
//
#include "group_container.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_tab.h"
#include "interface_manager.h"
#include "nel/gui/action_handler.h"

View file

@ -30,11 +30,11 @@ namespace NLGUI
class CCtrlBase;
class CViewText;
class CGroupList;
class CGroupEditBox;
}
class CChatWindow;
class CGroupContainer;
class CGroupEditBox;
/** Interface to react to a chat box entry
* Derivers should define the msgEntered member function to handle entry event.
@ -122,7 +122,7 @@ public:
*/
CGroupContainer *getContainer() const { return _Chat; }
//
CGroupEditBox *getEditBox() const;
NLGUI::CGroupEditBox *getEditBox() const;
/** try to rename the chat window
* \return true if success
*/
@ -163,7 +163,7 @@ protected:
protected:
IChatWindowListener *_Listener;
NLMISC::CRefPtr<CGroupContainer> _Chat;
CGroupEditBox *_EB;
NLGUI::CGroupEditBox *_EB;
bool _ParentBlink;
static CChatWindow *_ChatWindowLaunchingCommand;
std::vector<IObserver *> _Observers;

View file

@ -24,7 +24,7 @@
#include "dbctrl_sheet.h"
#include "nel/gui/view_bitmap.h"
#include "nel/gui/ctrl_button.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "../client_cfg.h"
#include "nel/gui/view_text.h"
#include "skill_manager.h"

View file

@ -31,14 +31,13 @@ namespace NLGUI
class CCtrlBaseButton;
class CViewText;
class CViewBitmap;
class CGroupEditBox;
}
// ***************************************************************************
class CDBCtrlSheet;
class CSBrickSheet;
class CGroupEditBox;
// ***************************************************************************
/**

View file

@ -26,7 +26,7 @@
#include "nel/misc/xml_auto_ptr.h"
#include "nel/gui/action_handler.h"
#include "../time_client.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "nel/gui/view_text_formated.h"
#include "nel/gui/view_text_id.h"
#include "nel/gui/lua_ihm.h"

File diff suppressed because it is too large Load diff

View file

@ -1,363 +0,0 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef RZ_CTRL_EDITBOX_H
#define RZ_CTRL_EDITBOX_H
#include "nel/gui/interface_group.h"
#include "nel/gui/group_editbox_base.h"
#include "nel/3d/u_texture.h"
namespace NLGUI
{
class CEventDescriptor;
class CViewText;
}
// ----------------------------------------------------------------------------
class CGroupEditBox : public CGroupEditBoxBase
{
public:
class IComboKeyHandler
{
public:
virtual ~IComboKeyHandler(){}
virtual bool isComboKeyChat( const NLGUI::CEventDescriptorKey &edk ) const = 0;
};
enum TEntryType { Text, Integer, PositiveInteger, Float, PositiveFloat, Alpha, AlphaNum, AlphaNumSpace, Password, Filename, PlayerName }; // the type of entry this edit bot can deal with
DECLARE_UI_CLASS( CGroupEditBox )
/// Constructor
CGroupEditBox(const TCtorParam &param);
/// Dtor
~CGroupEditBox();
bool parse(xmlNodePtr cur,CInterfaceGroup * parentGroup);
virtual uint32 getMemory() { return (uint32)(sizeof(*this)+_Id.size()); }
virtual void draw();
virtual bool handleEvent (const NLGUI::CEventDescriptor& eventDesc);
/// Accessors
ucstring getInputString() const { return _InputString; }
const ucstring &getInputStringRef() const { return _InputString; }
const ucstring &getPrompt() const { return _Prompt; }
/** Set the prompt
* NB : line returns are encoded as '\n', not '\r\n'
*/
void setPrompt(const ucstring &s) { _Prompt = s; }
void setInputString(const ucstring &str);
void setInputStringRef(const ucstring &str) {_InputString = str; };
void setInputStringAsInt(sint32 val);
sint32 getInputStringAsInt() const;
void setInputStringAsInt64(sint64 val);
sint64 getInputStringAsInt64() const;
void setInputStringAsFloat(float val);
float getInputStringAsFloat() const;
void setInputStringAsStdString(const std::string &str);
std::string getInputStringAsStdString() const;
void setInputStringAsUtf8(const std::string &str);
std::string getInputStringAsUtf8() const;
void setColor(NLMISC::CRGBA col);
/// force the selection of all the text
void setSelectionAll();
virtual void checkCoords();
virtual void updateCoords();
virtual void clearViews ();
virtual void setActive (bool state);
static CGroupEditBox *getMenuFather() { return _MenuFather; }
void setCommand(const ucstring &command, bool execute);
// Stop parent from blinking
void stopParentBlink() { if (_Parent) _Parent->disableBlink(); }
// Get / set cursor position
sint32 getCursorPos () const {return _CursorPos;}
void setCursorPos (sint32 pos) {_CursorPos=pos;}
// Get / set cursor at previous line end
bool isCursorAtPreviousLineEnd () const {return _CursorAtPreviousLineEnd;}
void setCursorAtPreviousLineEnd (bool setCursor) {_CursorAtPreviousLineEnd=setCursor;}
// Get / set current selection position
static sint32 getSelectCursorPos () {return _SelectCursorPos;}
static void setSelectCursorPos (sint32 pos) {_SelectCursorPos=pos;}
// Get the view text
const CViewText *getViewText () const {return _ViewText;}
// Get the historic information
sint32 getMaxHistoric() const {return _MaxHistoric;}
sint32 getCurrentHistoricIndex () const {return _CurrentHistoricIndex;}
void setCurrentHistoricIndex (sint32 index) {_CurrentHistoricIndex=index;}
const ucstring &getHistoric(uint32 index) const {return _Historic[index];}
uint32 getNumHistoric() const {return (uint32)_Historic.size ();}
// Get on change action handler
const std::string &getAHOnChange() const {return _AHOnChange;}
const std::string &getParamsOnChange() const {return _ParamsOnChange;}
void cutSelection();
/// From CInterfaceElement
sint32 getMaxUsedW() const;
sint32 getMinUsedW() const;
// Copy the selection into buffer
void copy();
// Paste the selection into buffer
void paste();
// Write the string into buffer
void writeString(const ucstring &str, bool replace = true, bool atEnd = true);
// Expand the expression (true if there was a '/' at the start of the line)
bool expand();
// Back space
void back();
// ignore the next char/key event -> useful when a key set the focus on an editbox (keydown is received, the focus, then keychar is received by the editbox again, but is irrelevant)
void bypassNextKey() { _BypassNextKey = true; }
// True if the editBox loose the focus on enter
bool getLooseFocusOnEnter() const {return _LooseFocusOnEnter;}
//
virtual void clearAllEditBox();
// From CInterfaceElement
virtual bool wantSerialConfig() const;
// From CInterfaceElement
virtual void serialConfig(NLMISC::IStream &f);
// From CInterfaceElement
virtual void onQuit();
// From CInterfaceElement
virtual void onLoadConfig();
// from CCtrlBase
virtual void elementCaptured(CCtrlBase *capturedElement);
// from CCtrlBase
virtual void onKeyboardCaptureLost();
// set the input string as "default". will be reseted at first click (used for user information)
void setDefaultInputString(const ucstring &str);
// For Interger and PositiveInteger, can specify min and max values
void setIntegerMinValue(sint32 minValue) {_IntegerMinValue=minValue;}
void setIntegerMaxValue(sint32 maxValue) {_IntegerMaxValue=maxValue;}
void setPositiveIntegerMinValue(uint32 minValue) {_PositiveIntegerMinValue=minValue;}
void setPositiveIntegerMaxValue(uint32 maxValue) {_PositiveIntegerMaxValue=maxValue;}
void setFocusOnText();
int luaSetSelectionAll(CLuaState &ls);
int luaSetupDisplayText(CLuaState &ls);
int luaSetFocusOnText(CLuaState &ls);
int luaCancelFocusOnText(CLuaState &ls);
REFLECT_EXPORT_START(CGroupEditBox, CGroupEditBoxBase)
REFLECT_LUA_METHOD("setupDisplayText", luaSetupDisplayText);
REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll);
REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText);
REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText);
REFLECT_STRING("input_string", getInputStringAsStdString, setInputStringAsStdString);
REFLECT_UCSTRING("uc_input_string", getInputString, setInputString);
REFLECT_EXPORT_END
/** Restore the original value of the edit box.
* This value is captured when the edit box get focus
* (return true if no undo was available)
* Will always fails ifthe edito box do not have the focus
*/
bool undo();
/** Cancel last undo operation
* Return true if redo operation is available
*/
bool redo();
/// freeze the control (loose focus, and cannot edit)
void setFrozen (bool state);
bool getFrozen () const { return _Frozen; }
protected:
// Cursor infos
float _BlinkTime;
sint32 _CursorPos;
uint32 _MaxNumChar;
uint32 _MaxNumReturn;
uint32 _MaxFloatPrec; // used in setInputStringAsFloat() only
sint32 _MaxCharsSize;
sint32 _FirstVisibleChar;
sint32 _LastVisibleChar;
// Text selection
static sint32 _SelectCursorPos;
bool _SelectingText;
NLMISC::CRGBA _TextSelectColor;
NLMISC::CRGBA _BackSelectColor;
// Text info
ucstring _Prompt;
ucstring _InputString;
CViewText *_ViewText;
// undo / redo
ucstring _StartInputString; // value of the input string when focus was acuired first
ucstring _ModifiedInputString;
// Historic info
typedef std::deque<ucstring> THistoric;
THistoric _Historic;
uint32 _MaxHistoric;
sint32 _CurrentHistoricIndex;
sint32 _PrevNumLine;
// Action Handler
std::string _AHOnChange;
std::string _ParamsOnChange;
std::string _ListMenuRight;
std::string _AHOnFocusLost;
std::string _AHOnFocusLostParams;
// entry type
TEntryType _EntryType;
bool _Setupped : 1; // setup
bool _BypassNextKey : 1;
bool _BlinkState : 1;
bool _CursorAtPreviousLineEnd : 1; // force the cursor to be displayed at the end of the previous line end (if END has beeen pressed while in a string split accross 2 lines)
bool _LooseFocusOnEnter : 1;
bool _ResetFocusOnHide : 1;
bool _BackupFatherContainerPos : 1; // Backup father container position when characters are typed.
// If the edit box is at the bottom of the screen and if it expands on y
// because of multiline, thz parent container will be moved to top
// The good position can be restored by a press on enter then
bool _WantReturn : 1; // Want return char, don't call the enter action handler
bool _Savable : 1; // should content be saved ?
bool _DefaultInputString : 1; // Is the current input string the default one (should not be edited)
bool _Frozen : 1; // is the control frozen? (cannot edit in it)
bool _CanRedo : 1;
bool _CanUndo : 1;
std::vector<char> _NegativeFilter;
sint _CursorTexID;
sint32 _CursorWidth;
sint32 _IntegerMinValue;
sint32 _IntegerMaxValue;
uint32 _PositiveIntegerMinValue;
uint32 _PositiveIntegerMaxValue;
sint32 _ViewTextDeltaX;
private:
void setupDisplayText();
void makeTopWindow();
void handleEventChar(const NLGUI::CEventDescriptorKey &event);
void handleEventString(const NLGUI::CEventDescriptorKey &event);
void setup();
void triggerOnChangeAH();
void appendStringFromClipboard(const ucstring &str);
ucstring getSelection();
static CGroupEditBox *_MenuFather;
static bool isValidAlphaNumSpace(ucchar c)
{
if (c > 255) return false;
char ac = (char) c;
return (ac >= '0' && ac <= '9') ||
(ac >= 'a' && ac <= 'z') ||
(ac >= 'A' && ac <= 'Z') ||
ac==' ';
}
static bool isValidAlphaNum(ucchar c)
{
if (c > 255) return false;
char ac = (char) c;
return (ac >= '0' && ac <= '9') ||
(ac >= 'a' && ac <= 'z') ||
(ac >= 'A' && ac <= 'Z');
}
static bool isValidAlpha(ucchar c)
{
if (c > 255) return false;
char ac = (char) c;
return (ac >= 'a' && ac <= 'z') ||
(ac >= 'A' && ac <= 'Z');
}
static bool isValidPlayerNameChar(ucchar c)
{
// valid player name (with possible shard prefix / suffix format
return isValidAlpha(c) || c=='.' || c=='(' || c==')';
}
static bool isValidFilenameChar(ucchar c)
{
if (c == '\\' ||
c == '/' ||
c == ':' ||
c == '*' ||
c == '?' ||
c == '\"' ||
c == '<' ||
c == '>' ||
c == '|') return false;
return true;
}
//
bool isFiltered(ucchar c)
{
uint length = (uint)_NegativeFilter.size();
for (uint k = 0; k < length; ++k)
{
if ((ucchar) _NegativeFilter[k] == c) return true;
}
return false;
}
static IComboKeyHandler *comboKeyHandler;
public:
static void setComboKeyHandler( IComboKeyHandler *handler ){ comboKeyHandler = handler; }
};
#endif // RZ_CTRL_EDITBOX_H
/* End of ctrl_editbox.h */

View file

@ -38,7 +38,7 @@ extern "C"
#include "nel/gui/ctrl_text_button.h"
#include "nel/gui/action_handler.h"
#include "group_paragraph.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "interface_manager.h"
#include "nel/gui/view_bitmap.h"
#include "../actions.h"

View file

@ -25,7 +25,7 @@
#include "../zone_util.h"
#include "../user_entity.h"
#include "nel/gui/ctrl_button.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "../string_manager_client.h"
#include "group_container.h"
#include "nel/gui/action_handler.h"

View file

@ -26,7 +26,7 @@
#include <string>
#include "nel/gui/event_descriptor.h"
#include "nel/gui/input_handler.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
/**

View file

@ -64,7 +64,7 @@
#include "group_menu.h"
#include "group_container.h"
#include "nel/gui/group_modal.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_in_scene_bubble.h"
#include "group_skills.h"
#include "group_compas.h"

View file

@ -70,7 +70,7 @@
#include "group_menu.h"
#include "group_container.h"
#include "group_scrolltext.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_skills.h"
#include "group_html_forum.h"
#include "group_html_mail.h"

View file

@ -76,7 +76,7 @@
#include "../motion/user_controls.h"
#include "group_html_cs.h"
#include "bonus_malus.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "../entities.h"
#include "../sheet_manager.h" // for emotes
#include "../global.h" // for emotes

View file

@ -25,7 +25,7 @@
#include "interface_manager.h"
#include "nel/gui/action_handler.h"
#include "nel/gui/ctrl_button.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "nel/gui/group_list.h"
#include "dbgroup_combo_box.h"
#include "group_container.h"

View file

@ -26,7 +26,7 @@
#include "nel/gui/action_handler.h"
#include "dbctrl_sheet.h"
#include "nel/gui/ctrl_button.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "nel/gui/group_list.h"
#include "dbgroup_combo_box.h"
#include "group_container.h"

View file

@ -26,7 +26,7 @@
#include "action_handler_misc.h"
#include "chat_window.h"
#include "../entity_animation_manager.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "group_menu.h"
#include "../client_chat_manager.h"
#include "../string_manager_client.h"

View file

@ -23,7 +23,7 @@
#include "nel/gui/view_bitmap.h"
#include "interface_manager.h"
#include "nel/gui/action_handler.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "../client_chat_manager.h"
#include "chat_text_manager.h"
#include "people_interraction.h"

View file

@ -40,7 +40,7 @@
#include "dbctrl_sheet.h"
#include "dbgroup_list_sheet.h"
#include "nel/gui/group_editbox_base.h"
#include "group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "nel/gui/group_tree.h"
#include "nel/gui/reflect.h"
#include "dbview_bar.h"

View file

@ -35,7 +35,7 @@
#include "interface_v3/interface_manager.h"
#include "interface_v3/input_handler_manager.h"
#include "interface_v3/group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "interface_v3/group_quick_help.h"
#include "nel/gui/view_text.h"
#include "nel/gui/ctrl_button.h"

View file

@ -81,7 +81,7 @@ using namespace NLGUI;
#include "../interface_v3/input_handler_manager.h"
#include "../connection.h"
#include "../init_main_loop.h"
#include "../interface_v3/group_editbox.h"
#include "nel/gui/group_editbox.h"
#include "../landscape_poly_drawer.h"
#include "../input.h"
#include "../motion/user_controls.h"