1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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_CONTEXTUAL_CURSOR_H
20 #define CL_CONTEXTUAL_CURSOR_H
26 #include "nel/misc/types_nl.h"
30 * Class to manage contextual cursor.
31 * \author Guillaume PUZIN
32 * \author Nevrax France
35 class CContextualCursor
38 /// Callback function to call per context.
39 typedef void (*TFunc
) (void);
40 typedef void (*TFunc2
) (bool,bool);
49 bool isString
; // True if this cursor is a string cursor and not an icon cursor
52 typedef std::map
<std::string
, TFunctions
> TContext
;
65 /// Insert a context and associate the function. If the context already exist -> replace the function if 'replace' = true.
66 void add(bool isString
, const std::string
&contextName
, const std::string
&texture
, float distMax
, TFunc checkFunc
, TFunc2 execFunc
, bool replace
= true);
68 void del(const std::string
&contextName
);
70 // Select a nex context.
71 bool context(const std::string
&contextName
, float dist
= 0, const std::string
&cursName
= std::string());
72 inline const std::string
&context() const {return _Context
;}
74 // Check if there is an entity under the cursor.
76 /// Execute the Action according to the cursor state.
77 void execute(bool rightClick
, bool dblClick
);
81 #endif // CL_CONTEXTUAL_CURSOR_H
83 /* End of contextual_cursor.h */