home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / MRCE / SOURCE.ZIP / SZTOOLBA.CPP < prev   
Encoding:
C/C++ Source or Header  |  1995-09-11  |  17.8 KB  |  586 lines

  1. // MRCEXT: Micro Focus Extension DLL for MFC 2.1+
  2. // Copyright (C)1994-5    Micro Focus Inc, 2465 East Bayshore Rd, Palo Alto, CA 94303.
  3. // 
  4. //  This program is free software; you can redistribute it and/or modify
  5. //  it under the terms of the GNU General Public License as published by
  6. //  the Free Software Foundation. In addition, you may also charge for any
  7. //  application    using MRCEXT, and are under no obligation to supply source
  8. //  code. You must accredit Micro Focus Inc in the "About Box", or banner
  9. //  of your application. 
  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 also have received a copy of the GNU General Public License with this
  17. //  software, also indicating additional rights you have when using MRCEXT.  
  18. //
  19. //
  20. // sztoolba.cpp : implementation file
  21. // $Date:   11 Sep 1995 09:47:22  $
  22. // $Author:   MRC  $
  23. // 
  24. //
  25. // classes in this file
  26. // CMRCSizeToolBar - a sizeable toolbar. A sizeable control bar containing a CToolBarCtrl object.
  27. //                  which responds to tooltips/command enabling through the normal MFC architecture
  28. //
  29. // CToolCmdUI   - CCmdUI private class.
  30. //
  31. // CMRCToolBarCtrl - CToolBarCtrl derived object with addition left mouse button handling, etc.
  32.  
  33. #include "mrcstafx.h"
  34.  
  35. #ifdef _DEBUG
  36. #undef THIS_FILE
  37. static char BASED_CODE THIS_FILE[] = __FILE__;
  38. #endif
  39.  
  40. #define TOOLCTRL_ID 99
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CMRCSizeToolBar
  44.  
  45. IMPLEMENT_DYNAMIC(CMRCSizeToolBar, CMRCSizeControlBar);
  46.  
  47. CMRCSizeToolBar::CMRCSizeToolBar(int nStyle) : CMRCSizeControlBar(nStyle)
  48. {
  49.     // these are the default sizes for the toolbar bitmap
  50.     m_ToolCtrlButtonSize.cx = 16;
  51.     m_ToolCtrlButtonSize.cy = 15;
  52.     m_pBitmapIds = NULL;
  53.     m_nBitmapButtons = 0;
  54. }
  55.  
  56.  
  57. CMRCSizeToolBar::~CMRCSizeToolBar()
  58. {
  59. }
  60.  
  61.  
  62.  
  63. BEGIN_MESSAGE_MAP(CMRCSizeToolBar, CMRCSizeControlBar)
  64.     //{{AFX_MSG_MAP(CMRCSizeToolBar)
  65.     ON_WM_CREATE()
  66.     //}}AFX_MSG_MAP
  67.     ON_NOTIFY_RANGE(TTN_NEEDTEXT, 0, 0xffff, OnTBNToolTip)
  68.     ON_NOTIFY_RANGE(TBN_QUERYINSERT, 0, 0xffff, OnTBNQueryInsert)
  69.     ON_NOTIFY_RANGE(TBN_QUERYDELETE, 0, 0xffff, OnTBNQueryDelete)
  70.     ON_NOTIFY_RANGE(TBN_BEGINADJUST, 0, 0xffff, OnTBNBeginAdjust)
  71.     ON_NOTIFY_RANGE(TBN_TOOLBARCHANGE, 0, 0xffff, OnTBNToolBarChange)
  72. //    ON_NOTIFY(TBN_GETBUTTONINFO, TOOLCTRL_ID, OnTBNGetButtonInfo)
  73.       ON_NOTIFY_RANGE(TBN_GETBUTTONINFO, 0, 0xffff, OnTBNGetButtonInfo)
  74. END_MESSAGE_MAP()
  75.  
  76.  
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CMRCSizeToolBar message handlers
  79.  
  80.  
  81. #define DOCKED_HORZ_BORDER 6
  82. #define DOCKED_VERT_BORDER 4
  83.  
  84. //-------------------------------------------------------------------
  85. void CMRCSizeToolBar::OnSizedOrDocked(int cx, int cy, BOOL bFloating, int flags)
  86. // respond to this event as we need to override it
  87. //-------------------------------------------------------------------
  88. {
  89.     CRect rect(0,0,cx,cy);        // rectangle for client area
  90.     CRect TabRect;
  91.  
  92.     // shrink rectangle if we're docked
  93.     //if (!IsProbablyFloating())
  94.         rect.InflateRect(- DOCKED_HORZ_BORDER,  - DOCKED_VERT_BORDER );
  95.  
  96.     m_ToolCtrl.MoveWindow(&rect);
  97.     m_ToolCtrl.AutoSize();
  98. }
  99.  
  100.  
  101. //-----------------------------------------------------------------------------
  102. BOOL CMRCSizeToolBar::Create(CWnd * pParent, DWORD dwStyle, UINT nID, LPRECT pRect)
  103. //-----------------------------------------------------------------------------
  104. {
  105.     m_ToolCtrlButtonSize.cx = 16;
  106.     m_ToolCtrlButtonSize.cy = 15;
  107.     
  108.     // if no rectangle supplied, then what is hopefully as sensible default.
  109.     // ie a single row of buttons
  110.     CRect rect;
  111.     if (pRect != NULL)
  112.         rect.CopyRect(pRect);
  113.     else
  114.     {
  115.         pParent->GetClientRect(&rect);
  116.         rect.left = 0;
  117.         rect.top = 0;
  118.         rect.bottom = m_ToolCtrlButtonSize.cy + 18;
  119.         rect.right -= 8;
  120.     }
  121.         
  122.     BOOL status = CMRCSizeControlBar::Create(pParent, NULL, nID, dwStyle, rect); 
  123.     if (status == TRUE)
  124.     {
  125.     }
  126.     return status;
  127. }
  128.  
  129.  
  130.  
  131. //-----------------------------------------------------------------------------
  132. int CMRCSizeToolBar::OnCreate(LPCREATESTRUCT lpCS) 
  133. //-----------------------------------------------------------------------------
  134. {
  135.     if (CMRCSizeControlBar::OnCreate(lpCS) == -1)
  136.         return -1;
  137.  
  138.     CRect rect;
  139.     GetClientRect(&rect);
  140.     
  141.     DWORD dwStyle = WS_VISIBLE | WS_CHILD | TBSTYLE_WRAPABLE // | TBSTYLE_TOOLTIPS
  142.                 | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER;  // | CCS_NOHILITE*  - CCS_NOHILITE doesn't exist in VC2.2 
  143.     
  144.     // If there a list of bitmap id's, then let the user configure the toolbar
  145.     if (m_pBitmapIds != NULL)
  146.         dwStyle |= CCS_ADJUSTABLE;
  147.     
  148.     if (!m_ToolCtrl.Create(dwStyle, rect, this, TOOLCTRL_ID))
  149.     {
  150.         TRACE("Failed to create CToolBarCtrl\n");
  151.         return -1;
  152.     }
  153.     return 0;
  154. }
  155.  
  156.  
  157.  
  158. // These are functions designed as 1-1 replacements for existing CToolBar functions. They
  159. // are not the most efficient way to make use of the CSizeToolBarCtrl control, but mean it'll
  160. // work with standard AppWizard created applications.
  161.  
  162. //-----------------------------------------------------------------------------
  163. BOOL CMRCSizeToolBar::LoadBitmap(LPCTSTR lpszResourceName)
  164. //-----------------------------------------------------------------------------
  165. {
  166.     if (!m_Bitmap.LoadBitmap(lpszResourceName))
  167.         return FALSE;
  168.  
  169.     // get the bitmap info, and use this to get the no of buttons in the bitmap
  170.     BITMAP bm;
  171.     m_Bitmap.GetObject(sizeof BITMAP, &bm); 
  172.     
  173.     int nButtons = bm.bmWidth / m_ToolCtrlButtonSize.cx;
  174.     
  175.     if (m_ToolCtrl.AddBitmap(nButtons, &m_Bitmap) == -1)
  176.         return FALSE;
  177.  
  178.     return TRUE;
  179. }
  180.  
  181.  
  182. //-----------------------------------------------------------------------------
  183. void CMRCSizeToolBar::SetSizes(SIZE sizeButton, SIZE sizeImage)
  184. //-----------------------------------------------------------------------------
  185. {
  186. // if succeeded, keep track of it in the size of the control
  187.     if (m_ToolCtrl.SetButtonSize(sizeButton))
  188.         m_ToolCtrlButtonSize = sizeButton;
  189.  
  190.     m_ToolCtrl.SetBitmapSize(sizeImage);
  191. }
  192.  
  193.  
  194. //-----------------------------------------------------------------------------
  195. void CMRCSizeToolBar::SetBitmapIds(UINT * pIds, int nButtons)
  196. //-----------------------------------------------------------------------------
  197. {
  198.     m_pBitmapIds = pIds;
  199.     m_nBitmapButtons = nButtons;
  200. }
  201.  
  202.  
  203. //-----------------------------------------------------------------------------
  204. int CMRCSizeToolBar::FindBitmapIndex(UINT nID)
  205. //-----------------------------------------------------------------------------
  206. {
  207.     ASSERT(m_pBitmapIds != NULL);
  208.     for (int i = 0; i < m_nBitmapButtons ; i++)
  209.     {
  210.         if (m_pBitmapIds[i] == (int)nID)
  211.             return i;
  212.     }
  213.     return -1;
  214. }
  215.  
  216.  
  217.  
  218. //-----------------------------------------------------------------------------
  219. BOOL CMRCSizeToolBar::SetButtons(UINT * pButtons, int nButtons)
  220. // emulate CToolBar::SetButtons()
  221. //-----------------------------------------------------------------------------
  222. {
  223.     // allocate an array of TBBUTTON's
  224.     TBBUTTON * parrButtons = new TBBUTTON[nButtons];        // allocate an array
  225.  
  226.     int nImageNo = 0;        // no of image in bitmap (coun
  227.     int nBtn = 0;             // no of buttons we've actually created (including separators)
  228.                             // may not equal no of buttons supplied by user, as id's may not
  229.                             // be found
  230.     for (int i = 0; i < nButtons; i++)
  231.     {
  232.         UINT nID = pButtons[i];
  233.         parrButtons[i].dwData =  NULL;
  234.         parrButtons[i].iString = NULL;
  235.         if (nID == ID_SEPARATOR)
  236.         {
  237.             parrButtons[nBtn].iBitmap = NULL;
  238.             parrButtons[nBtn].idCommand = 0;
  239.             parrButtons[nBtn].fsState = 0;
  240.             parrButtons[nBtn].fsStyle = TBSTYLE_SEP;  
  241.         } 
  242.         else
  243.         {
  244.             if (m_pBitmapIds != NULL)        // if there's a list of bitmaps, then translate this
  245.             {
  246.                 nImageNo = FindBitmapIndex(nID);
  247.                 if (nImageNo == -1)
  248.                 {
  249.                     TRACE("Couldn't find bitmap for ID=%d\n",nID);
  250.                     continue;                    // skip to next iteration
  251.                     nImageNo = 0;
  252.                 }
  253.                 else
  254.                 {
  255.                     parrButtons[i].iBitmap = nImageNo;
  256.                 }
  257.             }
  258.             else
  259.             {
  260.                 parrButtons[i].iBitmap = nImageNo;
  261.                 nImageNo++;
  262.             }
  263.             parrButtons[nBtn].idCommand = nID;
  264.             parrButtons[nBtn].fsState = TBSTATE_ENABLED;
  265.             parrButtons[nBtn].fsStyle = TBSTYLE_BUTTON; 
  266.         }
  267.         nBtn++;
  268.     }
  269.  
  270.     BOOL status = m_ToolCtrl.AddButtons(nBtn, parrButtons);
  271.     delete parrButtons;
  272.  
  273.     return status;
  274. }    
  275.  
  276.  
  277.  
  278. //-----------------------------------------------------------------------------
  279. afx_msg void CMRCSizeToolBar::OnTBNToolTip(UINT uID, NMHDR *pNMHDR, LRESULT * pResult)
  280. // tool tip notification handler for tool bar
  281. //-----------------------------------------------------------------------------
  282. {
  283.     TOOLTIPTEXT * pTip = (TOOLTIPTEXT *) pNMHDR;
  284.     pTip->hinst = NULL;
  285.     pTip->lpszText = NULL;
  286.     UINT ButtonId = pTip->hdr.idFrom;    
  287.     
  288.     CString strText;
  289.     if (strText.LoadString(ButtonId))
  290.     {
  291.         char * pTipText = strchr(strText, '\n');   // tool tip is after "\n" in the string
  292.         if (pTipText != NULL)
  293.         {    
  294.             strcpy(pTip->szText, pTipText + 1);
  295.             pTip->lpszText = pTip->szText;
  296.         
  297.             // try to ensure tool tip control and ensure it is top most in the Z-order
  298.             CToolTipCtrl * pToolTipCtrl = m_ToolCtrl.GetToolTips();
  299.             pToolTipCtrl->SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
  300.     
  301.         }    
  302.         // Set the text in the main window. Doesn't appear to be an easy way to check if
  303.         // we're not over any particular bit of the tool tip.
  304.         AfxGetMainWnd()->SendMessage(WM_SETMESSAGESTRING, ButtonId);
  305.         return; 
  306.     }    
  307.     
  308.     TRACE("CMRCSizeToolBar:No Tooltip prompt for ID=%d\n", ButtonId);
  309.     return;    
  310. }
  311.  
  312.  
  313. //-----------------------------------------------------------------------------
  314. afx_msg void CMRCSizeToolBar::OnTBNGetButtonInfo(UINT nID, NMHDR *pNMHDR, LRESULT * pResult)
  315. // Return information for bitmap indexes in the toolbar
  316. //-----------------------------------------------------------------------------
  317. {
  318.     if (nID != TOOLCTRL_ID)
  319.         return;
  320.     TBNOTIFY * pTBN = (TBNOTIFY *)pNMHDR;
  321.     
  322.     int nIndex = pTBN->iItem;
  323.     if (nIndex < m_nBitmapButtons)
  324.     {
  325.         *pResult = TRUE;
  326.  
  327.          UINT nButtonId = m_pBitmapIds[nIndex];
  328.          pTBN->tbButton.iBitmap = nIndex;
  329.          pTBN->tbButton.idCommand = nButtonId;
  330.         pTBN->tbButton.fsState = TBSTATE_ENABLED;
  331.         pTBN->tbButton.fsStyle = TBSTYLE_BUTTON;
  332.         pTBN->tbButton.iString = 0;        
  333.         if (pTBN->pszText != NULL)
  334.         {        
  335.             CString strText;
  336.             if (strText.LoadString(nButtonId))
  337.             {
  338.                 char * pTipText = strchr(strText, '\n');   // tool tip is after "\n" in the string
  339.                 if (pTipText != NULL)
  340.                 {    
  341.                     strncpy(pTBN->pszText, pTipText + 1, pTBN->cchText);
  342.                        return;
  343.                 }
  344.             }
  345.             TRACE("CMRCSizeToolBar:No Tooltip prompt for ID=%d\n", nButtonId);
  346.             strncpy(pTBN->pszText, "???", pTBN->cchText);
  347.         }
  348.     }
  349.     else 
  350.         *pResult = FALSE;
  351. }
  352.  
  353.  
  354.  
  355. //-----------------------------------------------------------------------------
  356. afx_msg void CMRCSizeToolBar::OnTBNBeginAdjust(UINT uID, NMHDR *pNMHDR, LRESULT * pResult)
  357. //-----------------------------------------------------------------------------
  358. {
  359. }
  360.  
  361.  
  362. //-----------------------------------------------------------------------------
  363. afx_msg void CMRCSizeToolBar::OnTBNQueryInsert(UINT uID, NMHDR *pNMHDR, LRESULT * pResult)
  364. //-----------------------------------------------------------------------------
  365. {
  366.     *pResult = TRUE;        // always allow buttons to be inserted
  367. }
  368.  
  369.  
  370. //-----------------------------------------------------------------------------
  371. afx_msg void CMRCSizeToolBar::OnTBNQueryDelete(UINT uID, NMHDR *pNMHDR, LRESULT * pResult)
  372. //-----------------------------------------------------------------------------
  373. {
  374.     *pResult = TRUE;        // always allow buttons to be deleted
  375. }
  376.  
  377. //-----------------------------------------------------------------------------
  378. afx_msg void CMRCSizeToolBar::OnTBNToolBarChange(UINT uID, NMHDR *pNMHDR, LRESULT * pResult)
  379. //-----------------------------------------------------------------------------
  380. {
  381. }
  382.  
  383.  
  384.  
  385.  
  386. /////////////////////////////////////////////////////////////////////////////
  387. /////////////////////////////////////////////////////////////////////////////
  388. // CMRCToolBarCtrl
  389. /////////////////////////////////////////////////////////////////////////////
  390. /////////////////////////////////////////////////////////////////////////////
  391.  
  392. CMRCToolBarCtrl::CMRCToolBarCtrl()
  393. {
  394. }
  395.  
  396. CMRCToolBarCtrl::~CMRCToolBarCtrl()
  397. {
  398. }
  399.  
  400.  
  401. BEGIN_MESSAGE_MAP(CMRCToolBarCtrl, CToolBarCtrl)
  402.     //{{AFX_MSG_MAP(CMRCToolBarCtrl)
  403.     ON_WM_LBUTTONDOWN()
  404.     //}}AFX_MSG_MAP
  405. END_MESSAGE_MAP()
  406.  
  407.  
  408. /////////////////////////////////////////////////////////////////////////////
  409. // CMRCToolBarCtrl message handlers
  410.  
  411. //-----------------------------------------------------------------------------
  412. void CMRCToolBarCtrl::GetBoundingSize(CSize & size)
  413. // Returns the size that would bound all the buttons in the toolbar 
  414. //-----------------------------------------------------------------------------
  415. {
  416.     size.cx = 0;
  417.     size.cy = 0;
  418.     
  419.     for (int i = GetButtonCount(); i >= 0; i--)
  420.     {
  421.         CRect rect;
  422.         if (GetItemRect(i, &rect))
  423.         {
  424.             size.cx = max(size.cx, rect.right);
  425.             size.cy = max(size.cy, rect.bottom);
  426.         }
  427.     }
  428. }
  429.  
  430.  
  431.  
  432. //-----------------------------------------------------------------------------
  433. int CMRCToolBarCtrl::HitTestButtons(CPoint point) 
  434. // returns index of button that lies at that point
  435. //-----------------------------------------------------------------------------
  436. {
  437.     // Hit test all the buttons. It might be an idea to cache the rectangles for all the
  438.     // items, but for now this loop doesn't seem too bad
  439.     for (int i = GetButtonCount(); i >= 0; i--)
  440.     {
  441.         TBBUTTON tbButton;
  442.         CRect rect;
  443.         if (GetItemRect(i, &rect))
  444.         {
  445.             if (rect.PtInRect(point))
  446.             {
  447.                 GetButton(i, &tbButton);
  448.                 if (tbButton.fsStyle == TBSTYLE_SEP)
  449.                     return -1;                // inside a separator        
  450.                 else
  451.                     return i;                // inside a button
  452.             }
  453.             if (point.y > rect.bottom)        // if point we're testing is below items in the
  454.                                         // array, then stop (minor optimization)
  455.                 break;
  456.         }
  457.     }
  458.     return -1;
  459. }
  460.  
  461.  
  462.  
  463. //-----------------------------------------------------------------------------
  464. void CMRCToolBarCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
  465. //-----------------------------------------------------------------------------
  466. {
  467.     if (HitTestButtons(point) != -1)
  468.     {
  469.         CToolBarCtrl::OnLButtonDown(nFlags, point);
  470.     }
  471.     else
  472.     {
  473.         CWnd * pParent = GetOwner();
  474.         ASSERT(pParent != NULL);
  475.         // map to co-ordinates of parent window
  476.         ClientToScreen(&point);
  477.         pParent->ScreenToClient(&point);
  478.         // let the parent handle it
  479.         pParent->SendMessage(WM_LBUTTONDOWN, nFlags, MAKELONG(point.x, point.y));  
  480.     }
  481. }
  482.  
  483. /////////////////////////////////////////////////////////////////////////////
  484. /////////////////////////////////////////////////////////////////////////////
  485. // CToolBar idle update through CToolCmdUI class. 
  486.  
  487. class CToolCmdUI : public CCmdUI        // class private to this file !
  488. {
  489. public: // re-implementations only
  490.     virtual void Enable(BOOL bOn);
  491.     virtual void SetCheck(int nCheck);
  492.     virtual void SetText(LPCTSTR lpszText);
  493. };
  494.  
  495. //-----------------------------------------------------------------------------
  496. void CToolCmdUI::Enable(BOOL bOn)
  497. //-----------------------------------------------------------------------------
  498. {
  499.     m_bEnableChanged = TRUE;
  500.     CMRCSizeToolBar* pSizeToolBar = (CMRCSizeToolBar *)m_pOther;
  501.     CMRCToolBarCtrl * pToolBar = &pSizeToolBar->m_ToolCtrl;
  502.     ASSERT(pToolBar != NULL);
  503.  
  504.     ASSERT(m_nIndex < m_nIndexMax);
  505.  
  506.     // Get toolbar button state
  507.     TBBUTTON TB;
  508.     pToolBar->GetButton(m_nIndex, &TB);
  509.     UINT nNewState = TB.fsState & ~TBSTATE_ENABLED;
  510.     if (bOn)
  511.         nNewState |= TBSTATE_ENABLED;
  512.     if (nNewState != TB.fsState)
  513.         pToolBar->SetState(m_nID, nNewState);
  514. }
  515.  
  516.  
  517. //-----------------------------------------------------------------------------
  518. void CToolCmdUI::SetCheck(int nCheck)
  519. //-----------------------------------------------------------------------------
  520. {
  521.     ASSERT(nCheck >= 0 && nCheck <= 2); // 0=>off, 1=>on, 2=>indeterminate
  522.     CMRCSizeToolBar* pSizeToolBar = (CMRCSizeToolBar *)m_pOther;
  523.     CMRCToolBarCtrl * pToolBar = &pSizeToolBar->m_ToolCtrl;
  524.     ASSERT(pToolBar != NULL);
  525.  
  526.     ASSERT(m_nIndex < m_nIndexMax);
  527.  
  528.     // Get toolbar button state
  529.     TBBUTTON TB;
  530.     pToolBar->GetButton(m_nIndex, &TB);
  531.     UINT nNewState = TB.fsState & ~ (TBSTATE_CHECKED | TBSTATE_INDETERMINATE);
  532.     
  533.     if (nCheck == 1)
  534.         nNewState |= TBSTATE_CHECKED;
  535.     else
  536.         if (nCheck == 2)
  537.             nNewState |= TBSTATE_INDETERMINATE;
  538.     
  539.     if (nNewState != TB.fsState)
  540.         pToolBar->SetState(m_nID, nNewState);
  541.  
  542.    // should we set the button style too ?
  543.    //    pToolBar->_SetButtonStyle(m_nIndex, nNewStyle | TBBS_CHECKBOX); */
  544. }
  545.  
  546.  
  547. //-----------------------------------------------------------------------------
  548. void CToolCmdUI::SetText(LPCTSTR)
  549. //-----------------------------------------------------------------------------
  550. {
  551.     // ignore it
  552. }
  553.  
  554.  
  555. //-----------------------------------------------------------------------------
  556. void CMRCSizeToolBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
  557. //-----------------------------------------------------------------------------
  558. {
  559.     CToolCmdUI state;
  560.     state.m_pOther = this;
  561.  
  562.     state.m_nIndexMax = m_ToolCtrl.GetButtonCount();
  563.     for (state.m_nIndex = 0; state.m_nIndex < state.m_nIndexMax;
  564.       state.m_nIndex++)
  565.     {
  566.         TBBUTTON TB;
  567.         m_ToolCtrl.GetButton(state.m_nIndex, &TB);
  568.         if (!(TB.fsStyle & TBSTYLE_SEP))
  569.         {
  570.             state.m_nID = TB.idCommand;
  571.             state.DoUpdate(pTarget, bDisableIfNoHndler);
  572.         }
  573.     }
  574.     // update any dialog controls added to the toolbar (probably unlikely in this case)
  575.     UpdateDialogControls(pTarget, bDisableIfNoHndler);
  576.  
  577. }
  578.  
  579.  
  580. //-----------------------------------------------------------------------------
  581. CToolBarCtrl * CMRCSizeToolBar::GetToolBarCtrl()
  582. //-----------------------------------------------------------------------------
  583. {
  584.     return &m_ToolCtrl;
  585. }
  586.