|
// SlideSon.cpp : implementation file
//
#include "stdafx.h"
#include "SlideSon.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSlideSon dialog
/*
CSlideSon::CSlideSon(CWnd* pParent /*=NULL*///)
// : CDialog(CSlideSon::IDD, pParent)
//{
//{{AFX_DATA_INIT(CSlideSon)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
/* m_pDlg = NULL;
}
*/
CSlideSon::CSlideSon( UINT nDlgID,CWnd* pParent )
: CDialog( nDlgID, pParent )
{
m_pDlg = pParent ;
m_nSpeed = MID;
m_SlideDirection = RIGHT;
}
/*
CSlideSon::Create()
{
return CDialog::Create(CSlideSon::IDD);
}
*/
void CSlideSon::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSlideSon)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSlideSon, CDialog)
//{{AFX_MSG_MAP(CSlideSon)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSlideSon message handlers
BOOL CSlideSon::RePosition()
{
this->m_pDlg->GetWindowRect(&m_MyPos);
int xPos = m_MyPos.right ;
SetWindowPos(&wndTop,xPos,m_MyPos.top+4,OrigPos.Width(),m_MyPos.Height()-8,SWP_SHOWWINDOW);
return TRUE;
}
BOOL CSlideSon::StartSlide()
{
this->m_pDlg->GetWindowRect(&m_MyPos);
GetWindowRect(&OrigPos);
int nCtr,xPos;
switch (m_SlideDirection)
{
case RIGHT:
xPos = m_MyPos.right-OrigPos.Width();
for(nCtr=0;nCtr<=OrigPos.Width();xPos+=5,nCtr+=5)
{
Sleep(m_nSpeed);
SetWindowPos(m_pDlg,xPos,m_MyPos.top+4,OrigPos.Width(),m_MyPos.Height()-8,SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
}
break;
case LEFT:
xPos =m_MyPos.left;
for(nCtr=0 ; nCtr<=OrigPos.Width() ; nCtr+=5,xPos-=5)
{
Sleep(m_nSpeed);
SetWindowPos(m_pDlg,xPos,m_MyPos.top+4,OrigPos.Width(),m_MyPos.Height()-8,SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOACTIVATE);
}
break;
}
return TRUE; // return TRUE unless you set the focus to a control
}
BOOL CSlideSon::Close()
{
//
int nCtr,xPos;
switch (m_SlideDirection)
{
case RIGHT:
xPos = m_MyPos.right;
for(nCtr=0;nCtr<=OrigPos.Width();xPos-=5,nCtr+=5)
{
Sleep(m_nSpeed);
SetWindowPos(m_pDlg,xPos,m_MyPos.top+4,OrigPos.Width(),m_MyPos.Height()-8,SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOACTIVATE);
}
break;
case LEFT:
GetWindowRect(&OrigPos);
xPos = OrigPos.left;
for(nCtr=0 ; nCtr<=OrigPos.Width() ; nCtr+=5,xPos+=5)
{
Sleep(m_nSpeed);
SetWindowPos(m_pDlg,xPos,m_MyPos.top+4,OrigPos.Width(),m_MyPos.Height()-8,SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION);
}
break;
}
//
return TRUE;
}
void CSlideSon::OnOK()
{
// TODO: Add extra validation here
if (m_pDlg!=NULL)
m_pDlg->PostMessage(WM_CLOSE_SLIDING,IDOK,0);
CDialog::OnOK();
}
void CSlideSon::OnCancel()
{
// TODO: Add extra cleanup here
if (m_pDlg!=NULL)
m_pDlg->PostMessage(WM_CLOSE_SLIDING,IDOK,0);
CDialog::OnCancel();
}
|
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.