#ifndef _COMMON_MDIWIN_HPP_
#define _COMMON_MDIWIN_HPP_
#ifndef _COMMON_GUIWINDOW_HPP_
#include <common/guiwnd.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _COMMON_PUREMENU_HPP_
#include <common/puremenu.hpp>
#endif

class FrameWindow;
class MDIWindow;

typedef SmartPointer<MDIWindow> PMDIWindow;

class MDIWindow : public GUIWindow
{
public:
	MDIWindow(void);
 	virtual ~MDIWindow();
  BOOL createWindow(FrameWindow &frameWindow,const String &className,const String &windowName=String(),const String &menuName=String(),const String &iconName=String());
	PureMenu &getMenu(void);
	const String &className(void)const;
	SmartPointer<FrameWindow> getFrame(void)const;
protected:
	virtual void preRegister(WNDCLASS &wndClass);
	virtual void preCreate(MDICREATESTRUCT &createStruct);
private:
  int windowProcedure(HWND hWnd,WORD message,WPARAM wParam,LPARAM lParam);
  void registerClass(HINSTANCE hInstance,const String &className,const String &menuName,const String &iconName);
  BOOL createWindow(HINSTANCE hInstance,const String &className,const String &windowName,const String &menuName);
  void mdiActivate(CallbackData &someCallbackData);

	SmartPointer<FrameWindow> mFrameWindow;
	PureMenu mViewMenu;
	String mClassName;
};

inline
PureMenu &MDIWindow::getMenu(void)
{
  return mViewMenu;
}

inline
const String &MDIWindow::className(void)const
{
  return mClassName;
}

inline
SmartPointer<FrameWindow> MDIWindow::getFrame(void)const
{
  return mFrameWindow;
}
#endif
