[Windows version] WindowImpl cleanup, fixes and improvements.
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / windows / platform-implement-win.h
index 18b33c1..6c84b31 100755 (executable)
@@ -1,21 +1,21 @@
 #ifndef PLATFORM_IMPLEMENT_WIN_INCLUDE\r
 #define PLATFORM_IMPLEMENT_WIN_INCLUDE\r
 \r
-/*
-* Copyright (c) 2018 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
+/*\r
+* Copyright (c) 2018 Samsung Electronics Co., Ltd.\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
 */\r
 \r
 // EXTERNAL_HEADERS\r
 typedef uint64_t   WinWindowHandle;\r
 typedef uint64_t   WinPixmap;\r
 \r
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-\r
-namespace WindowsPlatformImplementation\r
+namespace Dali\r
 {\r
 \r
-void RunLoop();\r
-\r
-int GetEdgeHeight();\r
-\r
-int GetColorDepth();\r
-\r
-uint64_t CreateHwnd(\r
-    _In_opt_ const char *lpClassName,\r
-    _In_opt_ const char *lpWindowName,\r
-    _In_ int X,\r
-    _In_ int Y,\r
-    _In_ int nWidth,\r
-    _In_ int nHeight,\r
-    _In_opt_ uint64_t parent);\r
+namespace Internal\r
+{\r
 \r
-void SetListener( CallbackBase *callback );\r
+namespace Adaptor\r
+{\r
 \r
-bool PostWinMessage(\r
-    _In_ uint32_t Msg,\r
-    _In_ uint32_t wParam,\r
-    _In_ uint64_t lParam,\r
-    _In_ uint64_t hWnd);\r
+namespace WindowsPlatform\r
+{\r
 \r
 bool PostWinThreadMessage(\r
     _In_ uint32_t Msg,\r
-    _In_ uint32_t wParam,\r
+    _In_ uint64_t wParam,\r
     _In_ uint64_t lParam,\r
     _In_ uint64_t threadID = -1 );\r
 \r
-void ShowWindow( uint64_t hWnd );\r
-void HideWindow( uint64_t hWnd );\r
-\r
 using timerCallback = bool(*)(void *data);\r
 \r
 int SetTimer(int interval, timerCallback callback, void *data);\r
 \r
 void KillTimer(int id);\r
 \r
-void GetDPI( uint64_t hWnd, float &xDpi, float &yDpi );\r
-\r
 const char* GetKeyName( int keyCode );\r
 \r
 uint64_t GetCurrentThreadId();\r
@@ -85,12 +57,59 @@ void GetNanoseconds( uint64_t& timeInNanoseconds );
 \r
 unsigned int GetCurrentMilliSeconds( void );\r
 \r
-} // namespace WindowsPlatformImplement
-
-} // namespace Adaptor
-
-} // namespace internal
-
-} // namespace Dali
-
+class WindowImpl\r
+{\r
+public:\r
+  static const uint32_t STYLE;\r
+  static const int32_t EDGE_WIDTH;\r
+  static const int32_t EDGE_HEIGHT;\r
+\r
+  WindowImpl();\r
+\r
+  virtual ~WindowImpl();\r
+\r
+  static void ProcWinMessage( uint64_t hWnd, uint32_t uMsg, uint64_t wParam, uint64_t lParam );\r
+\r
+  static uint64_t CreateHwnd(\r
+    _In_opt_ const char *lpWindowName,\r
+    _In_ int X,\r
+    _In_ int Y,\r
+    _In_ int nWidth,\r
+    _In_ int nHeight,\r
+    _In_opt_ uint64_t parent );\r
+\r
+  static void DestroyHWnd(uint64_t hWnd);\r
+\r
+  void GetDPI( float &xDpi, float &yDpi );\r
+\r
+  int GetColorDepth();\r
+\r
+  void SetListener( CallbackBase *callback );\r
+\r
+  bool PostWinMessage(\r
+    _In_ uint32_t Msg,\r
+    _In_ uint64_t wParam,\r
+    _In_ uint64_t lParam );\r
+\r
+  void SetHWND(uint64_t inHWnd);\r
+  void SetWinProc();\r
+\r
+protected:\r
+\r
+private:\r
+  int colorDepth;\r
+  uint64_t mHWnd; // no ownership, managed outside\r
+  uint64_t mHdc;\r
+\r
+  CallbackBase *listener;\r
+};\r
+\r
+} // namespace WindowsPlatformImplement\r
+\r
+} // namespace Adaptor\r
+\r
+} // namespace internal\r
+\r
+} // namespace Dali\r
+\r
 #endif // WIN32_WINDOWS_SYSTEM_INCLUDE\r