
/*
 *@@sourcefile xfdrives.c:
 *      This file contains SOM code for the following XWorkplace class:
 *
 *      --  XWPDrives
 *
 *
 *@@added V1.0.11 (2016-11-22) [rwalsh]
 *@@somclass XWPDrives xfdrv_
 *@@somclass M_XWPDrives xfdrvM_
 */

/*
 *      Copyright (C) 1997-2016 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.
 */

/*
 *  This file was generated by the SOM Compiler and Emitter Framework.
 *  Generated using:
 *      SOM Emitter emitctm: 2.41
 */

#ifndef SOM_Module_xfdrives_Source
#define SOM_Module_xfdrives_Source
#endif
#define XWPDrives_Class_Source
#define M_XWPDrives_Class_Source

#pragma strings(readonly)

/*
 *  Suggested #include order:
 *  1)  os2.h
 *  2)  C library headers
 *  3)  setup.h (code generation and debugging options)
 *  4)  headers in helpers\
 *  5)  at least one SOM implementation header (*.ih)
 *  6)  dlgids.h, headers in shared\ (as needed)
 *  7)  headers in implementation dirs (e.g. filesys\, as needed)
 *  8)  #pragma hdrstop and then more SOM headers which crash with precompiled headers
 */

#define INCL_DOSEXCEPTIONS
#define INCL_DOSPROCESS
#define INCL_DOSSEMAPHORES
#define INCL_WINWINDOWMGR
#define INCL_WINMENUS
#define INCL_WINSHELLDATA
#include <os2.h>

// C library headers
#include <stdio.h>              // needed for except.h
#include <setjmp.h>             // needed for except.h
#include <assert.h>             // needed for except.h

// generic headers
#include "setup.h"                      // code generation and debugging options

// headers in /helpers

// SOM headers which don't crash with prec. header files
#include "xfdrives.ih"
#include "xfdisk.h"

// XWorkplace implementation headers
#include "shared\common.h"              // the majestic XWorkplace include file
#include "shared\kernel.h"              // XWorkplace Kernel

#include "filesys\fdrsplit.h"           // folder split views
#include "filesys\folder.h"             // XFolder implementation
#include "filesys\statbars.h"           // status bar translation logic

// other SOM headers
#pragma hdrstop                         // VAC++ keeps crashing otherwise

/* ******************************************************************
 *
 *   XWPDrives methods
 *
 ********************************************************************/

/*
 *@@ wpAddToContent:
 *      This WPDrives method is overridden to intercept the
 *      notification that a WPDisk object has been added to
 *      the Drives folder.
 *
 *      For all object classes except WPDisk, WPDrives calls
 *      its parent's method which allows XFolder to notify
 *      Xview and the statusbars of the addition. This doesn't
 *      happen for disk objects, so we have to send out the
 *      notification from here.
 */

SOM_Scope BOOL  SOMLINK xfdrv_wpAddToContent(XWPDrives *somSelf,
                                             WPObject* Object)
{
    // XWPDrivesMethodDebug("XWPDrives","xfdrv_wpAddToContent");

    BOOL brc = XWPDrives_parent_WPDrives_wpAddToContent(somSelf, Object);

    // this is only needed for WPDisk objects
    if (_somIsA(Object, _WPDisk))
    {
        // insert object into any open Splitview for this folder
        fdrSplitInsertObject(somSelf, Object);

        if (!(_wpQueryFldrFlags(somSelf) & (FOI_POPULATEINPROGRESS | FOI_REFRESHINPROGRESS)))
            fdrForEachOpenInstanceView(somSelf,
                                       stb_PostCallback,
                                       STBM_UPDATESTATUSBAR);
    }
    return brc;
}

/*
 *@@ wpclsInitData:
 *      this WPObject class method gets called when a class
 *      is loaded by the WPS (probably from within a
 *      somFindClass call) and allows the class to initialize
 *      itself.
 */

SOM_Scope void  SOMLINK xfdrvM_wpclsInitData(M_XWPDrives *somSelf)
{
    // M_XWPDrivesMethodDebug("M_XWPDrives","xfdrvM_wpclsInitData");

    M_XWPDrives_parent_M_WPDrives_wpclsInitData(somSelf);

    krnClassInitialized(G_pcszXWPDrives);
}

