mdi.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk/mdi.h
  3. // Purpose: TDI-based MDI implementation for wxGTK
  4. // Author: Robert Roebling
  5. // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
  6. // Copyright: (c) 1998 Robert Roebling
  7. // (c) 2008 Vadim Zeitlin
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_GTK_MDI_H_
  11. #define _WX_GTK_MDI_H_
  12. #include "wx/frame.h"
  13. class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
  14. class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow;
  15. typedef struct _GtkNotebook GtkNotebook;
  16. //-----------------------------------------------------------------------------
  17. // wxMDIParentFrame
  18. //-----------------------------------------------------------------------------
  19. class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
  20. {
  21. public:
  22. wxMDIParentFrame() { Init(); }
  23. wxMDIParentFrame(wxWindow *parent,
  24. wxWindowID id,
  25. const wxString& title,
  26. const wxPoint& pos = wxDefaultPosition,
  27. const wxSize& size = wxDefaultSize,
  28. long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
  29. const wxString& name = wxFrameNameStr)
  30. {
  31. Init();
  32. (void)Create(parent, id, title, pos, size, style, name);
  33. }
  34. bool Create(wxWindow *parent,
  35. wxWindowID id,
  36. const wxString& title,
  37. const wxPoint& pos = wxDefaultPosition,
  38. const wxSize& size = wxDefaultSize,
  39. long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
  40. const wxString& name = wxFrameNameStr);
  41. // we don't store the active child in m_currentChild unlike the base class
  42. // version so override this method to find it dynamically
  43. virtual wxMDIChildFrame *GetActiveChild() const;
  44. // implement base class pure virtuals
  45. // ----------------------------------
  46. virtual void ActivateNext();
  47. virtual void ActivatePrevious();
  48. static bool IsTDI() { return true; }
  49. // implementation
  50. bool m_justInserted;
  51. virtual void OnInternalIdle();
  52. protected:
  53. virtual void DoGetClientSize(int* width, int* height) const;
  54. private:
  55. friend class wxMDIChildFrame;
  56. void Init();
  57. DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
  58. };
  59. //-----------------------------------------------------------------------------
  60. // wxMDIChildFrame
  61. //-----------------------------------------------------------------------------
  62. class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
  63. {
  64. public:
  65. wxMDIChildFrame() { Init(); }
  66. wxMDIChildFrame(wxMDIParentFrame *parent,
  67. wxWindowID id,
  68. const wxString& title,
  69. const wxPoint& pos = wxDefaultPosition,
  70. const wxSize& size = wxDefaultSize,
  71. long style = wxDEFAULT_FRAME_STYLE,
  72. const wxString& name = wxFrameNameStr)
  73. {
  74. Init();
  75. Create(parent, id, title, pos, size, style, name);
  76. }
  77. bool Create(wxMDIParentFrame *parent,
  78. wxWindowID id,
  79. const wxString& title,
  80. const wxPoint& pos = wxDefaultPosition,
  81. const wxSize& size = wxDefaultSize,
  82. long style = wxDEFAULT_FRAME_STYLE,
  83. const wxString& name = wxFrameNameStr);
  84. virtual ~wxMDIChildFrame();
  85. virtual void SetMenuBar( wxMenuBar *menu_bar );
  86. virtual wxMenuBar *GetMenuBar() const;
  87. virtual void Activate();
  88. virtual void SetTitle(const wxString& title);
  89. // implementation
  90. void OnActivate( wxActivateEvent& event );
  91. void OnMenuHighlight( wxMenuEvent& event );
  92. virtual void GTKHandleRealized();
  93. wxMenuBar *m_menuBar;
  94. bool m_justInserted;
  95. private:
  96. void Init();
  97. GtkNotebook *GTKGetNotebook() const;
  98. DECLARE_EVENT_TABLE()
  99. DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
  100. };
  101. //-----------------------------------------------------------------------------
  102. // wxMDIClientWindow
  103. //-----------------------------------------------------------------------------
  104. class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
  105. {
  106. public:
  107. wxMDIClientWindow() { }
  108. ~wxMDIClientWindow();
  109. virtual bool CreateClient(wxMDIParentFrame *parent,
  110. long style = wxVSCROLL | wxHSCROLL);
  111. private:
  112. virtual void AddChildGTK(wxWindowGTK* child);
  113. DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
  114. };
  115. #endif // _WX_GTK_MDI_H_