TileSetBrowserFrame.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. FinalSun/FinalAlert 2 Mission Editor
  3. Copyright (C) 1999-2024 Electronic Arts, Inc.
  4. Authored by Matthias Wagner
  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. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. // TileSetBrowserFrame.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "finalsun.h"
  20. #include "TileSetBrowserFrame.h"
  21. #include "resource.h"
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CTileSetBrowserFrame
  29. IMPLEMENT_DYNCREATE(CTileSetBrowserFrame, CFrameWnd)
  30. CTileSetBrowserFrame::CTileSetBrowserFrame()
  31. {
  32. }
  33. CTileSetBrowserFrame::~CTileSetBrowserFrame()
  34. {
  35. }
  36. BEGIN_MESSAGE_MAP(CTileSetBrowserFrame, CFrameWnd)
  37. //{{AFX_MSG_MAP(CTileSetBrowserFrame)
  38. ON_WM_SIZE()
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Behandlungsroutinen für Nachrichten CTileSetBrowserFrame
  43. void CTileSetBrowserFrame::PostNcDestroy()
  44. {
  45. // TODO: Speziellen Code hier einfügen und/oder Basisklasse aufrufen
  46. delete this;
  47. // CFrameWnd::PostNcDestroy();
  48. }
  49. BOOL CTileSetBrowserFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
  50. {
  51. ((CDialogBar*)&m_bar)->Create(this, IDD_TERRAINBAR, CBRS_TOP, 5);
  52. m_bar.ShowWindow(SW_SHOW);
  53. CRect r;
  54. GetClientRect(r);
  55. m_view.Create(NULL, NULL, WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE, r, this, 1, NULL);
  56. RecalcLayout(TRUE);
  57. CSize sizeTotal;
  58. GetClientRect(&r);
  59. sizeTotal.cx = r.right;
  60. sizeTotal.cy = m_view.m_bottom_needed;
  61. m_view.SetScrollSizes(MM_TEXT, sizeTotal);
  62. m_view.ShowWindow(SW_SHOW);
  63. return CFrameWnd::OnCreateClient(lpcs, pContext);
  64. }
  65. void CTileSetBrowserFrame::RecalcLayout(BOOL bNotify)
  66. {
  67. RECT r;
  68. RECT rm;
  69. GetClientRect(&rm);
  70. m_bar.GetClientRect(&r);
  71. m_view.SetWindowPos(NULL, 0, r.bottom, rm.right, rm.bottom - r.bottom, SWP_NOZORDER);
  72. m_view.GetClientRect(&r);
  73. CSize sizeTotal;
  74. sizeTotal.cx = r.right;
  75. sizeTotal.cy = m_view.m_bottom_needed;
  76. m_view.SetScrollSizes(MM_TEXT, sizeTotal);
  77. CFrameWnd::RecalcLayout(bNotify);
  78. }
  79. void CTileSetBrowserFrame::OnSize(UINT nType, int cx, int cy)
  80. {
  81. CFrameWnd::OnSize(nType, cx, cy);
  82. RecalcLayout();
  83. }