testtoolsconn/stat/desktop/source/desktop/inc/scriptprogressmonitorimp.h
changeset 0 3da2a79470a7
equal deleted inserted replaced
-1:000000000000 0:3da2a79470a7
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #if ! defined (SCRIPTPROGRESSMONITORIMP_H_045CF869_6A0F_4447_B5CF_393C4C419BDE)
       
    23 #define SCRIPTPROGRESSMONITORIMP_H_045CF869_6A0F_4447_B5CF_393C4C419BDE
       
    24 
       
    25 #include <Statexp.h>
       
    26 
       
    27 /////////////////////////////////////////////////////////////////////////////
       
    28 // ScriptProgressMonitorImp
       
    29 // Concrete implementation of the class ScriptProgressMonitor.
       
    30 // This class knows about the dialog window and uses Windows messages
       
    31 // to call the dialog call-back update methods.
       
    32 // Even though this class knows of the dialog class it is not wise to
       
    33 // call methods in the MFC Window class directly as we may (probably are)
       
    34 // in a different thread and calling MFC methods across treads is a bad
       
    35 // thing to do.
       
    36 /////////////////////////////////////////////////////////////////////////////
       
    37 
       
    38 class ScriptProgressMonitorImp : public ScriptProgressMonitor
       
    39 {
       
    40 public:
       
    41 	ScriptProgressMonitorImp(HWND hWnd);
       
    42 	~ScriptProgressMonitorImp();
       
    43 
       
    44 protected:
       
    45 	HWND m_hWnd;
       
    46 
       
    47 public:
       
    48 	// Override in a derived class to call-back when a single
       
    49 	// command of the current script is processed.
       
    50 	virtual void OnCompleteCommand( int command );
       
    51 
       
    52 	// Override in a derived class to call-back when the
       
    53 	// whole of current script is processed.
       
    54 	virtual void OnCompleteScript( int scriptExitCode );
       
    55 };
       
    56 
       
    57 // These will not be implemented in-line as we are using virtual
       
    58 // meothds but putting them here saves the use of a seperate
       
    59 // source file.
       
    60 
       
    61 inline ScriptProgressMonitorImp::ScriptProgressMonitorImp( HWND hWnd )
       
    62 	: m_hWnd(hWnd)
       
    63 {
       
    64 	;
       
    65 }
       
    66 
       
    67 inline ScriptProgressMonitorImp::~ScriptProgressMonitorImp()
       
    68 {
       
    69 	;
       
    70 }
       
    71 
       
    72 inline void ScriptProgressMonitorImp::OnCompleteCommand( int command )
       
    73 {
       
    74 	::PostMessage( m_hWnd, WM_DONE_COMMAND, command, 0 );
       
    75 }
       
    76 
       
    77 inline void ScriptProgressMonitorImp::OnCompleteScript( int scriptExitCode )
       
    78 {
       
    79 	::PostMessage( m_hWnd, WM_DONE_SCRIPT, scriptExitCode, 0 );
       
    80 }
       
    81 
       
    82 #endif // ! defined (SCRIPTPROGRESSMONITORIMP_H_045CF869_6A0F_4447_B5CF_393C4C419BDE)