mdi.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/gtk1/mdi.h
  3. // Purpose: TDI-based MDI implementation for wxGTK1
  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_GTK1_MDI_H_
  11. #define _WX_GTK1_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 GtkOnSize( int x, int y, int width, int height );
  52. virtual void OnInternalIdle();
  53. private:
  54. void Init();
  55. DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
  56. };
  57. //-----------------------------------------------------------------------------
  58. // wxMDIChildFrame
  59. //-----------------------------------------------------------------------------
  60. class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxTDIChildFrame
  61. {
  62. public:
  63. wxMDIChildFrame() { Init(); }
  64. wxMDIChildFrame(wxMDIParentFrame *parent,
  65. wxWindowID id,
  66. const wxString& title,
  67. const wxPoint& pos = wxDefaultPosition,
  68. const wxSize& size = wxDefaultSize,
  69. long style = wxDEFAULT_FRAME_STYLE,
  70. const wxString& name = wxFrameNameStr)
  71. {
  72. Init();
  73. Create(parent, id, title, pos, size, style, name);
  74. }
  75. bool Create(wxMDIParentFrame *parent,
  76. wxWindowID id,
  77. const wxString& title,
  78. const wxPoint& pos = wxDefaultPosition,
  79. const wxSize& size = wxDefaultSize,
  80. long style = wxDEFAULT_FRAME_STYLE,
  81. const wxString& name = wxFrameNameStr);
  82. virtual ~wxMDIChildFrame();
  83. virtual void SetMenuBar( wxMenuBar *menu_bar );
  84. virtual wxMenuBar *GetMenuBar() const;
  85. virtual void Activate();
  86. virtual void SetTitle(const wxString& title);
  87. // implementation
  88. void OnActivate( wxActivateEvent& event );
  89. void OnMenuHighlight( wxMenuEvent& event );
  90. wxMenuBar *m_menuBar;
  91. GtkNotebookPage *m_page;
  92. bool m_justInserted;
  93. private:
  94. void Init();
  95. GtkNotebook *GTKGetNotebook() const;
  96. DECLARE_EVENT_TABLE()
  97. DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
  98. };
  99. //-----------------------------------------------------------------------------
  100. // wxMDIClientWindow
  101. //-----------------------------------------------------------------------------
  102. class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
  103. {
  104. public:
  105. wxMDIClientWindow() { }
  106. virtual bool CreateClient(wxMDIParentFrame *parent,
  107. long style = wxVSCROLL | wxHSCROLL);
  108. private:
  109. DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
  110. };
  111. #endif // _WX_GTK1_MDI_H_