RFC - PrefListener API

Stephen Hack (shack@uiuc.edu)
Thu, 14 Oct 1999 21:08:14 -0500


--9amGYk9869ThD9tj
Content-Type: text/plain; charset=us-ascii

I saw a reference to this in the text/fmt/xp/fl_DocLayout.cpp:109
Since I would find it useful, and am willing to implement it, I want to toss
the idea out to the list.

-shack

--9amGYk9869ThD9tj
Content-Type: text/plain
Content-Disposition: attachment; filename="PrefsListener.txt"

PrefsListener API
---------------------------------------------------------------------------
Stephen Hack (shack@uiuc.edu)
Thu Oct 14 21:04:30 CDT 1999

1. Callback Function Prototype

The call back routine will be of type PrefsListener
ie. typedef void (*PrefsListener)(
XAP_App *pApp,
XAP_Prefs *pPrefs,
XML_Char *key,
XML_Char *oldval, // ?? needed ??
XML_Char *newval,
void *data ); // data that is passed in ( could be the
*this pointer)

2. Functions to interact w/ a given Pref Value

PrefsCondition = {
enum { KEY_EXACT, KEY_BEGINS_WITH, KEY_REGEXP, ... } condition_type;
XML_Char *string; // key pattern
}

Prefs->addListener( PrefsCondition, PrefsListener, void *data );
Prefs->removeListener( PrefsCondition, PrefsListener, void *data );

This will allow a given section of code the ability to instruct the Prefs
class to notify it when preference(s) are changed.

An Example: The code that automatically checks the spelling, the
"AutoSpellCheck" preference, could get notified when the options dialog (or
toolbar, or menu...) changes the preference. This would seperate the changing
of preferences and the internal changes/effects.

--9amGYk9869ThD9tj--



This archive was generated by hypermail 1.03b2.