kpilot Library API Documentation

jplugin.h

00001 /***************************************************************************
00002                           jplugin.h  -  description
00003                              -------------------
00004     begin                : Sat Mar 16 2002
00005     copyright            : (C) 2002 by reinhold
00006     email                : reinhold@albert
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef JPLUGIN_H
00019 #define JPLUGIN_H
00020 
00021 #include <qstring.h>
00022 #include <stdlib.h>
00023 #include <stdio.h>
00024 #include <klibloader.h>
00025 
00026 extern "C" {
00027 #undef signals /* GTK uses "signals" as variable name :( */
00028 #include "JPilotAPI/libplugin.h"
00029 //#include <gtk/gtk.h>
00030 #define signals protected /* GTK is done messing up ;) */
00031 
00032 //typedef int GtkWidget;
00033 
00034 
00039   // type definitions of the callback functions in the JPIlot plugins
00040 typedef int (*T_get_name)(char *name, int len);
00041 typedef int (*T_get_menu_name)(char *name, int len);
00042 typedef int (*T_get_help_name)(char *name, int len);
00043 typedef int (*T_get_db_name)(char *db_name, int len);
00044 typedef int (*T_startup)(jp_startup_info *info);
00045 typedef int (*T_gui)(GtkWidget *vbox, GtkWidget *hbox, unsigned int unique_id);
00046 typedef int (*T_help)(char **text, int *width, int *height);
00047 typedef int (*T_print)();
00048 typedef int (*T_gui_cleanup)(void);
00049 typedef int (*T_pre_sync)(void);
00050 typedef int (*T_sync)(int sd);
00051 typedef int (*T_search)(char *search_string, int case_sense, struct search_result **sr);
00052 typedef int (*T_post_sync)(void);
00053 typedef int (*T_exit_cleanup)(void);
00054 typedef void (*T_versionM)(int *major_version, int *minor_version);
00055 
00056 }
00057 
00058 
00059 /* this structure holds *ALL* information about the dynamically linked library (aka. plugin)
00060    the references to the callback functions are retrieved when they are really needed */
00061 struct plugin_s {
00062     bool sync_on;
00063     unsigned char user_only;
00064     QString fullpath;
00065     QString name;
00066     QString menu_name;
00067     QString help_name;
00068     QString db_name;
00069     int number;
00070 };
00071 
00072 
00073 class JPlugin {
00074 public:
00075     JPlugin();
00076     JPlugin(QString filename);
00077     ~JPlugin();
00078     bool unload();
00079     bool load(QString fn);
00080     void init_info_null(struct plugin_s *p);
00081     void exit_info(struct plugin_s *);
00082     bool get_plugin_info(struct plugin_s *p, QString path);
00083     
00084     int startup(jp_startup_info*si);
00085     int gui(GtkWidget*vbox, GtkWidget*hbox, unsigned int uID);
00086     int gui_cleanup();
00087     int help(char** text, int*width, int*height);
00088     int pre_sync();
00089     int sync(int sd);
00090     int post_sync();
00091     int exit_cleanup();
00092     bool hasGui();
00093     
00094     bool loaded;
00095     plugin_s info;
00096     KLibrary *lib;
00097 };
00098 
00099 
00100 
00101 
00102 #endif
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:47 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003