home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 8 Other
/
08-Other.zip
/
SOMINF.ZIP
/
INTEGRAT.INF
(
.txt
)
< prev
next >
Wrap
OS/2 Help File
|
1992-07-15
|
11KB
|
333 lines
ΓòÉΓòÉΓòÉ 1. Levels of Integration ΓòÉΓòÉΓòÉ
This is a review of the levels of integration.
ΓòÉΓòÉΓòÉ 1.1. Level 1 ΓòÉΓòÉΓòÉ
o Provide OO File capabilities
o Drag/Drop to open applications
o Exploit Drag/Drop rendering
o CUA 91 controls (notebooks, containers)
o Shutdown notification
o Online Documentation
o OO Install
Code Necessary: Presentation Manager additions to existing code.
ΓòÉΓòÉΓòÉ 1.2. Level 2 ΓòÉΓòÉΓòÉ
o Intelligent Printing (drag and drop data files)
o Special Folder Behavior
o Multiple Views
Code Necessary: Presentation Manager additions to existing code, subclass
WPDataFile to add WPS functions without redesigning existing
code.
ΓòÉΓòÉΓòÉ 1.3. Level 3 ΓòÉΓòÉΓòÉ
o Object View replaces Application View
o Application consists of objects on the desktop
Code Necessary: Presentation Manager additions to existing code, subclass
WPDataFile to add WPS functions, restructure application as
objects.
ΓòÉΓòÉΓòÉ 2. Methodologies ΓòÉΓòÉΓòÉ
These are the different methods of integration with the Workplace Shell.
ΓòÉΓòÉΓòÉ 2.1. Ignore It ΓòÉΓòÉΓòÉ
Level 0. This is not recommended!
If you do nothing else, make sure your program will accept a filename as a
parameter from the command line. Since the default drag and drop behavior is to
invoke the program named and pass the physical name of the file being dropped,
then if your customer creates a program object that points at your executable,
the drag and drop will work.
You can save your customer some time by installing the executable as a program
object to allow drag and drop initiation, and to register any supported file
types. This simple install procedure will save the customer having to create
the object from a program template.
ΓòÉΓòÉΓòÉ 2.2. Emulate It ΓòÉΓòÉΓòÉ
Level 1.
You can obtain many benefits of the Workplace Shell interface by using
Presentation Manager APIs, for example, Drag and Drop support.
This method requires adding more PM code to your existing application, but
could avoid any SOM or Workplace programming.
Level 2.
To take advantage of even more of the Workplace functionality, while still
avoiding writing a complete Workplace Shell application, implement an object
descended from WPDataFile which has the following methods overridden.
o Instance Methods
o Class Methods
o Other Updates
ΓòÉΓòÉΓòÉ 2.3. Use It ΓòÉΓòÉΓòÉ
Level 3. This is not recommended!
Create a Workplace object, and add any additional processing the application
needs.
This application will run in the Workplace Shell process, and can be
interrupted if any other WPS application fails.
ΓòÉΓòÉΓòÉ 2.4. Integrate With It ΓòÉΓòÉΓòÉ
Level 3.
A Workplace object can be created which allows full use of the OO User
Interface, but which also protects application-specific processing from the
concerns with running in the Shell process.
Create a Workplace object which provides the user interface, and have it spawn
background processes which do the real work of the application.
Note: Whenever possible, work should be accomplished in its own process, to
minimize the amount of processing in the shell itself.
Some Critical Workplace Methods:
Method Notes
wpOpen Make sure you process any different views (i.e. Settings)
wpPrint Override the Print methods which your object supports
wpDrop Override the other drag and drop methods as well
For example, this is a demo which reports what object is dropped on it.
ΓòÉΓòÉΓòÉ 3. The Ten Steps ΓòÉΓòÉΓòÉ
1. Design Your Object
2. Design Its Views
3. Choose a Parent Class for subclassing
4. Create the Class Definition for Your Object
5. Compile the Class Definition
6. Add Your Object-specific code
7. Compile & Link Your Object
8. Register Your Object with the WPS
9. Instantiate Your Object
10. Test and Iterate
ΓòÉΓòÉΓòÉ <hidden> Installing a Program into the Shell ΓòÉΓòÉΓòÉ
#define INCL_WINWORKPLACE
#include <os2.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
CHAR szTitle[80];
CHAR szSetup[120];
strcpy(szTitle, argv[1]);
strcpy(szSetup, "EXENAME=");
strcat(szSetup, argv[1]);
printf("[%ld]", WinCreateObject("WPProgram",
szTitle,
szSetup,
"<WP_DESKTOP>",
CO_FAILIFEXISTS));
}
ΓòÉΓòÉΓòÉ <hidden> Who Am I? - An Example Application ΓòÉΓòÉΓòÉ
This is the Whoami application. It reports the actual name of an object
whenever an object is dropped on it. It also explains its usage when opened.
o CSC file
o C source
ΓòÉΓòÉΓòÉ <hidden> CSC (SOM Source) ΓòÉΓòÉΓòÉ
#include <wpabs.sc>
class: Whoami,
external stem = WAI,
local,
major version = 1,
minor version = 1;
parent: WPAbstract;
passthru: C.ih;
#define INCL_WINWORKPLACE
#include <os2.h>
endpassthru;
methods:
override wpOpen;
override wpDrop;
ΓòÉΓòÉΓòÉ <hidden> C (User-Modified) Source ΓòÉΓòÉΓòÉ
/*
* This file was generated by the SOM Compiler.
* FileName: whoami.c.
* Generated using:
* SOM Precompiler spc: 1.22
* SOM Emitter emitc: 1.24
*/
#define Whoami_Class_Source
#include "whoami.ih"
SOM_Scope MRESULT SOMLINK wpDrop(Whoami *somSelf,
HWND hwndCnr,
PDRAGINFO pdrgInfo,
PDRAGITEM pdrgItem)
{
char szDataType[80];
/* WhoamiData *somThis = WhoamiGetData(somSelf); */
WhoamiMethodDebug("Whoami","wpDrop");
DrgQueryStrName(pdrgItem->hstrSourceName, 80, szDataType);
WinMessageBox(HWND_DESKTOP,
HWND_DESKTOP,
szDataType,
"Who Am I?",
0,
MB_NOICON | MB_OK | MB_MOVEABLE);
return 0;
}
SOM_Scope HWND SOMLINK wpOpen(Whoami *somSelf,
HWND hwndCnr,
ULONG ulView,
ULONG param)
{
/* WhoamiData *somThis = WhoamiGetData(somSelf); */
WhoamiMethodDebug("Whoami","wpOpen");
if (ulView != OPEN_SETTINGS)
WinMessageBox(HWND_DESKTOP,
HWND_DESKTOP,
"This program identifies objects dropped on it.",
"Who Am I?",
0,
MB_MOVEABLE | MB_OK);
else
return (parent_wpOpen(somSelf,hwndCnr,ulView,param));
}
ΓòÉΓòÉΓòÉ <hidden> Instance Methods ΓòÉΓòÉΓòÉ
Method Processing
wpSetup Start an instance of the application to process
the file.
o Call parent_wpSetup()
o Query the realname of the data file (wpQueryFileName)
o DosOpen() the file
o Write intial valid data so that your application understands the file as
empty.
o DosClose() the file
o Query the class type list (wpclsQueryInstanceType)
o If a type list is returned set the type on the file (wpSetType)
wpPrintObject Start an instance of the application and tell
that instance to print the file
(wpQueryFilename).
wpQueryAssociationFilter Return the file extension for this class. Only
return one.
Example: return "*.XYZ"
wpQueryAssociationType Return the file type for this class. Only return
one.
Example: return "XYZ Type"
ΓòÉΓòÉΓòÉ <hidden> Class Methods ΓòÉΓòÉΓòÉ
Method Processing
wpclsQueryDefaultHelp
o Set the value of *pHelpPanelId to the help panel id to be displayed
o strcpy the name of your help panel library (XYZ.HLP) into HelpLibrary
o return TRUE.
Note: This is the help displayed when the user
presses F1 over this object.
wpclsQueryIconData Return the default icon data for this class of
object.
ΓòÉΓòÉΓòÉ <hidden> Other Updates ΓòÉΓòÉΓòÉ
The application should have an ASSOCTABLE entry in its executable which matches
the values for the extension and type returned above.
ASSOCTABLE ID_TABLE
BEGIN
"XYZ Type", "*.XYZ", EAF_DEFAULTOWNER, xyz.ico
END
Note that xyz.ico must exist at the time you do your resource compile since it
is added to the .ASSOCTABLE extended attributes of the program.
Reminder: When you deliver the application, you must use a vehicle that
preserves these extended attributes.
If the application handles multiple types with a unique extension for each type
then do the following:
o Subclass WPDataFile and handle all of the methods except
wpclsQueryInstanceType and wpclsQueryInstanceFilter.
o Introduce a subclass for each type that returns a corresponding Type and
Filter and insure that there is a corresponding entry for it in the
ASSOCTABLE in the .RC file.