//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// This source code is licensed under Microsoft Shared Source License
// Version 1.0 for Windows CE.
// For a copy of the license visit http://go.microsoft.com/fwlink/?LinkId=3223.
//

#include <windows.h>
#include <commdlg.h>

#ifndef PRINTHANDLER_H
#define PRINTHANDLER_H

typedef struct _DCDATA_ {
        HDC hdcPrint;
        HDC hdcVideoMemory;
        int nWidth, nHeight;
        int nCurrentX, nCurrentY;
        int nVidCurrentX, nVidCurrentY;
        int nVidWidth, nVidHeight;
} DCDATA;

typedef struct _PHPARAMS_ {
        bool bDrawToPrimary;
        DEVMODE dm;
        TCHAR *tszDeviceName;
        TCHAR *tszDriverName;
        TCHAR *tszOutputName;
} PHPARAMS;

typedef class CPrintHandler
{
    public:
        CPrintHandler();
        ~CPrintHandler();

        bool Initialize();
        bool Cleanup();
        bool SetPrintHandlerParams(PHPARAMS *);
        bool SetTestDescription(TCHAR *);
        bool GetDCData(DCDATA *);
        bool TestStart(int, int);
        bool TestFinished();

    private:
        bool InitializeMainWindow();
        bool CleanupMainWindow();

        DEVMODE m_dm;
        TCHAR *m_tszDeviceName;
        TCHAR *m_tszDriverName;
        TCHAR *m_tszOutputName;

        HDC m_hdcPrint;
        HDC m_hdcVideoMemory;
        HBITMAP m_hbmpVideoMemory;
        HBITMAP m_hbmpVideoMemoryStock;
        int m_nWidth;
        int m_nHeight;
        int m_nCurrentX;
        int m_nCurrentY;
        int m_nLeftMargin;
        int m_nTopMargin;
        int m_nPageWidth;
        int m_nPageHeight;
        int m_nVidWidth;
        int m_nVidHeight;

        HWND m_hwndPrimary;
        HDC m_hdcPrimary;
        int m_nPrimaryTop;
        int m_nPrimaryLeft;
        int m_nPrimaryWidth;
        int m_nPrimaryHeight;

        TCHAR *m_tszTestInstructions;
        int m_nInstructionHeight;
        bool m_bDrawToPrimary;
        bool m_bInitialized;
} PrintHandler;

#endif
