DockableForm.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. // DockableFormClass.cpp : implementation file
  19. //
  20. #include "StdAfx.h"
  21. #include "DockableForm.H"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. //
  29. // DockableFormClass
  30. //
  31. DockableFormClass::DockableFormClass (UINT nIDTemplate)
  32. : m_uiTemplateID (nIDTemplate),
  33. CWnd ()
  34. {
  35. //{{AFX_DATA_INIT(DockableFormClass)
  36. // NOTE: the ClassWizard will add member initialization here
  37. //}}AFX_DATA_INIT
  38. return ;
  39. }
  40. /////////////////////////////////////////////////////////////////////////////
  41. //
  42. // ~DockableFormClass
  43. //
  44. DockableFormClass::~DockableFormClass (void)
  45. {
  46. return ;
  47. }
  48. BEGIN_MESSAGE_MAP(DockableFormClass, CWnd)
  49. //{{AFX_MSG_MAP(DockableFormClass)
  50. ON_WM_CREATE()
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. //
  55. // Create
  56. //
  57. BOOL
  58. DockableFormClass::Create
  59. (
  60. LPCTSTR /*lpszClassName*/,
  61. LPCTSTR /*lpszWindowName*/,
  62. DWORD dwRequestedStyle,
  63. const RECT& rect,
  64. CWnd* pParentWnd,
  65. UINT nID,
  66. CCreateContext* pContext
  67. )
  68. {
  69. ASSERT(pParentWnd != NULL);
  70. // call PreCreateWindow to get prefered extended style
  71. CREATESTRUCT cs; memset(&cs, 0, sizeof(CREATESTRUCT));
  72. if (dwRequestedStyle == 0) {
  73. dwRequestedStyle = AFX_WS_DEFAULT_VIEW;
  74. }
  75. cs.style = dwRequestedStyle;
  76. if (!PreCreateWindow(cs)) {
  77. return FALSE;
  78. }
  79. // create a modeless dialog
  80. if (!CreateDlg(MAKEINTRESOURCE (m_uiTemplateID), pParentWnd)) {
  81. return FALSE;
  82. }
  83. ExecuteDlgInit(MAKEINTRESOURCE (m_uiTemplateID));
  84. ::SetWindowLong (m_hWnd, GWL_STYLE, ::GetWindowLong (m_hWnd, GWL_STYLE) & (~WS_CAPTION));
  85. SetDlgCtrlID(nID);
  86. GetWindowRect (m_rectForm);
  87. // force the size requested
  88. SetWindowPos(NULL, rect.left, rect.top,
  89. rect.right - rect.left, rect.bottom - rect.top,
  90. SWP_NOZORDER|SWP_NOACTIVATE);
  91. // make visible if requested
  92. if (dwRequestedStyle & WS_VISIBLE) {
  93. ShowWindow(SW_NORMAL);
  94. }
  95. // To support dynamic data exchange...
  96. UpdateData (FALSE);
  97. HandleInitDialog ();
  98. return TRUE;
  99. }
  100. /////////////////////////////////////////////////////////////////////////////
  101. //
  102. // OnCreate
  103. //
  104. int
  105. DockableFormClass::OnCreate (LPCREATESTRUCT lpCreateStruct)
  106. {
  107. // Allow the base class to process this message
  108. if (CWnd::OnCreate(lpCreateStruct) == -1) {
  109. return -1;
  110. }
  111. // we use the style from the template - but make sure that
  112. // the WS_BORDER bit is correct
  113. // the WS_BORDER bit will be whatever is in dwRequestedStyle
  114. ModifyStyle(WS_BORDER|WS_CAPTION, lpCreateStruct->style & (WS_BORDER|WS_CAPTION));
  115. ModifyStyleEx(WS_EX_CLIENTEDGE, lpCreateStruct->dwExStyle & WS_EX_CLIENTEDGE);
  116. // initialize controls etc
  117. /*if (!ExecuteDlgInit(MAKEINTRESOURCE (m_uiTemplateID))) {
  118. return -1;
  119. }*/
  120. return 0;
  121. }
  122. ////////////////////////////////////////////////////////////////////////////
  123. //
  124. // WindowProc
  125. //
  126. LRESULT
  127. DockableFormClass::WindowProc
  128. (
  129. UINT message,
  130. WPARAM wParam,
  131. LPARAM lParam
  132. )
  133. {
  134. // Is this the message we are expecting?
  135. if (message == WM_SHOWWINDOW) {
  136. // Make sure the controls reflect the current state when we are
  137. // shown
  138. if ((BOOL)wParam) {
  139. //Update_Controls ();
  140. }
  141. }
  142. // Allow the base class to process this message
  143. return CWnd::WindowProc(message, wParam, lParam);
  144. }