]> icculus.org git repositories - icculus/iodoom3.git/blob - neo/tools/radiant/TabsDlg.h
Various Mac OS X tweaks to get this to build. Probably breaking things.
[icculus/iodoom3.git] / neo / tools / radiant / TabsDlg.h
1 /*
2 ===========================================================================
3
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company. 
6
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).  
8
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.
21
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code.  If not, please request a copy in writing from id Software at the address below.
23
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25
26 ===========================================================================
27 */
28
29 #pragma once
30 #include "afxcmn.h"
31 #include "TearoffContainerWindow.h"
32
33
34 // CTabsDlg dialog
35 class CTabsDlg : public CDialog
36 {
37 //      DECLARE_DYNAMIC ( CTabsDlg )
38         // Construction
39 public:
40         
41         CTabsDlg(UINT ID ,CWnd* pParent = NULL);        // standard constructor
42
43         typedef void (*pfnOnDockEvent)( bool , int , CWnd* );
44
45         void AddDockedWindow ( CWnd* wnd , int ID , int imageID , const CString& title , bool dock , pfnOnDockEvent dockCallback = NULL);
46         void DockWindow ( int ID , bool dock );
47         bool RectWithinDockManager ( CRect& rect );
48         void FocusWindow ( int ID );
49         void SetImageList ( CImageList* list )
50         {
51                 ASSERT ( list );
52                 m_Tabs.SetImageList( list );
53         }
54
55         bool IsDocked ( CWnd* wnd );
56
57         protected:
58         int CTabsDlg::PreTranslateMessage ( MSG* msg );
59
60 // Implementation
61 protected:
62         CImageList m_TabImages;
63         CPoint m_DragDownPoint;
64         CMapWordToPtr m_Windows;
65         bool m_DragTabActive;
66
67         void DoDataExchange(CDataExchange* pDX);
68
69         //private struct that holds the info we need about each window
70         struct DockedWindowInfo {
71                 DockedWindowInfo ( CWnd* wnd , int ID , int imageID , const CString& title = "" , pfnOnDockEvent dockCallback = NULL)
72                 {
73                         ASSERT ( wnd );
74                         m_Window = wnd;
75                         m_ID = ID;
76                         m_ImageID = imageID;
77                         m_TabControlIndex = -1;
78                         if ( title.GetLength() == 0 )
79                         {
80                                 m_Window->GetWindowText( m_Title );
81                                 
82                         }
83                         else
84                         {
85                                 m_Title = title;
86                         }
87                         m_State = DOCKED;
88                         m_DockCallback = dockCallback;
89                 }
90                 
91                 enum eState {DOCKED,FLOATING} ;
92                 CTearoffContainerWindow m_Container;            //the floating window that will hold m_Window when it's undocked
93                 CWnd* m_Window;                         
94                 CString m_Title;
95                 int m_ImageID;
96                 int m_ID;
97                 int m_TabControlIndex;
98                 eState m_State;
99                 pfnOnDockEvent m_DockCallback;
100         };
101         void ShowAllWindows ( bool show = true );
102
103         void HandleUndock ();
104         void UpdateTabControlIndices ();        
105
106         // Generated message map functions
107         virtual BOOL OnInitDialog();
108         DECLARE_MESSAGE_MAP()
109
110 public:
111         CTabCtrl m_Tabs;
112         afx_msg void OnTcnSelchange(NMHDR *pNMHDR, LRESULT *pResult);
113         afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
114         afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
115         afx_msg void OnMouseMove(UINT nFlags, CPoint point);
116         afx_msg void OnDestroy();
117
118         void SaveWindowPlacement ( int ID = -1 );
119 };