136 lines
2.9 KiB
C++
136 lines
2.9 KiB
C++
|
//
|
|||
|
// <20>ւȂ<D682><C882>傱<EFBFBD>E<EFBFBD>C<EFBFBD><43><EFBFBD>h<EFBFBD>E<EFBFBD>N<EFBFBD><4E><EFBFBD>X
|
|||
|
//
|
|||
|
#include "DebugOut.h"
|
|||
|
#include "Wnd.h"
|
|||
|
|
|||
|
// Instance
|
|||
|
CWndList WndList;
|
|||
|
|
|||
|
list<CWnd*> CWndList::m_WndPtrList;
|
|||
|
|
|||
|
// <20>D<EFBFBD>L<EFBFBD><4C><EFBFBD>c
|
|||
|
CWndList::CWndList()
|
|||
|
{
|
|||
|
// m_WndPtrList.clear();
|
|||
|
}
|
|||
|
|
|||
|
CWndList::~CWndList()
|
|||
|
{
|
|||
|
// if( !m_WndPtrList.empty() )
|
|||
|
// m_WndPtrList.clear();
|
|||
|
}
|
|||
|
|
|||
|
void CWndList::Add( CWnd* pWnd )
|
|||
|
{
|
|||
|
m_WndPtrList.push_back( pWnd );
|
|||
|
}
|
|||
|
|
|||
|
void CWndList::Del( CWnd* pWnd )
|
|||
|
{
|
|||
|
for( list<CWnd*>::iterator it=m_WndPtrList.begin(); it!=m_WndPtrList.end(); ) {
|
|||
|
if( *it == pWnd ) {
|
|||
|
m_WndPtrList.erase(it);
|
|||
|
break;
|
|||
|
} else {
|
|||
|
++it;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
BOOL CWndList::IsDialogMessage( LPMSG msg )
|
|||
|
{
|
|||
|
if( m_WndPtrList.empty() )
|
|||
|
return FALSE;
|
|||
|
|
|||
|
list<CWnd*>::iterator it=m_WndPtrList.begin();
|
|||
|
while( it != m_WndPtrList.end() ) {
|
|||
|
if( ::IsDialogMessage( (*it)->m_hWnd, msg ) )
|
|||
|
return TRUE;
|
|||
|
++it;
|
|||
|
}
|
|||
|
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
|
|||
|
CWnd::CWnd()
|
|||
|
{
|
|||
|
m_hWnd = NULL;
|
|||
|
m_hMenu = NULL;
|
|||
|
}
|
|||
|
|
|||
|
CWnd::~CWnd()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
void CWnd::SetThis()
|
|||
|
{
|
|||
|
// Dispatch<63>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD>悤<EFBFBD><E682A4>CWnd*<2A>ߍ<F0968482><DF8D><EFBFBD>
|
|||
|
if( m_hWnd ) {
|
|||
|
::SetWindowLong( m_hWnd, GWL_USERDATA, (LONG)this );
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
LRESULT CALLBACK CWnd::g_WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|||
|
{
|
|||
|
// <20>E<EFBFBD>C<EFBFBD><43><EFBFBD>h<EFBFBD>E<EFBFBD><45><EFBFBD>J<EFBFBD><4A><EFBFBD>O<EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD><EFBFBD>菈<EFBFBD><E88F88><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if( msg == WM_CREATE ) {
|
|||
|
LPCREATESTRUCT lpcs = (LPCREATESTRUCT)lParam;
|
|||
|
CWnd* pWnd = (CWnd*)::GetWindowLong( hWnd, GWL_USERDATA );
|
|||
|
if( !pWnd ) {
|
|||
|
// CWnd* this<69>ߍ<F0968482><DF8D><EFBFBD>
|
|||
|
::SetWindowLong( hWnd, GWL_USERDATA, (LONG)lpcs->lpCreateParams );
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>̃E<CC83>C<EFBFBD><43><EFBFBD>h<EFBFBD>E<EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
pWnd = (CWnd*)lpcs->lpCreateParams;
|
|||
|
pWnd->m_hWnd = hWnd;
|
|||
|
}
|
|||
|
}
|
|||
|
// CWnd* this<69>ߍ<F0968482><DF8D><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>
|
|||
|
CWnd* pWnd = (CWnd*)::GetWindowLong( hWnd, GWL_USERDATA );
|
|||
|
|
|||
|
if( pWnd ) {
|
|||
|
return pWnd->DispatchWnd( hWnd, msg, wParam, lParam );
|
|||
|
} else {
|
|||
|
return ::DefWindowProc( hWnd, msg, wParam, lParam );
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
BOOL CALLBACK CWnd::g_DlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|||
|
{
|
|||
|
// <20>f<EFBFBD>B<EFBFBD>X<EFBFBD>p<EFBFBD>b<EFBFBD>`<60>O<EFBFBD>ɂ<EFBFBD><C982><EFBFBD><EFBFBD><EFBFBD><EFBFBD>菈<EFBFBD><E88F88><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
if( msg == WM_INITDIALOG ) {
|
|||
|
// Dispatch<63>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD>悤<EFBFBD><E682A4>CWnd*<2A>ߍ<F0968482><DF8D><EFBFBD>(<28><><EFBFBD>[<5B>_<EFBFBD><5F><EFBFBD>͕K<CD95><4B>DialogBoxParam<61>ŋN<C58B><4E><EFBFBD><EFBFBD><EFBFBD>鎖)
|
|||
|
// CWnd* this<69>ߍ<F0968482><DF8D><EFBFBD><EFBFBD>ł<EFBFBD><C582>邪<EFBFBD>C<EFBFBD><43><EFBFBD>[<5B>_<EFBFBD><5F><EFBFBD>ł͓<C582><CD93><EFBFBD><EFBFBD>Ă<EFBFBD><C482>Ȃ<EFBFBD>
|
|||
|
CWnd* pWnd = (CWnd*)::GetWindowLong( hWnd, GWL_USERDATA );
|
|||
|
|
|||
|
if( !pWnd ) {
|
|||
|
::SetWindowLong( hWnd, GWL_USERDATA, (LONG)lParam );
|
|||
|
pWnd = (CWnd*)lParam;
|
|||
|
}
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD>̃E<CC83>C<EFBFBD><43><EFBFBD>h<EFBFBD>E<EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
pWnd->m_hWnd = hWnd;
|
|||
|
|
|||
|
// <20>_<EFBFBD>C<EFBFBD>A<EFBFBD><41><EFBFBD>O<EFBFBD>𒆉<EFBFBD><F0928689>Ɉړ<C988><DA93><EFBFBD><EFBFBD><EFBFBD>:)
|
|||
|
HWND hWndParent = ::GetParent( hWnd );
|
|||
|
if( hWndParent ) {
|
|||
|
RECT rcParent, rc;
|
|||
|
::GetWindowRect( hWndParent, &rcParent );
|
|||
|
::GetWindowRect( hWnd, &rc );
|
|||
|
INT x = rcParent.left+(rcParent.right-rcParent.left)/2-(rc.right-rc.left)/2;
|
|||
|
INT y = rcParent.top +(rcParent.bottom-rcParent.top)/2-(rc.bottom-rc.top)/2;
|
|||
|
// DEBUGOUT( "X=%d Y=%d\n", x, y );
|
|||
|
::SetWindowPos( hWnd, NULL, x, y, -1, -1, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// CWnd* this<69>ߍ<F0968482><DF8D><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>
|
|||
|
CWnd* pWnd = (CWnd*)::GetWindowLong( hWnd, GWL_USERDATA );
|
|||
|
|
|||
|
if( pWnd ) {
|
|||
|
return pWnd->DispatchDlg( hWnd, msg, wParam, lParam );
|
|||
|
} else {
|
|||
|
return FALSE;
|
|||
|
}
|
|||
|
}
|
|||
|
|