
//***************************************************
// Generalised Bitmap Module C++ adapter for GBM plugins
//
// Requires: GBM.DLL version 1.35 or higher (with multipage support)
//
// Copyright (C) 2006-2008 Heiko Nitzsche
//
//   This software is provided 'as-is', without any express or implied
//   warranty.  In no event will the author be held liable for any damages
//   arising from the use of this software.
//
//   Permission is granted to anyone to use this software for any purpose,
//   including commercial applications, and to alter it and redistribute it
//   freely, subject to the following restrictions:
//
//   1. The origin of this software must not be misrepresented; you must not
//      claim that you wrote the original software. If you use this software
//      in a product, an acknowledgment in the product documentation would be
//      appreciated but is not required.
//   2. Altered source versions must be plainly marked as such, and must not be
//      misrepresented as being the original software.
//   3. This notice may not be removed or altered from any source distribution.
//
//***************************************************

#ifndef __CLASS_GBM_DIALOG_ACCESSOR__
    #define __CLASS_GBM_DIALOG_ACCESSOR__

#include "gbm.h"
#include "gbmdlg.h"

// ---------------------------------------------------------

class GbmDialogAccessorException
{
    public:
       GbmDialogAccessorException() {}
      ~GbmDialogAccessorException() {}
};

// ---------------------------------------------------------

class GbmDialogAccessor
{
    private:

        char    * moduleName;
        HMODULE   moduleHandle;

        GbmDialogAccessor(const GbmDialogAccessor & accessor);
        GbmDialogAccessor & operator =(const GbmDialogAccessor & accessor);

        BOOLEAN init(const char * dllPath);

        // --- Function prototype for DLL functions ---

      #if defined(__IBMC__) || defined(__IBMCPP__)
        GBM_ERR (* _System fn_GbmFileDlg)       (HWND hwndP, HWND hwndO, GBMFILEDLG *pgbmfild);
        MRESULT (* _System fn_GbmDefFileDlgProc)(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
      #else
        GBM_ERR (_System * fn_GbmFileDlg)       (HWND hwndP, HWND hwndO, GBMFILEDLG *pgbmfild);
        MRESULT (_System * fn_GbmDefFileDlgProc)(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
      #endif

    // ---------------------------------------------------------

    public:

        GbmDialogAccessor() throw (GbmDialogAccessorException);
        GbmDialogAccessor(const char * dllPath) throw (GbmDialogAccessorException);

        virtual ~GbmDialogAccessor();

        const char * getModuleName()   const;
        const char * getHelpFileName() const;

        // GBMDLG wrapper functions

        GBM_ERR GbmFileDlg(HWND hwndP, HWND hwndO, GBMFILEDLG *pgbmfild) const;

        BOOL    hasPublicGbmDefFileDlgProc() const;
        MRESULT GbmDefFileDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) const;
};

#endif


