00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00033
00034
00035
00037
00038
00040
00041
00043
00044
00045
00046
00047
00049
00050 #include "stdafx.h"
00051
00052 #include "ldapauth_TabCtrl.h"
00053
00054 #include "ConfigLDAP.h"
00055 #include "ConfigUser.h"
00056 #include "ConfigPwd.h"
00057 #include "ConfigHooks.h"
00058 #include "ConfigAbout.h"
00059
00060 #ifdef _DEBUG
00061 #define new DEBUG_NEW
00062 #undef THIS_FILE
00063 static char THIS_FILE[] = __FILE__;
00064 #endif
00065
00067
00068
00069 ldapAuthTabCtrl::ldapAuthTabCtrl()
00070 {
00071 m_tabPages[0]=new CConfigLDAP;
00072 m_tabPages[1]=new CConfigUser;
00073 m_tabPages[2]=new CConfigPwd;
00074 m_tabPages[3]=new CConfigHooks;
00075 m_tabPages[4]=new CConfigAbout;
00076
00077 m_nNumberOfPages=5;
00078 }
00079
00080 ldapAuthTabCtrl::~ldapAuthTabCtrl()
00081 {
00082 for(int nCount=0; nCount < m_nNumberOfPages; nCount++){
00083 delete m_tabPages[nCount];
00084 }
00085 }
00086
00087 void ldapAuthTabCtrl::Init()
00088 {
00089 m_tabCurrent=0;
00090
00091 m_tabPages[0]->Create(IDD_LDAP_TAB, this);
00092 m_tabPages[1]->Create(IDD_USER_TAB, this);
00093 m_tabPages[2]->Create(IDD_PWD_TAB, this);
00094 m_tabPages[3]->Create(IDD_HOOK_TAB, this);
00095 m_tabPages[4]->Create(IDD_ABOUT_TAB, this);
00096
00097 m_tabPages[0]->ShowWindow(SW_SHOW);
00098 m_tabPages[1]->ShowWindow(SW_HIDE);
00099 m_tabPages[2]->ShowWindow(SW_HIDE);
00100 m_tabPages[3]->ShowWindow(SW_HIDE);
00101 m_tabPages[4]->ShowWindow(SW_HIDE);
00102
00103 SetRectangle();
00104 }
00105
00106 void ldapAuthTabCtrl::SetRectangle()
00107 {
00108 CRect tabRect, itemRect;
00109 int nX, nY, nXc, nYc;
00110
00111 GetClientRect(&tabRect);
00112 GetItemRect(0, &itemRect);
00113
00114 nX=itemRect.left;
00115 nY=itemRect.bottom+1;
00116 nXc=tabRect.right-itemRect.left-1;
00117 nYc=tabRect.bottom-nY-1;
00118
00119 m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
00120 for(int nCount=1; nCount < m_nNumberOfPages; nCount++){
00121 m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
00122 }
00123 }
00124
00125 BEGIN_MESSAGE_MAP(ldapAuthTabCtrl, CTabCtrl)
00126
00127 ON_WM_LBUTTONDOWN()
00128
00129 END_MESSAGE_MAP()
00130
00131
00132
00133
00134 void ldapAuthTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
00135 {
00136 CTabCtrl::OnLButtonDown(nFlags, point);
00137
00138 if(m_tabCurrent != GetCurFocus()){
00139 m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
00140 m_tabCurrent=GetCurFocus();
00141 m_tabPages[m_tabCurrent]->ShowWindow(SW_SHOW);
00142 m_tabPages[m_tabCurrent]->SetFocus();
00143 }
00144 }
00145
00146
00147 void ldapAuthTabCtrl::OnSave()
00148 {
00149 ((CConfigLDAP *)m_tabPages[0])->OnSave();
00150 ((CConfigUser *)m_tabPages[1])->OnSave();
00151 ((CConfigPwd *)m_tabPages[2])->OnSave();
00152 ((CConfigHooks *)m_tabPages[3])->OnSave();
00153 }
00154