OlCreateInputEventDB(3W) UNIX System V OlCreateInputEventDB(3W)
Database Utilities
NAME
OlCreateInputEventDB - create a client specific Key and/or Button
database
SYNOPSIS
#include <Xol/OpenLook.h>
...
OlVirtualEventTable
OlCreateInputEventDB(w, key_info, num_key_info, btn_info, num_btn_info)
Widget w;
OlKeyOrBtnInfo key_info;
int num_key_info;
OlKeyBtnInfo btn_info;
int num_btn_info;
DESCRIPTION
The OlCreateInputEventDB function is used to create a client specific Key
and/or Button database. This function returns a database pointer if the
call to this function is successful otherwise a NULL pointer is returned.
Mapping for a new virtual command can be composed from the mappings of a
previously defined virtual command.
The returned value from this function is an opaque pointer
(OlVirtualEventTable). A client application should use this pointer when
registering and/or looking up this database.
typedef struct OlVirtualEventInfo *OlVirtualEventTable;
The key_info and btn_info parameters are a pointer to an OlKeyOrBtnRec
structure.
typedef struct {
String name;
String defaultvalue; /* "," separate string */
OlVirtualName virtualname;
} OlKeyOrBtnRec, *OlKeyOrBtnInfo;
Caveat
A client application can create a Key only database by having the NULL
btn_info. The same applies to a Button only database.
Each virtual command can have two different bindings because the OPEN
LOOK toolkit allows the alternate key or button sequence.
The OPEN LOOK toolkit already has a set of predefined OPEN LOOK virtual
names. It is important that the virtual_name value of a client
application database starts with a big value to avoid the virtual_name
collision.
10/89 Page 1
OlCreateInputEventDB(3W) UNIX System V OlCreateInputEventDB(3W)
SEE ALSO
OlClassSearchIEDB(3W)
OlClassSearchTextDB(3W)
OlLookupInputEvent(3W)
OlWidgetSearchIEDB(3W)
OlWidgetSearchTextDB(3W)
EXAMPLE
/* To create a client application database */
...
#include <Xol/OpenLook.h>
...
/* start with a big value to avoid */
/* the "virtualname" collision */
#define OLMYBASE 1000
#define OLMYDRAWLINEBTN OLMYBASE+0
#define OLMYDRAWARCBTN OLMYBASE+1
#define OLMYREDISPLAYKEY OLMYBASE+2
#define OLMYSAVEPARTKEY OLMYBASE+3
#define XtNmyDrawLineBtn "myDrawLineBtn"
#define XtNmyDrawArcBtn "myDrawArcBtn"
#define XtNmyRedisplayKey "myRedisplayKey"
#define XtNmySavePartKey "mySavePartKey"
static OlKeyOrBtnRec OlMyBtnInfo[] = {
/*name defaultvalue virtualname */
{ XtNmyDrawLineBtn, "c<Button1>", OLMYDRAWLINEBTN },
{ XtNmyDrawArcBtn, "s<myDrawLineBtn>", OLMYDRAWARCBTN },
};
static OlKeyOrBtnRec OlMyKeyInfo[] = {
/*name defaultvalue virtualname */
{ XtNmyRedisplayKey, "c<F5>", OLMYREDISPLAYKEY },
{ XtNmySavePartKey, "c<F5>", OLMYSAVEPARTKEY },
};
static OlVirtualEventTable OlMyDB;
...
OlMyDB = OlCreateInputEventDB(
w,
OlMyKeyInfo, XtNumber(OlMyKeyInfo),
OlMyBtnInfo, XtNumber(OlMyBtnInfo)
);
...
Page 2 10/89