|
// DialogScroll.h : header for the CDialogScroll class
//
// This class adds a scroll feature to CDialog, similar in function to CFormView.
// To use this class, create a dialog resource as usual, then derive from
// this CDialogScroll class instead of from CDialog. Pass the desired size of the
// dialog window (most likely smaller than the dialog resource) to the constructor.
#ifndef _DIALOGSCROLL_H_
#define _DIALOGSCROLL_H_
#include <afxtempl.h>
class CDialogScroll : public CDialog
{
DECLARE_DYNAMIC(CDialogScroll)
//
// Modeless construction for embedded dialog
// this is proteceted so that you will have to
// derive a class to make this work properly
//
CDialogScroll();
public:
// Modeless construction
CDialogScroll (int nWidth, int nHeight);
// Modal construction, no dialog bar
CDialogScroll (UINT nIDTemplate, int nWidth, int nHeight, CWnd* pParentWnd = NULL);
// Modal construction with dialog bar
CDialogScroll (UINT nIDTemplate,
int nWidth,
int nHeight,
UINT nDlgBarIDTemplate,
CWnd* pParentWnd = NULL);
virtual ~CDialogScroll();
// create the dialog within another dialog
BOOL CreateAsChild(UINT nTemplateID, UINT nWndToReplaceID, BOOL bBorder, CWnd* pParent);
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDialogScroll)
//}}AFX_VIRTUAL
// Implementation
protected:
// as passed to constructor:
int m_nWidth; // desired window width
int m_nHeight; // desired window height
UINT m_nDlgBarIDTemplate; // 0 if none specified
UINT m_nDlgBarStyle;
UINT m_nDlgBarControlID;
BOOL m_bInit; // TRUE if OnInitDialog() has been called
int m_cxOrig; // width of dialog template resource
int m_cyOrig; // height of dialog template resource
BOOL m_bVertSBVisible;
BOOL m_bHorzSBVisible;
BOOL m_bEmbedded;
class CDlgBar : public CDialog
{
public:
CDlgBar(CDialogScroll& DialogScroll);
virtual BOOL OnCommand( WPARAM wParam, LPARAM lParam );
protected:
CDialogScroll& m_DialogScroll;
};
friend CDlgBar;
CDlgBar* m_pDlgBar; // allocated only if 0 != m_nDlgBarIDTemplate
void Construct(
int nWidth,
int nHeight,
UINT nDlgBarIDTemplate);
void PositionDlgBar();
// Generated message map functions
//{{AFX_MSG(CTestScrollDlg)
virtual BOOL OnInitDialog();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnMove(int x, int y);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
// for idle-time processing
static LRESULT CALLBACK IdleProc(int nCode, WPARAM wParam, LPARAM lParam);
// for keystroke processing
static LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wVKeyCode, LPARAM lFlags);
// for message filtering
static LRESULT CALLBACK MessageProc(int code, WPARAM wUnused, LPARAM lMsg);
// for communicating to IdleProc(), KeyboardProc(), and MessageProc():
class CEnvironment
{
public:
HHOOK m_hOldIdleProc; // old idle processing function handle
HHOOK m_hOldKeyboardProc; // old keyboard processing function handle
HHOOK m_hOldMessageProc; // old message processing function handle
CDialogScroll* m_pThis; // the current CDialogScroll object
CWnd* m_pCtrl; // the control on the dialog with the focus
//
// NOTE on m_pThisParent
// the current CDialogScroll parent object this will be different than the m_pThis
// when dialog is embedded within another dialog
//
CWnd* m_pThisParent;
CWnd* GetEmbeddedWnd() { return m_pThisParent;}
};
// list of active CEnvironment objects;
// head of this list is the current idle-time environment object:
static CPtrList m_listIdle;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif //_DIALOGSCROLL_H_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.