doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TabsDlg.h
Go to the documentation of this file.
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;
64  CMapWordToPtr m_Windows;
66 
67  void DoDataExchange(CDataExchange* pDX);
68 
69  //private struct that holds the info we need about each window
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 
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;
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 };
void SetImageList(CImageList *list)
Definition: TabsDlg.h:49
CMapWordToPtr m_Windows
Definition: TabsDlg.h:64
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
void UpdateTabControlIndices()
Definition: TabsDlg.cpp:276
CTearoffContainerWindow m_Container
Definition: TabsDlg.h:92
void ShowAllWindows(bool show=true)
Definition: TabsDlg.cpp:242
void(* pfnOnDockEvent)(bool, int, CWnd *)
Definition: TabsDlg.h:43
void FocusWindow(int ID)
Definition: TabsDlg.cpp:258
afx_msg void OnDestroy()
Definition: TabsDlg.cpp:295
case const int
Definition: Callbacks.cpp:52
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Definition: TabsDlg.cpp:194
#define BOOL
Definition: mprintf.c:71
void AddDockedWindow(CWnd *wnd, int ID, int imageID, const CString &title, bool dock, pfnOnDockEvent dockCallback=NULL)
Definition: TabsDlg.cpp:226
bool m_DragTabActive
Definition: TabsDlg.h:65
afx_msg void OnTcnSelchange(NMHDR *pNMHDR, LRESULT *pResult)
Definition: TabsDlg.cpp:67
void DockWindow(int ID, bool dock)
Definition: TabsDlg.cpp:87
CTabsDlg(UINT ID, CWnd *pParent=NULL)
Definition: TabsDlg.cpp:37
bool IsDocked(CWnd *wnd)
Definition: TabsDlg.cpp:314
#define NULL
Definition: Lib.h:88
void HandleUndock()
Definition: TabsDlg.cpp:205
#define show(x)
Definition: getpart.c:36
DockedWindowInfo(CWnd *wnd, int ID, int imageID, const CString &title="", pfnOnDockEvent dockCallback=NULL)
Definition: TabsDlg.h:71
void SaveWindowPlacement(int ID=-1)
Definition: TabsDlg.cpp:335
CPoint m_DragDownPoint
Definition: TabsDlg.h:63
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
CImageList m_TabImages
Definition: TabsDlg.h:62
void DoDataExchange(CDataExchange *pDX)
Definition: TabsDlg.cpp:52
unsigned char bool
Definition: setup.h:74
virtual BOOL OnInitDialog()
Definition: TabsDlg.cpp:60
pfnOnDockEvent m_DockCallback
Definition: TabsDlg.h:99
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
Definition: TabsDlg.cpp:189
bool RectWithinDockManager(CRect &rect)
Definition: TabsDlg.cpp:179
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Definition: TabsDlg.cpp:220
CTabCtrl m_Tabs
Definition: TabsDlg.h:111
int PreTranslateMessage(MSG *msg)
Definition: TabsDlg.cpp:158