2013-12-02 11:17:07 -05:00
|
|
|
// dxTabCtrl.cpp : implementation file
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// This class is provided as is and Ben Hill takes no
|
|
|
|
// responsibility for any loss of any kind in connection
|
|
|
|
// to this code.
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Is is meant purely as a educational tool and may
|
|
|
|
// contain bugs.
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// ben@shido.fsnet.co.uk
|
|
|
|
// http://www.shido.fsnet.co.uk
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// Thanks to a mystery poster in the C++ forum on
|
|
|
|
// www.codeguru.com I can't find your name to say thanks
|
|
|
|
// for your Control drawing code. If you are that person
|
|
|
|
// thank you very much. I have been able to use some of
|
|
|
|
// you ideas to produce this sample application.
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "dxTabCtrl.h"
|
|
|
|
|
|
|
|
#include "TabProgram.h"
|
2016-03-22 12:45:29 -04:00
|
|
|
#include "TabHook.h"
|
2013-12-02 11:17:07 -05:00
|
|
|
#include "TabDirectX.h"
|
2016-07-24 12:46:36 -04:00
|
|
|
#include "TabDirectX2.h"
|
2014-11-19 11:40:00 -05:00
|
|
|
#include "TabDirect3D.h"
|
2014-04-22 12:39:07 -04:00
|
|
|
#include "TabInput.h"
|
2013-12-02 11:17:07 -05:00
|
|
|
#include "TabTiming.h"
|
|
|
|
#include "TabWindow.h"
|
|
|
|
#include "TabOpenGL.h"
|
|
|
|
#include "TabCompat.h"
|
2013-06-29 12:38:04 -04:00
|
|
|
#include "TabColor.h"
|
2016-03-22 12:45:29 -04:00
|
|
|
#include "TabLogs.h"
|
2015-09-09 12:41:24 -04:00
|
|
|
#include "TabRegistry.h"
|
2015-07-01 12:40:14 -04:00
|
|
|
#include "TabNotes.h"
|
2013-07-12 12:38:33 -04:00
|
|
|
#include "TabSysLibs.h"
|
2013-11-10 11:38:21 -05:00
|
|
|
#include "TabDebug.h"
|
2013-12-02 11:17:07 -05:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
#undef THIS_FILE
|
|
|
|
static char THIS_FILE[] = __FILE__;
|
|
|
|
#endif
|
|
|
|
|
2013-11-10 11:38:21 -05:00
|
|
|
extern BOOL gbDebug;
|
|
|
|
|
2013-12-02 11:17:07 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CDXTabCtrl
|
|
|
|
|
|
|
|
CDXTabCtrl::CDXTabCtrl()
|
|
|
|
{
|
2013-06-29 12:38:04 -04:00
|
|
|
int i=0;
|
|
|
|
m_tabPages[i++]=new CTabProgram;
|
2016-03-22 12:45:29 -04:00
|
|
|
m_tabPages[i++]=new CTabHook;
|
2013-06-29 12:38:04 -04:00
|
|
|
m_tabPages[i++]=new CTabWindow;
|
2013-07-12 12:38:33 -04:00
|
|
|
m_tabPages[i++]=new CTabInput;
|
|
|
|
m_tabPages[i++]=new CTabDirectX;
|
2016-07-24 12:46:36 -04:00
|
|
|
m_tabPages[i++]=new CTabDirectX2;
|
2014-11-19 11:40:00 -05:00
|
|
|
m_tabPages[i++]=new CTabDirect3D;
|
2013-06-29 12:38:04 -04:00
|
|
|
m_tabPages[i++]=new CTabTiming;
|
|
|
|
m_tabPages[i++]=new CTabLogs;
|
2013-07-12 12:38:33 -04:00
|
|
|
m_tabPages[i++]=new CTabSysLibs;
|
2013-06-29 12:38:04 -04:00
|
|
|
m_tabPages[i++]=new CTabCompat;
|
2015-09-09 12:41:24 -04:00
|
|
|
m_tabPages[i++]=new CTabRegistry;
|
2015-07-01 12:40:14 -04:00
|
|
|
m_tabPages[i++]=new CTabNotes;
|
2013-11-10 11:38:21 -05:00
|
|
|
if (gbDebug) m_tabPages[i++]=new CTabDebug;
|
2013-12-02 11:17:07 -05:00
|
|
|
|
2013-06-29 12:38:04 -04:00
|
|
|
m_nNumberOfPages=i;
|
2013-12-02 11:17:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
CDXTabCtrl::~CDXTabCtrl()
|
|
|
|
{
|
|
|
|
for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
|
|
|
|
delete m_tabPages[nCount];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDXTabCtrl::Init()
|
|
|
|
{
|
2013-06-29 12:38:04 -04:00
|
|
|
int i = 0;
|
2013-12-02 11:17:07 -05:00
|
|
|
m_tabCurrent=0;
|
|
|
|
|
2013-06-29 12:38:04 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_PROGRAM, this);
|
2016-03-22 12:45:29 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_HOOK, this);
|
2013-07-12 12:38:33 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_OUTPUT, this);
|
|
|
|
m_tabPages[i++]->Create(IDD_TAB_INPUT, this);
|
|
|
|
m_tabPages[i++]->Create(IDD_TAB_DIRECTX, this);
|
2016-07-24 12:46:36 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_DIRECTX2, this);
|
2014-11-19 11:40:00 -05:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_D3D, this);
|
2013-06-29 12:38:04 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_TIMING, this);
|
|
|
|
m_tabPages[i++]->Create(IDD_TAB_LOG, this);
|
2013-07-12 12:38:33 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_SYSLIBS, this);
|
2013-06-29 12:38:04 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_COMPAT, this);
|
2015-09-09 12:41:24 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_REGISTRY, this);
|
2015-07-01 12:40:14 -04:00
|
|
|
m_tabPages[i++]->Create(IDD_TAB_NOTES, this);
|
2013-11-10 11:38:21 -05:00
|
|
|
if (gbDebug) m_tabPages[i++]->Create(IDD_TAB_DEBUG, this);
|
2013-12-02 11:17:07 -05:00
|
|
|
|
|
|
|
for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
|
|
|
|
m_tabPages[nCount]->ShowWindow(nCount ? SW_HIDE:SW_SHOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetRectangle();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CDXTabCtrl::SetRectangle()
|
|
|
|
{
|
|
|
|
CRect tabRect, itemRect;
|
|
|
|
int nX, nY, nXc, nYc;
|
|
|
|
|
|
|
|
GetClientRect(&tabRect);
|
|
|
|
GetItemRect(0, &itemRect);
|
|
|
|
|
|
|
|
nX=itemRect.left;
|
|
|
|
nY=itemRect.bottom+1;
|
|
|
|
nXc=tabRect.right-itemRect.left-1;
|
|
|
|
nYc=tabRect.bottom-nY-1;
|
|
|
|
|
|
|
|
m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
|
|
|
|
for(int nCount=1; nCount < m_nNumberOfPages; nCount++){
|
|
|
|
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDXTabCtrl, CTabCtrl)
|
|
|
|
//{{AFX_MSG_MAP(CDXTabCtrl)
|
|
|
|
ON_WM_LBUTTONDOWN()
|
|
|
|
//}}AFX_MSG_MAP
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CDXTabCtrl message handlers
|
|
|
|
|
|
|
|
void CDXTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
|
|
|
|
{
|
|
|
|
CTabCtrl::OnLButtonDown(nFlags, point);
|
|
|
|
|
|
|
|
if(m_tabCurrent != GetCurFocus()){
|
|
|
|
m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
|
|
|
|
m_tabCurrent=GetCurFocus();
|
|
|
|
m_tabPages[m_tabCurrent]->ShowWindow(SW_SHOW);
|
|
|
|
m_tabPages[m_tabCurrent]->SetFocus();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-07-24 12:46:36 -04:00
|
|
|
void CDXTabCtrl::SwitchToTab(int pos)
|
|
|
|
{
|
|
|
|
m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
|
|
|
|
SetCurSel(pos);
|
|
|
|
m_tabPages[pos]->ShowWindow(SW_SHOW);
|
|
|
|
m_tabPages[pos]->SetFocus();
|
|
|
|
m_tabCurrent=GetCurFocus();
|
|
|
|
}
|
|
|
|
|
2013-12-02 11:17:07 -05:00
|
|
|
void CDXTabCtrl::OnOK()
|
|
|
|
{
|
|
|
|
for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
|
|
|
|
m_tabPages[nCount]->UpdateData(TRUE);
|
|
|
|
}
|
|
|
|
}
|
2016-07-24 12:46:36 -04:00
|
|
|
|