29 #include "../../idlib/precompiled.h"
38 : CDialog(ID, pParent)
52 void CTabsDlg::DoDataExchange(CDataExchange* pDX)
54 CDialog::DoDataExchange(pDX);
62 CDialog::OnInitDialog();
69 int ID = TabCtrl_GetCurSel ( pNMHDR->hwndFrom );
74 item.mask = TCIF_PARAM;
77 TabCtrl_GetItem (
m_Tabs.GetSafeHwnd() , ID , &item);
83 info->m_Window->ShowWindow(
TRUE);
90 m_Windows.Lookup ( (WORD)ID , (
void*&)info );
93 ASSERT (
m_Tabs.GetSafeHwnd() );
101 CString classname = AfxRegisterWndClass ( CS_DBLCLKS , 0 , 0 , 0 );
104 info->m_Window->GetWindowRect(rect);
105 info->m_Container.CreateEx ( WS_EX_TOOLWINDOW , classname , info->m_Title , WS_THICKFRAME | WS_SYSMENU | WS_POPUP | WS_CAPTION, rect ,
this , 0 );
106 info->m_Window->SetParent ( &info->m_Container );
107 info->m_Window->ShowWindow(
TRUE);
109 info->m_Container.SetDockManager(
this);
110 info->m_Container.ShowWindow(
TRUE);
111 info->m_Container.SetDialog ( info->m_Window , info->m_ID );
113 if (info->m_TabControlIndex >= 0 )
115 m_Tabs.DeleteItem( info->m_TabControlIndex );
118 if (
m_Tabs.GetItemCount() > 0 )
123 CString placementName = info->m_Title +
"Placement";
130 info->m_TabControlIndex =
m_Tabs.InsertItem( TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM , 0 , info->m_Title , info->m_ImageID , (
LPARAM)info);
133 info->m_Window->ShowWindow (
TRUE);
135 info->m_Container.SetDockManager(
NULL );
136 info->m_Container.DestroyWindow ();
139 GetWindowRect ( rect );
142 rect.DeflateRect(0,0,0,1);
144 rect.InflateRect(0,0,0,1);
151 if ( info->m_DockCallback )
153 info->m_DockCallback ( dock , info->m_ID , info->m_Window );
160 if ( msg->message == WM_LBUTTONDBLCLK && msg->hwnd ==
m_Tabs.GetSafeHwnd() )
167 if ( msg->message == WM_LBUTTONDOWN && msg->hwnd ==
m_Tabs.GetSafeHwnd()) {
168 m_Tabs.SendMessage ( msg->message , msg->wParam , msg->lParam );
171 else if ( msg->message == WM_LBUTTONUP && msg->hwnd ==
m_Tabs.GetSafeHwnd()) {
172 m_Tabs.SendMessage ( msg->message , msg->wParam , msg->lParam );
176 return CDialog::PreTranslateMessage(msg);
181 CRect tabsRect,intersectionRect;
183 m_Tabs.GetWindowRect ( tabsRect );
184 intersectionRect.IntersectRect( tabsRect , rect );
186 return !(intersectionRect.IsRectEmpty());
191 CDialog::OnLButtonDown(nFlags, point);
201 CDialog::OnLButtonUp(nFlags, point);
208 item.mask = TCIF_PARAM;
210 int curSel = TabCtrl_GetCurSel (
m_Tabs.GetSafeHwnd());
212 TabCtrl_GetItem (
m_Tabs.GetSafeHwnd() , curSel , &item);
222 CDialog::OnMouseMove(nFlags, point);
229 m_Windows.Lookup( (WORD)ID , (
void*&)info);
232 ASSERT ( info ==
NULL );
249 m_Windows.GetNextAssoc( pos, ID, (
void*&)info );
250 ASSERT ( info->m_Window );
253 info->m_Window->ShowWindow( show );
261 m_Windows.Lookup( (WORD)ID , (
void*&)info);
264 ASSERT ( info->m_Window );
268 TabCtrl_SetCurFocus (
m_Tabs.GetSafeHwnd() , info->m_TabControlIndex );
272 info->m_Container.SetFocus();
279 item.mask = TCIF_PARAM;
282 int itemCount =
m_Tabs.GetItemCount();
284 for (
int i = 0 ;
i < itemCount ;
i ++ )
286 if ( !
m_Tabs.GetItem(
i , &item ) )
288 Sys_Error (
"UpdateTabControlIndices(): GetItem failed!\n" );
298 item.mask = TCIF_PARAM;
302 for (
int i = 0 ;
i <
m_Tabs.GetItemCount() ;
i ++ )
310 CDialog::OnDestroy();
319 CString placementName;
325 m_Windows.GetNextAssoc( pos, wID, (
void*&)info );
327 if ( info->m_Window == wnd ) {
339 CString placementName;
345 m_Windows.GetNextAssoc( pos, wID, (
void*&)info );
348 placementName = info->m_Title +
"Placement";
CONST PIXELFORMATDESCRIPTOR UINT
void UpdateTabControlIndices()
void ShowAllWindows(bool show=true)
bool LoadWindowPlacement(HWND hwnd, const char *pName)
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
void AddDockedWindow(CWnd *wnd, int ID, int imageID, const CString &title, bool dock, pfnOnDockEvent dockCallback=NULL)
afx_msg void OnTcnSelchange(NMHDR *pNMHDR, LRESULT *pResult)
void SetParent(CPropTreeItem *pParent)
void DockWindow(int ID, bool dock)
CTabsDlg(UINT ID, CWnd *pParent=NULL)
#define IDC_TAB_INSPECTOR
void SaveWindowPlacement(int ID=-1)
void Sys_Error(const char *error,...)
virtual BOOL OnInitDialog()
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
bool RectWithinDockManager(CRect &rect)
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
int PreTranslateMessage(MSG *msg)