#ifndef XML_FORM_WINDOW_H_INCLUDED
#define XML_FORM_WINDOW_H_INCLUDED
/*****************************************************************************/
/* HEADER FILE */
/*****************************************************************************/
/*
$Archive: $
$Revision: $
Last Checkin:
$Date: $
By:
$Author: $
Last Modification:
$ModTime: $
Description: Declaration of the XML Form Window.
TOOL And XML FORMS License
==========================
Except where otherwise noted, all of the documentation
and software included in the TOOL package is
copyrighted by Michael Swartzendruber.
Copyright (C) 2005 Michael John Swartzendruber.
All rights reserved.
Access to this code, whether intentional or accidental,
does NOT IMPLY any transfer of rights.
This software is provided "as-is," without any express
or implied warranty. In no event shall 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 and redistribute it, provided that the following
conditions are met:
1. All redistributions of source code files must retain
all copyright notices that are currently in place,
and this list of conditions without modification.
2. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
3. If you use this software in another product, an acknowledgment
in the product documentation would be appreciated but is
not required.
4. Modified versions in source or binary form must be plainly
marked as such, and must not be misrepresented as being
the original software.
*/
/*****************************************************************************/
#include <map>
#include "XMLFormControlResizer.h"
#include "XMLFormObserver.h"
#pragma warning( disable : 4786 )
const int TABLELENGTH = 40;
// forward declaration
//
class CXMLFormFacade;
class CXMLFormControlFactory;
class VMFacade;
class CXMLFormWindow : public CFrameWnd
{
friend class CXMLFormFacade;
DECLARE_DYNCREATE( CXMLFormWindow )
public:
CXMLFormWindow( bool bSizeable = false, bool bModal = true );
virtual ~CXMLFormWindow( void );
void SetBackgroundColor( COLORREF xNewBackgroundColor );
void SetTextColor( COLORREF xNewTextColor );
COLORREF GetBackgroundColor( void ){ return( m_xBackgroundColor ); };
COLORREF GetTextColor( void ){ return( m_xTextColor ); };
void SetObserver( CXMLFormObserver* poObserver )
{
m_poObserver = poObserver;
};
void SetOwner( CXMLFormFacade* poOwner )
{
m_poOwner = poOwner;
};
void SetErrorText( const char* pchText )
{
m_oValidationErrorText = pchText;
};
void ShowErrors( UINT iButtonID );
void RefreshControlsInRect( CRect& roRect );
void ChildFocus( CWnd* poChild, bool bHasFocus );
CWnd* HasFocus( void )
{
return( m_poHasFocus );
};
void TreatAsControl( void ){ m_bTreatAsControl = true; };
void EnableCustomRender( const char* pchRenderCode, const char* pchRenderEntry )
{
m_bCustomRender = true;
m_oRenderCode = pchRenderCode;
m_oRenderEntry = pchRenderEntry;
}
//{{AFX_VIRTUAL( CXMLFormWindow )
virtual BOOL PreTranslateMessage( MSG* pxMsg );
//}}AFX_VIRTUAL
public:
//{{AFX_MSG( CXMLFormWindow )
afx_msg BOOL OnEraseBkgnd( CDC* pDC );
afx_msg void OnLButtonDown( UINT nFlags, CPoint point );
afx_msg void OnRButtonDown( UINT nFlags, CPoint point );
afx_msg void OnPaint();
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
afx_msg void OnSize( UINT iType, int iDeltaX, int iDeltaY );
afx_msg UINT OnNcHitTest( CPoint point );
afx_msg HBRUSH OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );
afx_msg void OnDestroy( void );
afx_msg void OnNcPaint();
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );
afx_msg BOOL OnNcActivate( BOOL bActive );
afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point );
afx_msg void OnLButtonUp( UINT nFlags, CPoint point );
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// Overrideable.
protected:
virtual BOOL DoClickProcessing( void );
BOOL IsPtInDialog( POINT xPoint );
DWORD HitTest( CPoint oPoint );
static HHOOK m_hOldHook;
private:
void CreateErrorWindow();
void InvalidateSpecialKids( void );
BOOL CompareClassName( HWND hWnd, LPCTSTR pchClassName );
private:
bool m_bDrawGripper;
CString m_oValidationErrorText;
CWnd* m_poPopup;
CWnd* m_poPopupOwner;
CWnd* m_poHasFocus;
CWnd* m_poHadFocusLast;
CEdit m_oPopupText;
CRect m_oOriginalSize;
CRect m_oGripperRect;
CBrush m_oBrush;
COLORREF m_xBackgroundColor;
COLORREF m_xTextColor;
CXMLFormObserver* m_poObserver;
CXMLFormFacade* m_poOwner;
CXMLFormControlFactory* m_poFactory;
bool m_bDestroyed;
bool m_bModal;
CXMLFormControlResizer m_oResizeHelper;
CRect m_oRestoreToSize;
CRect m_oCloseButtonRect;
DWORD m_LastHit;
DWORD m_ButtonDown;
bool m_bCustomRender;
CString m_oRenderCode;
CString m_oRenderEntry;
VMFacade* m_poRenderEngine;
HWND m_hMyWindowHandle;
bool m_bTreatAsControl;
public:
static LRESULT CALLBACK LocalWndProc( HWND, UINT, WPARAM, LPARAM );
static LRESULT CALLBACK LocalMouseFunc( int iCode, WPARAM wParam, LPARAM lParam );
};
#endif
/*****************************************************************************/
/* Check-in history
$WorkFile: $
$Archive: $
*$Log: $
*/
/*****************************************************************************/