00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "WndHelp.h"
00025 #include "Skin.h"
00026
00027 #ifdef _DEBUG
00028 #define new DEBUG_NEW
00029 #undef THIS_FILE
00030 static char THIS_FILE[] = __FILE__;
00031 #endif
00032
00033 IMPLEMENT_SERIAL(CHelpWnd, CPanelWnd, 1)
00034
00035 BEGIN_MESSAGE_MAP(CHelpWnd, CPanelWnd)
00036
00037 ON_WM_CREATE()
00038 ON_WM_DESTROY()
00039 ON_WM_SIZE()
00040
00041 END_MESSAGE_MAP()
00042
00043 #define PANEL_WIDTH 200
00044 #define TOOLBAR_HEIGHT 28
00045
00046
00048
00049
00050 CHelpWnd::CHelpWnd() : CPanelWnd( TRUE, FALSE )
00051 {
00052 Create( IDR_HELPFRAME );
00053 }
00054
00055 CHelpWnd::~CHelpWnd()
00056 {
00057 }
00058
00060
00061
00062 int CHelpWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
00063 {
00064 if ( CPanelWnd::OnCreate( lpCreateStruct ) == -1 ) return -1;
00065
00066 CRect rect( 0, 0, 0, 0 );
00067
00068 if ( ! m_wndToolBar.Create( this, WS_CHILD|WS_VISIBLE|CBRS_NOALIGN, AFX_IDW_TOOLBAR ) ) return -1;
00069 m_wndToolBar.SetBarStyle( m_wndToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_BORDER_TOP );
00070 m_wndPanel.Create( WS_CHILD|WS_VISIBLE, rect, this, 100 );
00071 m_wndView.Create( WS_CHILD|WS_VISIBLE, rect, this, 100 );
00072
00073 LoadState();
00074
00075 return 0;
00076 }
00077
00078 void CHelpWnd::OnDestroy()
00079 {
00080 SaveState();
00081 CPanelWnd::OnDestroy();
00082 }
00083
00084 void CHelpWnd::OnSkinChange()
00085 {
00086 CPanelWnd::OnSkinChange();
00087 Skin.CreateToolBar( _T("CHelpWnd"), &m_wndToolBar );
00088
00089 }
00090
00091 void CHelpWnd::OnSize(UINT nType, int cx, int cy)
00092 {
00093 if ( nType != 1982 ) CPanelWnd::OnSize( nType, cx, cy );
00094
00095 CRect rc;
00096 GetClientRect( &rc );
00097
00098 HDWP hDWP = BeginDeferWindowPos( 3 );
00099
00100 DeferWindowPos( hDWP, m_wndToolBar, HWND_TOP, PANEL_WIDTH, rc.bottom - TOOLBAR_HEIGHT, rc.right - PANEL_WIDTH, TOOLBAR_HEIGHT, 0 );
00101 DeferWindowPos( hDWP, m_wndPanel, NULL, 0, 0, PANEL_WIDTH, rc.bottom, SWP_NOZORDER );
00102 DeferWindowPos( hDWP, m_wndView, NULL, PANEL_WIDTH, 0, rc.right - PANEL_WIDTH, rc.bottom - TOOLBAR_HEIGHT, SWP_NOZORDER );
00103
00104 EndDeferWindowPos( hDWP );
00105 }
00106
00107 BOOL CHelpWnd::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
00108 {
00109 if ( m_wndToolBar.m_hWnd != NULL )
00110 {
00111 if ( m_wndToolBar.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE;
00112 }
00113
00114 return CPanelWnd::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );
00115 }