Resolve "Toggle Free Look with Hotkey"
[ryzomcore.git] / ryzom / client / src / interfaces_manager / capture.h
blob7767e6afb4084ff246d130493ebf0799227c3b62
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CL_CAPTURE_H
20 #define CL_CAPTURE_H
23 //////////////
24 // Includes //
25 //////////////
26 // Misc.
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/event_listener.h"
29 #include "nel/misc/ucstring.h"
30 // Client.
31 #include "control.h"
32 #include "pen.h"
35 ///////////
36 // Using //
37 ///////////
38 using NLMISC::IEventListener;
39 using NLMISC::CEvent;
42 /**
43 * Class to manage the keyboard capture.
44 * \author Guillaume PUZIN
45 * \author Nevrax France
46 * \date 2001
48 class CCapture : public CControl, public CPen, public IEventListener
50 private:
51 /// Initialize the button (1 function called for all constructors -> easier).
52 inline void init(uint numFunc);
53 /// callback
54 virtual void operator () (const CEvent& event);
56 protected:
57 uint _NumFunc;
58 /// the max number of char on a line
59 uint _MaxChar;
60 /// the memorized line
61 ucstring _Str;
62 /// the prompt (displayed at the beginning of the control, before the edited line)
63 ucstring _Prompt;
64 /// the mode, if insert==true, the line is being edited
65 bool _Insert;
67 public:
68 /// Constructor.
69 CCapture(uint id);
70 CCapture(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, uint numFunc, const CPen &pen);
71 CCapture(uint id, float x, float y, float x_pixel, float y_pixel, float w, float h, float w_pixel, float h_pixel, uint numFunc, uint32 fontSize, CRGBA color, bool shadow);
73 /// Destructor.
74 ~CCapture();
76 /// Display the Bitmap.
77 virtual void display();
78 /// Manage the click of the mouse for the Bitmap.
79 virtual void click(float x, float y, bool &taken);
82 /// set the string contained in the class : _Str.
83 void setStr(const ucstring &str)
85 _Str = str;
88 /// Return the string contained in the class : _Str.
89 const ucstring &getStr() const
91 return _Str;
94 void setPrompt(const ucstring &str)
96 _Prompt = str;
99 const ucstring &getPrompt() const { return _Prompt; }
101 /// Set if the Control is in Insert mode.
102 inline void insert(bool i) {_Insert = i;}
103 /// Return if the control is in insert mode.
104 inline bool insert() const {return _Insert;}
108 #endif // CL_CAPTURE_H
110 /* End of capture.h */