// 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;
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);
+
+ WXHMENU GetWindowMenu() const { return m_windowMenu; }
- void SetMenuBar(wxMenuBar *menu_bar);
+ // MDI operations
+ // --------------
+ virtual void Cascade();
+ virtual void Tile();
+ virtual void ArrangeIcons();
+ virtual void ActivateNext();
+ virtual void ActivatePrevious();
- // 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;
+ // handlers
+ // --------
- // Get the active MDI child window (Windows only)
- wxMDIChildFrame *GetActiveChild() const ;
+ // Responds to colour changes
+ void OnSysColourChanged(wxSysColourChangedEvent& event);
- // Get the client window
- inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
+ void OnSize(wxSizeEvent& event);
- // Create the client window class (don't Create the window,
- // just return a new class)
- virtual wxMDIClientWindow *OnCreateClient() ;
+ bool HandleActivate(int state, bool minimized, WXHWND activate);
+ bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
- // MDI operations
- virtual void Cascade();
- virtual void Tile();
- virtual void ArrangeIcons();
- virtual void ActivateNext();
- virtual void ActivatePrevious();
+ // override window proc for MDI-specific message processing
+ virtual MRESULT OS2WindowProc(HWND hwnd, WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
+
+ virtual MRESULT OS2DefWindowProc(HWND hwnd, WXUINT, WXWPARAM, WXLPARAM);
+ virtual bool OS2TranslateMessage(WXMSG* msg);
protected:
+ virtual void InternalSetMenuBar();
+
+ wxMDIClientWindow * m_clientWindow;
+ wxMDIChildFrame * m_currentChild;
+ WXHMENU 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:
+ friend class WXDLLEXPORT wxMDIChildFrame;
+
+ DECLARE_EVENT_TABLE()
};
class WXDLLEXPORT wxMDIChildFrame: public wxFrame
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 virtual function hiding warning
- virtual 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(HWND hwnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
+ virtual MRESULT OS2DefWindowProc(HWND hwnd, 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
class WXDLLEXPORT 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