OpenDoc > Library >
Listing 2. Code snippets from the .cpp implementation file for KeyPadPart
The complete OS/2
implementation for this class is available as part of a Redbook produced by IBM.
SOM_Scope void SOMLINK KPInitSemanticInterface(
KeyPadPart *somSelf,
Environment *ev)
{
...
_fSemtIntf = new ODSemanticInterface();
// ODSemanticInterface derives directly from
// ODBaseSemanticInterface,
// shown in Figure 1. above. This call instantiates
// the ODSemanticInterface extension.
_fSemtIntf->InitSemanticInterface(ev, somSelf,
_fSession);
// This call initializes the ODSemanticInterface
// extension.
...
}
============================================================
SOM_Scope ODBoolean SOMLINK HasExtension(
KeyPadPart *somSelf,
Environment *ev,
ODType extensionName)
{
...
if (!strcmp(extensionName, kODExtSemanticInterface)) {
// kODExtSemanticInterface is a constant defined
// in the stdexts.xh header file
return kODTrue;
} else {
// Check to see if the parent supports this extension
return (KeyPadPart_parent_SimplePart_HasExtension(
somSelf,
ev,
extensionName));
}
}
============================================================
SOM_Scope ODExtension* SOMLINK AcquireExtension(
KeyPadPart *somSelf,
Environment *ev,
ODType extensionName)
{
...
if(!strcmp(extensionName, kODExtSemanticInterface)) {
return _fSemtIntf;
// return the extension we instantiated when
// KeyPadPart was initialized
}
,,,
}