M
mosfet
Hi,
I have qome questions about templated class and pointer.
Let's says I have some graphical classes defined like this(WTL framework) :
// represent a view
class CFooView : public CStdDialogImpl<CFooView>
{
public:
enum { IDD = IDD_FOO_FORM };
....
};
// represent a welcome view
class CWelcomeView : public CStdDialogImpl<CWelcomeView>
{
public:
....
};
class CMainFrame :
public CFrameWindowImpl<CMainFrame>,
public CUpdateUI<CMainFrame>,
public CAppWindow<CMainFrame>,
public CFullScreenFrame<CMainFrame>,
public CMessageFilter,
public CIdleHandler,
public CMDIBase<CMainFrame>
{
public:
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
if(CFrameWindowImpl<CMainFrame>:
reTranslateMessage(pMsg))
return TRUE;
return m_mainView.IsWindow() ? m_mainView.PreTranslateMessage(pMsg) :
FALSE;
}
// our views
CVoxsyncBackupView m_mainView;
CWelcomeView m_welcomeView;
???????????? m_curView;
....
};
As you can see in CMainFrame class I have some views defined in it and I
am supposed to be able to switch between them.
The problem comes from the PreTranslateMessage method, because it is
supposed to point to the current view.
So how could I declare a kind of pointer on the current templated class ?
Until now I was using only one view so PreTranslateMessage is using
m_mainView but what if I want to use another view ?
I have qome questions about templated class and pointer.
Let's says I have some graphical classes defined like this(WTL framework) :
// represent a view
class CFooView : public CStdDialogImpl<CFooView>
{
public:
enum { IDD = IDD_FOO_FORM };
....
};
// represent a welcome view
class CWelcomeView : public CStdDialogImpl<CWelcomeView>
{
public:
....
};
class CMainFrame :
public CFrameWindowImpl<CMainFrame>,
public CUpdateUI<CMainFrame>,
public CAppWindow<CMainFrame>,
public CFullScreenFrame<CMainFrame>,
public CMessageFilter,
public CIdleHandler,
public CMDIBase<CMainFrame>
{
public:
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
if(CFrameWindowImpl<CMainFrame>:
return TRUE;
return m_mainView.IsWindow() ? m_mainView.PreTranslateMessage(pMsg) :
FALSE;
}
// our views
CVoxsyncBackupView m_mainView;
CWelcomeView m_welcomeView;
???????????? m_curView;
....
};
As you can see in CMainFrame class I have some views defined in it and I
am supposed to be able to switch between them.
The problem comes from the PreTranslateMessage method, because it is
supposed to point to the current view.
So how could I declare a kind of pointer on the current templated class ?
Until now I was using only one view so PreTranslateMessage is using
m_mainView but what if I want to use another view ?