1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This source file has been modified by the following contributors:
5 // Copyright (C) 2020 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
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
29 #include "nel/misc/types_nl.h"
33 * Class to manage contextual cursor.
34 * \author Guillaume PUZIN
35 * \author Nevrax France
38 class CContextualCursor
41 /// Callback function to call per context.
42 typedef void (*TFunc
) (void);
43 typedef void (*TFunc2
) (bool,bool);
52 bool isString
; // True if this cursor is a string cursor and not an icon cursor
55 typedef std::map
<std::string
, TFunctions
> TContext
;
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);
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.
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 */