home *** CD-ROM | disk | FTP | other *** search
/ Clickx 47 / Clickx 47.iso / assets / software / sswitchxp152.exe / source / SpeedswitchXP / SystemInfo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-13  |  3.2 KB  |  140 lines

  1. /*
  2.    SpeedswitchXP V1.5
  3.    - Windows XP CPU Frequency Control for Notebooks -
  4.  
  5.    Copyright(c) 2002-2005 Christian Diefer
  6.  
  7.    This program is free software; you can redistribute it and/or modify
  8.    it under the terms of the GNU General Public License version 2 as 
  9.    published by the Free Software Foundation.
  10.    
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.    
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #define _UNICODE
  22.  
  23. #include "stdafx.h"
  24. #include "SpeedswitchXP.h"
  25. #include "CPUData.h"
  26. #include "PowerCapabilities.h"
  27. #include "SystemInfo.h"
  28. #include "uxtheme.h"
  29.  
  30. CCPUData cpuData;
  31. CPowerCapabilities powerCaps;
  32.  
  33. // CSystemInfo dialog
  34.  
  35. IMPLEMENT_DYNAMIC(CSystemInfo, CDialog)
  36. CSystemInfo::CSystemInfo(CWnd* pParent /*=NULL*/)
  37.     : CDialog(CSystemInfo::IDD, pParent)
  38. { }
  39.  
  40. CSystemInfo::~CSystemInfo()
  41. { }
  42.  
  43. void CSystemInfo::DoDataExchange(CDataExchange* pDX)
  44. {
  45.   CDialog::DoDataExchange(pDX);
  46.   DDX_Control(pDX, IDC_TAB3, tabCtrl);
  47. }
  48.  
  49.  
  50. BEGIN_MESSAGE_MAP(CSystemInfo, CDialog)
  51.   ON_NOTIFY(TCN_SELCHANGE, IDC_TAB3, OnTcnSelchangeTab3)
  52. END_MESSAGE_MAP()
  53.  
  54.  
  55. // CSystemInfo message handlers
  56.  
  57. BOOL CSystemInfo::OnInitDialog()
  58. {
  59.   CDialog::OnInitDialog();
  60.  
  61.   CString s1;
  62.   wchar_t t[256];
  63.  
  64.   s1.LoadStringW( IDS_INFO3 );
  65.   _tcscpy_s( t, s1 );
  66.  
  67.     TC_ITEM TabCtrlItem;
  68.     TabCtrlItem.mask = TCIF_TEXT;
  69.     TabCtrlItem.pszText = t;
  70.     tabCtrl.InsertItem( 0, &TabCtrlItem );
  71.  
  72.   s1.LoadStringW( IDS_INFO4 );
  73.   _tcscpy_s( t, s1 );
  74.     TabCtrlItem.pszText = t;
  75.     tabCtrl.InsertItem( 1, &TabCtrlItem );
  76.  
  77.   tabs[0] = &cpuData;
  78.   tabs[1] = &powerCaps;
  79.  
  80.   cpuData.Create( IDD_CPUDATA, this );
  81.   powerCaps.Create( IDD_POWERCAPS, this );
  82.  
  83.   cpuData.ShowWindow( SW_SHOW );
  84.   powerCaps.ShowWindow( SW_HIDE );
  85.  
  86.   // calculate overlay window position and size
  87.   RECT rect;
  88.  
  89.   tabCtrl.GetClientRect( &rect );
  90.   ScreenToClient( &rect );
  91.  
  92.   for( int i=0; i<2; i++ )
  93.   {
  94.     RECT rect;
  95.  
  96.     tabs[i]->GetClientRect( &rect );
  97.     TabCtrl_AdjustRect( tabCtrl, 0, &rect );
  98.     tabCtrl.ClientToScreen( &rect );
  99.     ScreenToClient( &rect );
  100.     tabs[i]->SetWindowPos( &wndTop,
  101.                            rect.left,
  102.                            rect.top,
  103.                            rect.right - rect.left,
  104.                            rect.bottom - rect.top + 22,
  105.                            (i ? SWP_HIDEWINDOW : SWP_SHOWWINDOW) );
  106.  
  107.     EnableThemeDialogTexture( tabs[i]->m_hWnd, ETDT_ENABLETAB );
  108.   }
  109.  
  110.   cpuData.UpdateData( FALSE );
  111.   powerCaps.UpdateData( FALSE );
  112.  
  113.   log( _T("OnInitDialog von Sysinfo zuende") );
  114.  
  115.   return TRUE;
  116. }
  117.  
  118. void CSystemInfo::OnTcnSelchangeTab3( NMHDR *pNMHDR, LRESULT *pResult )
  119. {
  120.   int i = tabCtrl.GetCurSel();
  121.  
  122.   for( int x=0; x<2; x++ )
  123.     tabs[x]->ShowWindow( x==i ? SW_SHOW : SW_HIDE );
  124.  
  125.   *pResult = 0;
  126. }
  127.  
  128. void CSystemInfo::OnOK()
  129. {
  130.   CDialog::OnOK();
  131. }
  132.  
  133. void CSystemInfo::setVars()
  134. {
  135.   cpuData.setVars();
  136.   powerCaps.setVars();
  137. }
  138.  
  139.  
  140.