CHANGED: #1471 CWidgetManager no longer depends on CGroupEditBox, it depends on a new class CGroupEditBoxBase instead.
This commit is contained in:
parent
cdfc43f9ee
commit
6ece9d9e27
7 changed files with 93 additions and 31 deletions
|
@ -145,7 +145,7 @@ protected:
|
||||||
if (_GroupEdit)
|
if (_GroupEdit)
|
||||||
{
|
{
|
||||||
// If selection active
|
// If selection active
|
||||||
CGroupEditBox *currSelection = CGroupEditBox::getCurrSelection();
|
CGroupEditBox *currSelection = dynamic_cast< CGroupEditBox* >( CGroupEditBox::getCurrSelection() );
|
||||||
if (currSelection != NULL)
|
if (currSelection != NULL)
|
||||||
{
|
{
|
||||||
if (currSelection != _GroupEdit)
|
if (currSelection != _GroupEdit)
|
||||||
|
|
|
@ -40,7 +40,6 @@ using namespace NL3D;
|
||||||
/////////////
|
/////////////
|
||||||
|
|
||||||
sint32 CGroupEditBox::_SelectCursorPos = 0;
|
sint32 CGroupEditBox::_SelectCursorPos = 0;
|
||||||
CGroupEditBox *CGroupEditBox::_CurrSelection = NULL;
|
|
||||||
CGroupEditBox *CGroupEditBox::_MenuFather = NULL;
|
CGroupEditBox *CGroupEditBox::_MenuFather = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ CGroupEditBox *CGroupEditBox::_MenuFather = NULL;
|
||||||
NLMISC_REGISTER_OBJECT(CViewBase, CGroupEditBox, std::string, "edit_box");
|
NLMISC_REGISTER_OBJECT(CViewBase, CGroupEditBox, std::string, "edit_box");
|
||||||
|
|
||||||
CGroupEditBox::CGroupEditBox(const TCtorParam ¶m) :
|
CGroupEditBox::CGroupEditBox(const TCtorParam ¶m) :
|
||||||
CInterfaceGroup(param),
|
CGroupEditBoxBase(param),
|
||||||
_BlinkTime(0.f),
|
_BlinkTime(0.f),
|
||||||
_CursorPos(0),
|
_CursorPos(0),
|
||||||
_MaxNumChar(std::numeric_limits<uint32>::max()),
|
_MaxNumChar(std::numeric_limits<uint32>::max()),
|
||||||
|
@ -68,7 +67,6 @@ CGroupEditBox::CGroupEditBox(const TCtorParam ¶m) :
|
||||||
_BlinkState(false),
|
_BlinkState(false),
|
||||||
_CursorAtPreviousLineEnd(false),
|
_CursorAtPreviousLineEnd(false),
|
||||||
_LooseFocusOnEnter(true),
|
_LooseFocusOnEnter(true),
|
||||||
_RecoverFocusOnEnter(true),
|
|
||||||
_ResetFocusOnHide(false),
|
_ResetFocusOnHide(false),
|
||||||
_BackupFatherContainerPos(false),
|
_BackupFatherContainerPos(false),
|
||||||
_WantReturn(false),
|
_WantReturn(false),
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#define RZ_CTRL_EDITBOX_H
|
#define RZ_CTRL_EDITBOX_H
|
||||||
|
|
||||||
#include "interface_group.h"
|
#include "interface_group.h"
|
||||||
|
#include "group_editbox_base.h"
|
||||||
#include "nel/3d/u_texture.h"
|
#include "nel/3d/u_texture.h"
|
||||||
|
|
||||||
namespace NLGUI
|
namespace NLGUI
|
||||||
|
@ -27,12 +28,14 @@ namespace NLGUI
|
||||||
class CEventDescriptor;
|
class CEventDescriptor;
|
||||||
}
|
}
|
||||||
class CViewText;
|
class CViewText;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
class CGroupEditBox : public CInterfaceGroup
|
class CGroupEditBox : public CGroupEditBoxBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum TEntryType { Text, Integer, PositiveInteger, Float, PositiveFloat, Alpha, AlphaNum, AlphaNumSpace, Password, Filename, PlayerName }; // the type of entry this edit bot can deal with
|
enum TEntryType { Text, Integer, PositiveInteger, Float, PositiveFloat, Alpha, AlphaNum, AlphaNumSpace, Password, Filename, PlayerName }; // the type of entry this edit bot can deal with
|
||||||
public:
|
public:
|
||||||
|
DECLARE_UI_CLASS( CGroupEditBox )
|
||||||
/// Constructor
|
/// Constructor
|
||||||
CGroupEditBox(const TCtorParam ¶m);
|
CGroupEditBox(const TCtorParam ¶m);
|
||||||
/// Dtor
|
/// Dtor
|
||||||
|
@ -71,8 +74,6 @@ public:
|
||||||
|
|
||||||
/// force the selection of all the text
|
/// force the selection of all the text
|
||||||
void setSelectionAll();
|
void setSelectionAll();
|
||||||
// disable any current selection
|
|
||||||
static void disableSelection() { _CurrSelection = NULL; }
|
|
||||||
|
|
||||||
virtual void checkCoords();
|
virtual void checkCoords();
|
||||||
virtual void updateCoords();
|
virtual void updateCoords();
|
||||||
|
@ -99,10 +100,6 @@ public:
|
||||||
static sint32 getSelectCursorPos () {return _SelectCursorPos;}
|
static sint32 getSelectCursorPos () {return _SelectCursorPos;}
|
||||||
static void setSelectCursorPos (sint32 pos) {_SelectCursorPos=pos;}
|
static void setSelectCursorPos (sint32 pos) {_SelectCursorPos=pos;}
|
||||||
|
|
||||||
// Get / set current selection
|
|
||||||
static CGroupEditBox *getCurrSelection () {return _CurrSelection;}
|
|
||||||
static void setCurrSelection (CGroupEditBox *selection) {_CurrSelection=selection;}
|
|
||||||
|
|
||||||
// Get the view text
|
// Get the view text
|
||||||
const CViewText *getViewText () const {return _ViewText;}
|
const CViewText *getViewText () const {return _ViewText;}
|
||||||
|
|
||||||
|
@ -141,9 +138,6 @@ public:
|
||||||
|
|
||||||
// True if the editBox loose the focus on enter
|
// True if the editBox loose the focus on enter
|
||||||
bool getLooseFocusOnEnter() const {return _LooseFocusOnEnter;}
|
bool getLooseFocusOnEnter() const {return _LooseFocusOnEnter;}
|
||||||
// True if the editBox can recover the focus on enter. if not, it does not erase OldCapturedKeyboard when loose focus
|
|
||||||
bool getRecoverFocusOnEnter() const {return _RecoverFocusOnEnter;}
|
|
||||||
void setRecoverFocusOnEnter(bool state) {_RecoverFocusOnEnter= state;}
|
|
||||||
//
|
//
|
||||||
virtual void clearAllEditBox();
|
virtual void clearAllEditBox();
|
||||||
// From CInterfaceElement
|
// From CInterfaceElement
|
||||||
|
@ -161,10 +155,6 @@ public:
|
||||||
// from CCtrlBase
|
// from CCtrlBase
|
||||||
virtual void onKeyboardCaptureLost();
|
virtual void onKeyboardCaptureLost();
|
||||||
|
|
||||||
std::string getAHOnFocus() { return _AHOnFocus; }
|
|
||||||
std::string getAHOnFocusParams() { return _AHOnFocusParams; }
|
|
||||||
|
|
||||||
|
|
||||||
// set the input string as "default". will be reseted at first click (used for user information)
|
// set the input string as "default". will be reseted at first click (used for user information)
|
||||||
void setDefaultInputString(const ucstring &str);
|
void setDefaultInputString(const ucstring &str);
|
||||||
|
|
||||||
|
@ -180,14 +170,13 @@ public:
|
||||||
int luaSetupDisplayText(CLuaState &ls);
|
int luaSetupDisplayText(CLuaState &ls);
|
||||||
int luaSetFocusOnText(CLuaState &ls);
|
int luaSetFocusOnText(CLuaState &ls);
|
||||||
int luaCancelFocusOnText(CLuaState &ls);
|
int luaCancelFocusOnText(CLuaState &ls);
|
||||||
REFLECT_EXPORT_START(CGroupEditBox, CInterfaceGroup)
|
REFLECT_EXPORT_START(CGroupEditBox, CGroupEditBoxBase)
|
||||||
REFLECT_LUA_METHOD("setupDisplayText", luaSetupDisplayText);
|
REFLECT_LUA_METHOD("setupDisplayText", luaSetupDisplayText);
|
||||||
REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll);
|
REFLECT_LUA_METHOD("setSelectionAll", luaSetSelectionAll);
|
||||||
REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText);
|
REFLECT_LUA_METHOD("setFocusOnText", luaSetFocusOnText);
|
||||||
REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText);
|
REFLECT_LUA_METHOD("cancelFocusOnText", luaCancelFocusOnText);
|
||||||
REFLECT_STRING("input_string", getInputStringAsStdString, setInputStringAsStdString);
|
REFLECT_STRING("input_string", getInputStringAsStdString, setInputStringAsStdString);
|
||||||
REFLECT_UCSTRING("uc_input_string", getInputString, setInputString);
|
REFLECT_UCSTRING("uc_input_string", getInputString, setInputString);
|
||||||
REFLECT_BOOL("enter_recover_focus", getRecoverFocusOnEnter, setRecoverFocusOnEnter);
|
|
||||||
REFLECT_EXPORT_END
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
/** Restore the original value of the edit box.
|
/** Restore the original value of the edit box.
|
||||||
|
@ -220,7 +209,6 @@ protected:
|
||||||
|
|
||||||
// Text selection
|
// Text selection
|
||||||
static sint32 _SelectCursorPos;
|
static sint32 _SelectCursorPos;
|
||||||
static CGroupEditBox *_CurrSelection; // the edit box for which the selection is currently active, or NULL if there's none
|
|
||||||
bool _SelectingText;
|
bool _SelectingText;
|
||||||
NLMISC::CRGBA _TextSelectColor;
|
NLMISC::CRGBA _TextSelectColor;
|
||||||
NLMISC::CRGBA _BackSelectColor;
|
NLMISC::CRGBA _BackSelectColor;
|
||||||
|
@ -249,10 +237,6 @@ protected:
|
||||||
|
|
||||||
std::string _AHOnFocusLost;
|
std::string _AHOnFocusLost;
|
||||||
std::string _AHOnFocusLostParams;
|
std::string _AHOnFocusLostParams;
|
||||||
std::string _AHOnFocus;
|
|
||||||
std::string _AHOnFocusParams;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// entry type
|
// entry type
|
||||||
TEntryType _EntryType;
|
TEntryType _EntryType;
|
||||||
|
@ -263,7 +247,6 @@ protected:
|
||||||
bool _BlinkState : 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 _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 _LooseFocusOnEnter : 1;
|
||||||
bool _RecoverFocusOnEnter : 1;
|
|
||||||
bool _ResetFocusOnHide : 1;
|
bool _ResetFocusOnHide : 1;
|
||||||
bool _BackupFatherContainerPos : 1; // Backup father container position when characters are typed.
|
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
|
// If the edit box is at the bottom of the screen and if it expands on y
|
||||||
|
|
14
code/ryzom/client/src/interface_v3/group_editbox_base.cpp
Normal file
14
code/ryzom/client/src/interface_v3/group_editbox_base.cpp
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#include "group_editbox_base.h"
|
||||||
|
|
||||||
|
CGroupEditBoxBase *CGroupEditBoxBase::_CurrSelection = NULL;
|
||||||
|
|
||||||
|
CGroupEditBoxBase::CGroupEditBoxBase( const TCtorParam ¶m ) :
|
||||||
|
CInterfaceGroup( param )
|
||||||
|
{
|
||||||
|
_RecoverFocusOnEnter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGroupEditBoxBase::~CGroupEditBoxBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
64
code/ryzom/client/src/interface_v3/group_editbox_base.h
Normal file
64
code/ryzom/client/src/interface_v3/group_editbox_base.h
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
// 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 GROUP_EDITBOX_BASE_H
|
||||||
|
#define GROUP_EDITBOX_BASE_H
|
||||||
|
|
||||||
|
#include "interface_group.h"
|
||||||
|
|
||||||
|
class CGroupEditBoxBase : public CInterfaceGroup
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_UI_CLASS( CGroupEditBoxBase )
|
||||||
|
|
||||||
|
CGroupEditBoxBase( const TCtorParam ¶m );
|
||||||
|
~CGroupEditBoxBase();
|
||||||
|
|
||||||
|
// True if the editBox can recover the focus on enter. if not, it does not erase OldCapturedKeyboard when loose focus
|
||||||
|
bool getRecoverFocusOnEnter() const{ return _RecoverFocusOnEnter; }
|
||||||
|
void setRecoverFocusOnEnter( bool state ){ _RecoverFocusOnEnter = state; }
|
||||||
|
|
||||||
|
std::string getAHOnFocus(){ return _AHOnFocus; }
|
||||||
|
std::string getAHOnFocusParams(){ return _AHOnFocusParams; }
|
||||||
|
|
||||||
|
// disable any current selection
|
||||||
|
static void disableSelection(){ _CurrSelection = NULL; }
|
||||||
|
|
||||||
|
// Get / set current selection
|
||||||
|
static CGroupEditBoxBase *getCurrSelection(){ return _CurrSelection; }
|
||||||
|
static void setCurrSelection( CGroupEditBoxBase *selection ){ _CurrSelection = selection; }
|
||||||
|
|
||||||
|
void draw(){}
|
||||||
|
|
||||||
|
REFLECT_EXPORT_START( CGroupEditBoxBase, CInterfaceGroup )
|
||||||
|
REFLECT_BOOL( "enter_recover_focus", getRecoverFocusOnEnter, setRecoverFocusOnEnter );
|
||||||
|
REFLECT_EXPORT_END
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _RecoverFocusOnEnter : 1;
|
||||||
|
|
||||||
|
std::string _AHOnFocus;
|
||||||
|
std::string _AHOnFocusParams;
|
||||||
|
|
||||||
|
static CGroupEditBoxBase *_CurrSelection; // the edit box for which the selection is currently active, or NULL if there's none
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "ctrl_draggable.h"
|
#include "ctrl_draggable.h"
|
||||||
#include "dbctrl_sheet.h"
|
#include "dbctrl_sheet.h"
|
||||||
#include "dbgroup_list_sheet.h"
|
#include "dbgroup_list_sheet.h"
|
||||||
|
#include "group_editbox_base.h"
|
||||||
#include "group_editbox.h"
|
#include "group_editbox.h"
|
||||||
#include "group_tree.h"
|
#include "group_tree.h"
|
||||||
#include "nel/gui/reflect.h"
|
#include "nel/gui/reflect.h"
|
||||||
|
@ -84,7 +85,8 @@ void registerInterfaceElements()
|
||||||
REGISTER_REFLECTABLE_CLASS(CGroupContainer, CInterfaceGroup);
|
REGISTER_REFLECTABLE_CLASS(CGroupContainer, CInterfaceGroup);
|
||||||
REGISTER_REFLECTABLE_CLASS(CDBGroupSelectNumber, CInterfaceGroup);
|
REGISTER_REFLECTABLE_CLASS(CDBGroupSelectNumber, CInterfaceGroup);
|
||||||
REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup);
|
REGISTER_REFLECTABLE_CLASS(IListSheetBase, CInterfaceGroup);
|
||||||
REGISTER_REFLECTABLE_CLASS(CGroupEditBox, CInterfaceGroup);
|
REGISTER_REFLECTABLE_CLASS(CGroupEditBoxBase, CInterfaceGroup);
|
||||||
|
REGISTER_REFLECTABLE_CLASS(CGroupEditBox, CGroupEditBoxBase);
|
||||||
REGISTER_REFLECTABLE_CLASS(CGroupTree, CInterfaceGroup);
|
REGISTER_REFLECTABLE_CLASS(CGroupTree, CInterfaceGroup);
|
||||||
REGISTER_REFLECTABLE_CLASS(CDBGroupComboBox, CInterfaceGroup);
|
REGISTER_REFLECTABLE_CLASS(CDBGroupComboBox, CInterfaceGroup);
|
||||||
REGISTER_REFLECTABLE_CLASS(CCtrlScrollBase, CCtrlBase);
|
REGISTER_REFLECTABLE_CLASS(CCtrlScrollBase, CCtrlBase);
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
#include "group_container.h"
|
#include "group_container.h"
|
||||||
#include "group_in_scene.h"
|
#include "group_in_scene.h"
|
||||||
#include "view_pointer.h"
|
#include "view_pointer.h"
|
||||||
#include "group_editbox.h"
|
|
||||||
|
#include "group_editbox_base.h"
|
||||||
#include "ctrl_draggable.h"
|
#include "ctrl_draggable.h"
|
||||||
|
|
||||||
CWidgetManager* CWidgetManager::instance = NULL;
|
CWidgetManager* CWidgetManager::instance = NULL;
|
||||||
|
@ -1127,8 +1128,8 @@ void CWidgetManager::setCapturePointerRight(CCtrlBase *c)
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
void CWidgetManager::setCaptureKeyboard(CCtrlBase *c)
|
void CWidgetManager::setCaptureKeyboard(CCtrlBase *c)
|
||||||
{
|
{
|
||||||
CGroupEditBox *oldEb= dynamic_cast<CGroupEditBox*>((CCtrlBase*)_CaptureKeyboard);
|
CGroupEditBoxBase *oldEb= dynamic_cast<CGroupEditBoxBase*>((CCtrlBase*)_CaptureKeyboard);
|
||||||
CGroupEditBox *newEb= dynamic_cast<CGroupEditBox*>(c);
|
CGroupEditBoxBase *newEb= dynamic_cast<CGroupEditBoxBase*>(c);
|
||||||
|
|
||||||
if (_CaptureKeyboard && _CaptureKeyboard != c)
|
if (_CaptureKeyboard && _CaptureKeyboard != c)
|
||||||
{
|
{
|
||||||
|
@ -1141,7 +1142,7 @@ void CWidgetManager::setCaptureKeyboard(CCtrlBase *c)
|
||||||
}
|
}
|
||||||
if ( newEb )
|
if ( newEb )
|
||||||
{
|
{
|
||||||
CGroupEditBox::disableSelection();
|
CGroupEditBoxBase::disableSelection();
|
||||||
|
|
||||||
if (!newEb->getAHOnFocus().empty())
|
if (!newEb->getAHOnFocus().empty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue