Index: trunk/ab5.0/abdev/abdev/include/MainFrame.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/MainFrame.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/MainFrame.h	(revision 489)
@@ -0,0 +1,29 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{
+
+
+class MainFrame
+	: public WindowComponents::BaseWindow
+{
+	WindowAreaManager wam;
+	WindowComponents::MdiWindow *mdiWindow;
+
+public:
+
+	::LRESULT OnCreate( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled );
+	::LRESULT OnClose( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled );
+	void OnSize(UINT nType, CSize size);
+	::LRESULT OnDestroy( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled );
+
+private:
+	// メッセージマップ
+	BEGIN_MSG_MAP( MainFrame )
+		MESSAGE_HANDLER( WM_CREATE, OnCreate )
+		MESSAGE_HANDLER( WM_CLOSE, OnClose )
+		MESSAGE_HANDLER( WM_DESTROY, OnDestroy )
+	END_MSG_MAP()
+};
+
+
+}}
Index: trunk/ab5.0/abdev/abdev/include/Program.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/Program.h	(revision 481)
+++ trunk/ab5.0/abdev/abdev/include/Program.h	(revision 489)
@@ -6,5 +6,18 @@
 class Program
 {
+	static MainFrame mainFrame;
+
+	static void InitializeWindow();
 public:
+	static CAppModule _Module;
+
+	static void Main();
+
+
+
+	static HWND GetMainFrameWndHandle()
+	{
+		return mainFrame.m_hWnd;
+	}
 };
 
Index: trunk/ab5.0/abdev/abdev/include/WindowAreaManager.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowAreaManager.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowAreaManager.h	(revision 489)
@@ -0,0 +1,23 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{
+
+
+class WindowAreaManager
+{
+	HWND hParentWnd;
+	std::vector<WindowCollection> windowCollections;
+public:
+	void SetParentWnd( HWND hParentWnd )
+	{
+		this->hParentWnd = hParentWnd;
+	}
+
+	void Add();
+	void AddMdiWindow( WindowComponents::MdiWindow *mdiWindow );
+
+	WindowComponents::MdiWindow *mdiWindow;
+};
+
+
+}}
Index: trunk/ab5.0/abdev/abdev/include/WindowCollection.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowCollection.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowCollection.h	(revision 489)
@@ -0,0 +1,23 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{
+
+
+class WindowCollection
+{
+	WindowComponents::MdiWindow *mdiWindow;
+	WindowComponents::BaseWindowPtrs windows;
+public:
+
+	WindowCollection()
+		: mdiWindow( NULL )
+	{
+	}
+	WindowCollection( WindowComponents::MdiWindow *mdiWindow )
+		: mdiWindow( mdiWindow )
+	{
+	}
+};
+
+
+}}
Index: trunk/ab5.0/abdev/abdev/include/WindowComponents/BaseWindow.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowComponents/BaseWindow.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowComponents/BaseWindow.h	(revision 489)
@@ -0,0 +1,20 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{ namespace WindowComponents{
+
+
+class BaseWindow
+	: public CWindowImpl<BaseWindow, CAxWindow>
+{
+public:
+	BaseWindow()
+	{
+	}
+	~BaseWindow()
+	{
+	}
+};
+typedef std::vector<BaseWindow *> BaseWindowPtrs;
+
+
+}}}
Index: trunk/ab5.0/abdev/abdev/include/WindowComponents/DockingWindow.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowComponents/DockingWindow.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowComponents/DockingWindow.h	(revision 489)
@@ -0,0 +1,19 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{ namespace WindowComponents{
+
+
+class DockingWindow
+	: public BaseWindow
+{
+public:
+	DockingWindow()
+	{
+	}
+	~DockingWindow()
+	{
+	}
+};
+
+
+}}}
Index: trunk/ab5.0/abdev/abdev/include/WindowComponents/MdiChild.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowComponents/MdiChild.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowComponents/MdiChild.h	(revision 489)
@@ -0,0 +1,37 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{ namespace WindowComponents{
+
+
+class MdiChild
+	: public CMDIChildWindowImpl<MdiChild>
+{
+public:
+    virtual void OnFinalMessage(HWND /*hWnd*/){
+        delete this;
+    }
+
+private:
+    // メッセージマップ
+    BEGIN_MSG_MAP_EX(MdiChild)
+        MSG_WM_CREATE(OnCreate)
+        //MSG_WM_FORWARDMSG(OnForwardMsg)
+        CHAIN_MSG_MAP(CMDIChildWindowImpl<MdiChild>)
+    END_MSG_MAP()
+
+    LRESULT OnCreate(LPCREATESTRUCT lpcs){
+        SetMsgHandled(false);
+        return 1;
+    }
+/*
+    LRESULT OnForwardMsg(LPMSG pMsg, DWORD dwUserData){
+        // メッセージフィルタ処理
+        if(CMDIChildWindowImpl<MdiChild>::PreTranslateMessage(pMsg))
+            return TRUE;
+
+        return m_view.PreTranslateMessage(pMsg);
+    }*/
+};
+
+
+}}}
Index: trunk/ab5.0/abdev/abdev/include/WindowComponents/MdiWindow.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowComponents/MdiWindow.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowComponents/MdiWindow.h	(revision 489)
@@ -0,0 +1,75 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{ namespace WindowComponents{
+
+
+class MdiWindow
+	: public CMDIFrameWindowImpl<MdiWindow>
+	, public CUpdateUI<MdiWindow>
+	, public CMessageFilter
+	, public CIdleHandler
+{
+public:
+    virtual BOOL PreTranslateMessage(MSG* pMsg){
+        if(CMDIFrameWindowImpl<MdiWindow>::PreTranslateMessage(pMsg))
+            return TRUE;
+
+        // アクティブな子ウィンドウにメッセージフィルタの機会を与える
+        HWND hWnd = MDIGetActive();
+        if(hWnd != NULL)
+            return (BOOL)::SendMessage(hWnd, WM_FORWARDMSG, 0, (LPARAM)pMsg);
+
+        return FALSE;
+    }
+
+    virtual BOOL OnIdle(){
+        UIUpdateToolBar();
+        UIUpdateStatusBar();
+        return FALSE;
+    }
+
+    BEGIN_UPDATE_UI_MAP(MdiWindow)
+        // エントリなし
+    END_UPDATE_UI_MAP()
+
+    BEGIN_MSG_MAP_EX(MdiWindow)
+        MSG_WM_CREATE(OnCreate)
+        COMMAND_ID_HANDLER_EX(ID_APP_EXIT, OnFileExit)
+        COMMAND_ID_HANDLER_EX(ID_FILE_NEW, OnFileNew)
+        COMMAND_ID_HANDLER_EX(ID_WINDOW_CASCADE, OnWindowCascade)
+        COMMAND_ID_HANDLER_EX(ID_WINDOW_TILE_HORZ, OnWindowTile)
+        COMMAND_ID_HANDLER_EX(ID_WINDOW_ARRANGE, OnWindowArrangeIcons)
+        CHAIN_MSG_MAP(CUpdateUI<MdiWindow>)
+        CHAIN_MSG_MAP(CMDIFrameWindowImpl<MdiWindow>)
+    END_MSG_MAP()
+
+    LRESULT OnCreate(LPCREATESTRUCT lpcs);
+
+    void OnFileExit(UINT uNotifyCode, int nID, HWND hWndCtl){
+        PostMessage(WM_CLOSE);
+    }
+
+    void OnFileNew(UINT uNotifyCode, int nID, HWND hWndCtl){
+        // 子ウィンドウを作成
+        MdiChild *child = new MdiChild();
+        child->CreateEx( m_hWndClient );
+    }
+
+    void OnWindowCascade(UINT uNotifyCode, int nID, HWND hWndCtl){
+        // 子ウィンドウを重ねて表示
+        MDICascade();
+    }
+
+    void OnWindowTile(UINT uNotifyCode, int nID, HWND hWndCtl){
+        // 子ウィンドウを上下に並べて表示
+        MDITile();
+    }
+
+    void OnWindowArrangeIcons(UINT uNotifyCode, int nID, HWND hWndCtl){
+        // 最小化された子ウィンドウのアイコンを整列
+        MDIIconArrange();
+    }
+};
+
+
+}}}
Index: trunk/ab5.0/abdev/abdev/include/WindowComponents/TextView.h
===================================================================
--- trunk/ab5.0/abdev/abdev/include/WindowComponents/TextView.h	(revision 489)
+++ trunk/ab5.0/abdev/abdev/include/WindowComponents/TextView.h	(revision 489)
@@ -0,0 +1,27 @@
+#pragma once
+
+namespace ActiveBasic{ namespace IDE{ namespace WindowComponents{
+
+
+class TextView
+	: DockingWindow
+{
+public:
+	TextView()
+	{
+	}
+	~TextView()
+	{
+	}
+
+	virtual ::LRESULT OnCreate ( ::UINT msg, ::WPARAM wParam, ::LPARAM lParam, ::BOOL& handled );
+
+private:
+	// メッセージマップ
+	BEGIN_MSG_MAP( TextView )
+		MESSAGE_HANDLER( WM_CREATE, OnCreate )
+	END_MSG_MAP()
+};
+
+
+}}}
