FormToolbar.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. ////////////////////////////////////////////////////////////////////////
  19. //
  20. // FormToolbarClass.H
  21. //
  22. // Module declaring a CControlBar derived class which is used to implement
  23. // floating or dockable toolbars containing dialogs.
  24. //
  25. //
  26. #ifndef __FORMTOOLBARCLASS_H
  27. #define __FORMTOOLBARCLASS_H
  28. //////////////////////////////////////////////////////////////
  29. //
  30. // FormToolbarClass
  31. //
  32. class FormToolbarClass : public CControlBar
  33. {
  34. // Operations
  35. public:
  36. // Overrides
  37. // ClassWizard generated virtual function overrides
  38. //{{AFX_VIRTUAL(FormToolbarClass)
  39. protected:
  40. //}}AFX_VIRTUAL
  41. // Implementation
  42. // Generated message map functions
  43. //{{AFX_MSG(FormToolbarClass)
  44. afx_msg void OnSize(UINT nType, int cx, int cy);
  45. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  46. //}}AFX_MSG
  47. DECLARE_MESSAGE_MAP()
  48. public:
  49. ////////////////////////////////////////////////////////
  50. //
  51. // Public Contructors
  52. //
  53. FormToolbarClass ();
  54. virtual ~FormToolbarClass ();
  55. ////////////////////////////////////////////////////////
  56. //
  57. // Public Methods
  58. //
  59. //
  60. // Required methods
  61. //
  62. CSize CalcFixedLayout (BOOL, BOOL) { return CSize (100, 100); }
  63. CSize CalcDynamicLayout( int nLength, DWORD dwMode )
  64. {
  65. if (dwMode & LM_VERTDOCK)
  66. {
  67. if (::AfxGetMainWnd () &&
  68. ::AfxGetMainWnd ()->GetDlgItem (AFX_IDW_PANE_FIRST))
  69. {
  70. CRect rect;
  71. ::AfxGetMainWnd ()->GetDlgItem (AFX_IDW_PANE_FIRST)->GetClientRect (&rect);
  72. return CSize (m_minSize.cx, rect.Height ()+8);
  73. }
  74. else
  75. {
  76. return m_minSize;
  77. }
  78. }
  79. else if (dwMode & LM_HORZDOCK)
  80. {
  81. if (::AfxGetMainWnd ())
  82. {
  83. CRect rect;
  84. ::AfxGetMainWnd ()->GetClientRect (&rect);
  85. return CSize (rect.Width ()+8, m_minSize.cy);
  86. }
  87. else
  88. {
  89. return m_minSize;
  90. }
  91. }
  92. else
  93. {
  94. return m_minSize;
  95. }
  96. }
  97. void OnUpdateCmdUI (class CFrameWnd*, int) {}
  98. BOOL Create (class DockableFormClass *pCFormClass, LPCTSTR pszWindowName, CWnd *pCParentWnd, UINT uiID);
  99. class DockableFormClass * Get_Form (void) const { return m_pCForm; }
  100. protected:
  101. private:
  102. ////////////////////////////////////////////////////////
  103. //
  104. // Private member data
  105. //
  106. class DockableFormClass *m_pCForm;
  107. CSize m_minSize;
  108. };
  109. #endif //__FORMTOOLBARCLASS_H