Main Page   File List   File Members  

eboxyplugin.h File Reference

eboxy Plugin API header More...

#include "plugintypes.h"

Go to the source code of this file.

Functions

int findObject (const char *object, const char *type)
 Finds a specific object by name, and optionally type.

const char * typeOfObject (const char *object)
 Gets the type name of an object.

char * getPropertyAsString (const char *object, const char *property)
 Gets the string value of a property.

int setPropertyAsString (const char *object, const char *property, const char *value)
 Sets the string value of a property.

char * callMethod (const char *object, const char *method, int numargs, const char *args[])
 Calls a method on an object.

void callMethodNoReturn (const char *object, const char *method, int numargs, const char *args[])
 Calls a method on an object, when you don't care about the return value.

int registerObject (const char *name)
 Registers a new custom object.

int registerPropertyDL (const char *object, const char *property, const char *getter, const char *setter)
 Registers a property on a custom object.

int registerEventHandlerDL (const char *object, const char *event, const char *eventfunc)
 Registers a handler for an event.

int registerMethodDL (const char *object, const char *method, int numargs, const char *methodfunc)
 Registers a method on a custom object.

int fireEvent (const char *object, const char *event)
 Fires an event on an object.

const struct plugin_info * getPluginInfo (const char *name)
 Gets information on a loaded plugin.

void setPluginInfo (const char *namestring, const char *verstring)
 Sets information for your plugin.

void requestUnload (void)
 Tells eboxy that your plugin should be unloaded as soon as possible.

int changePage (const char *pagename)
 Changes the current page.

int loadXMLFile (const char *filename, const char *pagename)
 Loads a new XML file.

int performAction (const char *actionname)
 Performs an eboxy action (see documentation for action list).

int isPluginLoaded (const char *name)
 Checks if a plugin is loaded.

int unregisterObject (const char *name)
 Unregisters a previously registered custom object.

int unregisterEventHandlerDL (const char *object, const char *event)
 Unregisters a previously registered handler for an event.

int createWidget (const char *name, const char *type, const char *templatename)
 Creates a widget at runtime.

int createPage (const char *name)
 Creates a page at runtime.

int cloneWidget (const char *original, const char *duplicate)
 Creates a copy of an existing widget at runtime.

int deleteWidget (const char *name)
 Deletes a widget at runtime.

int deletePage (const char *name)
 Deletes a page at runtime.

int runScript (const char *code, int flags)
 Execute the specified eboxy script code.


Detailed Description

eboxy Plugin API header


Function Documentation

char* callMethod const char *    object,
const char *    method,
int    numargs,
const char *    args[]
 

Calls a method on an object.

Parameters:
object  the name of the object
method  the name of the method
numargs  the number of arguments being passed to the function (must be equal to the number specified when the method was registered).
args  the arguments to pass to the function (pass NULL and 0 for numargs for no arguments).
Returns:
return value of method (NULL if none). Must be freed if not NULL (use callMethodNoReturn() if you don't care about the return value).

void callMethodNoReturn const char *    object,
const char *    method,
int    numargs,
const char *    args[]
 

Calls a method on an object, when you don't care about the return value.

Parameters:
object  the name of the object
method  the name of the method
numargs  the number of arguments being passed to the function (must be equal to the number specified when the method was registered).
args  the arguments to pass to the function (pass NULL and 0 for numargs for no arguments).

int changePage const char *    pagename
 

Changes the current page.

Parameters:
pagename  the name of the page to change to
Returns:
0 on success, non-zero on failure.

int cloneWidget const char *    original,
const char *    duplicate
 

Creates a copy of an existing widget at runtime.

Note that to actually make use of this widget, you will need to add it to the current page (possibly adjusting its property values beforehand).

Parameters:
original  the name of the widget to clone
duplicate  the name of the new duplicate widget
Returns:
0 on success, non-zero on failure.

int createPage const char *    name
 

Creates a page at runtime.

Parameters:
name  the name of the new page
Returns:
0 on success, non-zero on failure.

int createWidget const char *    name,
const char *    type,
const char *    templatename
 

Creates a widget at runtime.

Note that to actually make use of this widget, you will need to set its properties and then add it to the current page.

Parameters:
name  the name of the new widget
type  the type of widget to create. These are the same names as used in the XML skin file.
templatename  the name of a template from the current XML file to apply to the new widget (optional - pass NULL if unused).
Returns:
0 on success, non-zero on failure.

int deletePage const char *    name
 

Deletes a page at runtime.

The page you are deleting can be any page, dynamically created or otherwise, as long as it is not currently being displayed.

Parameters:
name  the name of the page to delete
Returns:
0 on success, non-zero on failure.

int deleteWidget const char *    name
 

Deletes a widget at runtime.

The widget cannot be added to a page at this time - you must remove it first.

Parameters:
name  the name of the widget to delete
Returns:
0 on success, non-zero on failure.

int findObject const char *    object,
const char *    type
 

Finds a specific object by name, and optionally type.

Parameters:
object  the name of the object
type  the type name of the object you're looking for. Pass NULL if you don't care about the type.
Returns:
1 if the object exists, 0 if not.

int fireEvent const char *    object,
const char *    event
 

Fires an event on an object.

Events can only be fired on objects that your plugin created.

Parameters:
object  the name of the object
event  the name of the event
Returns:
0 on success, non-zero on failure.

const struct plugin_info* getPluginInfo const char *    name
 

Gets information on a loaded plugin.

Parameters:
name  the name of the plugin
Returns:
a struct containing info on the plugin.

char* getPropertyAsString const char *    object,
const char *    property
 

Gets the string value of a property.

Parameters:
object  the name of the object
property  the name of the property
Returns:
the value of the specified property (or NULL in case of an error).

int isPluginLoaded const char *    name
 

Checks if a plugin is loaded.

Parameters:
name  the name of the plugin
Returns:
1 if the plugin is loaded, 0 if not.

int loadXMLFile const char *    filename,
const char *    pagename
 

Loads a new XML file.

Parameters:
filename  the XML file to load.
pagename  the name of the page to start with (pass NULL to use the first listed).
Returns:
0 on success, non-zero on failure.

int performAction const char *    actionname
 

Performs an eboxy action (see documentation for action list).

Parameters:
actionname  the name of the action.
Returns:
0 on success, non-zero on failure.

int registerEventHandlerDL const char *    object,
const char *    event,
const char *    eventfunc
 

Registers a handler for an event.

Note: you will not get an error if you register for an event that will never be triggered, so be careful to type the name correctly.

Parameters:
object  the name of the object
event  the name of the event
eventfunc  exact name of the function to call in your plugin when the event occurs. The function should be defined like this (with your own name, of course):
  int eventhandler(const char *sender)
The return value of this function is currently unused, but you should return 0 for compatibility with future usage.
Returns:
0 on success, non-zero on failure.

int registerMethodDL const char *    object,
const char *    method,
int    numargs,
const char *    methodfunc
 

Registers a method on a custom object.

Methods can only be registered on objects that your plugin created.

Parameters:
object  the name of the object
method  the name of the method
numargs  the number of arguments the function expects
methodfunc  exact name of the function to call in your plugin when the method is called. The function should be defined like this (with your own name, of course):
  const char *methodcall(const char *sender, int numargs, const char *args[])
The return value of this function is accessible in scripts. You may return anything you like, as long as it isn't NULL or an invalid pointer. Return empty string ("") if you don't want to return anything.
Returns:
0 on success, non-zero on failure.

int registerObject const char *    name
 

Registers a new custom object.

Parameters:
name  the name of the object
Returns:
0 on success, non-zero on failure.

int registerPropertyDL const char *    object,
const char *    property,
const char *    getter,
const char *    setter
 

Registers a property on a custom object.

Properties can only be registered on objects that your plugin created.

Parameters:
object  the name of the object
property  the name of the property
getter  exact name of the function to call in your plugin to get the value of this property. The function should be defined like this (with your own name, of course):
  const char *getter(const char *sender)
You may pass NULL for this parameter, in which case the property will be write-only.
setter  exact name of the function to call in your plugin to set the value of this property. The function should be defined like this (with your own name, of course):
  void setter(const char *sender, const char *value)
You may pass NULL for this parameter, in which case the property will be read-only.
Returns:
0 on success, non-zero on failure.

int runScript const char *    code,
int    flags
 

Execute the specified eboxy script code.

Parameters:
code  a string containing the script code to execute
flags  1 to allow potentially dangerous commands (such as exec) to be used, zero otherwise. All other values are reserved (and ignored) at this time and should not be supplied.
Returns:
0 on success, non-zero on failure. If the trusted flag is turned off, the following commands are disabled within the specified code, and will result in an error: exec, execwait, exechide, load, loadplugin.

void setPluginInfo const char *    namestring,
const char *    verstring
 

Sets information for your plugin.

This should only ever be called once, in your plugin's ebplugin_init function.

Parameters:
namestring  the full name of your plugin (excluding version information, otherwise freeform)
verstring  a version string for your plugin (freeform)

int setPropertyAsString const char *    object,
const char *    property,
const char *    value
 

Sets the string value of a property.

Parameters:
object  the name of the object
property  the name of the property
value  the value to set the property to

const char* typeOfObject const char *    object
 

Gets the type name of an object.

Parameters:
object  the name of the object
Returns:
the type name of the specified object or NULL if the object doesn't exist.

int unregisterEventHandlerDL const char *    object,
const char *    event
 

Unregisters a previously registered handler for an event.

Note: it is not required that you unregister events - only if you wish to stop handling them for some reason but still keep the plugin running. (Event handlers are automatically unregistered when the plugin that owns them is unloaded).

Parameters:
object  the name of the object
event  the name of the event
Returns:
0 on success, non-zero on failure.

int unregisterObject const char *    name
 

Unregisters a previously registered custom object.

Also unregisters properties, methods and event handlers registered on the object. Note: it is not required that you unregister objects you create - only if you wish to withdraw them from service for some reason but still keep the plugin running. (Objects are automatically unregistered when the plugin that owns them is unloaded).

Parameters:
name  the name of the object
Returns:
0 on success, non-zero on failure.


Generated on Sun Mar 21 18:33:53 2004 for eboxy by doxygen1.2.16