AddUserDefinedEditors is an entry point that Builder Xcessory uses to add new resource type editors. It takes no arguments and has no return value. If you are rebuilding Builder Xcessory using bx.o, you must provide at least an empty version of AddUserDefinedEditors.
Note: If you register an editor for a type already defined by Builder Xcessory (integer, font_list, etc.), your editor overrides the Builder Xcessory editor. This might be detrimental and is discouraged.
Use the function RegisterResourceEditor to provide Builder Xcessory with the list of functions to use to create, update, and retrieve values from the new resource type editor.
Call RegisterResourceEditor once for each new resource type editor that you are adding to Builder Xcessory.
RegisterResourceEditor Function Prototype
RegisterResourceEditor has the following function prototype:
-
void RegisterResourceEditor(char *resource_type,
EditorCreateFunc ext_create,
EditorUpdateFunc ext_update,
EditorGetFunc ext_fetch,
EditorCreateFunc simple_create,
EditorUpdateFunc simple_update,
EditorGetFunc simple_fetch)
resource_type The name of resource type. For example, in our example using the XmDumbLabel and its new resource "XmNjustify", the resource type is "justify".
ext_create The resource type editor creation function for the extended editor. See the description of this function in"Creation Functions" . If this value is NULL, Builder Xcessory creates the default editor, which is a Motif Text widget.
ext_update The resource type editor update function for the extended editor. See the description of this function in"Update Functions" . If this value is NULL, Builder Xcessory uses XmTextSetString to update the editor.
ext_fetch The resource type editor fetch function for the extended editor. See the description of this function in "Fetch Functions" . If this value is NULL, Builder Xcessory uses XmTextGetString to retrieve a value.
simple_create The resource type editor creation function for the simple editor. See the description of this function in"Creation Functions" . If this value is NULL, Builder Xcessory creates the default editor, which is a Motif Text widget.
simple_update The resource type editor update function for the extended editor. See the description of this function in"Update Functions" . If this value is NULL, Builder Xcessory uses the XmTextSetString to update the editor.
simple_fetch The resource type editor fetch function for the extended editor. See the description of this function in "Fetch Functions" . If this value is NULL, Builder Xcessory uses XmTextGetString to retrieve a value.
Example
As an example of using RegisterResourceEditor, the following code shows the call used to add the XmDumbLabel widget's "justify" type editor to Builder Xcessory:
-
void
AddUserDefinedEditors() -
{
RegisterResourceEditor("justify",
JustifyExtendedBuild,
JustifyExtendedUpdate,
JustifyExtendedFetch,
JustifySingleBuild,
JustifySingleUpdate,
JustifySingleFetch);
}
Once you write the code for the functions specified in this example, you must add them to Builder Xcessory, as described in the following sections.
Compiling to a Shared Library
Adding functions to Builder Xcessory by compiling
The preferred method for adding functions to Builder Xcessory is to compile your new functions and function AddUserDefinedEditors() together into a shared library (refer to you platform documentation for information on how to build a shared library) and put this new library in a directory searched by Builder Xcessory:
When you run Builder Xcessory next, it loads all libraries in these directories and calls AddUserDefinedEditors from each library.
Relinking Builder Xcessory
Adding functions to Builder Xcessory by relinking
An alternate method for adding functions to Builder Xcessory is to relink Builder Xcessory and provide function AddUserDefinedEditors (as well as empty implementations of AddUserWidgets and AddUserFunctions). Link everything with bx.o.
When you run the new Builder Xcessory executable, the new editors are available.
Note: The shared library method is not available on the SunOS 4 platform. You must relink Builder Xcessory with bx.o and your functions to add resource type editors on this platform.