| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/window/dialog_client_view.h" | 5 #include "views/window/dialog_client_view.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
| 10 #include <vsstyle.h> | 10 #include <vsstyle.h> |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 int buttons = dd->GetDialogButtons(); | 251 int buttons = dd->GetDialogButtons(); |
| 252 if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL) | 252 if (buttons & MessageBoxFlags::DIALOGBUTTON_CANCEL) |
| 253 return dd->Cancel(); | 253 return dd->Cancel(); |
| 254 if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) | 254 if (buttons & MessageBoxFlags::DIALOGBUTTON_OK) |
| 255 return dd->Accept(true); | 255 return dd->Accept(true); |
| 256 } | 256 } |
| 257 return true; | 257 return true; |
| 258 } | 258 } |
| 259 | 259 |
| 260 void DialogClientView::WindowClosing() { | 260 void DialogClientView::WindowClosing() { |
| 261 #if !defined(TOOLKIT_VIEWS) |
| 261 FocusManager* focus_manager = GetFocusManager(); | 262 FocusManager* focus_manager = GetFocusManager(); |
| 262 DCHECK(focus_manager); | 263 DCHECK(focus_manager); |
| 263 if (focus_manager) | 264 if (focus_manager) |
| 264 focus_manager->RemoveFocusChangeListener(this); | 265 focus_manager->RemoveFocusChangeListener(this); |
| 266 #else |
| 267 NOTIMPLEMENTED(); |
| 268 #endif |
| 265 ClientView::WindowClosing(); | 269 ClientView::WindowClosing(); |
| 266 } | 270 } |
| 267 | 271 |
| 268 int DialogClientView::NonClientHitTest(const gfx::Point& point) { | 272 int DialogClientView::NonClientHitTest(const gfx::Point& point) { |
| 269 if (size_box_bounds_.Contains(point.x() - x(), point.y() - y())) | 273 if (size_box_bounds_.Contains(point.x() - x(), point.y() - y())) |
| 270 return HTBOTTOMRIGHT; | 274 return HTBOTTOMRIGHT; |
| 271 return ClientView::NonClientHitTest(point); | 275 return ClientView::NonClientHitTest(point); |
| 272 } | 276 } |
| 273 | 277 |
| 274 //////////////////////////////////////////////////////////////////////////////// | 278 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 22 matching lines...) Expand all Loading... |
| 297 | 301 |
| 298 void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent, | 302 void DialogClientView::ViewHierarchyChanged(bool is_add, View* parent, |
| 299 View* child) { | 303 View* child) { |
| 300 if (is_add && child == this) { | 304 if (is_add && child == this) { |
| 301 // Can only add and update the dialog buttons _after_ they are added to the | 305 // Can only add and update the dialog buttons _after_ they are added to the |
| 302 // view hierarchy since they are native controls and require the | 306 // view hierarchy since they are native controls and require the |
| 303 // Container's HWND. | 307 // Container's HWND. |
| 304 ShowDialogButtons(); | 308 ShowDialogButtons(); |
| 305 ClientView::ViewHierarchyChanged(is_add, parent, child); | 309 ClientView::ViewHierarchyChanged(is_add, parent, child); |
| 306 | 310 |
| 311 #if !defined(TOOLKIT_VIEWS) |
| 307 FocusManager* focus_manager = GetFocusManager(); | 312 FocusManager* focus_manager = GetFocusManager(); |
| 308 // Listen for focus change events so we can update the default button. | 313 // Listen for focus change events so we can update the default button. |
| 309 DCHECK(focus_manager); // bug #1291225: crash reports seem to indicate it | 314 DCHECK(focus_manager); // bug #1291225: crash reports seem to indicate it |
| 310 // can be NULL. | 315 // can be NULL. |
| 311 if (focus_manager) | 316 if (focus_manager) |
| 312 focus_manager->AddFocusChangeListener(this); | 317 focus_manager->AddFocusChangeListener(this); |
| 318 #else |
| 319 NOTIMPLEMENTED(); |
| 320 #endif |
| 313 | 321 |
| 314 // The "extra view" must be created and installed after the contents view | 322 // The "extra view" must be created and installed after the contents view |
| 315 // has been inserted into the view hierarchy. | 323 // has been inserted into the view hierarchy. |
| 316 CreateExtraView(); | 324 CreateExtraView(); |
| 317 UpdateDialogButtons(); | 325 UpdateDialogButtons(); |
| 318 Layout(); | 326 Layout(); |
| 319 } | 327 } |
| 320 } | 328 } |
| 321 | 329 |
| 322 gfx::Size DialogClientView::GetPreferredSize() { | 330 gfx::Size DialogClientView::GetPreferredSize() { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 initialized = true; | 510 initialized = true; |
| 503 } | 511 } |
| 504 } | 512 } |
| 505 | 513 |
| 506 void DialogClientView::Close() { | 514 void DialogClientView::Close() { |
| 507 window()->Close(); | 515 window()->Close(); |
| 508 GetDialogDelegate()->OnClose(); | 516 GetDialogDelegate()->OnClose(); |
| 509 } | 517 } |
| 510 | 518 |
| 511 } // namespace views | 519 } // namespace views |
| OLD | NEW |