Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / contextual_cursor.h
blob31ba7a3c51ab2eb48b86eca5a8c4a2312141fafe
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_CONTEXTUAL_CURSOR_H
20 #define CL_CONTEXTUAL_CURSOR_H
22 /////////////
23 // INCLUDE //
24 /////////////
25 // Misc
26 #include "nel/misc/types_nl.h"
29 /**
30 * Class to manage contextual cursor.
31 * \author Guillaume PUZIN
32 * \author Nevrax France
33 * \date 2001
35 class CContextualCursor
37 public:
38 /// Callback function to call per context.
39 typedef void (*TFunc) (void);
40 typedef void (*TFunc2) (bool,bool);
42 protected:
43 typedef struct
45 float distMax;
46 TFunc checkFunc;
47 TFunc2 execFunc;
48 std::string cursor;
49 bool isString; // True if this cursor is a string cursor and not an icon cursor
50 }TFunctions;
52 typedef std::map<std::string, TFunctions> TContext;
54 TContext _Contexts;
56 /// Current Context.
57 std::string _Context;
59 public:
60 /// Constructor
61 CContextualCursor();
63 void release();
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);
67 /// Remove a context.
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.
75 void check();
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 */