aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Image.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/Image.hh')
-rw-r--r--src/FbTk/Image.hh72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/FbTk/Image.hh b/src/FbTk/Image.hh
new file mode 100644
index 0000000..49c9340
--- /dev/null
+++ b/src/FbTk/Image.hh
@@ -0,0 +1,72 @@
1// Image.hh for FbTk - Fluxbox ToolKit
2// Copyright (c) 2003 Henrik Kinnunen (fluxgen at users.sourceforge.net)
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// $Id: Image.hh,v 1.3 2003/12/16 17:06:51 fluxgen Exp $
23
24#ifndef FBTK_IMAGE_HH
25#define FBTK_IMAGE_HH
26
27#include <string>
28#include <list>
29#include <map>
30
31namespace FbTk {
32
33class ImageBase;
34class PixmapWithMask;
35
36/// loads images
37class Image {
38public:
39 /// @return an instance of PixmapWithMask on success, 0 on failure
40 static PixmapWithMask *load(const std::string &filename, int screen_num);
41 /// for register file type and imagebase
42 /// @return false on failure
43 static bool registerType(const std::string &type, ImageBase &base);
44 /// removes a imagebase class from register
45 /// @return false on failure
46 static void remove(ImageBase &base);
47 /// adds a path to search images from
48 static void addSearchPath(const std::string &search_path);
49 /// removes a path to search images from
50 static void removeSearchPath(const std::string &search_path);
51 /// adds a path to search images from
52 static void removeAllSearchPaths();
53private:
54 typedef std::map<std::string, ImageBase *> ImageMap;
55 typedef std::list<std::string> StringList;
56
57 static ImageMap s_image_map;
58 static StringList s_search_paths;
59};
60
61/// common interface for all image classes
62class ImageBase {
63public:
64 virtual ~ImageBase() { Image::remove(*this); }
65 virtual PixmapWithMask *load(const std::string &name, int screen_num) const = 0;
66};
67
68} // end namespace FbTk
69
70#endif // IMAGE_HH
71
72