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.hh70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/FbTk/Image.hh b/src/FbTk/Image.hh
new file mode 100644
index 0000000..c655a2e
--- /dev/null
+++ b/src/FbTk/Image.hh
@@ -0,0 +1,70 @@
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.1 2003/08/22 21:25:14 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 /// adds a path to search images from
50 static void removeAllSearchPaths();
51private:
52 typedef std::map<std::string, ImageBase *> ImageMap;
53 typedef std::list<std::string> StringList;
54
55 static ImageMap s_image_map;
56 static StringList s_search_paths;
57};
58
59/// common interface for all image classes
60class ImageBase {
61public:
62 virtual ~ImageBase() { Image::remove(*this); }
63 virtual PixmapWithMask *load(const std::string &name, int screen_num) const = 0;
64};
65
66}; // end namespace FbTk
67
68#endif // IMAGE_HH
69
70