Labyrinth
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
nameeditwidget.hpp
1 //////////////////////////////
2 //
3 // File: lxs/game/nameeditwidget.hpp
4 // Author: Maciej Kaminski
5 // E-mail: maciej.a.kaminski@gmail.com
6 // Website: maciejkaminski.pl
7 //
8 // File creation date: May 30 2014
9 // This file is part of Project Labyrinth
10 // This file is going to be released under terms of GNU GPL in near future
11 //
12 //////////////////////////////
13 
14 #ifndef __LXS_NAME_ED_WIDG__
15 #define __LXS_NAME_ED_WIDG__
16 
17 
18 namespace LxS{
19  namespace Game {
20  //! to set name of character
22  {
23  SWRS::Character & chara;
24  public:
25  //! constructor
26  NameEditWidget(SWRS::Character & _chara):chara(_chara)
27  {
28  SetBaseText("Name?");
29  if (!chara.GetName().empty())
30  SetText(chara.GetName());
31  }
32  void OnText()
33  {
34  if (!GetText().empty()
35  && GetText().c_str()[0]!=' ')
36  chara.SetName(GetText());
37  }
38  };
39  }
40 }
41 
42 #endif