HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_IconManager.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_IconManager.h (C++)
7  *
8  * COMMENTS: A very simple class to help with finding and otherwise
9  * dealing with icon files.
10  */
11 
12 #ifndef __UT_IconManager__
13 #define __UT_IconManager__
14 
15 #include "UT_API.h"
16 #include "UT_UniquePtr.h"
17 
18 
19 #define UT_ICON_MAXSIZE 64
20 
21 enum
23 {
26 };
27 
28 class UT_PathSearch;
29 class UT_String;
30 
32 {
33 public:
35 
36  /// Gets the first icon (of type SGI, image, or SVG) in the icon path
37  /// that matches the icon root name. Sets 'iconpath' to the full path
38  /// to that icon file, and if type is set to a non-NULL pointer, sets
39  /// the type appropriately.
40  /// Returns true if an icon was found, and false otherwise.
41  bool getFirstIconFile(const char *iconroot,
42  UT_String &iconpath,
43  UT_IconType *type = NULL);
44 
45  /// As in getFirstIconFile, but only finds image icons.
46  bool getFirstImageFile(const char *imageroot,
47  UT_String &imagepath);
48 
49  /// As in getFirstIconFile, but only finds SVG icons.
50  bool getFirstSVGFile(const char *svgroot,
51  UT_String &svgpath);
52 
53  // This returns a pointer to a list of pointers to strings. The last
54  // one will be null marking the end of the list.
55  static const char **getValidExts();
56 
57  // Returns true if the extension in the filename matches one of the valid
58  // extensions.
59  static bool hasValidExt(const UT_String &filename);
60 
61 private:
62  bool getFirstFile(const char *iconroot,
63  UT_String &iconpath,
65  bool doimages,
66  bool dosvg);
67 
68  static const char *theValidExts[];
69  static const UT_IconType theExtTypes[];
70 };
71 
73 
74 #endif
75 
GT_API const UT_StringHolder filename
#define UT_API
Definition: UT_API.h:14
UT_API UT_IconManager * UTgetIconManager()
UT_IconType
type
Definition: core.h:1059