Chapter 7: Flash Application Layout
59
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
case CM_UNPACK:
/* Pass the event on to the Target app before applying
the localizer hook. */
AppProcessEvent(super, e);
localize(self, XR_stringPtr(XR_NativeLanguage));
break;
case CM_UNINSTALL:
case CM_PACK:
/* Unhook the localizer before passing the event on to the
Target app */
unlocalize(self);
default:
/* Forward all events to their rightful owner */
AppProcessEvent(super, e);
}
}
/**********************************************************************
If requested language matches the language we know, hook over
Target app.
**********************************************************************/
BOOL localize(pFrame self, char *requestedLang)
{
if (hook == 0 && strcmp(requestedLang, MyLang) == 0)
return OO_InstallAppHookByName(TargetApp, (pFrame)&TargetStrings, &hook);
return FALSE;
}
/**********************************************************************
Unhook from Target app if we have anything to unhook.
**********************************************************************/
void unlocalize(pFrame self)
{
if (hook)
{
OO_UninstallAppHookByName(TargetApp, hook);
hook = 0;
}
}
/**********************************************************************
We have just been notified that a new app was installed. Is it our
Target application? If so, apply our localization to it.
**********************************************************************/
void noticeInstall(pFrame self, ACB const *pacb)
{
if (strcmp((char *)pacb->appHeader->name, (char *)TargetApp) == 0)
localize(self, XR_stringPtr(XR_NativeLanguage));
}