home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
xwplascr.zip
/
XWPL0208.ZIP
/
idl
/
__sample_dataf.idl
next >
Wrap
Text File
|
2001-10-13
|
9KB
|
238 lines
/*
* __sample.idl:
* Sample IDL file for adding a new class to XWorkplace.
* This is for a WPDataFile subclass called SampleDataFile.
*
* To adjust this to your needs, do the following:
*
* -- Modify all the sections marked with "&&&".
*
* -- Search and replace "SampleDataFile" with your class
* name. For a PDF subclass, replace with "XWPPdf", for example.
*
* -- Search and replace "WPDataFile" with the class which
* should be the parent class of your class. Take WPFolder
* if you're creating a WPFolder subclass, for example.
*
* To add this class into the XWorkplace makefile system to have
* all necessary source files produced, see PROGREF.INF, "Adding
* Features to XWorkplace", which gives you instructions.
*/
/*
* Copyright (C) 2000 Ulrich Möller.
* This file is part of the XWorkplace source package.
* XWorkplace is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation, in version 2 as it comes in the
* "COPYING" file of the XWorkplace main distribution.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <wpdataf.idl>
// this is SOM for WPDataFile from the Toolkit headers;
// &&& you must include the IDL file of the parent class
// of your class here. The IDL file name is specified in
// "WPS Object Classes" in the WPS Programming Reference.
/*
CLASS: SampleDataFile
CLASS HIERARCHY:
SOMObject
└── WPObject
└── WPFileSystem
└── WPDataFile
└── SampleDataFile
*/
interface M_SampleDataFile; //# forward reference to metaclass
interface SampleDataFile : WPDataFile //# &&& SampleDataFile is a WPDataFile subclass
{
/*
* New instance methods for SampleDataFile:
* none presently. If you wish to add methods,
* specify them here. See xfldr.idl for examples.
*/
#ifdef __SOMIDL__
implementation {
//# Class modifiers:
//# these are special SOM compiler keywords which are
//# somewhat magic. These must be specified, or the
//# SOM compiler will produce garbage.
externalprefix = sdf_; //# &&& prefix for all the function names generated
//# by the SOM compiler; this must be unique among
//# all XWorkplace classes!
externalstem = sdf; //# &&& same as above, without "_"
majorversion = 1;
minorversion = 1;
filestem = spldataf; //# &&& specifies the filestem for files generated
//# by the SOM compiler (e.g. spldataf.h, spldataf.ih,
//# spldataf.c)
metaclass = M_SampleDataFile;
dllname = "xfldr.dll"; //# target DLL, do not modify
callstyle = oidl; //# forget CORBA stuff (*ev and such)
/*
* Internal instance variables for SampleDataFile:
* every instance of this class will have variables
* (same as member variables in C++). These can be
* accessed using the variable name here prefixed
* with an underscore. For example, use "_fSampleBOOL"
* in your C code.
*
* If your class defines instance variables, you need to
* override the following methods:
*
* -- wpInitData must initialize the variable to something,
* or its value will be undefined. This method can be
* considered a constructor.
*
* -- If you allocated memory, wpUnInitData must clean up.
* This is the equivalent of a destructor.
*
* -- If you want a WPS setup string for this instance
* variable, wpSetup must parse the setup string, set
* the variable, and update open views of the object.
*
* -- If the value of the variable is to be persistent
* between Desktop restarts, wpSaveState and wpRestoreState
* must save and restore the value to the object's
* persistent data. Where this data is stored depends
* on the class's descendant; subclasses of WPAbstract
* will use OS2.INI, subclasses of WPFileSystem will
* use the .CLASSINFO extended attribute.
*/
BOOL fSampleBOOL;
/*
* WPDataFile methods overridden by SampleDataFile
* (typical methods listed here):
*
* for each of these methods, the SOM compiler will
* generate an empty function stub in the C source
* file which you must then fill in to make it do
* anything meaningful.
*/
wpInitData: override;
wpSetup: override;
wpUnInitData: override;
wpSaveState: override;
wpRestoreState: override;
wpFilterPopupMenu: override;
wpModifyPopupMenu: override;
wpMenuItemSelected: override;
wpMenuItemHelpSelected: override;
#ifdef __PRIVATE__
#endif
}; // implementation
#endif /* __SOMIDL__ */
};
//#
//#
//# Now define Metaclass.
//# ---------------------
//#
//# This is a bit difficult. With SOM, classes are objects
//# too. This is what allows the WPS to work on classes at
//# runtime in the first place. As a result, every class
//# must have a metaclass. As opposed to C++, where you have
//# a static class (which doesn't "exist" an runtime) and
//# objects (which "exist" at runtime), in SOM you get this:
//#
//# object
//# is instance of
//# class ("class object")
//# is instance of
//# metaclass
//#
//# With WPDataFile, this looks like the following:
//#
//# sample.txt
//# is instance of
//# WPDataFile (class object)
//# is instance of
//# M_WPDataFile (metaclass)
//#
//# When the WPS is initialized, all classes on the WPS class
//# list are created as "class objects". Every time the WPS
//# instantiates an object (e.g. during folder population),
//# it creates it according to its class object, by invoking
//# the wpclsNew or wpclsMakeAwake class methods.
//#
//# Both classes and metaclasses have methods:
//#
//# -- Instance methods belong to a class and operate on a
//# Desktop object. For example, wpQueryTitle gets the title
//# of a Desktop object. The WPS prefixes all instance methods
//# with "wp".
//#
//# -- Class methods belong to a metaclass and operate on a
//# class object. For example, wpclsQueryTitle gets the
//# default title for objects of a class. The WPS prefixes
//# all class methods with "wpcls".
interface M_SampleDataFile : M_WPDataFile
{
/*
* New class methods for M_SampleDataFile:
*
*/
#ifdef __SOMIDL__
implementation {
//# Class Modifiers
externalprefix = sdfM_; //# &&& same prefix as above, but add "M" for the metaclass
externalstem = sdfM; //# &&&
functionprefix = sdfM_; //# &&&
majorversion = 1;
minorversion = 1;
filestem = spldataf; //# must be same as above
dllname = "xfldr.dll"; //# target DLL, do not modify
callstyle = oidl;
/*
* Internal class variables for M_SampleDataFile:
* similar to objects (as defined by the class),
* classes can have member variables also (defined
* by the metaclass). List them here as with the
* class definition (above).
*/
/*
* M_WPDataFile methods overridden by M_SampleDataFile:
*
*/
wpclsInitData: override;
wpclsQueryTitle: override;
wpclsQueryInstanceFilter: override;
wpclsQueryInstanceType: override;
};
#endif /* __SOMIDL__ */
};