doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TearoffContainerWindow.cpp
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 #include "../../idlib/precompiled.h"
30 #pragma hdrstop
31 
32 // TearoffContainerWindow.cpp : implementation file
33 //
34 
35 #include "TabsDlg.h"
36 #include "TearoffContainerWindow.h"
37 
38 
39 // CTearoffContainerWindow
40 
41 IMPLEMENT_DYNAMIC(CTearoffContainerWindow, CWnd)
43 {
44  m_DragPreviewActive = false;
45  m_ContainedDialog = NULL;
46  m_DockManager = NULL;
47 }
48 
50 {
51 }
52 
53 
54 BEGIN_MESSAGE_MAP(CTearoffContainerWindow, CWnd)
55  ON_WM_NCLBUTTONDBLCLK()
56  ON_WM_CLOSE()
57  ON_WM_SIZE()
58  ON_WM_DESTROY()
59  ON_WM_SETFOCUS()
60 END_MESSAGE_MAP()
61 
62 // CTearoffContainerWindow message handlers
63 
64 
65 void CTearoffContainerWindow::OnNcLButtonDblClk(UINT nHitTest, CPoint point)
66 {
67  if ( nHitTest == HTCAPTION )
68  {
69  m_DockManager->DockWindow ( m_DialogID , true );
70  }
71 
72  CWnd::OnNcLButtonDblClk(nHitTest, point);
73 }
74 
75 
76 void CTearoffContainerWindow::SetDialog ( CWnd* dlg , int ID )
77 {
78  m_DialogID = ID;
79  m_ContainedDialog = dlg;
80 
81  CRect rect;
82  CPoint point (-10 , -10);
83  m_ContainedDialog->GetWindowRect ( rect );
84 
85  rect.OffsetRect(point); //move the window slightly so you can tell it's been popped up
86 
87  //stupid hack to get the window resize itself properly
88  rect.DeflateRect(0,0,0,1);
89  MoveWindow(rect);
90  rect.InflateRect(0,0,0,1);
91  MoveWindow(rect);
92 }
93 
95 {
96  m_DockManager = dlg;
97 }
99 {
100  if ( m_DockManager )
101  {
102  //send it back to the docking window (for now at least)
103  m_DockManager->DockWindow ( m_DialogID , true );
104  }
105 }
106 
107 
109 {
110  if ( pMsg->message == WM_NCLBUTTONUP )
111  {
112 /* CRect rect;
113  GetWindowRect ( rect );
114 
115  rect.DeflateRect( 0,0,0,rect.Height() - GetSystemMetrics(SM_CYSMSIZE));
116  if ( m_DockManager->RectWithinDockManager ( rect ))
117  {
118  m_DockManager->DockDialog ( m_DialogID , true );
119  }
120 */
121  }
122 
123  return CWnd::PreTranslateMessage(pMsg);
124 }
125 void CTearoffContainerWindow::OnSize(UINT nType, int cx, int cy)
126 {
127  if ( m_ContainedDialog )
128  {
129  m_ContainedDialog->MoveWindow ( 0,0,cx,cy);
130  }
131 
132  CWnd::OnSize(nType, cx, cy);
133 }
134 
136 {
137  CWnd::OnDestroy();
138 
139  // TODO: Add your message handler code here
140 }
141 
143 {
144  CWnd::OnSetFocus(pOldWnd);
145  if ( m_ContainedDialog )
146  {
147  m_ContainedDialog->SetFocus();
148  }
149  // TODO: Add your message handler code here
150 }
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
#define BOOL
Definition: mprintf.c:71
void DockWindow(int ID, bool dock)
Definition: TabsDlg.cpp:87
void SetDockManager(CTabsDlg *dlg)
#define NULL
Definition: Lib.h:88
afx_msg void OnSize(UINT nType, int cx, int cy)
afx_msg void OnSetFocus(CWnd *pOldWnd)
void SetDialog(CWnd *dlg, int ID)