//=-- ThemeManager.h - Provides a context to load user themes from -----------=
//
//  The ThemeManager class provides a context for loading themes and other 
//    input files.  If AllowUserThemes is true, then this class first searches
//    the user's local theme directory for the file.  If it is not found there
//    or if AllowUserThemes is false, then the ServerResourcesPath is checked.
//    If the file is not found there either, then an empty string is returned.
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-1998 Chris Lattner
//=---------------------------------------------------------------------------=

#ifndef THEMEMANAGER_H
#define THEMEMANAGER_H

class String; class CSString;
template <class Key, class Value> class Table;
template <class C> class LinkedList;
template <class P, class S> class DataPair;

class ThemeManager {
public :
  int AllowUserThemes;

  ThemeManager();
  ~ThemeManager();

  int AddThemeSourcePath(const String &ServerResourcesPath, 
                         const String &ServerResourcesURL, int ServerTheme);

  void PrintThemes();

  // FindTheme - Searches the user and server paths and returns the filename 
  //   of the theme.  If the theme isn't found, an nonzero value is returned.
  int FindTheme(const String &ThemeName,                           // In parameter
                String &ReturnPath, String &ReturnURL);            // Out parameters

private :
  // Keep track of directories already checked.
  LinkedList<String> *ResourcesSearched;

  // The Key is the theme name.  The first part of the value is the Path, the 
  // second portion is the theme URL.
  Table<CSString, DataPair<String,String> > *ThemesFound;
};

#endif
