
/*
 * xfldr.idl:
 *      SOM interface description file for the following
 *      XFolder classes (in this order):
 *          XFolder
 *          XFldStartup
 *          XFldShutdown
 *      and the respective metaclasses.
 *
 *      Check the other files starting with xf* for the
 *      other XFolder classes.
 *
 *      XFolder is probably the most complex class of this
 *      package. Not only are context menus manipulated, but
 *      open folder view windows are also subclassed to
 *      introduce additional functionality.
 *
 *      The XFolder class must always be installed.
 *      Installation of XFldStartup and XFldShutdown is
 *      optional.
 *
 *      Copyright (C) 1997-99 Ulrich M”ller.
 *      This file is part of the XFolder source package.
 *      XFolder 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 XFolder 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 <wpfolder.idl>         // this is SOM for WPFolder

/*
   CLASS: XFolder

   CLASS HIERARCHY:

       SOMObject
         ÀÄÄ WPObject = XFldObject
               ÀÄÄ WPFileSystem
                     ÀÄÄ WPFolder
                           ÀÄÄ XFolder
*/

interface M_XFolder;            // Forward Reference to XFolder metaclass

interface XFolder : WPFolder
{

    /*
     * SOM typedef definitions:
     *      declaring types here is similar to
     *      passing them thru to the .H file,
     *      but the difference is that we can also
     *      use them in this .IDL file.
     */

    // FDRSORTINFO:
    // original WPS structure stored in folder instance data for
    // remembering folder sort settings; it is into this structure
    // that wpRestoreData writes IDKEY_FDRSORTINFO data
    struct FDRSORTINFO {
        ULONG   ulDefaultSort;
            // the sort criterion that has the check mark in
            // the "Sort" submenu; one of the WPSORTKEY_*
            // things defined in the passthru_h stuff below
        BOOL    fAlwaysSort;
        ULONG   ulCurrentSort;
            // apparently, ulCurrentSort is only used by the WPS
            // if fAlwaysSort == TRUE; in that case, it contains
            // the current sort criterion, which may be different
            // than the default one
        ULONG   ulZero1;
        ULONG   ulZero2;
        ULONG   ulZero3;
    };
    typedef FDRSORTINFO *PFDRSORTINFO;

    struct WPSRGB {
        BYTE bBlue,
             bGreen,
             bRed,
             bExtra;
    };

    // FDRLONGARRAY:
    // original WPS structure stored in folder instance data for
    // storing various folder view data; it is into this structure
    // that wpRestoreData writes IDKEY_FDRLONGARRAY data.
    // On Warp 4, apparently the structure always has a size of 84 bytes
    // == 21 longs.
    // On Warp 3, four long's are missing; where therefore have 68 bytes
    // == 17 longs.
    struct FDRLONGARRAY {
        /* container view attributes */
            // offset 0x0000
        ULONG   ulIconViewCnrAttrs;
        ULONG   ulTreeViewCnrAttrs;
            // offset 0x0008
        ULONG   ulDetlViewCnrAttrs;    // Henk says, always 28 80 30 00
        ULONG   ulFolderFlag;          // Henk says, always 03 02 00 00
            // offset 0x0010
        ULONG   ulTreeStyle;           // Henk says, always 00 00 00 00
        ULONG   ulDetailsStyle;        // Henk says, always FF FF FF FF
            // offset 0x0018
        WPSRGB  rgbTextBkgndCol;      // BB GG RR 00;
                // this is the same for all views, but it is copied from
                // some folder background data I don't know; byte 4 is also
                // used for "transparency" when changed from Details view (duh)
        ULONG   ul7;      // unknown, always EF FF FF FF
            // offset 0x0020
        ULONG   ul8;      // unknown, always EF FF FF FF

        /* text colors */
        WPSRGB  rgbIconViewTextCol;
            // offset 0x0028
        ULONG   ul10;     // unknown, always EF FF FF FF
        WPSRGB  rgbTreeViewTextCol;
            // offset 0x0030
        WPSRGB  rgbDetlViewTextCol;

        ULONG   ul13;     // unknown, always 00 00 00 40
            // offset 0x0038
        ULONG   ulIconViewTextVisibility; // 00 00 00 40: standard,
                                        // 00 00 00 00: invisible,
                                        // 01 00 00 00: not transparent
                // Note that the "transparency" flag is always the same for
                // all views. rgbTextBkgndCol Byte 4 will be 00 if transparency
                // is off also.
        ULONG   ulTreeViewTextVisibility; // the same

            // offset 0x0040
        ULONG   ul16;     // unknown, always 00 00 00 00

        // end of structure on Warp 3
        // the following long's are only available on Warp 4:

        ULONG ulMenuBarVisibility;    // 0 = off, 1 = on, 2 = default

        /* Shadow text colors */
            // offset 0x0048
        WPSRGB rgbIconViewShadowCol;
        WPSRGB rgbTreeViewShadowCol;
            // offset 0x0050
        WPSRGB rgbDetlViewShadowCol;
    };
    typedef FDRLONGARRAY *PFDRLONGARRAY;

    // FDRBACKGROUND:
    // original WPS structure stored in folder instance data for
    // storing folder background data; I don't know which IDKEY_*
    // corresponds to this, because on Warp 4, something else
    // seems to be used. This information is from Henk Kelder.
    // That's 14 bytes altogether.
    struct FDRBACKGROUND
    {
        ULONG   ul1;
        WPSRGB  rgbColor;
        BYTE   bColorOnly; // 0x28 Image, 0x27 Color only
        BYTE   b9;
        BYTE   bImageType; // 2=Normal,3=tiled,4=scaled
        BYTE   b10;
        BYTE   bScaleFactor;
        BYTE   b12;
    };
    typedef FDRBACKGROUND *PFDRBACKGROUND;

    /*
     * New instance methods for XFolder:
     *
     */

    BOOL xfUpdateAllFrameWndTitles();
        /*@@ xfUpdateAllFrameWndTitles:
           this method sets the frame wnd titles for all currently
           open views of a given folder to the full path;
           it is called on the Worker thread after XFolder's replacements
           of wpMoveObject, wpSetTitle, or wpRefresh have been called.
           It does check the respective Global / folder settings. */

    BOOL xfSnapToGrid(in BOOL fNotify);
        /*@@ xfSnapToGrid:
           makes all objects in the folder "snap" on a grid whose
           coordinates are to be defined in the "system" object.
           This method checks if an Icon view of the folder is
           currently open; if not and fNotify == TRUE, it displays
           a message box. */

    BOOL xfQueryFldrSort(in PUSHORT pusDefaultSort, in PUSHORT pusAlwaysSort);
        /*@@ xfQueryFldrSort:
           this returns the folder's sort settings into the specified
           USHORT variables. These are set to SET_DEFAULT if no instance
           data has been defined; you will then need to query the Global
           Settings' values. */

    BOOL xfSetFldrSort(in USHORT usDefaultSort, in USHORT usAlwaysSort);
        /*@@ xfSetFldrSort:
           this is the new XFolder method for setting the sort data
           for a certain folder.

           usDefaultSort should be one of the SV_ constants as in
           XFolder::xfSortViewOnce or SET_DEFAULT for resetting the folder's
           default sort criterion to the Global Settings's value.

           usAlwaysSort can be 0 or 1 or SET_DEFAULT also.

           This method updates all open folder views with the new
           sort settings.
           This method returns TRUE if any visible change occured as
           a result to the new settings. */

    VOID xfSetCnrSort(in HWND hwndCnr, in BOOL fForce);
        /*@@ xfSetCnrSort:
           this is the most central function of XFolder's
           extended sorting capabilities. This is called
           every time the container in an open folder view
           needs to have its sort settings updated. In other
           words, this function evaluates the current folder
           sort settings and finds out the corresponding
           container sort comparison functions and other
           settings.

           Parameters:
           --  HWND hwndCnr     cnr of open view of somSelf
           --  BOOL fForce      TRUE: always update the cnr
                                settings, even if they have
                                not changed

           This function gets called:
           1)  from our wpOpen override to set folder sort
               when a new folder view opens;
           2)  from our wpSetFldrSort override (see notes
               there);
           3)  after folder sort settings have been changed
               using xfSetFldrSort.

           It is usually not necessary to call this method
           directly. To sort folders, you should call
           XFolder::xfSetFldrSort or XFolder::xfSortViewOnce
           instead.

           Note that XFolder does not use the WPS's sort
           mechanisms at all. Instead, we set our own
           container sort comparison functions directly
           _always_. Those functions are all in cnrsort.c.

           See the XFolder Programming Guide for an
           overview of how XFolder sorting works. */


    BOOL xfSortViewOnce(in HWND hwndFrame, in USHORT usSort);
        /*@@ xfSortViewOnce:
           sorts the content of given folder.
           As opposed to XFolder::xfSetFldrSort, this does not
           change the folder sort settings, but only sorts the view
           once.
           This is used by the context menu entries in the "Sort"
           menu.

           ulSort must be one of the following:
           --  SV_NAME
           --  SV_TYPE
           --  SV_CLASS                (new: sort by object class)
           --  SV_REALNAME
           --  SV_SIZE
           --  SV_LASTWRITEDATE
           --  SV_LASTACCESSDATE
           --  SV_CREATIONDATE
           --  SV_EXT                  (new: sort by extension)
           --  SV_FOLDERSFIRST         (new: sort folders first) */

    BOOL xfGetIconPos(in WPObject pObject,
                    in PBYTE pICONPOS,
                    in USHORT usICONPOSSize,
                    in PICONPOS pipReturn);
        /*@@ xfQueryIconPos:
           this new instance method retrieves the icon position of an
           object in a currently populated folder; you need to initialize
           the pICONPOS structure first, whose size you need to pass in
           ulICONPOSSize; the ICONPOS data will be copied to pipReturn.
           The method returns FALSE if something went wrong. */

    BOOL xfInvalidateOrderedContent();
        /*@@ xfInvalidateOrderedContent:
           this deletes the ordered content list so that it will
           be rebuilt when it's needed. This is necessary if
           objects in the folder have changed. */

    BOOL xfUpdateOrderedContent();
        /*@@ xfUpdateOrderedContent:
           this new instance methods builds or updates a list of the
           folder contents in memory. The root of the list is saved
           in the folder instance data.

           This method is called by XFolder::xfQueryOrderedContent if the
           list in memory has not been built yet. You do not need to call this
           method manually. */

    WPObject xfQueryOrderedContent(in WPObject Object, in ULONG ulOption);
        /*@@ xfQueryOrderedContent:
           this new instance method has the same parameters als wpQueryContent,
           but it returns items from the list built by
           XFolder::xfUpdateOrderedContent.

           As opposed to the list returned by wpQueryContent, the objects
           in this list are in the same order as in the name or details views,
           because the list is built according to the .ICONPOS EAs. */

    ULONG xfBeginProcessOrderedContent(in ULONG ulTiming,
                    in PFNWP pfnwpCallback,
                    in ULONG ulCallbackParam);
        /*@@ xfBeginProcessOrderedContent:
           this new instance method uses XFolder::xfQueryOrderedContent to open
           all the objects in the given folder. This method returns immediately;
           further processing is done in the background Worker thread.

           Parameters:
           -- ULONG ulTiming:     the time to wait between starting objects
                                  in milliseconds; if set to 0, this function
                                  will work in "Wait" mode, i.e. the next
                                  object will open the next object only if
                                  the previous one has been closed again
                                  (e.g. for XShutdown folder)
           -- PFNWP pfnwpCallback: a callback routine which will be called on
                                  every object which is started;
           -- ULONG ulCallbackParam: the first parameter to pass to this proc.

           pfnwpCallback will be passed the following parameters:
           -- HWND  hwnd:     will not be a hwnd, but ulCallbackParam;
           -- ULONG msg:      will contain the current object of the
                              folder on which this mthd is invoked;
                              this must be cast manually to (WPObject*)
           -- MPARAM mp1:     contains the current object count
                              (starting with 1 and increasing for each
                              subsequent object);
           -- MPARAM mp2:     the (constant) number of objects in the folder.

           This callback func may be used for implementing a progress bar.
           You can use ulCallbackParam for the msg window handle and display
           the progress according to mp1 and mp2; the object title may be
           obtained by calling _wpQueryTitle((WPObject*)msg).

           After all objects have been processed, the callback will called
           once more with msg == 0 to allow cleaning up. If the folder does
           not contain any objects, callback will only be called this one time.

           If you're running in "Wait" mode, the callback must return the
           hwnd of the object which you must have opened with wpViewObject,
           so that XFolder can wait for this window to be closed.

           Note that even though the processing of the folder is done in the
           Worker thread, the callback func is actually called on the main
           (Workplace) thread, so you can create your window there and have
           work done on it without having to worry about thread safety. This
           is implemented because wpViewObject is having problems when not
           being called in the Workplace thread.

           This method returns a handle which may be used in
           XFolder::xfCancelProcessOrderedContent to abort processing,
           or 0 upon errors. */

    BOOL xfCancelProcessOrderedContent(in ULONG hPOC);
        /*@@ xfCancelProcessOrderedContent:
           this method cancels a folder content process started with
           XFolder::xfBeginProcessOrderedContent; hPOC must the handle
           returned by that function.

           Warning: After folder content processing has finished, hPOC is
           no longer valid, and calling this function then will simply
           crash the WPS. As a result, your callback function MUST keep
           track if hPOC is still valid; after the callback func has been
           called with msg == 0, calling this function is no longer allowed. */

    ULONG xfMakeFavoriteFolder(in BOOL fInsert);
        /*@@ xfMakeFavoriteFolder:
           if fInsert is TRUE, this folder will be made a "favorite folder",
           i.e. added to all context menus; if FALSE, it will be removed. */

    BOOL xfIsFavoriteFolder();
        /*@@ xfIsFavoriteFolder:
           returns TRUE if somSelf is on the list of "favorite" folders. */

    ULONG xfSetQuickOpen(in BOOL fQuickOpen);
        /*@@ xfSetQuickOpen:
           if fQuickOpen == TRUE, somSelf will automatically be
           populated at WPS bootup. */

    BOOL xfQueryQuickOpen();
        /*@@ xfQueryQuickOpen:
           returns TRUE if somSelf has the QuickOpen feature ON. */

    HWND xfShowStatusBar(in PVOID psli, in BOOL fShow);
        /*@@ xfShowStatusBar:
           depending on fShow, this shows or hides the folder status
           bar for a certain folder.

           Parameters:
           --  psli:      list item of this folder frame from the global
                          linked list (of PSUBCLASSEDLISTITEM's); this
                          item contains the folder frame window handle
           --  fShow:     show / hide flag

           This func returns the hwnd of the status bar or NULL if calling
           the func was useless, because the status bar was already
           (de)activated.
           Note that this does _not_ change the folder's visibility
           settings, but only shows or hides the status bar "factually"
           by reformatting the folder frame's PM windows.
           This function _must_ be called only from the same thread
           where the folder frame window is running (normally TID 1),
           otherwise the WPS will crash or PM will hang.

           Because of all this, call XFolder::xfSetStatusBarVisibility
           instead if you wish to change folder status bars. That function
           will do the display also. */

    BOOL xfSetStatusBarVisibility(in ULONG ulVisibility, in BOOL fUpdate);
        /*@@ xfSetStatusBarVisibility:
           this new instance method sets the status bar visibility of
           a folder.
           ulVisibility may be:
           -- STATUSBAR_ON:        show status bars
           -- STATUSBAR_OFF:       hide status bars
           -- STATUSBAR_DEFAULT:   use Global Setting for this folder

           If fUpdate is TRUE, XFolder will have the Worker thread search
           for open folder views and update their frame controls accordingly.
           Otherwise the status bar setting will only be changed internally
           for the next time the folder is opened. Might lead to errors.
           Returns TRUE if successful. */

    BOOL xfQueryStatusBarVisibility();
        /*@@ xfQueryStatusBarVisibility:
           this new instance method returns the status bar visibility of
           a folder:
           -- STATUSBAR_ON:        status bars visible
           -- STATUSBAR_OFF:       status bars invisible
           -- STATUSBAR_DEFAULT:   Global Setting used for this folder */

    BOOL xfForEachOpenView(in ULONG ulMsg, in PFNWP pfnwpCallback);
        /*@@ xfForEachOpenView:
           this instance method goes through all open views of a folder and calls
           pfnwpCallback for each them (as opposed to xfclsForEachOpenView, which
           goes through all open folders on the system).

           The following params are then passed to pfnwpCallback:
           --   hwnd    HWND       hwndView   the hwnd of the view frame window;
           --   mp1     ULONG      ulView     the view type (as def'd in wpOpen)
           --   mp2     XFolder*   pFolder    somSelf.

           This method does not return until all views have been processed.
           You might want to call this method in a different thread if the task
           will take long.
           This method returns TRUE if the callback returned TRUE at least once.
           Note on disk objects/root folders: the WPS does not maintain an open
           view list for root folders, but only for the corresponding disk object.
           xfForEachOpenView will call open disk views also, but the callback
           will still be passed the root folder in pFolder! */

    ULONG xfAddXFolderPages(in HWND hwndDlg);
        /*@@ xfAddXFolderPages:
           this actually adds the "XFolder" pages into all folder notebooks. */

#ifdef __SOMIDL__
  implementation {

    releaseorder:
        xf_withdrawn1,
        xfUpdateAllFrameWndTitles,
        xfSnapToGrid,
        xfQueryFldrSort,
        xfSetFldrSort,
        xfSortViewOnce,
        xfGetIconPos,
        xfInvalidateOrderedContent,
        xfUpdateOrderedContent,
        xfQueryOrderedContent,
        xfBeginProcessOrderedContent,
        xfCancelProcessOrderedContent,
        xfMakeFavoriteFolder,
        xfIsFavoriteFolder,
        xfSetQuickOpen,
        xfQueryQuickOpen,
        xfShowStatusBar,
        xfSetStatusBarVisibility,
        xfQueryStatusBarVisibility,
        xfForEachOpenView,
        xfAddXFolderPages,
        xfSetCnrSort;

    /*
     * Class Modifiers:
     *
     */

    externalprefix = xf_;
    externalstem = xf;
    majorversion = 1;
    minorversion = 1;
    filestem = xfldr;           //# specifies the filestem for sc-generated files
    metaclass = M_XFolder;
    dllname = "xfldr.dll";
    callstyle = oidl;           //# forget CORBA stuff (*ev and such)

    /*
     * Internal instance variables for XFolder:
     *
     */

    // the following four correspond to the "XFolder" instance
    // settings page; all of these have a "transparent" value,
    // which makes the folder use the global setting instead
    BYTE        bSnapToGridAllowed,
                bAcceleratorsAllowed,
                bFullPath,
                bStatusBar;

    // the following two are for XFolder's replacement sort
    // settings; these have a transparent default value also
    BYTE        AlwaysSort,
                DefaultSort;

    // the following pointers are all initialized in wpRestoreData
    // when the original WPFolder restores its instance data
    // and point to WPS-internal memory.

    // pointer to WPFolder's sort data struct
    PFDRSORTINFO pFldrSortInfo;
    // pointer to WPFolder's "long array"
    PFDRLONGARRAY pFldrLongArray;
    // pointer to WPFolder's "string array"
    PSZ           pszFldrStrArray;
    // pointer to WPFolder's folder background info
    PUSHORT       pusFldrBackground;
    // size of those structures
    ULONG         cbFldrStrArray,
                  cbFldrLongArray;
    // pointer to WPFolder's "SHOWALLINTREEVIEW" flag
    // (Warp 4 only); this is queried in wpRestoreLong
    PULONG        pulShowAllInTreeView;

    PVOID       pliOrderedContentFirst,
                pliOrderedContentLast;        // linked WPObject pointer list
    HMTX        hmtxOrderedContent;           // mutex sem for that data

    PBYTE       pICONPOS;                     // ICONPOS EA data;
    ULONG       ulICONPOSSize;                // size of that data

    LONG        MenuMousePosX,
                MenuMousePosY;
    // POINTL2     ptlMenuMousePos;              // where pointer was when context menu was opened
    // ULONG       ulSBInflatedFrame;

    ULONG       ulDummy;

    BOOL        fUnInitCalled;                // flag for wpUnInitData

    HWND        hwndCnrSaved;                 // workaround for wpPopupMenu bug

    /*
     * The following is forced into the .H file:
     *
     */

     passthru C_h_after =     "";

    /*
     * WPFolder methods overridden by XFolder:
     *
     */

    wpInitData: override;
        /*@@ wpInitData:
           here XFolder will initialize its instance data */

    wpUnInitData: override;
        /*@@ wpUnInitData:
           clean up when object is deleted or made dormant */

    wpFree: override;
        /*@@ wpFree:
           this WPObject method destroys the persistent form of the object
           and then frees the memory that represented that object. For
           WPFolders, this is called when a folder is actually to be
           deleted. We will call the parent method and then also remove
           those darn PMWorkplace:FolderPos entries which the WPS never
           deletes */

    wpSetup: override;
        /*@@ wpSetup:
           this instance method is called to allow a
           newly created object to initialize itself.
           XFolder will examine its setup strings here */

    wpSaveState: override;
        /*@@ wpSaveState:
           this instance method is called to allow an
           an object to save its state; XFolder will
           save its instance settings (NB page) here */

    wpRestoreState: override;
        /*@@ wpRestoreState:
           this instance method is called to allow an
           an object to restore its state; XFolder will
           restore its instance settings (NB page) here */

    wpRestoreLong: override;
        /*@@ wpRestoreLong:
           this instance method restores a 32-bit data
           value from the folder EAs upon object awakening.
           We check the "ulKey" value after having called
           the parent to be able to intercept the pointer
           to certain WPS-internal folder data, which
           we cannot access otherwise. That's a real ugly
           kludge, but there's no other way to get certain
           folder settings. ;-)
           On Warp 4, the WPS queries the
           IDKEY_FDRTREEVIEWCONTENTS key here, which is
           == 1 if the "SHOWALLINTREEVIEW" flag is on. */

    wpRestoreData: override;
        /*@@ wpRestoreData:
           this instance method restores binary instance
           data from the folder EAs upon object awakening.
           We check the "ulKey" value after having called
           the parent to be able to intercept the pointer
           to certain WPS-internal folder data, which
           we cannot access otherwise. That's a real ugly
           kludge, but there's no other way to get certain
           folder settings. ;-)
           On Warp 4, the WPS queries lots of sort and
           folder view settings here, whose pointers we
           can store in XFolder's instance data. */

    wpAddSettingsPages: override;
        /*@@ wpAddSettingsPages:
           call xfAddXFolderPages */

    wpAddFolderSortPage: override;
        /*@@ wpAddFolderSortPage:
           this normally adds the "Sort" page to the folder
           settings notebook; if allowed, we will replace this
           by the new XFolder version of it */

    wpFilterPopupMenu: override;
        /*@@ wpFilterPopupMenu:
           this removes default menu entries according to the
           Global Settings. */

    wpModifyPopupMenu: override;
        /*@@ wpModifyPopupMenu:
           this routine allows an object to modify a context
           menu. We add the various XFolder menu entries here
           by calling the common XFolder function in menus.c,
           which is also used by the XFldDisk class. */

    wpMenuItemSelected: override;
        /*@@ wpMenuItemSelected:
           process input when any menu item was selected;
           we do this by calling the common XFolder function
           in menus.c, which is also used by XFldDisk. */

    wpMenuItemHelpSelected: override;
        /*@@ wpMenuItemHelpSelected:
           display help for a context menu item. */

    wpOpen: override;
        /*@@ wpOpen:
           this instance method opens a new folder view.
           This is one of the main hooks where the XFolder
           features are inserted into the WPS.
           We call the parent method first (which will create
           the folder window) and then subclass the
           resulting frame window with the new
           fnwpSubclassedFolderFrame window procedure. */

    wpRefresh: override;
        /*@@ wpRefresh:
           this method updates a folder; after doing
           this, we will also update the title of the
           window and maybe status bars. */

    wpSetFldrAttr: override;
        /*@@ wpSetFldrAttr:
           this sets new container attributes
           (those CV_* flags) for the specified folder view
           (OPEN_CONTENTS, OPEN_TREE, OPEN_DETAILS) */

    wpQueryFldrAttr: override;
        /*@@ wpQueryFldrAttr:
           this returns the current container attributes
           (those CV_* flags) for the specified folder view
           (OPEN_CONTENTS, OPEN_TREE, OPEN_DETAILS) */

    wpAddToContent: override;
        /*@@ wpAddToContent:
           this method is overridden to intercept the
           notification of the "Added an object to a folder"
           event for subclasses that define their own folder view.
           The parent must always be called. */

    wpDeleteFromContent: override;
        /*@@ wpDeleteFromContent:
           this method should be overridden to intercept the
           notification of the "Removed an object from a folder"
           event for subclasses that define their own folder view.
           The parent must always be called. */

    wpStoreIconPosData: override;
        /*@@ wpStoreIconPosData:
           this method is documented only for Warp 4
           (but exists in Warp 3 also, see WPFOLDER.H);
           it is called when an open folder in icon or
           details view is closed.
           The WPS then apparently saves the .ICONPOS
           data to disk; we only override this method to be
           notified that we need to to update our
           icon order data (xfUpdateOrderedContent). */

    wpMoveObject: override;
        /*@@ wpMoveObject:
           this is called when the folder is moved to a
           different location; we then need to update
           the titles of this folder AND of possibly open
           subfolders with the full path; we pass this
           to the Worker thread */

    wpSetTitle: override;
        /*@@ wpSetTitle:
           this is called when the folder is renamed.
           We then need to update the titles of this
           folder AND of possibly open subfolders with
           the full path; we pass this task to the Worker
           thread, since it may take a while */

    wpSetFldrSort: override;
        /*@@ wpSetFldrSort:
           apparently, this method normally gets called by the
           WPS every time it tries to sort a folder. That is,
           when one of the "Sort" menu items is selected or when
           the folder is sorted for another reason, e.g. because
           "Always sort" is on and a file in the folder was
           renamed.

           The WPS ref. says about this method:
           "This instance method sets the sort attributes on
           the folder window and  saves those values in the
           instance data. Note:  This method only rearranges a
           folder open in icon view. If (pSortRecord == NULL),
           the values are reset to the default sort values."

           However, the description of this method in the WPS
           ref. is complete garbage. The SORTFASTINFO structure
           described there is obviously not used, but some
           undocumented data instead. (I guess that's why IBM
           uses a PVOID here, so they need not apologize.)
           Also, this method rearranges _all_ open folders, not
           just icons views.

           Anyway, if XFolder extended sorting is enabled,
           we can intercept this method call to prevent the
           WPS from sorting the container. We will then not
           call the default method, but our own one instead.
           Since XFolder completely takes over the other sort
           functions, this method probably only gets called
           when files are renamed any more. */

    wpQueryDefaultHelp: override;
        /*@@ wpQueryDefaultHelp:
           this instance method specifies the default
           help panel for this instance; XFolder will
           return something different for the
           Config folder and its subfolders. */

#ifdef __PRIVATE__

#endif

  }; // implementation
#endif /* __SOMIDL__ */
};

//#
//#
//# Now define Metaclass.
//# ---------------------
//#

interface M_XFolder : M_WPFolder
{

    /*
     * New class methods for M_XFolder:
     *
     */

    BOOL xfclsForEachOpenView(in ULONG ulMsg, in PFNWP pfnwpCallback);
        /*@@ xfclsForEachOpenView:
           this class method goes through all open folder windows and calls
           pfnwpCallback for each open view of each open folder.

           The following params will be passed to pfnwpCallback:
           -- hwnd    HWND       hwndView   the hwnd of the view frame window;
           -- mp1     ULONG      ulView     the view type (as def'd in wpOpen)
           -- mp2     XFolder*   pFolder    the currently open folder.

           This method does not return until all views have been processed.
           You might want to call this method in a different thread if the task
           will take long. */

    XFolder xfclsQueryFavoriteFolder(in XFolder pFolder);
        /*@@ xfclsQueryFavoriteFolder:
           This returns "favorite" folders.
           If pFolder == NULL, the first favorite folder is returned,
           otherwise the favorite folder which comes after pFolder
           in the favorite folder list.
           This returns NULL if no more folders are found. */

    XFolder xfclsQueryQuickOpenFolder(in XFolder pFolder);
        /*@@ xfclsQueryQuickOpenFolder:
           This returns folders which have the "QuickOpen" flag on.
           If pFolder == NULL, the first such folder is returned,
           otherwise the folder which comes after pFolder
           in the quick-open folder list.
           This returns NULL if no more folders are found. */

    BOOL xfclsSetDefaultTitle(in PSZ pszNewTitle);
        /*@@ xfclsSetDefaultTitle:
           changes the default title to pszNewTitle. The default
           title appears in the third column in folder Details
           views. */

#ifdef __SOMIDL__
  implementation {

    releaseorder:
                    xfclsForEachOpenView,
                    xfclsQueryFavoriteFolder,
                    xfclsQueryQuickOpenFolder,
                    xfclsSetDefaultTitle,
                    xfcls_withdrawn1;

    /*
     * Class Modifiers:
     *
     */

    externalprefix = xfM_;
    externalstem = xfM;
    functionprefix = xfM_;
    majorversion = 1;
    minorversion = 1;
    filestem = xfldr;           //# specifies the filestem for sc-generated files
    dllname = "xfldr.dll";
    callstyle = oidl;

    /*
     * Internal class variables for M_XFolder:
     *
     */

    // XFolder class default title
    CHAR        szDefaultTitle[200];

    // class default icons
    HPOINTER    hptrClosed;
    HPOINTER    hptrOpen;

    /*
     * M_WPFolder methods overridden by M_XFolder:
     *
     */

    wpclsInitData: override;
        /*@@ wpclsInitData:
           this initializes the WPFolder / XFolder class as a whole;
           we need to call the parent and then set some XFolder
           data */

    wpclsCreateDefaultTemplates: override;
        /*@@ wpclsCreateDefaultTemplates:
           this is called by the system to allow a class to
           create its default templates. The default WPS
           behavior is to create new templates if the class
           default title is different from the existing
           templates, but since we are replacing the class,
           we will have to suppress this in order not to
           crowd the Templates folder. */

    wpclsQueryTitle: override;
        /*@@ wpclsQueryTitle:
           tell the WPS the new class name: XFolder or whatever
           was specified in the "Workplace Shell" object */

    wpclsQueryIconData: override;
        /*@@ wpclsQueryIconData:
           give folders a new default closed icon, if the
           global settings allow this.
           This is loaded from /ICONS/ICONS.DLL.
           Unfortunately, it appears to be impossible to
           dynamically load default icons as specified for
           the ICONINFO structure in the WPS reference.
           ICON_FILE at least doesn't work, and the format
           for ICON_DATA is not explained. So we have to
           use a DLL here. */

    wpclsQueryIconDataN: override;
        /*@@ wpclsQueryIconDataN:
           give folders a new default open icon, if the
           global settings allow this.
           See the notes for wpclsQueryIconData. */

  };
#endif /* __SOMIDL__ */
};


/*
   CLASS: XFldStartup

   CLASS HIERARCHY:

       SOMObject
         ÀÄÄ WPObject = XFldObject
               ÀÄÄ WPFileSystem
                     ÀÄÄ WPFolder = XFolder
                           ÀÄÄ XFldStartup
*/

interface M_XFldStartup;            // Forward Reference to XFldStartup metaclass

interface XFldStartup : XFolder
{

    /*
     * New instance methods for XFldStartup:
     *
     */

#ifdef __SOMIDL__
  implementation {

    /*
     * Class Modifiers:
     *
     */

    externalprefix = xfstup_;
    externalstem = xfstup;
    majorversion = 1;
    minorversion = 1;
    filestem = xfldr;           //# specifies the filestem for sc-generated files
    metaclass = M_XFldStartup;
    dllname = "xfldr.dll";
    callstyle = oidl;           //# forget CORBA stuff (*ev and such)

    /*
     * Internal instance variables for XFldStartup:
     *
     */

    /*
     * The following is forced into the .H file:
     *
     */

    /*
     * XFolder methods overridden by XFldStartup:
     *
     */

    wpModifyPopupMenu: override;
        /*@@ wpModifyPopupMenu:
           add a "Process content" menu item to this
           popup menu; the other menu items are inherited
           from XFolder */

    wpMenuItemSelected: override;
        /*@@ wpMenuItemSelected:
           react to selection of "Process content"
           menu item */

    wpMenuItemHelpSelected: override;
        /*@@ wpMenuItemHelpSelected:
           display help for "Process content"
           menu item */

    wpQueryDefaultHelp: override;
        /*@@ wpQueryDefaultHelp:
           this instance method specifies the default
           help panel for this instance; display some
           help for the Startup folder */


#ifdef __PRIVATE__

#endif

  }; // implementation
#endif /* __SOMIDL__ */
};

//#
//#
//# Now define Metaclass.
//# ---------------------
//#

interface M_XFldStartup : M_XFolder
{

    /*
     * New class methods for M_XFldStartup:
     *
     */

#ifdef __SOMIDL__
  implementation {

    /*
     * Class Modifiers:
     *
     */

    externalprefix = xfstupM_;
    externalstem = xfstupM;
    functionprefix = xfstupM_;
    majorversion = 1;
    minorversion = 1;
    filestem = xfldr;           //# specifies the filestem for sc-generated files
    dllname = "xfldr.dll";
    callstyle = oidl;

    /*
     * Internal instance variables for M_XFldStartup:
     *
     */

    /*
     * M_XFolder methods overridden by M_XFldStartup:
     *
     */

    wpclsQueryTitle: override;
        /*@@ wpclsQueryTitle:
           tell the WPS the new class name: "XFolder Startup" */

    wpclsQueryStyle: override;
        /*@@ wpclsQueryStyle:
           we return a flag so that no templates are created
           for the Startup folder */

    wpclsQueryIconData: override;
        /*@@ wpclsQueryIconData:
           give the Startup folder a new closed icon */

    wpclsQueryIconDataN: override;
        /*@@ wpclsQueryIconDataN:
           give the Startup folder a new animated icon */

  };
#endif /* __SOMIDL__ */
};


/*
   CLASS: XFldShutdown

   CLASS HIERARCHY:

       SOMObject
         ÀÄÄ WPObject = XFldObject
               ÀÄÄ WPFileSystem
                     ÀÄÄ WPFolder = XFolder
                           ÀÄÄ XFldShutdown
*/

interface M_XFldShutdown;           // Forward Reference to XFldShutdownmetaclass

interface XFldShutdown : XFolder
{

    /*
     * New instance methods for XFldShutdown:
     *
     */

#ifdef __SOMIDL__
  implementation {

    /*
     * Class Modifiers:
     *
     */

    externalprefix = xfshut_;
    externalstem = xfshut;
    majorversion = 1;
    minorversion = 1;
    filestem = xfldr;           //# specifies the filestem for sc-generated files
    metaclass = M_XFldShutdown;
    dllname = "xfldr.dll";
    callstyle = oidl;           //# forget CORBA stuff (*ev and such)

    /*
     * Internal instance variables for XFldShutdown:
     *
     */

    /*
     * The following is forced into the .H file:
     *
     */

    /*
     * XFolder methods overridden by XFldShutdown:
     *
     */

    wpQueryDefaultHelp: override;
        /*@@ wpQueryDefaultHelp:
           this instance method specifies the default
           help panel for this instance; display some
           help for the Shutdown folder */


#ifdef __PRIVATE__

#endif

  }; // implementation
#endif /* __SOMIDL__ */
};

//#
//#
//# Now define Metaclass.
//# ---------------------
//#

interface M_XFldShutdown : M_XFolder
{

    /*
     * New class methods for M_XFldShutdown:
     *
     */

#ifdef __SOMIDL__
  implementation {

    /*
     * Class Modifiers:
     *
     */

    externalprefix = xfshutM_;
    externalstem = xfshutM;
    functionprefix = xfshutM_;
    majorversion = 1;
    minorversion = 1;
    filestem = xfldr;           //# specifies the filestem for sc-generated files
    dllname = "xfldr.dll";
    callstyle = oidl;

    /*
     * Internal instance variables for M_XFldShutdown:
     *
     */

    /*
     * M_XFolder methods overridden by M_XFldShutdown:
     *
     */

    wpclsQueryTitle: override;
        /*@@ wpclsQueryTitle:
           tell the WPS the new class name: "XFolderShutdown" */

    wpclsQueryStyle: override;
        /*@@ wpclsQueryStyle:
           we return a flag so that no templates are created
           for the Shutdown folder */

    wpclsQueryIconData: override;
        /*@@ wpclsQueryIconData:
           give the Shutdown folder a new closed icon */

    wpclsQueryIconDataN: override;
        /*@@ wpclsQueryIconDataN:
           give the Shutdown folder a new animated icon */

  };
#endif /* __SOMIDL__ */
};

