CCStatusBar Class Reference

To override various part of the CStatusBar. More...

#include <cstatbar.h>

List of all members.

Public Member Functions

 CCStatusBar ()
 CCStatusBar constructor.
 ~CCStatusBar ()
 CCStatusBar destructor.
void DrawStatusText (CDC *pDC, const CRect &rect, LPCTSTR lpszText, UINT32 nStyle)
BOOL SetIndicators (StatusBarPaneData *pSLPD, INT32 Panes)
 Interface to CStatusBar::SetIndicators ALSO enables/disables panes according to data passed in.
BOOL Create (CFrameWnd *pParentWnd, DWORD dwStyle=WS_CHILD|WS_VISIBLE|CBRS_BOTTOM, UINT32 nID=_R(AFX_IDW_STATUS_BAR))
 Just a copy of CStatusBar Create() but allow double clicks and use our own font.
virtual CSize CalcFixedLayout (BOOL bStretch, BOOL bHorz)
 The status line is incorrectly sized under Windows 95.
virtual void DrawItem (LPDRAWITEMSTRUCT)
 Complete copy of MFC function so that it can call the CCStatusBar version of DrawStatusText (which is not virtual in CStatusBar!!!!).
BOOL UpdateStatusLineFont ()
afx_msg void OnLButtonDblClk (UINT32 nFlags, CPoint point)
 Handle mouse left button double clicks over the status bar.
afx_msg void OnInitialUpdate ()
 Just a copy of CStatusBar version but doesn't disable panes!
afx_msg void OnMouseMove (UINT32 nFlags, CPoint point)
 handle mouse moves over the status bar
BOOL UpdatePaneText (INT32 PaneID, StringBase *pText, BOOL ImmediateUpdate=FALSE)
 Update specified status bar pane.
BOOL UpdatePaneBitmap (INT32 PaneID, UINT32 BitmapID, BOOL ImmediateUpdate)
 Update specified status bar pane.
BOOL GetPaneRect (CRect *pRect, INT32 PaneID)
 get dimensions of status bar pane
BOOL SetPaneWidth (INT32 width, INT32 PaneID)
 Set the width of a status bar pane.
INT32 GetTextWidth (StringBase *pText, BOOL fBold=FALSE)
 Get the width of the given text as if it were on the status bar.
INT32 GetPaneIndexFromPoint (CPoint point)
 find the Index of a status bar pane given a point
BOOL GetStatusLineText (String_256 *pText, CPoint MousePos, HWND hWnd)
 if over StatusLine, gets help for a given point
BOOL PaintBitmap (CDC *pDC, const CRect &rect, UINT32 BitmapID, UINT32 nStyle)
 Paint a bitmap into a StatusLine pane Accounting for Styles: BORDERS/POPOUT/DISABLED.
FlagState PaneState (INT32 PaneID, FlagState NewState=NoChange)
 Read/write pane state.
BOOL UnSetIndicators ()
 Interface to CStatusBar::SetIndicators ALSO enables/disables panes according to data passed in.
BOOL PaneExists (INT32 PaneID)
 Test wheter pane exists without ERRORing.

Static Public Member Functions

static TCHARBubbleHelpCallBack (HWND hWnd, UINT32 PaneID, void *UserData)
 Bubble help call back handler (called some time after call to DoBubbleHelpOn() if mouse ha not moved).

Protected Attributes

UINT32 NumPanes
CPoint OldMousePos
StatusBarPaneDatapPaneData
CFont m_OldFont

Private Member Functions

 DECLARE_DYNAMIC (CCStatusBar)


Detailed Description

To override various part of the CStatusBar.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94

Definition at line 179 of file cstatbar.h.


Constructor & Destructor Documentation

CCStatusBar::CCStatusBar  ) 
 

CCStatusBar constructor.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94

Definition at line 140 of file cstatbar.cpp.

00140                          : CStatusBar()
00141 {
00142     ERROR3IF(this == NULL,"CStatusBar::CStatusBar() - this == NULL");
00143 
00144     OldMousePos = CPoint(0,0);
00145     NumPanes = 0;
00146     pPaneData = NULL;
00147     // >>Webster (Adrian 2/2/97)
00148     // We change the status bar font to Arial Narrow 9
00149     // Note that this is a system-wide setting, so we change it "quietly" (i.e. don't broadcast a WM_WININICHANGE)
00150     // so as not to affect other applications already running
00151     //NONCLIENTMETRICS ncMetrics;
00152     //ncMetrics.cbSize = sizeof(NONCLIENTMETRICS);
00153     //::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncMetrics, 0);
00154     //m_OldFont.CreateFontIndirect(&ncMetrics.lfStatusFont);
00155     //CFont newStatusFont;
00156     //newStatusFont.CreatePointFont(90, _T("Arial Narrow")); 
00157     //newStatusFont.GetLogFont(&ncMetrics.lfStatusFont);
00158     //::SystemParametersInfo(SPI_SETNONCLIENTMETRICS, 0, &ncMetrics, 0);
00159     // <<Webster
00160 }

CCStatusBar::~CCStatusBar  ) 
 

CCStatusBar destructor.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/2/95
Returns:
Errors: this==NULL NumPanes==0 pPaneData==NULL

Definition at line 173 of file cstatbar.cpp.

00174 {
00175     ERROR3IF(     this==NULL,"CStatusBar::~CStatusBar() - this==NULL");
00176     ERROR3IF( NumPanes==0,   "CStatusBar::~CStatusBar() - NumPanes==0");
00177     ERROR3IF(pPaneData==NULL,"CStatusBar::~CStatusBar() - pPaneData==NULL");
00178 
00179     delete pPaneData;
00180 
00181 }


Member Function Documentation

TCHAR * CCStatusBar::BubbleHelpCallBack HWND  hWnd,
UINT32  PaneIndex,
void *  UserData
[static]
 

Bubble help call back handler (called some time after call to DoBubbleHelpOn() if mouse ha not moved).

static TCHAR* CCStatusBar::BubbleHelpCallBack(HWND hWnd, UINT32 PaneIndex, void* UserData)

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/1/95
Parameters:
hWnd - not used [INPUTS] PaneID - ID of pane bubble help requesteed for UserData - not used
Returns:
pointer to text, or NULL if fails (see Errors)

Errors: PaneIndex out of range StringBase::Load() fails

Definition at line 683 of file cstatbar.cpp.

00684 {
00685     static String_64 BubbleHelpText("");
00686 
00687     CCStatusBar* pCCStatusBar=GetApplication()->GetpCCStatusBar();
00688     ERROR3IF(pCCStatusBar==NULL,"CCStatusBar::BubbleHelpCallBack() - pCCStatusBar==NULL");
00689     if (pCCStatusBar && PaneIndex>=0 && PaneIndex<pCCStatusBar->NumPanes)
00690         BubbleHelpText.Load(pCCStatusBar->pPaneData[PaneIndex].BubbleHelpID);
00691     else
00692         ERROR3("CCStatusBar::BubbleHelpCallBack() - PaneIndex out of range");
00693 
00694     return (TCHAR*)BubbleHelpText;
00695 }

CSize CCStatusBar::CalcFixedLayout BOOL  bStretch,
BOOL  bHorz
[virtual]
 

The status line is incorrectly sized under Windows 95.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/3/96

Definition at line 777 of file cstatbar.cpp.

00778 {
00779     CSize NewSize(0,0);
00780     NewSize = CStatusBar::CalcFixedLayout(0,bHorz);
00781 // Removed, makes the status line too wide.
00782 /*  if(IS_CHICAGO)
00783     {
00784         NewSize.cy +=4;
00785     }
00786 */
00787     return NewSize;
00788  }

BOOL CCStatusBar::Create CFrameWnd *  pParentWnd,
DWORD  dwStyle = WS_CHILD|WS_VISIBLE|CBRS_BOTTOM,
UINT32  nID = _R(AFX_IDW_STATUS_BAR)
 

Just a copy of CStatusBar Create() but allow double clicks and use our own font.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94
Parameters:
pParentWnd - pointer to parent window [INPUTS] dwStyle - stlye flags nID - window ID
Returns:
FALSE if fails (see Errors)

Errors: this==NULL, pParentWnd==NULL, CWnd::Create() failed

Definition at line 223 of file cstatbar.cpp.

00224 {
00225     BOOL CreatedOK = CStatusBar::Create((CWnd*)pParentWnd,dwStyle,nID);
00226     ERROR2IF(!CreatedOK,FALSE,"CCStatusBar::Create() - CWnd::Create() failed");
00227 
00228     // set initial font and calculate bar height
00229     SendMessage(WM_SETFONT, (WPARAM)FontFactory::GetFont(STOCKFONT_STATUSBAR));
00230 
00231     INT32 Bits = GetClassLong(m_hWnd,GCL_STYLE);
00232     Bits |= CS_DBLCLKS;
00233     SetClassLong(m_hWnd,GCL_STYLE,Bits); 
00234 
00235     // >>Webster (Adrian 2/2/97)
00236     // We change the system -wide status bar font back to what it used to be before starting Webster
00237     //NONCLIENTMETRICS ncMetrics;
00238     //ncMetrics.cbSize = sizeof(NONCLIENTMETRICS);
00239     //::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncMetrics, 0);
00240     //m_OldFont.GetLogFont(&ncMetrics.lfStatusFont);
00241     //::SystemParametersInfo(SPI_SETNONCLIENTMETRICS, 0, &ncMetrics, 0);
00242     // <<Webster
00243 
00244     
00245     return TRUE;
00246 }

CCStatusBar::DECLARE_DYNAMIC CCStatusBar   )  [private]
 

void CCStatusBar::DrawItem LPDRAWITEMSTRUCT  lpDrawItemStruct  )  [virtual]
 

Complete copy of MFC function so that it can call the CCStatusBar version of DrawStatusText (which is not virtual in CStatusBar!!!!).

Author:
-
Date:
-

Definition at line 800 of file cstatbar.cpp.

00801 {
00802     INT32 itemID = lpDrawItemStruct->itemID;
00803     CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
00804     
00805     ASSERT_VALID(pDC);
00806     ASSERT_VALID(this);
00807 
00808     CRect rect;
00809     GetClientRect(&rect);
00810     CStatusBarCtrl* pCStatusBarCtrl = &GetStatusBarCtrl();
00811     pCStatusBarCtrl->GetRect(itemID, &rect);
00812     CBrush TheBrush(GetSysColor(COLOR_BTNFACE)) ;
00813     pDC->FillRect(&rect,&TheBrush);
00814 
00815 //  ASSERT_VALID(pDC);
00816 //  ASSERT_VALID(this);
00817 
00818         // slight bodge here
00819         if(itemID==0)
00820         {
00821             CString Text = GetPaneText(itemID);
00822             DrawStatusText(pDC, lpDrawItemStruct->rcItem,(LPCTSTR)Text, GetPaneStyle(itemID));
00823         }
00824         else if ((pPaneData[itemID].PaneID)== _R(IDS_SL_MOUSEPOS))
00825         {
00826             CString Text = GetPaneText(itemID);
00827             DrawStatusText(pDC, lpDrawItemStruct->rcItem, (LPCTSTR)Text, GetPaneStyle(itemID));
00828         }
00829         else if ((pPaneData[itemID].PaneID)== _R(IDS_SL_PRINTMODE))
00830         {
00831             RECT rcPane = lpDrawItemStruct->rcItem;
00832 
00833             if (pPaneData[itemID].BitmapID)
00834             {
00835                 // Paint bitmap to left end of pane
00836                 rcPane.right = rcPane.left + 16;
00837                 PaintBitmap(pDC, rcPane, pPaneData[itemID].BitmapID, GetPaneStyle(itemID));
00838 
00839                 // Reset rectangle so text doesn't overlap bitmap
00840                 rcPane = lpDrawItemStruct->rcItem;
00841                 rcPane.left = rcPane.left + 16;
00842             }
00843             CString Text = GetPaneText(itemID);
00844             DrawStatusText(pDC, rcPane, (LPCTSTR)Text, GetPaneStyle(itemID));
00845         }
00846         else if (pPaneData[itemID].BitmapID)
00847         {
00848             if (GetPaneStyle(itemID) & SBPS_DISABLED)
00849             { 
00850                 PaintBitmap(pDC, lpDrawItemStruct->rcItem, pPaneData[itemID].OffBitmapID, GetPaneStyle(itemID));
00851             }
00852             else
00853             {  
00854                 PaintBitmap(pDC, lpDrawItemStruct->rcItem, pPaneData[itemID].BitmapID, GetPaneStyle(itemID));
00855             }
00856             
00857         }   
00858 }

void CCStatusBar::DrawStatusText CDC pDC,
const CRect &  rect,
LPCTSTR  lpszText,
UINT32  nStyle
 

Definition at line 957 of file cstatbar.cpp.

00958 {
00959     ASSERT_VALID(pDC);
00960 /*  UIC 
00961     if (!(nStyle & SBPS_NOBORDERS))
00962     {
00963         // Colours are in parameter order:
00964         // clrTopLeft   Specifies the color of the top and left sides of the three-dimensional rectangle.
00965         // clrBottomRight   Specifies the color of the bottom and right sides of the three-dimensional rectangle.
00966         if (nStyle & SBPS_POPOUT)
00967             pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW)); //afxData.clrBtnHilite, afxData.clrBtnShadow);
00968         else
00969             pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT)); //afxData.clrBtnShadow, afxData.clrBtnHilite);
00970     }
00971 */ 
00972     // just support left justified text
00973     if (lpszText != NULL) // && !(nStyle & SBPS_DISABLED))
00974     {
00975         CRect rectText(rect);
00976         if (!(nStyle & SBPS_NOBORDERS)) // only adjust if there are borders
00977             rectText.InflateRect(-2*CX_BORDER, -CY_BORDER);
00978         else
00979             rectText.OffsetRect(0, -CY_BORDER); // baselines line up
00980     /*  UIC
00981         // chicago bodge - shift the text up by one pixel
00982         if(IS_CHICAGO)
00983             rectText.OffsetRect(0, -1); 
00984     */  
00985 
00986         // background is already grey   
00987         INT32 nOldMode = pDC->SetBkMode(TRANSPARENT);  
00988         COLORREF crBkColor = GetSysColor(COLOR_BTNFACE);  
00989         pDC->SetBkColor(crBkColor);  
00990         //COLORREF crBkColor   = pDC->SetBkColor(afxData.clrBtnFace);  
00991         COLORREF crTextColor = GetSysColor(COLOR_BTNTEXT);
00992         pDC->SetTextColor(crTextColor); //afxData.clrBtnText); 
00993 
00994     if (nStyle & SBPS_DISABLED)
00995             pDC->SetTextColor(crTextColor); //afxData.clrBtnShadow);
00996 
00997         // align on bottom (since descent is more important than ascent)
00998         pDC->SetTextAlign(TA_LEFT | TA_BOTTOM);
00999 
01000 // NEW CODE - output all text upto the first colon (if any) in bold
01001         String_256 text(lpszText);
01002         INT32 BoldLen=text.Sub(String_8("::"))+1;   // include one colon
01003         if (BoldLen>0)
01004         {
01005             // split into 2 strings
01006             String_256 BoldText("");
01007             text.Left(&BoldText,BoldLen);
01008             text.Right(&text,text.Length()-BoldLen-1); // strip one colon
01009 
01010             // select bold font and find width of bold text (limited to text rect width)
01011         //  HGDIOBJ hOldFont=pDC->SelectObject(FontFactory::GetFont(STOCKFONT_STATUSBARBOLD));
01012             HGDIOBJ hOldBoldFont=pDC->SelectObject(FontFactory::GetFont(STOCKFONT_STATUSBARBOLD));  //UIC 
01013 
01014             INT32 BoldTextWidth=pDC->GetTextExtent(BoldText,BoldText.Length()).cx;
01015             INT32 TextRectWidth=rectText.Width();
01016             if (BoldTextWidth>TextRectWidth)
01017                 BoldTextWidth=TextRectWidth;
01018 
01019             // output the bold text, modify text rect, restore font
01020             pDC->ExtTextOut(rectText.left, rectText.bottom,
01021                 ETO_CLIPPED, &rectText, (TCHAR*)BoldText, BoldLen, NULL);
01022             rectText.left+=BoldTextWidth;
01023         //  pDC->SelectObject(hOldFont);
01024             pDC->SelectObject(hOldBoldFont); // UIC
01025         }
01026 // END OF NEW CODE
01027         HGDIOBJ hOldFont=pDC->SelectObject(FontFactory::GetFont(STOCKFONT_STATUSBAR)); // UIC   
01028         // output remaining text
01029         pDC->ExtTextOut(rectText.left, rectText.bottom,
01030             ETO_CLIPPED, &rectText, (TCHAR*)text, text.Length(), NULL);
01031         pDC->SelectObject(hOldFont);    // UIC 
01032     }
01033 }

INT32 CCStatusBar::GetPaneIndexFromPoint CPoint  point  ) 
 

find the Index of a status bar pane given a point

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/1/95
Parameters:
point - [INPUTS]
Returns:
Index of pane containing point, or -1 if none

Errors: this==NULL,

Definition at line 654 of file cstatbar.cpp.

00655 {
00656     ERROR2IF(this==NULL,-1,"CCStatBar::GetPaneIndexFromPoint() - this==NULL");
00657 
00658     for (UINT32 i=0; i<NumPanes; i++)
00659     {
00660         RECT PaneRect;
00661         GetItemRect(i,&PaneRect);
00662         if (CRect(PaneRect).PtInRect(point))
00663             return i;
00664     }
00665     return -1;
00666 }

BOOL CCStatusBar::GetPaneRect CRect *  pRect,
INT32  PaneID
 

get dimensions of status bar pane

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
PaneID - id of pane [INPUTS]
pRect - pane rect [OUTPUTS]
Returns:
FALSE if failed (see Errors)

Errors: this==NULL, PaneID unrecognised

Definition at line 447 of file cstatbar.cpp.

00448 {
00449     ERROR2IF(this==NULL,FALSE,"CStatusBar::UpdatePaneText() - this==NULL");
00450 
00451     INT32 PaneIndex=CommandToIndex(PaneID);
00452     ERROR2IF(PaneIndex==-1,FALSE,"CStatusBar::UpdatePaneText() - unknown PaneID");
00453 
00454     GetItemRect(PaneIndex,pRect);
00455     return TRUE;
00456 }

BOOL CCStatusBar::GetStatusLineText String_256 pText,
CPoint  MousePos,
HWND  hWnd
 

if over StatusLine, gets help for a given point

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/1/95
Parameters:
MousePos - position in window [INPUTS] hWnd - handle of window
pText - [OUTPUTS]
Returns:
TRUE if ptext hold valid text, else FALSE if not over a pane

Errors: this==NULL, StringBase::Load() fails,

Definition at line 628 of file cstatbar.cpp.

00629 {
00630     ERROR2IF(this==NULL,FALSE,"CCStatusBar::GetStatusLineText() - this==NULL");
00631 
00632     if (GetSafeHwnd()!=hWnd)
00633         return FALSE;
00634 
00635     INT32 PaneIndex=GetPaneIndexFromPoint(MousePos);
00636     if (PaneIndex==-1)
00637         return FALSE;
00638 
00639     return (pText->Load(pPaneData[PaneIndex].StatusHelpID)!=0);
00640 }

INT32 CCStatusBar::GetTextWidth StringBase ptext,
BOOL  fBold = FALSE
 

Get the width of the given text as if it were on the status bar.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
ptext - text [INPUTS] fBold - if TRUE, assume bold text (by default FALSE)
Returns:
width of text, or -1 if failed (see Errors)

Errors: this==NULL,

Definition at line 469 of file cstatbar.cpp.

00470 {
00471     ERROR2IF(this==NULL,-1,"CStatusBar::GetTextWidth() - this==NULL");
00472     
00473     StockFont sf = (fBold ? STOCKFONT_STATUSBARBOLD : STOCKFONT_STATUSBAR);
00474 
00475     CClientDC dcScreen(NULL);
00476     HGDIOBJ OldObject = dcScreen.SelectObject(FontFactory::GetFont(sf));
00477     INT32 result = dcScreen.GetTextExtent(*ptext, ptext->Length()).cx;
00478     dcScreen.SelectObject(OldObject);   
00479 
00480     return result;
00481 }

void CCStatusBar::OnInitialUpdate  ) 
 

Just a copy of CStatusBar version but doesn't disable panes!

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/94

Definition at line 429 of file cstatbar.cpp.

00430 {
00431     OnIdleUpdateCmdUI(FALSE, 0L);
00432 }

void CCStatusBar::OnLButtonDblClk UINT32  nFlags,
CPoint  point
 

Handle mouse left button double clicks over the status bar.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94
Parameters:
nFlags - [INPUTS] point - mouse position
Returns:
Errors: this==NULL GetpStatusLine() fails

Definition at line 378 of file cstatbar.cpp.

00379 {
00380     if (this!=NULL)
00381     {
00382         StatusLine* pStatusLine=GetApplication()->GetpStatusLine();
00383         if (pStatusLine)
00384         {
00385             INT32 PaneIndex=GetPaneIndexFromPoint(point);
00386             INT32 PaneID=GetItemID(PaneIndex);
00387             pStatusLine->PaneDoubleClick(PaneID);
00388         }
00389     }
00390     else
00391         ERROR3("CCStatusBar::OnLButtonDblClk() - this==NULL");
00392 }

void CCStatusBar::OnMouseMove UINT32  nFlags,
CPoint  MousePos
 

handle mouse moves over the status bar

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/1/95
Parameters:
nFlags - [INPUTS] MousePos -
Returns:
Errors: this==NULL,

Definition at line 588 of file cstatbar.cpp.

00589 {
00590     ERROR3IF(this==NULL,"CCStatBar::OnMouseMove() - this==NULL");
00591 
00592     if (MousePos==OldMousePos)
00593         return;
00594 
00595     INT32 PaneIndex=GetPaneIndexFromPoint(MousePos);
00596     if (PaneIndex==-1)
00597         ControlHelper::BubbleHelpDisable();
00598     else
00599         ControlHelper::DoBubbleHelpOn(GetSafeHwnd(),PaneIndex,BubbleHelpCallBack,this);
00600 
00601     StatusLine* pStatusLine=GetApplication()->GetpStatusLine();
00602     if (pStatusLine)
00603     {
00604         String_256 Text("");
00605         GetStatusLineText(&Text,MousePos,GetSafeHwnd());
00606         if (!pStatusLine->UpdateText(&Text,STATUSLINE_SELDESC_STATBAR))
00607             ERROR3("CCStatusBar::OnMouseMove() - pStatusLine->UpdateText() failed");
00608     }
00609 
00610     OldMousePos=MousePos;
00611 }

BOOL CCStatusBar::PaintBitmap CDC pDC,
const CRect &  rect,
UINT32  BitmapID,
UINT32  nStyle
 

Paint a bitmap into a StatusLine pane Accounting for Styles: BORDERS/POPOUT/DISABLED.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/2/95
Parameters:
pDC - [INPUTS] rect - BitmapID - nStyle -
Returns:
FALSE if failed

Errors: this == NULL

See also:
CColourBar::PaintEditOrNewButton;

Definition at line 1056 of file cstatbar.cpp.

01057 {
01058     CRect BMRect(rect);
01059     if (!(nStyle & SBPS_NOBORDERS))
01060         BMRect.SetRect(rect.left+CX_BORDER, rect.top+CY_BORDER, rect.right-CX_BORDER, rect.bottom-CY_BORDER);
01061 
01062     if (BitmapID)
01063     {
01064         CDC srcDC;
01065         srcDC.CreateCompatibleDC(NULL);
01066 
01067         CBitmap bitmap;
01068         bitmap.LoadBitmap(BitmapID);
01069 
01070         CBitmap* pOldBitmap = srcDC.SelectObject(&bitmap);
01071 
01072         pDC->BitBlt(BMRect.left, BMRect.top, BMRect.Width(), BMRect.Height(), &srcDC, 0,0, SRCCOPY);
01073 
01074         // Now plot the glyph bitmap. It is a masked plot - all the light grey pixels
01075         // are plotted using the system COLOR_BTNFACE colour.
01076         CDC MonoDC;
01077         MonoDC.CreateCompatibleDC(NULL);
01078 
01079         // ...Now create a mono bitmap for the mask
01080         CBitmap MonoBitmap;
01081         MonoBitmap.CreateBitmap(BMRect.Width(), BMRect.Height(), 1, 1, NULL);
01082         CBitmap *OldMonoBitmap = MonoDC.SelectObject(&MonoBitmap);
01083 
01084         // Plot all light grey pixels in the glyph as black in our mask, while other pixels are white
01085         // The transparent bits on the bitmap button should be coloured purple to be see through 
01086         MonoDC.PatBlt(0, 0, BMRect.Width(), BMRect.Height(), WHITENESS);
01087         srcDC.SetBkColor(RGB(255,0,255));       // purple masking colour
01088         MonoDC.BitBlt(0, 0, BMRect.Width(), BMRect.Height(), &srcDC, 0, 0, SRCCOPY);
01089 
01090         pDC->SetTextColor(0L);                  // 0's in mono -> 0 (for ROP)
01091         pDC->SetBkColor((COLORREF)0x00FFFFFFL); // 1's in mono -> 1
01092 
01093         // And then blit the mask shape over the top, using the correct button face colour
01094         // (The areas not in the mask will not be plotted, so we are rendering the mask area only)
01095         CBrush HighlightBrush;
01096         HighlightBrush.CreateSolidBrush(GetSysColor(COLOR_BTNFACE));
01097 
01098         CBrush *OldBrush = pDC->SelectObject(&HighlightBrush);
01099         // draw highlight color where we have 0's in the mask, using a special RasterOp code (DSPDxax)
01100         pDC->BitBlt(BMRect.left, BMRect.top, BMRect.Width(), BMRect.Height(), &MonoDC, 0, 0, 0x00E20746L);
01101 
01102         // Put back the old brush
01103         pDC->SelectObject(OldBrush);
01104 
01105         MonoDC.SelectObject(OldMonoBitmap);
01106 
01107         // Put back the old bitmap
01108         srcDC.SelectObject(pOldBitmap);
01109     }
01110 /*  UIC 
01111 
01112     if (!(nStyle & SBPS_NOBORDERS))
01113     {
01114         // Colours are in parameter order:
01115         // clrTopLeft   Specifies the color of the top and left sides of the three-dimensional rectangle.
01116         // clrBottomRight   Specifies the color of the bottom and right sides of the three-dimensional rectangle.
01117 
01118         if (nStyle & SBPS_POPOUT)
01119             pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNHIGHLIGHT), GetSysColor(COLOR_BTNSHADOW)); //afxData.clrBtnHilite, afxData.clrBtnShadow);
01120         else
01121             pDC->Draw3dRect(rect, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNHIGHLIGHT)); //afxData.clrBtnShadow, afxData.clrBtnHilite);
01122     }
01123 */
01124     return TRUE;
01125 }

BOOL CCStatusBar::PaneExists INT32  PaneID  ) 
 

Test wheter pane exists without ERRORing.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/01/2004
Parameters:
PaneID - id of pane [INPUTS]
Returns:
TRUE if specified pane exists

Errors: this==NULL,

Definition at line 568 of file cstatbar.cpp.

00569 {
00570     ERROR2IF(this == NULL,Fail,"CStatusBar::PaneState() - this == NULL");
00571 
00572     INT32 PaneIndex = CommandToIndex(PaneID);
00573     return (PaneIndex != -1);
00574 }

FlagState CCStatusBar::PaneState INT32  PaneID,
FlagState  NewState = NoChange
 

Read/write pane state.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
PaneID - id of pane [INPUTS] state - Disable/Enable/Toggle/NoChange
Returns:
previous state Disable/Enable/Fail (see Errors)

Errors: this==NULL, PaneID unrecognised NewState invalid

Definition at line 530 of file cstatbar.cpp.

00531 {
00532     ERROR2IF(this == NULL,Fail,"CStatusBar::PaneState() - this == NULL");
00533 
00534     INT32 PaneIndex = CommandToIndex(PaneID);
00535     ERROR2IF(PaneIndex == -1, Fail, "CStatusBar::PaneState() - unknown PaneID");
00536 
00537     UINT32 OldStyle;
00538     UINT32 NewStyle;
00539     UINT32 OldPaneID;
00540     INT32  width;
00541     GetPaneInfo(PaneIndex, OldPaneID, OldStyle, width);
00542     switch (NewState)
00543     {
00544         case Disable:  NewStyle = OldStyle | SBPS_DISABLED; break;
00545         case Enable:   NewStyle = OldStyle &~ SBPS_DISABLED; break;
00546         case Toggle:   NewStyle = OldStyle ^ SBPS_DISABLED; break;
00547         case NoChange: NewStyle = OldStyle; break;
00548         default: ERROR3("CCStatusBar::PaneState() - passed invalid NewState");
00549     }
00550     if (NewStyle != OldStyle)
00551         SetPaneInfo(PaneIndex, OldPaneID, NewStyle, width);
00552 
00553     return ((OldStyle & SBPS_DISABLED) ? Disable : Enable);
00554 }

BOOL CCStatusBar::SetIndicators StatusBarPaneData pSLPD,
INT32  Panes
 

Interface to CStatusBar::SetIndicators ALSO enables/disables panes according to data passed in.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94
Parameters:
pSLPD - pointer to array of StatusLinePaneData [INPUTS] Panes - number of panes
Returns:
FALSE if fails

Errors: this==NULL PAneState() fails

Definition at line 278 of file cstatbar.cpp.

00279 {
00280     ERROR2IF(this == NULL,FALSE,"CStatusBar::SetIndicators() - this == NULL");
00281     ERROR2IF(NumPanes != 0,   FALSE,"CStatusBar::SetIndicators() - NumPanes != 0");
00282     ERROR2IF(pPaneData != NULL,FALSE,"CStatusBar::SetIndicators() - pPaneData != NULL");
00283 
00284     // copy pane data into class
00285     NumPanes = Panes;
00286     pPaneData = new StatusBarPaneData[NumPanes];    
00287     ERROR2IF(pPaneData==NULL,FALSE,"CCStatusBar::SetIndicators() - pPaneData==NULL");
00288     for (UINT32 i = 0; i < NumPanes; i++)
00289         pPaneData[i] = pSLPD[i];
00290 
00291     // call equivalent routine in base class
00292     UINT32* pPaneIDs = new UINT32[NumPanes];
00293     ERROR2IF(pPaneIDs == NULL,FALSE,"CCStatusBar::SetIndicators() - pPaneIDs == NULL");
00294     for (i = 0; i < NumPanes; i++)
00295         pPaneIDs[i] = pPaneData[i].PaneID;
00296     CStatusBar::SetIndicators(pPaneIDs,NumPanes);
00297     delete pPaneIDs;
00298 
00299     // set initial pane states & bitmap pane widths
00300     BOOL ReturnValue = TRUE;
00301     for (i = 0; i < NumPanes; i++)
00302     {
00303         if (PaneState(pPaneData[i].PaneID, pPaneData[i].InitState) == Fail)
00304             ReturnValue = FALSE;
00305 
00306         if(pPaneData[i].OwnerDrawn)
00307         {
00308             UINT32 PaneStyle = GetPaneStyle(i);
00309             SetPaneStyle(i,PaneStyle|SBPS_OWNERDRAW);
00310         }
00311 
00312         if (pPaneData[i].BitmapID)
00313         {
00314             CBitmap bitmap;
00315             BITMAP  BMObject;
00316             if (bitmap.LoadBitmap(pPaneData[i].BitmapID) == 0)
00317                 ReturnValue = FALSE;
00318 
00319             if (bitmap.GetObject(sizeof(BITMAP), &BMObject) == 0)
00320                 ReturnValue = FALSE;
00321 
00322             // Small bodge here to allow Print Colours pane to contain both bitmap and text
00323             // Don't force pane width if paneID is that of the Print Colours pane
00324             if (pPaneData[i].PaneID!=_R(IDS_SL_PRINTMODE))
00325             {
00326                 if (SetPaneWidth(BMObject.bmWidth-2, pPaneData[i].PaneID) == FALSE) // NB bodge offset '-2' !!!!
00327                     ReturnValue = FALSE;
00328             }
00329         }
00330     }
00331 
00332     return ReturnValue;
00333 }

BOOL CCStatusBar::SetPaneWidth INT32  width,
INT32  PaneID
 

Set the width of a status bar pane.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
PaneID - id of pane [INPUTS] width - new pane width
Returns:
FALSE if failed (see Errors)

Errors: this==NULL, PaneID unrecognised (or 0 as it is variable width!), width<0

Definition at line 497 of file cstatbar.cpp.

00498 {
00499     ERROR2IF(this==NULL,FALSE,"CStatusBar::SetPaneWidth() - this==NULL");
00500     ERROR2IF(width<0 ,FALSE,"CStatusBar::SetPaneWidth() - width<0");
00501 
00502     INT32 PaneIndex=CommandToIndex(PaneID);
00503     ERROR2IF(PaneIndex == -1,FALSE,"CStatusBar::SetPaneWidth() - unknown PaneID");
00504     ERROR2IF(PaneIndex == 0 ,FALSE,"CStatusBar::SetPaneWidth() - Pane with ID==0 is variable width!!!");
00505 
00506     UINT32 nStyle;
00507     UINT32 OldPaneID;
00508     INT32  OldWidth;
00509     GetPaneInfo(PaneIndex, OldPaneID, nStyle, OldWidth);
00510     SetPaneInfo(PaneIndex, OldPaneID, nStyle, width);
00511 
00512     return TRUE;
00513 }

BOOL CCStatusBar::UnSetIndicators  ) 
 

Interface to CStatusBar::SetIndicators ALSO enables/disables panes according to data passed in.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
08/01/2004
Parameters:
pSLPD - pointer to array of StatusLinePaneData [INPUTS] Panes - number of panes
Returns:
FALSE if fails

Errors: this==NULL

Definition at line 348 of file cstatbar.cpp.

00349 {
00350     ERROR2IF(this == NULL,FALSE,"CStatusBar::SetIndicators() - this == NULL");
00351 //  ERROR2IF(NumPanes != 0,   FALSE,"CStatusBar::SetIndicators() - NumPanes != 0");
00352 //  ERROR2IF(pPaneData != NULL,FALSE,"CStatusBar::SetIndicators() - pPaneData != NULL");
00353 
00354     if (NumPanes!=0 && pPaneData!=NULL)
00355     {
00356         delete[] pPaneData;
00357     }
00358 
00359     NumPanes=0;
00360     pPaneData = NULL;
00361 
00362     return TRUE;
00363 }

BOOL CCStatusBar::UpdatePaneBitmap INT32  PaneID,
UINT32  BitmapID,
BOOL  ImmediateUpdate
 

Update specified status bar pane.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/2/95
Parameters:
PaneID - id of pane [INPUTS] BitmapID - text (or NULL) ImmediateUpdate - redraw pane now (rather than queuing)
Returns:
FALSE if failed (see Errors)

Errors: this==NULL, PaneID unrecognised

Definition at line 1142 of file cstatbar.cpp.

01143 {
01144     ERROR2IF(this == NULL,FALSE,"CStatusBar::UpdatePaneBitmap() - this == NULL");
01145 
01146     INT32 PaneIndex = CommandToIndex(PaneID);
01147     ERROR2IF(PaneIndex == -1,FALSE,"CStatusBar::UpdatePaneBitmap() - unknown PaneID");
01148 
01149     /*if (pPaneData[PaneIndex].BitmapID != BitmapID)
01150     {
01151 */
01152         if (BitmapID!=0)
01153             pPaneData[PaneIndex].BitmapID = BitmapID;
01154 
01155         CRect rect;
01156         GetItemRect(PaneIndex,&rect);
01157 
01158         UINT32 nStyle;
01159         INT32  nWidth;
01160         UINT32 nID;
01161         GetPaneInfo(PaneIndex,nID,nStyle,nWidth);
01162         if (!(nStyle & SBPS_NOBORDERS))
01163             rect.SetRect(rect.left+CX_BORDER, rect.top+CY_BORDER, rect.right-CX_BORDER, rect.bottom-CY_BORDER);
01164 
01165         InvalidateRect(rect);
01166         if (ImmediateUpdate)
01167             UpdateWindow();
01168 //  }
01169 
01170     return TRUE;
01171 }

BOOL CCStatusBar::UpdatePaneText INT32  PaneID,
StringBase ptext,
BOOL  ImmediateUpdate = FALSE
 

Update specified status bar pane.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94
Parameters:
PaneID - id of pane [INPUTS] ptext - text (or NULL) ImmediateUpdate - redraw pane now (rather than queuing)
Returns:
FALSE if failed (see Errors)

Errors: this==NULL, PaneID unrecognised

Definition at line 408 of file cstatbar.cpp.

00409 {
00410     ERROR2IF(this==NULL,FALSE,"CStatusBar::UpdatePaneText() - this==NULL");
00411     
00412     INT32 PaneIndex=CommandToIndex(PaneID);
00413     ERROR2IF(PaneIndex==-1,FALSE,"CStatusBar::UpdatePaneText() - unknown PaneID");
00414     
00415     SetPaneText(PaneIndex, ptext==NULL ? NULL : (TCHAR*)*ptext);
00416     if (ImmediateUpdate && ptext) UpdateWindow();
00417 
00418     return TRUE;
00419 }

BOOL CCStatusBar::UpdateStatusLineFont  ) 
 

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/12/94
Returns:
FALSE if fails

Errors:

Definition at line 258 of file cstatbar.cpp.

00259 {
00260     SendMessage(WM_SETFONT, (WPARAM)FontFactory::GetFont(STOCKFONT_STATUSBAR));
00261 
00262     return TRUE;
00263 }


Member Data Documentation

CFont CCStatusBar::m_OldFont [protected]
 

Definition at line 228 of file cstatbar.h.

UINT32 CCStatusBar::NumPanes [protected]
 

Definition at line 225 of file cstatbar.h.

CPoint CCStatusBar::OldMousePos [protected]
 

Definition at line 226 of file cstatbar.h.

StatusBarPaneData* CCStatusBar::pPaneData [protected]
 

Definition at line 227 of file cstatbar.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:12 2007 for Camelot by  doxygen 1.4.4