Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

733 lines
24 KiB

  1. /******************************************************************************/
  2. /* Bar.CPP: IMPLEMENTATION OF THE CStatBar (Status Bar) CLASS */
  3. /* */
  4. /******************************************************************************/
  5. /* */
  6. /* Methods in this file */
  7. /* */
  8. /* CStatBar::CStatBar */
  9. /* CStatBar::~CStatBar */
  10. /* CStatBar::Create */
  11. /* CStatBar::OnSetFont */
  12. /* CStatBar::DoPaint */
  13. /* CStatBar::DrawStatusText */
  14. /* CStatBar::SetText */
  15. /* CStatBar::SetPosition */
  16. /* CStatBar::SetSize */
  17. /* CStatBar::ClearPosition */
  18. /* CStatBar::ClearSize */
  19. /* CStatBar::Reset */
  20. /* CStatBar::OnPaletteChanged */
  21. /* */
  22. /* */
  23. /* Functions in this file */
  24. /* */
  25. /* ClearStatusBarSize */
  26. /* ClearStatusBarPosition */
  27. /* SetPrompt */
  28. /* SetPrompt */
  29. /* ShowStatusBar */
  30. /* IsStatusBarVisible */
  31. /* GetStatusBarHeight */
  32. /* InvalidateStatusBar */
  33. /* ClearStatusBarPositionAndSize */
  34. /* ResetStatusBar */
  35. /* SetStatusBarPosition */
  36. /* SetStatusBarSize */
  37. /* SetStatusBarPositionAndSize */
  38. /* */
  39. /******************************************************************************/
  40. #include "stdafx.h"
  41. #include "global.h"
  42. #include "pbrush.h"
  43. #include "pbrusfrm.h"
  44. #ifdef _DEBUG
  45. #undef THIS_FILE
  46. static char BASED_CODE THIS_FILE[] = __FILE__;
  47. #endif
  48. IMPLEMENT_DYNAMIC( CStatBar, CStatusBar )
  49. #include "memtrace.h"
  50. CStatBar *g_pStatBarWnd = NULL;
  51. static UINT BASED_CODE indicators[] =
  52. {
  53. ID_SEPARATOR, // status line indicator
  54. IDB_SBPOS,
  55. IDB_SBSIZE
  56. };
  57. BEGIN_MESSAGE_MAP( CStatBar, CStatusBar )
  58. ON_WM_SYSCOLORCHANGE()
  59. ON_MESSAGE(WM_SETFONT, OnSetFont)
  60. ON_MESSAGE(WM_SIZEPARENT, OnSizeParent)
  61. ON_WM_NCDESTROY()
  62. END_MESSAGE_MAP()
  63. static int miSlackSpace;
  64. /******************************************************************************/
  65. CStatBar::CStatBar()
  66. {
  67. m_iBitmapWidth = 0;
  68. m_iBitmapHeight = 0;
  69. miSlackSpace = 0;
  70. m_iSizeY = 0;
  71. }
  72. CStatBar::~CStatBar()
  73. {
  74. // Ensure that the CControlBar doesn't assert trying access our parent
  75. // object (CPBFrame) during the destruction of our parent object.
  76. m_pDockSite = NULL;
  77. }
  78. /******************************************************************************/
  79. BOOL CStatBar::Create( CWnd* pParentWnd )
  80. {
  81. BOOL bRC = TRUE;
  82. int cxStatBar; // width of a char in the status bar
  83. // Create the status Bar Window.
  84. bRC = CStatusBar::Create(pParentWnd);
  85. ASSERT (bRC != FALSE);
  86. if (bRC != FALSE)
  87. {
  88. // Set the Pane Indicators.
  89. bRC = SetIndicators( indicators, sizeof( indicators ) / sizeof( UINT ) );
  90. ASSERT( bRC != FALSE );
  91. if (bRC != FALSE)
  92. {
  93. TRY
  94. {
  95. // Load the Separator Strings
  96. VERIFY(m_cstringSizeSeparator.LoadString(IDS_SIZE_SEPARATOR));
  97. VERIFY(m_cstringPosSeparator.LoadString(IDS_POS_SEPARATOR));
  98. }
  99. CATCH(CMemoryException,e)
  100. {
  101. m_cstringSizeSeparator.Empty();
  102. m_cstringPosSeparator.Empty();
  103. }
  104. END_CATCH
  105. // Load the Position and Size Bitmaps
  106. VERIFY(m_posBitmap.LoadBitmap(IDB_SBPOS));
  107. VERIFY(m_sizeBitmap.LoadBitmap(IDB_SBSIZE));
  108. if ( (m_posBitmap.GetSafeHandle() != NULL) &&
  109. (m_sizeBitmap.GetSafeHandle() != NULL) )
  110. {
  111. //Calculate the size of the pane and set them
  112. CClientDC dc(this);
  113. /*DK* What font to select? */
  114. /*DK* What to do if in foreign Language, Size "0"? */
  115. cxStatBar = (dc.GetTextExtent(TEXT("0"), 1)).cx;
  116. BITMAP bmp;
  117. m_posBitmap.GetObject(sizeof (BITMAP), &bmp);
  118. m_iBitmapWidth = bmp.bmWidth;
  119. m_iBitmapHeight = bmp.bmHeight;
  120. int iPaneWidth;
  121. UINT uiID, uiStyle;
  122. GetPaneInfo( 0, uiID, uiStyle, iPaneWidth) ;
  123. SetPaneInfo( 0, uiID, SBPS_NORMAL | SBPS_STRETCH, iPaneWidth );
  124. GetPaneInfo(1, uiID, uiStyle, iPaneWidth);
  125. if (iPaneWidth < bmp.bmWidth + (SIZE_POS_PANE_WIDTH * cxStatBar))
  126. {
  127. iPaneWidth = bmp.bmWidth + (SIZE_POS_PANE_WIDTH * cxStatBar);
  128. SetPaneInfo(1, uiID, uiStyle, iPaneWidth);
  129. }
  130. GetPaneInfo(2, uiID, uiStyle, iPaneWidth);
  131. if (iPaneWidth < bmp.bmWidth + (SIZE_POS_PANE_WIDTH * cxStatBar))
  132. {
  133. iPaneWidth = bmp.bmWidth + (SIZE_POS_PANE_WIDTH * cxStatBar);
  134. SetPaneInfo(2, uiID, uiStyle, iPaneWidth);
  135. }
  136. // force a height change
  137. CFont *pcFontTemp = GetFont();
  138. // initialize font height etc
  139. OnSetFont( (WPARAM)(HFONT)pcFontTemp->GetSafeHandle(), 0 );
  140. }
  141. else
  142. {
  143. bRC = FALSE;
  144. }
  145. }
  146. }
  147. return bRC;
  148. }
  149. /******************************************************************************/
  150. void CStatBar::OnNcDestroy( void )
  151. {
  152. m_posBitmap.DeleteObject();
  153. m_sizeBitmap.DeleteObject();
  154. m_posBitmap.m_hObject = NULL;
  155. m_sizeBitmap.m_hObject = NULL;
  156. m_cstringSizeSeparator.Empty();
  157. m_cstringPosSeparator.Empty();
  158. CStatusBar::OnNcDestroy();
  159. }
  160. /******************************************************************************/
  161. CSize CStatBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
  162. {
  163. CSize size = CStatusBar::CalcFixedLayout( bStretch, bHorz );
  164. size.cy = m_iSizeY;
  165. return size;
  166. }
  167. /******************************************************************************/
  168. /* Change the height of the status bar to allow the bitmaps to be painted */
  169. /* in the panes. The height is set in the OnSetFont OnSetFont method. Save */
  170. /* the current border values, change then call OnSetFont and then reset the */
  171. /* border values */
  172. /* */
  173. /* This will increase the height of the whole status bar until the next */
  174. /* OnSetFont (font change) for the status bar. */
  175. /* */
  176. /* In Barcore.cpp, the Height of the status bar is set in the OnSetFont */
  177. /* method as follows: */
  178. /* */
  179. /* Height = = (tm.tmHeight - tm.tmInternalLeading) + */
  180. /* CY_BORDER*4 (which is 2 extra on top, 2 */
  181. /* on bottom) - rectSize.Height(); */
  182. /* */
  183. /* This is really */
  184. /* Height = Height of Font + Border between Font and */
  185. /* Pane edges + Border between Pane edges and */
  186. /* Status bar window. */
  187. /* */
  188. /* tm.tmHeight - tm.tmInternalLeading is Font Height CY_BORDER*4 is border */
  189. /* between font and pane edges rectSize.Height is Neg of Border between Pane */
  190. /* and SBar rectSize is set to 0, then the deflated by the border size. */
  191. /* Deflating from 0 => negative, and - negative gives us a positive amount. */
  192. /* */
  193. /* by default m_cyBottomBorder = m_cyTopBorder = 1 */
  194. /******************************************************************************/
  195. /* We only change the border sizes temporarily for the calculation of the */
  196. /* status bar height. We really don't want to change the border sizes, but */
  197. /* are just using them as a way to affect the size of the whole bar. */
  198. /******************************************************************************/
  199. LRESULT CStatBar::OnSetFont(WPARAM wParam, LPARAM lParam)
  200. {
  201. CRect rect;
  202. int iTmpcyTopBorder = m_cyTopBorder;
  203. int iTmpcyBottomBorder = m_cyBottomBorder;
  204. m_cyTopBorder = m_cyBottomBorder = 2;
  205. miSlackSpace = 0;
  206. // Can't do this in MFC 4
  207. // lResult = CStatusBar::OnSetFont(wParam, lParam); //initialize font height etc
  208. rect.SetRectEmpty();
  209. CalcInsideRect( rect, TRUE ); // will be negative size
  210. int iBorder = CY_BORDER * 4 - rect.Height();
  211. int iSize = m_iSizeY - iBorder;
  212. int cyTallest = m_iBitmapHeight;
  213. CDC dc;
  214. if( dc.CreateIC( TEXT("DISPLAY"), NULL, NULL, NULL ) )
  215. {
  216. TEXTMETRIC tm;
  217. tm.tmHeight=0;
  218. CFont *font = CFont::FromHandle( (HFONT)wParam );
  219. if ( font )
  220. {
  221. CFont *oldFont = dc.SelectObject(font);
  222. if( dc.GetTextMetrics( &tm ) && tm.tmHeight > cyTallest )
  223. cyTallest = tm.tmHeight;
  224. if (oldFont)
  225. dc.SelectObject(oldFont);
  226. }
  227. dc.DeleteDC();
  228. }
  229. if (cyTallest > iSize)
  230. m_iSizeY = cyTallest + iBorder;
  231. if (m_iBitmapHeight > iSize)
  232. miSlackSpace = m_iBitmapHeight - iSize;
  233. m_cyTopBorder = iTmpcyTopBorder;
  234. m_cyBottomBorder = iTmpcyBottomBorder;
  235. return 1L;
  236. }
  237. /******************************************************************************/
  238. /* This routine is overloaded to allow us to paint the bitmaps in the panes. */
  239. /* If this routine was not here, it would work fine, but no bitmaps would */
  240. /* appear in the status indicator panes. */
  241. /******************************************************************************/
  242. void CStatBar::DoPaint( CDC* pDC )
  243. {
  244. BOOL bRC;
  245. CString cstringText_Pane1;
  246. CString cstringText_Pane2;
  247. CRect rect_Pane1;
  248. CRect rect_Pane2;
  249. CRgn cRgn_Pane1;
  250. CRgn cRgn_Pane2;
  251. CBitmap* pOldBitmap;
  252. UINT uiStyle_Pane1;
  253. UINT uiStyle_Pane2;
  254. UINT uiID;
  255. int iPaneWidth;
  256. HDC hdc = pDC->GetSafeHdc();
  257. GetItemRect( 1, &rect_Pane1 ); // get pane rect
  258. GetItemRect( 2, &rect_Pane2 ); // get pane rect
  259. pDC->ExcludeClipRect( &rect_Pane1 ); // exclude pane rect from paint
  260. pDC->ExcludeClipRect( &rect_Pane2 ); // exclude pane rect from paint
  261. CStatusBar::DoPaint( pDC ); // Let Parent Class paint remainder of status bar
  262. CFont* pfntOld = pDC->SelectObject( GetFont() );
  263. GetPaneText( 1, cstringText_Pane1 ); // Get the Text for the Pane
  264. GetPaneText( 2, cstringText_Pane2 ); // The status bar holds the text for us.
  265. GetPaneInfo( 1, uiID, uiStyle_Pane1, iPaneWidth );
  266. GetPaneInfo( 2, uiID, uiStyle_Pane2, iPaneWidth );
  267. uiStyle_Pane1 = SBPS_NORMAL;
  268. uiStyle_Pane2 = SBPS_NORMAL;
  269. CDC srcDC; // select current bitmap into a compatible CDC
  270. bRC = srcDC.CreateCompatibleDC( pDC );
  271. ASSERT( bRC != FALSE );
  272. if (bRC != FALSE)
  273. {
  274. // Set the Text and Background Colors for a Mono to Color Bitmap
  275. // Conversion. These are also set in DrawStatusText, so should not
  276. // have to reset them for the other bitmap/pane
  277. COLORREF crTextColor = pDC->SetTextColor( GetSysColor( COLOR_BTNTEXT ) );
  278. COLORREF crBkColor = pDC->SetBkColor ( GetSysColor( COLOR_BTNFACE ) );
  279. bRC = cRgn_Pane1.CreateRectRgnIndirect( rect_Pane1 );
  280. ASSERT( bRC != FALSE );
  281. if (bRC != FALSE)
  282. {
  283. pDC->SelectClipRgn( &cRgn_Pane1 ); // set clip region to pane rect
  284. pOldBitmap = srcDC.SelectObject( &m_posBitmap );
  285. rect_Pane1.InflateRect( -CX_BORDER, -CY_BORDER ); // deflate => don't paint on the borders
  286. pDC->BitBlt( rect_Pane1.left, rect_Pane1.top,
  287. rect_Pane1.Width(), rect_Pane1.Height(),
  288. &srcDC, 0, 0, SRCCOPY ); // BitBlt to pane rect
  289. srcDC.SelectObject( pOldBitmap );
  290. rect_Pane1.InflateRect( CX_BORDER, CY_BORDER ); // Inflate back for drawstatustext
  291. // paint the borders and the text.
  292. DrawStatusText( hdc, rect_Pane1, cstringText_Pane1, uiStyle_Pane1,
  293. m_iBitmapWidth + 1 );
  294. }
  295. cRgn_Pane2.CreateRectRgnIndirect(rect_Pane2);
  296. ASSERT( bRC != FALSE );
  297. if (bRC != FALSE)
  298. {
  299. pDC->SelectClipRgn(&cRgn_Pane2); // set clip region to pane rect
  300. pOldBitmap = srcDC.SelectObject(&m_sizeBitmap);
  301. rect_Pane2.InflateRect(-CX_BORDER, -CY_BORDER); // deflate => don't paint on the borders
  302. pDC->BitBlt(rect_Pane2.left, rect_Pane2.top, rect_Pane2.Width(),
  303. rect_Pane2.Height(), &srcDC, 0, 0, SRCCOPY); // BitBlt to pane rect
  304. srcDC.SelectObject(pOldBitmap);
  305. rect_Pane2.InflateRect(CX_BORDER, CY_BORDER); // Inflate back for drawstatustext
  306. // DrawStatusText will paint the borders and the text.
  307. DrawStatusText(hdc, rect_Pane2, cstringText_Pane2, uiStyle_Pane2, m_iBitmapWidth+1);
  308. }
  309. pDC->SetTextColor( crTextColor );
  310. pDC->SetBkColor ( crBkColor );
  311. }
  312. if (pfntOld != NULL)
  313. pDC->SelectObject( pfntOld );
  314. }
  315. /******************************************************************************/
  316. /* Partially taken from BARCORE.CPP DrawStatusText method of CStatusBar. */
  317. /* Last parameter was added */
  318. /* */
  319. /* This will allow us to output the text indented the space amount for our */
  320. /* bitmap. Normally, this routine puts the text left alligned to the pane. */
  321. /******************************************************************************/
  322. void PASCAL CStatBar::DrawStatusText( HDC hDC,
  323. CRect const& rect,
  324. LPCTSTR lpszText,
  325. UINT nStyle,
  326. int iIndentText )
  327. {
  328. ASSERT(hDC != NULL);
  329. CBrush* cpBrushHilite;
  330. CBrush* cpBrushShadow;
  331. HBRUSH hbrHilite = NULL;
  332. HBRUSH hbrShadow = NULL;
  333. if (! (nStyle & SBPS_NOBORDERS))
  334. {
  335. if (nStyle & SBPS_POPOUT)
  336. {
  337. // reverse colors
  338. cpBrushHilite = GetSysBrush( COLOR_BTNSHADOW );
  339. cpBrushShadow = GetSysBrush( COLOR_BTNHIGHLIGHT );
  340. }
  341. else
  342. {
  343. // normal colors
  344. cpBrushHilite = GetSysBrush( COLOR_BTNHIGHLIGHT );
  345. cpBrushShadow = GetSysBrush( COLOR_BTNSHADOW );
  346. }
  347. hbrHilite = (HBRUSH)cpBrushHilite->GetSafeHandle();
  348. hbrShadow = (HBRUSH)cpBrushShadow->GetSafeHandle();
  349. }
  350. // background is already grey
  351. UINT nOpts = ETO_CLIPPED;
  352. int nOldMode = SetBkMode ( hDC, OPAQUE );
  353. COLORREF crTextColor = SetTextColor( hDC, GetSysColor( COLOR_BTNTEXT ) );
  354. COLORREF crBkColor = SetBkColor ( hDC, GetSysColor( COLOR_BTNFACE ) );
  355. // Draw the hilites
  356. if (hbrHilite)
  357. {
  358. HGDIOBJ hOldBrush = SelectObject( hDC, hbrHilite );
  359. if (hOldBrush)
  360. {
  361. PatBlt( hDC, rect.right, rect.bottom, -(rect.Width() - CX_BORDER),
  362. -CY_BORDER, PATCOPY );
  363. PatBlt( hDC, rect.right, rect.bottom, -CX_BORDER,
  364. -(rect.Height() - CY_BORDER), PATCOPY );
  365. SelectObject( hDC, hOldBrush );
  366. }
  367. }
  368. if (hbrShadow)
  369. {
  370. HGDIOBJ hOldBrush = SelectObject( hDC, hbrShadow );
  371. if (hOldBrush)
  372. {
  373. PatBlt( hDC, rect.left, rect.top, rect.Width(), CY_BORDER, PATCOPY );
  374. PatBlt( hDC, rect.left, rect.top,
  375. CX_BORDER, rect.Height(), PATCOPY );
  376. SelectObject( hDC, hOldBrush );
  377. }
  378. }
  379. // We need to adjust the rect for the ExtTextOut, and then adjust it back
  380. // just support left justified text
  381. if (lpszText != NULL && !(nStyle & SBPS_DISABLED))
  382. {
  383. CRect rectText( rect );
  384. rectText.InflateRect( -2 * CX_BORDER, -CY_BORDER );
  385. // adjust left edge for indented Text
  386. rectText.left += iIndentText;
  387. // align on bottom (since descent is more important than ascent)
  388. SetTextAlign( hDC, TA_LEFT | TA_BOTTOM );
  389. if (miSlackSpace > 0)
  390. rectText.InflateRect( 0, -(miSlackSpace / 2) );
  391. ExtTextOut( hDC, rectText.left, rectText.bottom,
  392. nOpts, &rectText, lpszText, lstrlen( lpszText ), NULL );
  393. }
  394. SetTextColor( hDC, crTextColor );
  395. SetBkColor ( hDC, crBkColor );
  396. }
  397. /******************************************************************************/
  398. BOOL CStatBar::SetText(LPCTSTR szText)
  399. {
  400. BOOL bRC = TRUE;
  401. if (theApp.InEmergencyState())
  402. {
  403. bRC = FALSE;
  404. }
  405. else
  406. {
  407. bRC = SetPaneText(0, szText);
  408. }
  409. return bRC;
  410. }
  411. /******************************************************************************/
  412. BOOL CStatBar::SetPosition(const CPoint& pos)
  413. {
  414. BOOL bRC = TRUE;
  415. int cch;
  416. TCHAR szBuf [20];
  417. cch = wsprintf(szBuf, TEXT("%d~%d"), pos.x, pos.y);
  418. for (int i = 0; i < cch; i++)
  419. if (szBuf[i] == TEXT('~'))
  420. {
  421. szBuf[i] = m_cstringPosSeparator[0];
  422. break;
  423. }
  424. ASSERT (cch != 0);
  425. if (cch != 0)
  426. {
  427. bRC = SetPaneText(1, szBuf);
  428. }
  429. else
  430. {
  431. bRC = FALSE;
  432. }
  433. return bRC;
  434. }
  435. /******************************************************************************/
  436. BOOL CStatBar::SetSize(const CSize& size)
  437. {
  438. BOOL bRC = TRUE;
  439. int cch;
  440. TCHAR szBuf [20];
  441. cch = wsprintf( szBuf, TEXT("%d~%d"), size.cx, size.cy );
  442. for (int i = 0; i < cch; i++)
  443. if (szBuf[i] == TEXT('~'))
  444. {
  445. szBuf[i] = m_cstringSizeSeparator[0];
  446. break;
  447. }
  448. ASSERT (cch != 0);
  449. if (cch != 0)
  450. bRC = SetPaneText(2, szBuf);
  451. else
  452. bRC = FALSE;
  453. return bRC;
  454. }
  455. /******************************************************************************/
  456. BOOL CStatBar::ClearPosition()
  457. {
  458. BOOL bRC = TRUE;
  459. bRC = SetPaneText(1, TEXT("")); // clear the position
  460. return bRC;
  461. }
  462. /******************************************************************************/
  463. BOOL CStatBar::ClearSize()
  464. {
  465. BOOL bRC = TRUE;
  466. bRC = SetPaneText(2, TEXT("")); // clear the size
  467. return bRC;
  468. }
  469. /******************************************************************************/
  470. BOOL CStatBar::Reset()
  471. {
  472. return ClearPosition() && ClearSize();
  473. }
  474. /******************************************************************************/
  475. void CStatBar::OnSysColorChange()
  476. {
  477. CStatusBar::OnSysColorChange();
  478. InvalidateRect(NULL,FALSE);
  479. }
  480. /******************************************************************************/
  481. void ClearStatusBarSize()
  482. {
  483. ASSERT(g_pStatBarWnd);
  484. g_pStatBarWnd->ClearSize();
  485. }
  486. /******************************************************************************/
  487. void ClearStatusBarPosition()
  488. {
  489. ASSERT(g_pStatBarWnd);
  490. g_pStatBarWnd->ClearPosition();
  491. }
  492. /******************************************************************************/
  493. void SetPrompt(LPCTSTR szPrompt, BOOL bRedrawNow)
  494. {
  495. ASSERT(g_pStatBarWnd);
  496. g_pStatBarWnd->SetText(szPrompt);
  497. if (bRedrawNow)
  498. g_pStatBarWnd->UpdateWindow();
  499. }
  500. /******************************************************************************/
  501. void SetPrompt(UINT nStringID, BOOL bRedrawNow)
  502. {
  503. ASSERT(g_pStatBarWnd);
  504. CString str;
  505. VERIFY(str.LoadString(nStringID));
  506. g_pStatBarWnd->SetText(str);
  507. if (bRedrawNow)
  508. g_pStatBarWnd->UpdateWindow();
  509. }
  510. /******************************************************************************/
  511. void ShowStatusBar(BOOL bShow /* = TRUE */)
  512. {
  513. ASSERT(g_pStatBarWnd);
  514. g_pStatBarWnd->ShowWindow(bShow ? SW_SHOWNOACTIVATE : SW_HIDE);
  515. }
  516. /******************************************************************************/
  517. BOOL IsStatusBarVisible()
  518. {
  519. ASSERT(g_pStatBarWnd);
  520. return (g_pStatBarWnd->GetStyle() & WS_VISIBLE) != 0;
  521. }
  522. /******************************************************************************/
  523. int GetStatusBarHeight()
  524. {
  525. ASSERT(g_pStatBarWnd);
  526. CRect rect;
  527. g_pStatBarWnd->GetWindowRect(rect);
  528. return rect.Height();
  529. }
  530. /******************************************************************************/
  531. void InvalidateStatusBar(BOOL bErase /* = FALSE */)
  532. {
  533. ASSERT(g_pStatBarWnd);
  534. g_pStatBarWnd->Invalidate(bErase);
  535. }
  536. /******************************************************************************/
  537. void ClearStatusBarPositionAndSize()
  538. {
  539. ASSERT(g_pStatBarWnd);
  540. g_pStatBarWnd->ClearSize();
  541. g_pStatBarWnd->ClearPosition();
  542. }
  543. /******************************************************************************/
  544. void ResetStatusBar()
  545. {
  546. ASSERT(g_pStatBarWnd);
  547. g_pStatBarWnd->Reset();
  548. }
  549. /******************************************************************************/
  550. void SetStatusBarPosition(const CPoint& pos)
  551. {
  552. ASSERT(g_pStatBarWnd);
  553. if ( ::IsWindow(g_pStatBarWnd->m_hWnd) )
  554. g_pStatBarWnd->SetPosition(pos);
  555. }
  556. /******************************************************************************/
  557. void SetStatusBarSize(const CSize& size)
  558. {
  559. ASSERT(g_pStatBarWnd);
  560. if ( ::IsWindow( g_pStatBarWnd->m_hWnd) )
  561. g_pStatBarWnd->SetSize(size);
  562. }
  563. /******************************************************************************/
  564. void SetStatusBarPositionAndSize(const CRect& rect)
  565. {
  566. ASSERT(g_pStatBarWnd);
  567. g_pStatBarWnd->SetPosition(((CRect&)rect).TopLeft());
  568. g_pStatBarWnd->SetSize(rect.Size());
  569. }
  570. /******************************************************************************/
  571. LRESULT CStatBar::OnSizeParent(WPARAM wParam, LPARAM lParam)
  572. {
  573. LRESULT lRes = CStatusBar::OnSizeParent(wParam, lParam);
  574. return(lRes);
  575. }