1 /*************************************************************************** 2 plugin_definitions.h - description 3 ------------------- 4 begin : ? 10? 27 2003 5 copyright : (C) 2003 by Sheldon Lee Wen 6 email : leewsb@hotmail.com 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 18 #ifndef PLUGINDEFINITIONS_H 19 # define PLUGINDEFINITIONS_H 20 21 # include <config.h> 22 # include <lineak/lconfig.h> 23 # include <lineak/configdirectives.h> 24 # include <lineak/lobject.h> 25 26 # include <iostream> 27 # include <stdlib.h> 28 extern "C" { 29 #include <X11/Xlib.h> 30 } 31 32 using namespace std; 33 class LObject; 34 class LKbd; 35 class displayCtrl; 36 class PluginManager; 37 38 namespace lineak_plugins 39 { 40 41 struct identifier_info 42 { 43 string description; 44 string identifier; 45 string type; 46 string version; 47 }; 48 49 ostream & operator<<(ostream &out, identifier_info &rhs); 50 51 /* Struct returned by the macrolist interface */ 52 struct macro_info 53 { 54 int num_macros; 55 string *macro_list; 56 string *macro_info; 57 }; 58 59 ostream & operator<<(ostream &out, macro_info &rhs); 60 61 /** Struct returned by the directivelist interface */ 62 struct directive_info 63 { 64 ConfigDirectives *directives; 65 }; 66 67 ostream & operator<<(ostream &out, directive_info &rhs); 68 69 /** This is the information that we are passing to the 70 * initialize interface. */ 71 struct init_info 72 { 73 LKbd *kbd; 74 LConfig *config; 75 PluginManager *plugins; 76 bool verbose; 77 bool very_verbose; 78 bool global_enable; 79 //bool have_display; 80 }; 81 82 ostream & operator<<(ostream &out, init_info &rhs); 83 84 /** General interfaces */ 85 typedef identifier_info *(*identifier_t) (); 86 typedef int (*initialize_t) (init_info init); 87 typedef int (*initialize_display_t) (displayCtrl * myDisplay); 88 typedef void (*cleanup_t) (); 89 90 /** INterfaces for macro plugins */ 91 typedef int (*exec_t) (LObject * imyKey, XEvent xev); 92 typedef macro_info *(*macrolist_t) (); 93 94 /** Interfaces for display plugins */ 95 typedef directive_info *(*directivelist_t) (); 96 typedef displayCtrl *(*get_display_t) (); 97 typedef void (*display_show_t) (); 98 typedef void (*display_volume_t) (); 99 100 101 struct plugin_info 102 { 103 void *handle; 104 string filename; // this is the filename of the plugin. 105 identifier_info *identifier; 106 // Interfaces mostly used for macro plugins. 107 exec_t exec; 108 macrolist_t macrolist; 109 // Interfaces mostly used for diplay plugins. 110 get_display_t get_display; 111 //display_show_t show; 112 //display_volume_t volume; 113 // Interfaces used by all plugins. 114 cleanup_t cleanup; 115 initialize_t initialize; 116 initialize_display_t initialize_display; 117 directivelist_t directivelist; 118 // Flags for interfaces. 119 bool initialized_display; 120 bool directives_defined; 121 bool macros_defined; 122 bool loaded; 123 bool initialized; 124 // Lists of which macros and directives a plugin supports. 125 vector < string > macros; 126 ConfigDirectives directives; 127 }; 128 129 ostream & operator<<(ostream &out, plugin_info &rhs); 130 } 131 #endif 132