2 ==============================================================================
4 Copyright 2005-11 by Satoshi Fujiwara.
6 async can be redistributed and/or modified under the terms of the
7 GNU General Public License, as published by the Free Software Foundation;
8 either version 2 of the License, or (at your option) any later version.
10 async is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with async; if not, visit www.gnu.org/licenses or write to the
17 Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 Boston, MA 02111-1307 USA
20 ==============================================================================
30 #define BOOST_ASSIGN_MAX_PARAMS 7
31 #include <boost/assign.hpp>
32 #include <boost/assign/ptr_list_of.hpp>
33 #include <boost/assign/ptr_list_inserter.hpp>
34 #include <boost/foreach.hpp>
37 #define _CRTDBG_MAP_ALLOC
39 #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
42 #include "sf_windows.h"
43 #include "tab_dialog.h"
47 #include "exception.h"
48 #include "application.h"
50 #define THROW_IFERR(hres) \
51 if (FAILED(hres)) { throw sf::win32_error_exception(hres); }
53 #ifndef HINST_THISCOMPONENT
54 EXTERN_C IMAGE_DOS_HEADER __ImageBase;
55 #define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
60 tab_dialog_base::tab_dialog_base(sf::base_window& parent_window,HWND tab_hwnd,int tab_id,const std::wstring& menu_name,const std::wstring& name,HINSTANCE inst,LPCTSTR temp)
61 : base_win32_dialog_t(menu_name,name,false,0,0),parent_window_(parent_window)
62 ,tab_hwnd_(tab_hwnd),tab_id_(tab_id),inst_(inst),temp_(temp)
67 void tab_dialog_base::create()
69 hwnd_ = CreateDialogW(inst_,temp_,(HWND)parent_window_.raw_handle(),thunk_proc_);
70 BOOST_ASSERT(hwnd_ != NULL);
73 throw win32_error_exception();
79 void tab_dialog_base::resize()
82 DWORD dwDlgBase = GetDialogBaseUnits();
83 int cxMargin = LOWORD(dwDlgBase) / 4;
84 int cyMargin = HIWORD(dwDlgBase) / 8;
86 TabCtrl_GetItemRect(tab_hwnd_,0,&rci);
88 GetClientRect(tab_hwnd_,&r);
90 GetWindowRect(tab_hwnd_,&rw);
91 POINT pt = {rw.left,rw.top + rci.bottom};
92 ScreenToClient((HWND)parent_window_.raw_handle(),&pt);
97 r.right - cxMargin * 2 - 1,
98 r.bottom - rci.bottom - cyMargin * 2 - 1