omtk - a platform independent GUI toolkit

Documentation

 

Event

Structures

Updated in omtk 0.1.2.

typedef struct OmtkEvent

typedef struct
{
  OmtkWidget *widget;
  OmtkWidget *document;
  int event;
  void *custom;
} OmtkEvent;

This structure is passed to a callback function of an event.

  • widget: The affected widget, or NULL if it's an application event
  • document: The document of the widget, or NULL if the widget is not in a document
  • event: The event type, usually an OMTK_EVENT_* constant
  • custom: A user defined pointer that was passed to this callback function (can be NULL).

Functions

Updated in omtk 0.1.2.

omtk_event_add()

void omtk_event_add(OmtkWidget *widget, int event, \
    int (*function)(OmtkEvent *e), void *custom);

Adds an event.

  • widget is the affected widget, or NULL if it's an application event.
  • event is the event type, usually an OMTK_EVENT_* constant.
  • function is the callback function. This function will be called when the event occurs.
  • custom can be a pointer or NULL. This pointer will be passed to the callback function.

Example:

/* our callback function */
int app_launched(OmtkEvent *event)
{
  /* event->custom == 1234 */
  printf("the application launched! %d\n", (int)event->custom);
  return 0;
}

void add_event(void)
{
  omtk_event_add(NULL, OMTK_EVENT_DID_LAUNCH, app_launched, (void *)1234);
}

omtk_event_perform()

int omtk_event_perform(OmtkWidget *widget, int event);

This function performs an event. Do not use it if you don't know what you do.

Example:

omtk_event_perform(item, OMTK_EVENT_DID_CLICK); /* item is an OmtkWidget* */

omtk_event_free()

void omtk_event_free(OmtkWidget *widget);

Frees all events of a widget. You shouldn't use this function.

omtk_event_freeall()

void omtk_event_freeall(void);

This function frees all events. Do not use it if you don't know what you do.



Zurück zu www.eggdrop.ch | Back to www.eggdrop.ch

Last update: 20.02.04

Copyright (C) 2004, 2005 by Thomas "tom" Steinacher <tom at eggdrop.ch>

SourceForge.net Logo Valid HTML 4.0!