Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / client / src / contextual_cursor.h
blob93eb1509ff80024ee9a71b674401a42a89e06bca
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
6 //
7 // This program is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Affero General Public License as
9 // published by the Free Software Foundation, either version 3 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU Affero General Public License for more details.
17 // You should have received a copy of the GNU Affero General Public License
18 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef CL_CONTEXTUAL_CURSOR_H
23 #define CL_CONTEXTUAL_CURSOR_H
25 /////////////
26 // INCLUDE //
27 /////////////
28 // Misc
29 #include "nel/misc/types_nl.h"
32 /**
33 * Class to manage contextual cursor.
34 * \author Guillaume PUZIN
35 * \author Nevrax France
36 * \date 2001
38 class CContextualCursor
40 public:
41 /// Callback function to call per context.
42 typedef void (*TFunc) (void);
43 typedef void (*TFunc2) (bool,bool);
45 protected:
46 typedef struct
48 float distMax;
49 TFunc checkFunc;
50 TFunc2 execFunc;
51 std::string cursor;
52 bool isString; // True if this cursor is a string cursor and not an icon cursor
53 }TFunctions;
55 typedef std::map<std::string, TFunctions> TContext;
57 TContext _Contexts;
59 /// Current Context.
60 std::string _Context;
62 public:
63 /// Constructor
64 CContextualCursor();
66 void release();
68 /// Insert a context and associate the function. If the context already exist -> replace the function if 'replace' = true.
69 void add(bool isString, const std::string &contextName, const std::string &texture, float distMax, TFunc checkFunc, TFunc2 execFunc, bool replace = true);
70 /// Remove a context.
71 void del(const std::string &contextName);
73 // Select a nex context.
74 bool context(const std::string &contextName, float dist = 0, const std::string &cursName = std::string());
75 inline const std::string &context() const {return _Context;}
77 // Check if there is an entity under the cursor.
78 void check();
79 /// Execute the Action according to the cursor state.
80 void execute(bool rightClick, bool dblClick);
84 #endif // CL_CONTEXTUAL_CURSOR_H
86 /* End of contextual_cursor.h */