aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LResource.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/LResource.hh')
-rw-r--r--src/FbTk/LResource.hh59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/FbTk/LResource.hh b/src/FbTk/LResource.hh
new file mode 100644
index 0000000..897575b
--- /dev/null
+++ b/src/FbTk/LResource.hh
@@ -0,0 +1,59 @@
1// LResource: Fluxbox Resource implementation in lua
2// Copyright (C) 2011 Pavel Labath
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#ifndef FBTK_LRESOURCE_HH
23#define FBTK_LRESOURCE_HH
24
25#include <cassert>
26#include <list>
27#include <memory>
28#include <string>
29
30#include "Resource.hh"
31
32namespace lua {
33 class state;
34}
35
36namespace FbTk {
37
38class LResourceManager: public ResourceManager_base {
39public:
40 static void initState(lua::state &l);
41
42 LResourceManager(lua::state &l, const std::string &root);
43 virtual bool save(const char *filename, const char *);
44 virtual void addResource(Resource_base &r);
45 virtual void removeResource(Resource_base &r);
46 Resource_base *findResource(const std::string &resname);
47 const Resource_base *findResource(const std::string &resname) const;
48
49private:
50 typedef std::list<Resource_base *> ResourceList;
51
52 ResourceList m_resourcelist;
53 lua::state *m_l;
54 std::string m_root;
55};
56
57} // end namespace FbTk
58
59#endif // FBTK_LRESOURCE_HH