Main Page | Class List | File List | Class Members | File Members

ldapauth_TabCtrl.cpp

Go to the documentation of this file.
00001 
00005 /*
00006 pGina ldapAuth code - based upon skeleton code for pGina plugin development
00007 Copyright (C) 2002 Micah Cooper
00008 
00009 This program is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2
00012 of the License, or (at your option) any later version.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with this program; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00023 Email: coopermj@muohio.edu
00024 Snail Mail:
00025         Micah Cooper
00026         212A Kreger Hall
00027         Miami University
00028         Oxford OH  45056
00029 */
00030 // MyTabCtrl.cpp : implementation file
00031 //
00033 // This class is provided as is and Ben Hill takes no
00034 // responsibility for any loss of any kind in connection
00035 // to this code.
00037 // Is is meant purely as a educational tool and may
00038 // contain bugs.
00040 // ben@shido.fsnet.co.uk
00041 // http://www.shido.fsnet.co.uk
00043 // Thanks to a mystery poster in the C++ forum on 
00044 // www.codeguru.com I can't find your name to say thanks
00045 // for your Control drawing code. If you are that person 
00046 // thank you very much. I have been able to use some of 
00047 // you ideas to produce this sample application.
00049 
00050 #include "stdafx.h"
00051 //#include "MyTabExample.h"
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 // ldapAuthTabCtrl
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         //{{AFX_MSG_MAP(ldapAuthTabCtrl)
00127         ON_WM_LBUTTONDOWN()
00128         //}}AFX_MSG_MAP
00129 END_MESSAGE_MAP()
00130 
00131 
00132 // ldapAuthTabCtrl message handlers
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 

Generated on Fri Feb 20 12:03:42 2004 for ldapauth plugin for pGina by doxygen 1.3.5