00001
00002
00003
00004
00005
00006 #include "stdafx.h"
00007 #include "FdmApp.h"
00008 #include "AppStatusBar.h"
00009
00010 #ifdef _DEBUG
00011 #define new DEBUG_NEW
00012 #undef THIS_FILE
00013 static char THIS_FILE[] = __FILE__;
00014 #endif
00015
00016 CAppStatusBar::CAppStatusBar()
00017 {
00018 }
00019
00020 CAppStatusBar::~CAppStatusBar()
00021 {
00022 }
00023
00024 BEGIN_MESSAGE_MAP(CAppStatusBar, CStatusBar)
00025
00026 ON_WM_CREATE()
00027 ON_WM_SIZE()
00028
00029 END_MESSAGE_MAP()
00030
00031 int CAppStatusBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
00032 {
00033 if (CStatusBar::OnCreate(lpCreateStruct) == -1)
00034 return -1;
00035
00036 m_ttip.Create (this, TTS_ALWAYSTIP);
00037
00038
00039 m_ttip.SendMessage(TTM_SETMAXTIPWIDTH, 0, (UINT)(WORD)-1);
00040
00041 CRect rc (0, 0, 0, 0);
00042 m_ttip.AddTool (this, " ", &rc, ID_SB_TRAFFIC_THISMONTH);
00043 m_ttip.AddTool (this, LS (L_TOTAL_SPEED_SBTEXT), &rc, ID_SB_TOTALSPEED);
00044
00045 return 0;
00046 }
00047
00048 void CAppStatusBar::OnSize(UINT nType, int cx, int cy)
00049 {
00050 CStatusBar::OnSize(nType, cx, cy);
00051
00052 CRect rc;
00053 int i = CommandToIndex (ID_SB_TRAFFIC_THISMONTH);
00054 GetStatusBarCtrl ().GetRect (i, &rc);
00055 m_ttip.SetToolRect (this, ID_SB_TRAFFIC_THISMONTH, &rc);
00056
00057 i = CommandToIndex (ID_SB_TOTALSPEED);
00058 GetStatusBarCtrl ().GetRect (i, &rc);
00059 m_ttip.SetToolRect (this, ID_SB_TOTALSPEED, &rc);
00060 }
00061
00062 void CAppStatusBar::SetToolTipText(UINT nIDTip, LPCSTR pszText)
00063 {
00064 m_ttip.UpdateTipText (pszText, this, nIDTip);
00065 }
00066
00067 BOOL CAppStatusBar::PreTranslateMessage(MSG *pMsg)
00068 {
00069 m_ttip.RelayEvent (pMsg);
00070 return CStatusBar::PreTranslateMessage (pMsg);
00071 }