X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e320a79f187558effb04d92020b470372bbe456..9ab7ff537d1ead0f0b07c14841474203c7fa59ba:/include/wx/os2/mdi.h diff --git a/include/wx/os2/mdi.h b/include/wx/os2/mdi.h index c27d937e39..dfa7cfa50b 100644 --- a/include/wx/os2/mdi.h +++ b/include/wx/os2/mdi.h @@ -3,34 +3,27 @@ // Purpose: MDI (Multiple Document Interface) classes. // This doesn't have to be implemented just like Windows, // it could be a tabbed design as in wxGTK. -// Author: AUTHOR +// Author: David Webster // Modified by: -// Created: ??/??/98 +// Created: 10/10/99 // RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Copyright: (c) David Webster +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_MDI_H_ #define _WX_MDI_H_ -#ifdef __GNUG__ -#pragma interface "mdi.h" -#endif - #include "wx/frame.h" -WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr; -WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr; - -class WXDLLEXPORT wxMDIClientWindow; -class WXDLLEXPORT wxMDIChildFrame; +class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; +class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; -class WXDLLEXPORT wxMDIParentFrame: public wxFrame +class WXDLLIMPEXP_CORE wxMDIParentFrame: public wxFrame { DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) - friend class WXDLLEXPORT wxMDIChildFrame; + friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; public: wxMDIParentFrame(); @@ -45,7 +38,7 @@ public: Create(parent, id, title, pos, size, style, name); } - ~wxMDIParentFrame(); + virtual ~wxMDIParentFrame(); bool Create(wxWindow *parent, wxWindowID id, @@ -55,43 +48,62 @@ public: long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, const wxString& name = wxFrameNameStr); - void OnSize(wxSizeEvent& event); - void OnActivate(wxActivateEvent& event); - void OnSysColourChanged(wxSysColourChangedEvent& event); + // accessors + // --------- + + // Get the active MDI child window (Windows only) + wxMDIChildFrame *GetActiveChild() const; + + // Get the client window + wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; } + + // Create the client window class (don't Create the window, + // just return a new class) + virtual wxMDIClientWindow *OnCreateClient(void); - void SetMenuBar(wxMenuBar *menu_bar); + wxMenu* GetWindowMenu() const { return m_windowMenu; } +// void SetWindowMenu(wxMwnu* pMenu); - // Gets the size available for subwindows after menu size, toolbar size - // and status bar size have been subtracted. If you want to manage your own - // toolbar(s), don't call SetToolBar. - void GetClientSize(int *width, int *height) const; + // MDI operations + // -------------- + virtual void Cascade(); + virtual void Tile(); + virtual void ArrangeIcons(); + virtual void ActivateNext(); + virtual void ActivatePrevious(); - // Get the active MDI child window (Windows only) - wxMDIChildFrame *GetActiveChild() const ; + // handlers + // -------- - // Get the client window - inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }; + // Responds to colour changes + void OnSysColourChanged(wxSysColourChangedEvent& event); - // Create the client window class (don't Create the window, - // just return a new class) - virtual wxMDIClientWindow *OnCreateClient() ; + void OnSize(wxSizeEvent& event); - // MDI operations - virtual void Cascade(); - virtual void Tile(); - virtual void ArrangeIcons(); - virtual void ActivateNext(); - virtual void ActivatePrevious(); + bool HandleActivate(int state, bool minimized, WXHWND activate); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + // override window proc for MDI-specific message processing + virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + + virtual MRESULT OS2DefWindowProc(WXUINT, WXWPARAM, WXLPARAM); + virtual bool OS2TranslateMessage(WXMSG* msg); protected: + virtual void InternalSetMenuBar(); + + wxMDIClientWindow * m_clientWindow; + wxMDIChildFrame * m_currentChild; + wxMenu* m_windowMenu; - // TODO maybe have this member - wxMDIClientWindow *m_clientWindow; + // TRUE if MDI Frame is intercepting commands, not child + bool m_parentFrameActive; -DECLARE_EVENT_TABLE() +private: + DECLARE_EVENT_TABLE() }; -class WXDLLEXPORT wxMDIChildFrame: public wxFrame +class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame { DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) public: @@ -108,7 +120,7 @@ public: Create(parent, id, title, pos, size, style, name); } - ~wxMDIChildFrame(); + virtual ~wxMDIChildFrame(); bool Create(wxMDIParentFrame *parent, wxWindowID id, @@ -118,18 +130,31 @@ public: long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); - // Set menu bar - void SetMenuBar(wxMenuBar *menu_bar); - void SetClientSize(int width, int height); - void GetPosition(int *x, int *y) const ; + // MDI operations + virtual void Maximize(bool maximize = TRUE); + virtual void Restore(); + virtual void Activate(); - // MDI operations - virtual void Maximize(); - virtual void Restore(); - virtual void Activate(); -private: - // Supress VA's hidden function warning - void Maximize(bool maximize) {wxFrame::Maximize(maximize);} + // Handlers + + bool HandleMDIActivate(long bActivate, WXHWND, WXHWND); + bool HandleSize(int x, int y, WXUINT); + bool HandleWindowPosChanging(void *lpPos); + bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); + + virtual MRESULT OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual MRESULT OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + virtual bool OS2TranslateMessage(WXMSG *msg); + + virtual void OS2DestroyWindow(); + + // Implementation + bool ResetWindowStyle(void *vrect); + +protected: + virtual void DoGetPosition(int *x, int *y) const; + virtual void DoSetClientSize(int width, int height); + virtual void InternalSetMenuBar(); }; /* The client window is a child of the parent MDI frame, and itself @@ -139,28 +164,34 @@ private: * of the children. Phew! So the children are sort of 'adopted'... */ -class WXDLLEXPORT wxMDIClientWindow: public wxWindow +class WXDLLIMPEXP_CORE wxMDIClientWindow: public wxWindow { DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) + public: - wxMDIClientWindow() ; - inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) - { - CreateClient(parent, style); - } + wxMDIClientWindow() { Init(); } + wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0) + { + Init(); - ~wxMDIClientWindow(); + CreateClient(parent, style); + } - // Note: this is virtual, to allow overridden behaviour. - virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL); + // Note: this is virtual, to allow overridden behaviour. + virtual bool CreateClient(wxMDIParentFrame *parent, + long style = wxVSCROLL | wxHSCROLL); - // Explicitly call default scroll behaviour - void OnScroll(wxScrollEvent& event); + // Explicitly call default scroll behaviour + void OnScroll(wxScrollEvent& event); protected: + void Init() { m_scrollX = m_scrollY = 0; } -DECLARE_EVENT_TABLE() + int m_scrollX, m_scrollY; + +private: + DECLARE_EVENT_TABLE() }; #endif