OSDN Git Service

とりあえず立方体を描いてみた。
[winaudioj/winwrapper.git] / winwrapper / test_window.cpp
1 #include "StdAfx.h"\r
2 #include "test_window.h"\r
3 \r
4 #define BOOST_ASSIGN_MAX_PARAMS 7\r
5 #include <boost/assign.hpp>\r
6 #include <boost/assign/ptr_list_of.hpp>\r
7 #include <boost/assign/ptr_list_inserter.hpp>\r
8 #include <boost/foreach.hpp>\r
9 \r
10 #if _DEBUG\r
11 #define _CRTDBG_MAP_ALLOC\r
12 #include <crtdbg.h>\r
13 #define new new(_NORMAL_BLOCK, __FILE__, __LINE__)\r
14 #endif\r
15 \r
16 #include "sf_windows.h"\r
17 #include "toplevel_window.h"\r
18 #include "CommDlg.h"\r
19 #include "icon.h"\r
20 #include "timer.h"\r
21 #include "exception.h"\r
22 #include "application.h"\r
23 \r
24 \r
25 \r
26 #define THROW_IFERR(hres) \\r
27   if (FAILED(hres)) { throw sf::win32_error_exception(hres); }\r
28 \r
29 #ifndef HINST_THISCOMPONENT\r
30 EXTERN_C IMAGE_DOS_HEADER __ImageBase;\r
31 #define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)\r
32 #endif\r
33 \r
34 namespace sf \r
35 {\r
36 \r
37   HRESULT EnableBlurBehind(HWND hwnd)\r
38   {\r
39     HRESULT hr = S_OK;\r
40 \r
41     ////Create and populate the BlurBehind structre\r
42     //DWM_BLURBEHIND bb = {0};\r
43     ////Enable Blur Behind and Blur Region;\r
44     //bb.dwFlags = DWM_BB_ENABLE;\r
45     //bb.fEnable = true;\r
46     //bb.hRgnBlur = NULL;\r
47 \r
48     ////Enable Blur Behind\r
49     //hr = DwmEnableBlurBehindWindow(hwnd, &bb);\r
50     //if (SUCCEEDED(hr))\r
51     //{\r
52     //  //do more things\r
53       MARGINS mgn = {-1};\r
54                   hr = DwmExtendFrameIntoClientArea( hwnd, &mgn );\r
55  /*   }*/\r
56     return hr;\r
57   }\r
58 \r
59 \r
60 \r
61   test_window::test_window(\r
62     const std::wstring& title,\r
63     const std::wstring& name,bool fit_to_display,\r
64     float width,float height) : base_win32_window_t(title,name,fit_to_display,width,height)\r
65 \r
66   {\r
67     register_class();\r
68     create();\r
69     BOOL dwmEnable;\r
70     DwmIsCompositionEnabled (&dwmEnable); \r
71     if (dwmEnable) EnableBlurBehind(hwnd_);\r
72     //DwmEnableComposition(DWM_EC_DISABLECOMPOSITION );\r
73     show();\r
74     text(title_);\r
75     update();\r
76   }\r
77 \r
78 \r
79   test_window::~test_window()\r
80   {\r
81   }\r
82 \r
83   void test_window::create()\r
84   {\r
85     create_window();\r
86   }\r
87 \r
88   void test_window::create_window()\r
89   {\r
90 \r
91     // Windowを作成する\r
92     CreateWindowEx(\r
93       WS_EX_APPWINDOW,\r
94       name_.c_str(),\r
95       title_.c_str(),\r
96       WS_OVERLAPPEDWINDOW,\r
97       CW_USEDEFAULT,\r
98       CW_USEDEFAULT,\r
99       static_cast<uint32_t>(dpi_.scale_x(width_)),\r
100       static_cast<uint32_t>(dpi_.scale_x(height_)),\r
101       NULL,\r
102       NULL,\r
103       HINST_THISCOMPONENT,\r
104       this\r
105       );\r
106   };\r
107 \r
108   //base_win32_window_t::result_t test_window::on_create(CREATESTRUCT *p)\r
109   //{\r
110   //  return 0;\r
111   //}\r
112 \r
113 }\r