- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

uplugin.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/uplugin.hpp 00008 begin : Wed Apr 2 2003 00009 $Id: uplugin.hpp,v 1.8 2005/05/21 15:17:23 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 #ifndef UPLUGIN_HPP 00029 #define UPLUGIN_HPP 00030 00031 #include "uobject.hpp" 00032 #include "font/ufontinfo.hpp" 00033 00034 namespace ufo { 00035 00036 class UFontRenderer; 00037 class ULookAndFeel; 00038 class UVideoDriver; 00039 class USharedLib; 00040 00046 class UFO_EXPORT UPluginBase : public UObject { 00047 UFO_DECLARE_DYNAMIC_CLASS(UPluginBase) 00048 }; 00049 00050 typedef UPluginBase* (*plugin_create_t)(void); 00051 typedef void (*plugin_destroy_t)(UPluginBase*); 00052 00053 #define UFO_PLUGIN(category, feature, plugin) \ 00054 extern "C" { \ 00055 const char* ufo_plugin_category = category; \ 00056 const char* ufo_plugin_feature = feature; \ 00057 UPluginBase* ufo_plugin_create() \ 00058 { return static_cast<PluginBase*>(new plugin()); } \ 00059 void ufo_plugin_destroy(PluginBase* c) \ 00060 { delete static_cast<plugin*>(c); } \ 00061 } 00062 00069 struct UFO_EXPORT UPluginInfo { 00073 USharedLib * lib; 00075 std::string category; 00077 std::string feature; 00078 plugin_create_t create; 00079 plugin_destroy_t destroy; 00080 }; 00081 00082 00083 inline UFO_EXPORT bool operator==(const UPluginInfo & p1,const UPluginInfo & p2) { 00084 return ( 00085 p1.lib == p2.lib && 00086 p1.category == p2.category && 00087 p1.feature == p2.feature && 00088 p1.create == p2.create && 00089 p1.destroy == p2.destroy 00090 ); 00091 } 00092 00100 class UFO_EXPORT UFontPlugin : public UPluginBase { 00101 UFO_DECLARE_DYNAMIC_CLASS(UFontPlugin) 00102 public: 00106 virtual UFontRenderer * createFontRenderer(const UFontInfo & fontInfo) = 0; 00110 virtual UFontInfo queryFont(const UFontInfo & fontInfo) = 0; 00111 virtual std::vector<UFontInfo> listFonts(const UFontInfo & fontInfo) = 0; 00112 virtual std::vector<UFontInfo> listFonts() = 0; 00113 }; 00114 00121 class UFO_EXPORT ULAFPlugin : public UPluginBase { 00122 UFO_DECLARE_DYNAMIC_CLASS(ULAFPlugin) 00123 public: 00124 virtual ULookAndFeel * createLookAndFeel() = 0; 00125 }; 00126 00134 class UFO_EXPORT UImageIOPlugin : public UPluginBase { 00135 UFO_DECLARE_DYNAMIC_CLASS(UImageIOPlugin) 00136 public: 00137 }; 00138 00144 class UFO_EXPORT UVideoPlugin : public UPluginBase { 00145 UFO_DECLARE_DYNAMIC_CLASS(UVideoPlugin) 00146 public: 00147 virtual bool isAvailable() = 0; 00148 virtual UVideoDriver * createVideoDriver() = 0; 00149 }; 00150 00151 } // namespace ufo 00152 00153 #endif // UPLUGIN_HPP

The libUFO Project - written by Johannes Schmidt