Commit 60284578ecab30093ec1aff8cda0de123aafa046
1 parent
26d90f46
(window-example) Fix shadow variable compilation error on some platforms
Change-Id: Ibdb4df980399eb65b238014f040e18b2eeabd5f1
Showing
1 changed file
with
118 additions
and
122 deletions
examples/window/window-example.cpp
| 1 | 1 | /* |
| 2 | - * Copyright (c) 2019 Samsung Electronics Co., Ltd. | |
| 2 | + * Copyright (c) 2023 Samsung Electronics Co., Ltd. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -16,27 +16,27 @@ |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | 18 | #include <dali-toolkit/dali-toolkit.h> |
| 19 | -#include <dali/integration-api/scene.h> | |
| 20 | 19 | #include <dali/devel-api/adaptor-framework/window-devel.h> |
| 21 | 20 | #include <dali/integration-api/debug.h> |
| 21 | +#include <dali/integration-api/scene.h> | |
| 22 | 22 | |
| 23 | 23 | using namespace Dali; |
| 24 | 24 | using namespace Dali::Toolkit; |
| 25 | 25 | |
| 26 | -const int MARGIN = 50; | |
| 27 | -static int count = 0; | |
| 26 | +const int MARGIN = 50; | |
| 27 | +static int count = 0; | |
| 28 | 28 | |
| 29 | 29 | // This example shows how to create and display Hello World! using a simple TextActor |
| 30 | 30 | // |
| 31 | 31 | class WindowExampleController : public ConnectionTracker |
| 32 | 32 | { |
| 33 | 33 | public: |
| 34 | - WindowExampleController(Application &application) | |
| 35 | - : mApplication(application), | |
| 36 | - manual_rotation_flag(false), | |
| 37 | - rotation_count(0), | |
| 38 | - rot(0), | |
| 39 | - bColor(0) | |
| 34 | + WindowExampleController(Application& application) | |
| 35 | + : mApplication(application), | |
| 36 | + manual_rotation_flag(false), | |
| 37 | + rotation_count(0), | |
| 38 | + rot(0), | |
| 39 | + bColor(0) | |
| 40 | 40 | { |
| 41 | 41 | // Connect to the Application's Init signal |
| 42 | 42 | mApplication.InitSignal().Connect(this, &WindowExampleController::Create); |
| ... | ... | @@ -49,7 +49,7 @@ public: |
| 49 | 49 | ~WindowExampleController() = default; |
| 50 | 50 | |
| 51 | 51 | // The Init signal is received once (only) during the Application lifetime |
| 52 | - void Create(Application &application) | |
| 52 | + void Create(Application& application) | |
| 53 | 53 | { |
| 54 | 54 | // Get a handle to the window and set the background colour |
| 55 | 55 | Window window = application.GetWindow(); |
| ... | ... | @@ -60,9 +60,9 @@ public: |
| 60 | 60 | window.SetType(WindowType::NOTIFICATION); |
| 61 | 61 | window.SetNotificationLevel(WindowNotificationLevel::MEDIUM); |
| 62 | 62 | |
| 63 | - currentOrientation = Dali::WindowOrientation::PORTRAIT; | |
| 64 | - enableTimer = false; | |
| 65 | - bChangedOrientation = false; | |
| 63 | + currentOrientation = Dali::WindowOrientation::PORTRAIT; | |
| 64 | + enableTimer = false; | |
| 65 | + bChangedOrientation = false; | |
| 66 | 66 | manual_rotation_flag = false; |
| 67 | 67 | |
| 68 | 68 | // Add a text label to the window |
| ... | ... | @@ -99,7 +99,6 @@ public: |
| 99 | 99 | DevelWindow::MoveCompletedSignal(window).Connect(this, &WindowExampleController::OnWindowMovedByServer); |
| 100 | 100 | DevelWindow::ResizeCompletedSignal(window).Connect(this, &WindowExampleController::OnWindowResizedByServer); |
| 101 | 101 | |
| 102 | - | |
| 103 | 102 | window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT); |
| 104 | 103 | window.AddAvailableOrientation(Dali::WindowOrientation::LANDSCAPE); |
| 105 | 104 | window.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT_INVERSE); |
| ... | ... | @@ -111,37 +110,37 @@ public: |
| 111 | 110 | mTimer.TickSignal().Connect(this, &WindowExampleController::OnTimerTick); |
| 112 | 111 | } |
| 113 | 112 | |
| 114 | - void Pause(Application &application) | |
| 113 | + void Pause(Application& application) | |
| 115 | 114 | { |
| 116 | 115 | DALI_LOG_RELEASE_INFO("Application is paused..***********************\n"); |
| 117 | 116 | } |
| 118 | 117 | |
| 119 | - void Resume(Application &application) | |
| 118 | + void Resume(Application& application) | |
| 120 | 119 | { |
| 121 | 120 | DALI_LOG_RELEASE_INFO("Application is resumed..***********************\n"); |
| 122 | 121 | } |
| 123 | 122 | |
| 124 | - void PresentedCallback( int frameId ) | |
| 123 | + void PresentedCallback(int frameId) | |
| 125 | 124 | { |
| 126 | - DALI_LOG_RELEASE_INFO("PresentedCallback: FrameId %d\n",frameId); | |
| 125 | + DALI_LOG_RELEASE_INFO("PresentedCallback: FrameId %d\n", frameId); | |
| 127 | 126 | } |
| 128 | 127 | |
| 129 | 128 | void OnDeviceOrientationChanged(DeviceStatus::Orientation::Status status) |
| 130 | 129 | { |
| 131 | - DALI_LOG_RELEASE_INFO("orientation status: %d\n",status); | |
| 130 | + DALI_LOG_RELEASE_INFO("orientation status: %d\n", status); | |
| 132 | 131 | } |
| 133 | 132 | |
| 134 | 133 | void OnLowMemory(DeviceStatus::Memory::Status status) |
| 135 | 134 | { |
| 136 | - DALI_LOG_RELEASE_INFO("low memory status: %d\n",status); | |
| 135 | + DALI_LOG_RELEASE_INFO("low memory status: %d\n", status); | |
| 137 | 136 | } |
| 138 | 137 | |
| 139 | 138 | bool OnTimerTick() |
| 140 | 139 | { |
| 141 | 140 | Dali::Window window = mApplication.GetWindow(); |
| 142 | - bool ret = true; | |
| 141 | + bool ret = true; | |
| 143 | 142 | |
| 144 | - if (DevelWindow::IsWindowRotating(window) == true) | |
| 143 | + if(DevelWindow::IsWindowRotating(window) == true) | |
| 145 | 144 | { |
| 146 | 145 | isRotating = true; |
| 147 | 146 | DALI_LOG_RELEASE_INFO("Window is rotating!!!!\n"); |
| ... | ... | @@ -151,7 +150,7 @@ public: |
| 151 | 150 | DALI_LOG_RELEASE_INFO("Send AckWindowRotation in Timer\n"); |
| 152 | 151 | DevelWindow::SendRotationCompletedAcknowledgement(window); |
| 153 | 152 | count = 0; |
| 154 | - ret = false; | |
| 153 | + ret = false; | |
| 155 | 154 | } |
| 156 | 155 | } |
| 157 | 156 | else |
| ... | ... | @@ -186,28 +185,28 @@ public: |
| 186 | 185 | DALI_LOG_RELEASE_INFO("Resize finish %d x heigt %d\n", size.GetWidth(), size.GetHeight()); |
| 187 | 186 | if(bChangedOrientation) |
| 188 | 187 | { |
| 189 | - if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::PORTRAIT) | |
| 188 | + if(DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::PORTRAIT) | |
| 190 | 189 | { |
| 191 | 190 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::PORTRAIT\n"); |
| 192 | 191 | PositionSize newWindowPosition(0, 0, 400, 300); |
| 193 | 192 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(720 * 1280)\n"); |
| 194 | 193 | DevelWindow::SetPositionSize(winHandle, newWindowPosition); |
| 195 | 194 | } |
| 196 | - else if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::LANDSCAPE) | |
| 195 | + else if(DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::LANDSCAPE) | |
| 197 | 196 | { |
| 198 | 197 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::LANDSCAPE\n"); |
| 199 | 198 | PositionSize newWindowPosition(0, 0, 1280, 720); |
| 200 | 199 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(1280 * 720)\n"); |
| 201 | 200 | DevelWindow::SetPositionSize(winHandle, newWindowPosition); |
| 202 | 201 | } |
| 203 | - else if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::PORTRAIT_INVERSE) | |
| 202 | + else if(DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::PORTRAIT_INVERSE) | |
| 204 | 203 | { |
| 205 | 204 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::PORTRAIT_INVERSE\n"); |
| 206 | 205 | PositionSize newWindowPosition(100, 100, 720, 1280); |
| 207 | 206 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, SetPositionSize(100, 100, 720 * 1280)\n"); |
| 208 | 207 | DevelWindow::SetPositionSize(winHandle, newWindowPosition); |
| 209 | 208 | } |
| 210 | - else if( DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::LANDSCAPE_INVERSE) | |
| 209 | + else if(DevelWindow::GetCurrentOrientation(winHandle) == Dali::WindowOrientation::LANDSCAPE_INVERSE) | |
| 211 | 210 | { |
| 212 | 211 | DALI_LOG_RELEASE_INFO("DevelWindow::OnWindowResized, current orientation is Dali::WindowOrientation::LANDSCAPE_INVERSE\n"); |
| 213 | 212 | PositionSize newWindowPosition(100, 100, 1280, 720); |
| ... | ... | @@ -217,55 +216,55 @@ public: |
| 217 | 216 | } |
| 218 | 217 | } |
| 219 | 218 | |
| 220 | - bool OnTouch(Actor actor, const TouchEvent &touch) | |
| 219 | + bool OnTouch(Actor actor, const TouchEvent& touch) | |
| 221 | 220 | { |
| 222 | - if (touch.GetState(0) == PointState::DOWN) | |
| 221 | + if(touch.GetState(0) == PointState::DOWN) | |
| 223 | 222 | { |
| 224 | - const int local_x = static_cast<int>(touch.GetLocalPosition(0).x); | |
| 225 | - const int local_y = static_cast<int>(touch.GetLocalPosition(0).y); | |
| 223 | + const int local_x = static_cast<int>(touch.GetLocalPosition(0).x); | |
| 224 | + const int local_y = static_cast<int>(touch.GetLocalPosition(0).y); | |
| 226 | 225 | const int global_x = static_cast<int>(touch.GetScreenPosition(0).x); |
| 227 | 226 | const int global_y = static_cast<int>(touch.GetScreenPosition(0).y); |
| 228 | 227 | |
| 229 | 228 | DALI_LOG_RELEASE_INFO("Main Window Touch Event : x:%d, y:%d\n", local_x, local_y); |
| 230 | 229 | DALI_LOG_RELEASE_INFO("global position: x:%d, y:%d\n", global_x, global_y); |
| 231 | 230 | |
| 232 | - Dali::Window window = mApplication.GetWindow(); | |
| 231 | + Dali::Window window = mApplication.GetWindow(); | |
| 233 | 232 | Window::WindowSize windowSize = window.GetSize(); |
| 234 | 233 | |
| 235 | 234 | DALI_LOG_RELEASE_INFO("window size: w:%d, h:%d\n", windowSize.GetWidth(), windowSize.GetHeight()); |
| 236 | 235 | DevelWindow::EnableFloatingMode(window, true); |
| 237 | 236 | |
| 238 | - if ((local_x < MARGIN) && (local_y < MARGIN)) // left top corner | |
| 237 | + if((local_x < MARGIN) && (local_y < MARGIN)) // left top corner | |
| 239 | 238 | { |
| 240 | 239 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_LEFT\n", local_x, local_y); |
| 241 | 240 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_LEFT); |
| 242 | 241 | } |
| 243 | - else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) // rigth top corner | |
| 242 | + else if((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) // rigth top corner | |
| 244 | 243 | { |
| 245 | 244 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_RIGHT\n", local_x, local_y); |
| 246 | 245 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_RIGHT); |
| 247 | 246 | } |
| 248 | - else if ((local_x > MARGIN) && (local_x < (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) | |
| 247 | + else if((local_x > MARGIN) && (local_x < (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) | |
| 249 | 248 | { |
| 250 | 249 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y); |
| 251 | 250 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP); |
| 252 | 251 | } |
| 253 | - else if ((local_x < MARGIN) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 252 | + else if((local_x < MARGIN) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 254 | 253 | { |
| 255 | 254 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y); |
| 256 | 255 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::LEFT); |
| 257 | 256 | } |
| 258 | - else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 257 | + else if((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 259 | 258 | { |
| 260 | 259 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: LEFT\n", local_x, local_y); |
| 261 | 260 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::RIGHT); |
| 262 | 261 | } |
| 263 | - else if ((local_x < MARGIN) && (local_y > (windowSize.GetHeight() - MARGIN))) // left bottom corner | |
| 262 | + else if((local_x < MARGIN) && (local_y > (windowSize.GetHeight() - MARGIN))) // left bottom corner | |
| 264 | 263 | { |
| 265 | 264 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: RIGHT\n", local_x, local_y); |
| 266 | 265 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_LEFT); |
| 267 | 266 | } |
| 268 | - else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y > (windowSize.GetHeight() - MARGIN))) // right bottom corner | |
| 267 | + else if((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y > (windowSize.GetHeight() - MARGIN))) // right bottom corner | |
| 269 | 268 | { |
| 270 | 269 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: BOTTOM_RIGHT\n", local_x, local_y); |
| 271 | 270 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_RIGHT); |
| ... | ... | @@ -284,33 +283,33 @@ public: |
| 284 | 283 | |
| 285 | 284 | void CreateSubWindow() |
| 286 | 285 | { |
| 287 | - mSecondWindow = Window::New(PositionSize(0, 0, 600, 400), "", false); | |
| 288 | - mSecondWindow.SetTransparency(true); | |
| 289 | - mSecondWindow.SetBackgroundColor(Vector4(1.0, 0.3, 0.3, 0.5)); | |
| 290 | - | |
| 291 | - mTextLabel2 = TextLabel::New( "Second window" ); | |
| 292 | - mTextLabel2.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); | |
| 293 | - mTextLabel2.SetProperty( Actor::Property::NAME, "Second Window"); | |
| 294 | - mSecondWindow.Add( mTextLabel2 ); | |
| 295 | - | |
| 296 | - mSecondWindow.GetRootLayer().TouchedSignal().Connect(this, &WindowExampleController::OnSubWindowTouch); | |
| 297 | - mSecondWindow.ResizeSignal().Connect(this, &WindowExampleController::OnSubWindowResized); | |
| 298 | - DevelWindow::MovedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowMoved); | |
| 299 | - DevelWindow::MoveCompletedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowMovedByServer); | |
| 300 | - DevelWindow::ResizeCompletedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowResizedByServer); | |
| 301 | - | |
| 302 | - mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::PORTRAIT ); | |
| 303 | - mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::LANDSCAPE ); | |
| 304 | - mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::PORTRAIT_INVERSE ); | |
| 305 | - mSecondWindow.AddAvailableOrientation( Dali::WindowOrientation::LANDSCAPE_INVERSE ); | |
| 306 | - mSecondWindow.Show(); | |
| 307 | - | |
| 308 | - Rect<int> setInputRegion(0, 0, 1920, 1080); | |
| 309 | - //mSecondWindow.SetInputRegion(setInputRegion); | |
| 310 | - DevelWindow::ExcludeInputRegion(mSecondWindow, setInputRegion); | |
| 311 | - | |
| 312 | - Dali::Window window = mApplication.GetWindow(); | |
| 313 | - DevelWindow::SetParent(mSecondWindow, window); | |
| 286 | + mSecondWindow = Window::New(PositionSize(0, 0, 600, 400), "", false); | |
| 287 | + mSecondWindow.SetTransparency(true); | |
| 288 | + mSecondWindow.SetBackgroundColor(Vector4(1.0, 0.3, 0.3, 0.5)); | |
| 289 | + | |
| 290 | + mTextLabel2 = TextLabel::New("Second window"); | |
| 291 | + mTextLabel2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); | |
| 292 | + mTextLabel2.SetProperty(Actor::Property::NAME, "Second Window"); | |
| 293 | + mSecondWindow.Add(mTextLabel2); | |
| 294 | + | |
| 295 | + mSecondWindow.GetRootLayer().TouchedSignal().Connect(this, &WindowExampleController::OnSubWindowTouch); | |
| 296 | + mSecondWindow.ResizeSignal().Connect(this, &WindowExampleController::OnSubWindowResized); | |
| 297 | + DevelWindow::MovedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowMoved); | |
| 298 | + DevelWindow::MoveCompletedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowMovedByServer); | |
| 299 | + DevelWindow::ResizeCompletedSignal(mSecondWindow).Connect(this, &WindowExampleController::OnSubWindowResizedByServer); | |
| 300 | + | |
| 301 | + mSecondWindow.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT); | |
| 302 | + mSecondWindow.AddAvailableOrientation(Dali::WindowOrientation::LANDSCAPE); | |
| 303 | + mSecondWindow.AddAvailableOrientation(Dali::WindowOrientation::PORTRAIT_INVERSE); | |
| 304 | + mSecondWindow.AddAvailableOrientation(Dali::WindowOrientation::LANDSCAPE_INVERSE); | |
| 305 | + mSecondWindow.Show(); | |
| 306 | + | |
| 307 | + Rect<int> setInputRegion(0, 0, 1920, 1080); | |
| 308 | + //mSecondWindow.SetInputRegion(setInputRegion); | |
| 309 | + DevelWindow::ExcludeInputRegion(mSecondWindow, setInputRegion); | |
| 310 | + | |
| 311 | + Dali::Window window = mApplication.GetWindow(); | |
| 312 | + DevelWindow::SetParent(mSecondWindow, window); | |
| 314 | 313 | } |
| 315 | 314 | |
| 316 | 315 | void OnSubWindowMoved(Dali::Window winHandle, Dali::Window::WindowPosition position) |
| ... | ... | @@ -333,55 +332,55 @@ public: |
| 333 | 332 | DALI_LOG_RELEASE_INFO("OnWindowResizedByServer, x:%d, y:%d, width:%d\n", size.GetWidth(), size.GetHeight()); |
| 334 | 333 | } |
| 335 | 334 | |
| 336 | - bool OnSubWindowTouch(Actor actor, const TouchEvent &touch) | |
| 335 | + bool OnSubWindowTouch(Actor actor, const TouchEvent& touch) | |
| 337 | 336 | { |
| 338 | - if (touch.GetState(0) == PointState::DOWN) | |
| 337 | + if(touch.GetState(0) == PointState::DOWN) | |
| 339 | 338 | { |
| 340 | - const int local_x = static_cast<int>(touch.GetLocalPosition(0).x); | |
| 341 | - const int local_y = static_cast<int>(touch.GetLocalPosition(0).y); | |
| 339 | + const int local_x = static_cast<int>(touch.GetLocalPosition(0).x); | |
| 340 | + const int local_y = static_cast<int>(touch.GetLocalPosition(0).y); | |
| 342 | 341 | const int global_x = static_cast<int>(touch.GetScreenPosition(0).x); |
| 343 | 342 | const int global_y = static_cast<int>(touch.GetScreenPosition(0).y); |
| 344 | 343 | |
| 345 | 344 | DALI_LOG_RELEASE_INFO("SubWindow Touch Event : x:%d, y:%d\n", local_x, local_y); |
| 346 | 345 | DALI_LOG_RELEASE_INFO("global position: x:%d, y:%d\n", global_x, global_y); |
| 347 | 346 | |
| 348 | - Dali::Window window = mSecondWindow; | |
| 347 | + Dali::Window window = mSecondWindow; | |
| 349 | 348 | Window::WindowSize windowSize = window.GetSize(); |
| 350 | 349 | |
| 351 | 350 | DALI_LOG_RELEASE_INFO("window size: w:%d, h:%d\n", windowSize.GetWidth(), windowSize.GetHeight()); |
| 352 | 351 | DevelWindow::EnableFloatingMode(window, true); |
| 353 | 352 | |
| 354 | - if ((local_x < MARGIN) && (local_y < MARGIN)) // left top corner | |
| 353 | + if((local_x < MARGIN) && (local_y < MARGIN)) // left top corner | |
| 355 | 354 | { |
| 356 | 355 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_LEFT\n", local_x, local_y); |
| 357 | 356 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_LEFT); |
| 358 | 357 | } |
| 359 | - else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) // rigth top corner | |
| 358 | + else if((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) // rigth top corner | |
| 360 | 359 | { |
| 361 | 360 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP_RIGHT\n", local_x, local_y); |
| 362 | 361 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP_RIGHT); |
| 363 | 362 | } |
| 364 | - else if ((local_x > MARGIN) && (local_x < (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) | |
| 363 | + else if((local_x > MARGIN) && (local_x < (windowSize.GetWidth() - MARGIN)) && (local_y < MARGIN)) | |
| 365 | 364 | { |
| 366 | 365 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y); |
| 367 | 366 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::TOP); |
| 368 | 367 | } |
| 369 | - else if ((local_x < MARGIN) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 368 | + else if((local_x < MARGIN) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 370 | 369 | { |
| 371 | 370 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: TOP\n", local_x, local_y); |
| 372 | 371 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::LEFT); |
| 373 | 372 | } |
| 374 | - else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 373 | + else if((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y < (windowSize.GetHeight() - MARGIN)) && (local_y > MARGIN)) | |
| 375 | 374 | { |
| 376 | 375 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: LEFT\n", local_x, local_y); |
| 377 | 376 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::RIGHT); |
| 378 | 377 | } |
| 379 | - else if ((local_x < MARGIN) && (local_y > (windowSize.GetHeight() - MARGIN))) // left bottom corner | |
| 378 | + else if((local_x < MARGIN) && (local_y > (windowSize.GetHeight() - MARGIN))) // left bottom corner | |
| 380 | 379 | { |
| 381 | 380 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: RIGHT\n", local_x, local_y); |
| 382 | 381 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_LEFT); |
| 383 | 382 | } |
| 384 | - else if ((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y > (windowSize.GetHeight() - MARGIN))) // right bottom corner | |
| 383 | + else if((local_x > (windowSize.GetWidth() - MARGIN)) && (local_y > (windowSize.GetHeight() - MARGIN))) // right bottom corner | |
| 385 | 384 | { |
| 386 | 385 | DALI_LOG_RELEASE_INFO("RequestResizeToServer: BOTTOM_RIGHT\n", local_x, local_y); |
| 387 | 386 | DevelWindow::RequestResizeToServer(window, WindowResizeDirection::BOTTOM_RIGHT); |
| ... | ... | @@ -395,40 +394,39 @@ public: |
| 395 | 394 | return true; |
| 396 | 395 | } |
| 397 | 396 | |
| 398 | - void OnKeyEvent(const KeyEvent &event) | |
| 397 | + void OnKeyEvent(const KeyEvent& event) | |
| 399 | 398 | { |
| 400 | 399 | Dali::Window window = mApplication.GetWindow(); |
| 401 | - if (event.GetState() == KeyEvent::DOWN) | |
| 400 | + if(event.GetState() == KeyEvent::DOWN) | |
| 402 | 401 | { |
| 403 | - if (IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK)) | |
| 402 | + if(IsKey(event, Dali::DALI_KEY_ESCAPE) || IsKey(event, Dali::DALI_KEY_BACK)) | |
| 404 | 403 | { |
| 405 | 404 | mApplication.Quit(); |
| 406 | 405 | } |
| 407 | - else if (event.GetKeyName() == "1") | |
| 406 | + else if(event.GetKeyName() == "1") | |
| 408 | 407 | { |
| 409 | 408 | DALI_LOG_RELEASE_INFO("Move/Resize Test ::: window move and resize (10, 10) (600 x 400)\n"); |
| 410 | 409 | PositionSize windowPosition(10, 10, 600, 400); |
| 411 | 410 | DevelWindow::SetPositionSize(window, windowPosition); |
| 412 | 411 | } |
| 413 | - else if (event.GetKeyName() == "2") | |
| 412 | + else if(event.GetKeyName() == "2") | |
| 414 | 413 | { |
| 415 | 414 | DALI_LOG_RELEASE_INFO("Present Callback Test\n"); |
| 416 | 415 | |
| 417 | - Dali::Window window = mApplication.GetWindow(); | |
| 418 | 416 | if(bColor == 0) |
| 419 | 417 | { |
| 420 | - window.SetBackgroundColor(Color::WHITE); | |
| 421 | - bColor = 1; | |
| 418 | + window.SetBackgroundColor(Color::WHITE); | |
| 419 | + bColor = 1; | |
| 422 | 420 | } |
| 423 | 421 | else |
| 424 | 422 | { |
| 425 | - window.SetBackgroundColor(Color::BLACK); | |
| 426 | - bColor = 0; | |
| 423 | + window.SetBackgroundColor(Color::BLACK); | |
| 424 | + bColor = 0; | |
| 427 | 425 | } |
| 428 | 426 | |
| 429 | 427 | DevelWindow::AddFramePresentedCallback(window, std::unique_ptr<Dali::CallbackBase>(MakeCallback(this, &WindowExampleController::PresentedCallback)), count); |
| 430 | 428 | } |
| 431 | - else if (event.GetKeyName() == "3") | |
| 429 | + else if(event.GetKeyName() == "3") | |
| 432 | 430 | { |
| 433 | 431 | DALI_LOG_RELEASE_INFO("Send AckWindowRotation test\n"); |
| 434 | 432 | if(manual_rotation_flag == true) |
| ... | ... | @@ -438,14 +436,14 @@ public: |
| 438 | 436 | DALI_LOG_RELEASE_INFO("Send AckWindowRotation in Key Event Callback\n"); |
| 439 | 437 | DevelWindow::SendRotationCompletedAcknowledgement(window); |
| 440 | 438 | manual_rotation_flag = false; |
| 441 | - isRotating = false; | |
| 439 | + isRotating = false; | |
| 442 | 440 | } |
| 443 | 441 | else |
| 444 | 442 | { |
| 445 | 443 | DALI_LOG_RELEASE_INFO("is not Rotating\n"); |
| 446 | 444 | } |
| 447 | 445 | } |
| 448 | - else if (event.GetKeyName() == "4") | |
| 446 | + else if(event.GetKeyName() == "4") | |
| 449 | 447 | { |
| 450 | 448 | DALI_LOG_RELEASE_INFO("Set Manual Window Rotation Test\n"); |
| 451 | 449 | if(manual_rotation_flag) |
| ... | ... | @@ -465,7 +463,7 @@ public: |
| 465 | 463 | manual_rotation_flag = true; |
| 466 | 464 | } |
| 467 | 465 | } |
| 468 | - else if (event.GetKeyName() == "5") | |
| 466 | + else if(event.GetKeyName() == "5") | |
| 469 | 467 | { |
| 470 | 468 | DALI_LOG_RELEASE_INFO("Window Rotation and Resize test together\n"); |
| 471 | 469 | if(!bChangedOrientation) |
| ... | ... | @@ -479,7 +477,7 @@ public: |
| 479 | 477 | bChangedOrientation = false; |
| 480 | 478 | } |
| 481 | 479 | } |
| 482 | - else if (event.GetKeyName() == "6") | |
| 480 | + else if(event.GetKeyName() == "6") | |
| 483 | 481 | { |
| 484 | 482 | DALI_LOG_RELEASE_INFO("Maximize Test\n"); |
| 485 | 483 | if(DevelWindow::IsMaximized(window)) |
| ... | ... | @@ -491,7 +489,7 @@ public: |
| 491 | 489 | DevelWindow::Maximize(window, true); |
| 492 | 490 | } |
| 493 | 491 | } |
| 494 | - else if (event.GetKeyName() == "7") | |
| 492 | + else if(event.GetKeyName() == "7") | |
| 495 | 493 | { |
| 496 | 494 | DALI_LOG_RELEASE_INFO("Minimize Test\n"); |
| 497 | 495 | if(DevelWindow::IsMinimized(window)) |
| ... | ... | @@ -504,7 +502,7 @@ public: |
| 504 | 502 | } |
| 505 | 503 | } |
| 506 | 504 | |
| 507 | - else if (event.GetKeyName() == "8") | |
| 505 | + else if(event.GetKeyName() == "8") | |
| 508 | 506 | { |
| 509 | 507 | DALI_LOG_RELEASE_INFO("Set/Get Full Screen window Test\n"); |
| 510 | 508 | if(DevelWindow::GetFullScreen(window)) |
| ... | ... | @@ -515,9 +513,8 @@ public: |
| 515 | 513 | { |
| 516 | 514 | DevelWindow::SetFullScreen(window, true); |
| 517 | 515 | } |
| 518 | - | |
| 519 | 516 | } |
| 520 | - else if (event.GetKeyName() == "9") | |
| 517 | + else if(event.GetKeyName() == "9") | |
| 521 | 518 | { |
| 522 | 519 | DALI_LOG_RELEASE_INFO("Sub window Test\n"); |
| 523 | 520 | CreateSubWindow(); |
| ... | ... | @@ -528,28 +525,27 @@ public: |
| 528 | 525 | // Toggle the clipping mode on mClippingControl if any other actor by pressing any key |
| 529 | 526 | DALI_LOG_RELEASE_INFO("Scissor Test\n"); |
| 530 | 527 | ClippingMode::Type currentMode; |
| 531 | - mClipControl.GetProperty( Actor::Property::CLIPPING_MODE ).Get( currentMode ); | |
| 532 | - mClipControl.SetProperty( Actor::Property::CLIPPING_MODE, | |
| 533 | - ( ( currentMode == ClippingMode::DISABLED ) ? ClippingMode::CLIP_TO_BOUNDING_BOX : ClippingMode::DISABLED ) ); | |
| 528 | + mClipControl.GetProperty(Actor::Property::CLIPPING_MODE).Get(currentMode); | |
| 529 | + mClipControl.SetProperty(Actor::Property::CLIPPING_MODE, | |
| 530 | + ((currentMode == ClippingMode::DISABLED) ? ClippingMode::CLIP_TO_BOUNDING_BOX : ClippingMode::DISABLED)); | |
| 534 | 531 | } |
| 535 | - | |
| 536 | 532 | } |
| 537 | 533 | } |
| 538 | 534 | |
| 539 | - void OnAuxMessageEvent(const std::string &key, const std::string &value, const Property::Array &options) | |
| 535 | + void OnAuxMessageEvent(const std::string& key, const std::string& value, const Property::Array& options) | |
| 540 | 536 | { |
| 541 | - if (!key.empty()) | |
| 537 | + if(!key.empty()) | |
| 542 | 538 | { |
| 543 | 539 | std::cout << "Key: " << key << std::endl; |
| 544 | - if (!value.empty()) | |
| 540 | + if(!value.empty()) | |
| 545 | 541 | { |
| 546 | 542 | std::cout << "Value : " << value << std::endl; |
| 547 | 543 | } |
| 548 | 544 | |
| 549 | - if (!options.Empty()) | |
| 545 | + if(!options.Empty()) | |
| 550 | 546 | { |
| 551 | 547 | uint32_t options_count = static_cast<uint32_t>(options.Count()); |
| 552 | - for (uint32_t i(0); i != options_count; ++i) | |
| 548 | + for(uint32_t i(0); i != options_count; ++i) | |
| 553 | 549 | { |
| 554 | 550 | std::cout << "Option : " << options.GetElementAt(i) << std::endl; |
| 555 | 551 | } |
| ... | ... | @@ -558,27 +554,27 @@ public: |
| 558 | 554 | } |
| 559 | 555 | |
| 560 | 556 | private: |
| 561 | - Application &mApplication; | |
| 562 | - Control mClipControl; | |
| 563 | - bool manual_rotation_flag; | |
| 564 | - int rotation_count; | |
| 565 | - int rot; | |
| 566 | - Timer mTimer; | |
| 567 | - TextLabel mTextLabel2; | |
| 568 | - bool enableTimer; | |
| 569 | - bool bChangedOrientation; | |
| 570 | - bool isRotating; | |
| 571 | - bool bColor; | |
| 572 | - | |
| 573 | - Dali::Window mSecondWindow; | |
| 557 | + Application& mApplication; | |
| 558 | + Control mClipControl; | |
| 559 | + bool manual_rotation_flag; | |
| 560 | + int rotation_count; | |
| 561 | + int rot; | |
| 562 | + Timer mTimer; | |
| 563 | + TextLabel mTextLabel2; | |
| 564 | + bool enableTimer; | |
| 565 | + bool bChangedOrientation; | |
| 566 | + bool isRotating; | |
| 567 | + bool bColor; | |
| 568 | + | |
| 569 | + Dali::Window mSecondWindow; | |
| 574 | 570 | Dali::WindowOrientation currentOrientation; |
| 575 | 571 | |
| 576 | 572 | CallbackBase* mPresentCallback{}; |
| 577 | 573 | }; |
| 578 | 574 | |
| 579 | -int DALI_EXPORT_API main(int argc, char **argv) | |
| 575 | +int DALI_EXPORT_API main(int argc, char** argv) | |
| 580 | 576 | { |
| 581 | - Application application = Application::New(&argc, &argv); | |
| 577 | + Application application = Application::New(&argc, &argv); | |
| 582 | 578 | WindowExampleController test(application); |
| 583 | 579 | application.MainLoop(); |
| 584 | 580 | return 0; | ... | ... |