Fernando_Fiore

CMyMDITabOwner

Sep 29th, 2020
39
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template< class T, class TTabCtrl >
  2. class CMyMDITabOwnerImpl : public CMDITabOwnerImpl<T, TTabCtrl>
  3. {
  4. public:
  5.     DECLARE_WND_CLASS_EX(_T("MyMdiTabOwner"), 0, COLOR_APPWORKSPACE)
  6.     typedef CMyMDITabOwnerImpl<T, TTabCtrl> thisClass;
  7.     typedef CMDITabOwnerImpl<T, TTabCtrl> baseClass;
  8.     BEGIN_MSG_MAP(thisClass)
  9.         NOTIFY_CODE_HANDLER(CTCN_SELCHANGE, OnSelChange)
  10.         NOTIFY_CODE_HANDLER(CTCN_CLOSE, OnTabClose)
  11.         CHAIN_MSG_MAP(baseClass)
  12.         // NOTE: CCustomTabCtrl derived classes no longer
  13.         //  need notifications reflected.
  14.         // REFLECT_NOTIFICATIONS()
  15.     END_MSG_MAP()
  16.  
  17.     LRESULT OnSelChange(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  18.     {
  19.         LRESULT res = baseClass::OnSelChange(idCtrl, pnmh, bHandled);
  20.         int nSel = m_TabCtrl.GetCurSel();
  21.  
  22.         if (nSel >= 0) {
  23.             TTabCtrl::TItem* pItem = m_TabCtrl.GetItem(nSel);
  24.             if (pItem)
  25.             {
  26.                 ::SendMessage(pItem->GetTabView(), WM_NOTIFY,(WPARAM) idCtrl, (LPARAM) pnmh);
  27.             }
  28.         }
  29.         return res;
  30.     }
  31.  
  32.     LRESULT OnTabClose(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  33.     {
  34.         LRESULT res = baseClass::OnTabClose(idCtrl, pnmh, bHandled);
  35.         int nSel = m_TabCtrl.GetCurSel();
  36.         if (nSel >= 0) {
  37.             TTabCtrl::TItem* pItem = m_TabCtrl.GetItem(nSel);
  38.             if (pItem)
  39.             {
  40.                 ::SendMessage(pItem->GetTabView(), WM_NOTIFY, (WPARAM)idCtrl, (LPARAM)pnmh);
  41.             }
  42.         }
  43.         return res;
  44.     }
  45. };
  46.  
  47. template< class TTabCtrl >
  48. class CMyMDITabOwner :
  49.     public CMyMDITabOwnerImpl<CMyMDITabOwner<TTabCtrl>, TTabCtrl>
  50. {
  51. };
  52.  
  53. typedef CTabbedMDIClient< CDotNetTabCtrl<CTabViewTabItem>, CMyMDITabOwner< CDotNetTabCtrl<CTabViewTabItem> > > CMyTabbedMDIClient;
  54. class CMainFrame :
  55.     public CTabbedMDIFrameWindowImpl<CMainFrame, CMyTabbedMDIClient >,
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×