The following sample illustrates the class interface definition file (IDL):
#ifndef wpstyler_idl #define wpstyler_idl #include <wpabs.idl> #include <somcls.idl> interface M_Styler; interface Styler : WPAbstract { ULONG InsertObjectStylePage(in HWND hwndDlg); // Override: InsertObjectStylePage // // Description: // Insert the Styler page into the Settings notebook. ULONG QueryObjectStyle(in HWND hwndDlg); // Override: QueryObjectStyle // // Description: // Query the object's title and current style. // Set the Styler Settings page checkboxes and MLE. VOID SetObjectStyle(in HWND hwndDlg); // Override: SetObjectStyle // // Description: // Query the current checkbox state and set // the object's style accordingly. #ifdef __SOMIDL__ implementation { releaseorder: InsertObjectStylePage,QueryObjectStyle,SetObjectStyle; /* * Class modifiers */ functionprefix = Sty_; majorversion = 1; minorversion = 2; filestem = wpstyler; metaclass = M_Styler; callstyle = oidl; dllname = "wpstyler.dll"; /* * Internal instance variables */ BOOL fGeneralPage; // Display the General page if true ULONG ulStyle; // Save the style flags WPObject self; // Save the self pointer of dropped object /* * Passthru to the .IH file the following: */ passthru C_ih = "#define INCL_PM" "#define INCL_DOS" "#define INCL_DEV" "#define INCL_WPCLASS" "#define INCL_WINWORKPLACE" "#include <os2.h>" "#include <stdlib.h>" "#include <string.h>" "#include \"wpstyler.rch\"" "#include <somobj.h>" "" "#define OPEN_STYLER (OPEN_USER+1)" "" "#define MPNULL (MPFROMP(NULL))" "#define MPZERO (MPFROMSHORT(0))" "#define MRTRUE (MRFROMSHORT((SHORT) TRUE))" "#define MRFALSE (MRFROMSHORT((SHORT) FALSE))" "" "#define BM_UNCHECKED 0 // Parms in BM_SETCHECK message" "#define BM_CHECKED 1 // to set or clear the radio buttons" "" "#define PMWinSetDlgItemChecked(hwnd, id, bCheck)\" " (WinSendDlgItemMsg((hwnd), (id), BM_SETCHECK,\" " ((bCheck) ? MPFROMSHORT(1) : MPZERO), MPNULL))" "" "#define PMWinIsDlgItemChecked(hwnd, id)\" " (SHORT1FROMMR(WinSendDlgItemMsg((hwnd), (id),\" " BM_QUERYCHECK, MPNULL, MPNULL)) != 0)" "" "#define WinSetDialogFont(hwnd, usId, szFont)\" " (WinSetPresParam(WinWindowFromID(hwnd, usId),\" " PP_FONTNAMESIZE, (ULONG) strlen(szFont)+1, szFont))" ""; /* * Method modifiers */ wpInitData: override; // Override: wpInitData // // Description: // Initialize the state variables. Allocate any extra // memory that WPStyler might need. wpDragOver: override; // Method: wpDragOver // // Description: // Allow any object to be dropped on the Styler. wpDrop: override; // Method: wpDrop // // Description: // Query the self pointer of dropped object. // Call wpOpen to open the Settings notebook // and display the styles. wpOpen: override; // Method: wpOpen // // Description: // Opens the Settings notebook to display the General page // for the Styler object. wpAddSettingsPages: override; // Method: wpAddSettingsPages // // Description: // Add the Styler Settings page to let the user alter // the styles of any object that is dropped onto us. wpAddObjectWindowPage: override; // Method: wpAddObjectWindowPage // // Description: // Remove the Window page. wpAddObjectGeneralPage: override; // Method: wpAddObjectGeneralPage // // Description: // Remove the General page when the Styler // page is displayed. }; #endif /* __SOMIDL__ */ }; interface M_Styler : M_WPAbstract { HMODULE clsQueryModuleHandle(); // Method: clsQueryModuleHandle // // Description: // Return the module handle. #ifdef __SOMIDL__ implementation { releaseorder: clsQueryModuleHandle; /* * Class modifiers */ functionprefix = StyM_; majorversion = 1; minorversion = 2; filestem = wpstyler; callstyle = oidl; dllname = "wpstyler.dll"; /* * Internal instance variables */ HMODULE hmod; /* Resource module handle */ HPOINTER hicon; /* Icon handle */ /* * Method modifiers */ wpclsInitData: override; // Method: wpclsInitData // // Description: // Initalize the class data, query and save the module handle. // Load the icon handle. wpclsQueryIcon: override; // Method: wpclsQueryIcon // // Description: // Set the Stylers icon handle. wpclsQueryStyle: override; // Method: wpclsQueryStyle // // Description: // wpclsQueryStyle is called to allow the class object to // specify the default object class style for its instances. // // Remarks: // This method can be called at any time in order to determine the // default style for instances of this class. // This method should be overridden in order to modify the default // object style for instances of this class. wpclsQueryDefaultHelp: override; // Method: wpclsQueryDefaultHelp // // Description: // Set the help library name and default help ID. wpclsQueryDefaultView: override; // Method: wpclsQueryDefaultView // // Description: // Return the default view for a new instance of this object. // Tell the system what the Styler's default view is. }; #endif /* __SOMIDL__ */ }; #endif /* wpstyler_idl */