OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef VIEWS_WIDGET_WIDGET_H_ | 5 #ifndef VIEWS_WIDGET_WIDGET_H_ |
6 #define VIEWS_WIDGET_WIDGET_H_ | 6 #define VIEWS_WIDGET_WIDGET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stack> | 9 #include <stack> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 namespace gfx { | 36 namespace gfx { |
37 class Canvas; | 37 class Canvas; |
38 class Path; | 38 class Path; |
39 class Point; | 39 class Point; |
40 class Rect; | 40 class Rect; |
41 } | 41 } |
42 | 42 |
43 namespace ui { | 43 namespace ui { |
44 class Accelerator; | 44 class Accelerator; |
45 class Compositor; | 45 class Compositor; |
| 46 class CompositorDelegate; |
46 class OSExchangeData; | 47 class OSExchangeData; |
47 class ThemeProvider; | 48 class ThemeProvider; |
48 enum TouchStatus; | 49 enum TouchStatus; |
49 } | 50 } |
50 using ui::ThemeProvider; | 51 using ui::ThemeProvider; |
51 | 52 |
52 namespace views { | 53 namespace views { |
53 | 54 |
54 class DefaultThemeProvider; | 55 class DefaultThemeProvider; |
55 class InputMethod; | 56 class InputMethod; |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 490 |
490 ClientView* client_view() { | 491 ClientView* client_view() { |
491 return const_cast<ClientView*>( | 492 return const_cast<ClientView*>( |
492 const_cast<const Widget*>(this)->client_view()); | 493 const_cast<const Widget*>(this)->client_view()); |
493 } | 494 } |
494 const ClientView* client_view() const { | 495 const ClientView* client_view() const { |
495 // non_client_view_ may be NULL, especially during creation. | 496 // non_client_view_ may be NULL, especially during creation. |
496 return non_client_view_ ? non_client_view_->client_view() : NULL; | 497 return non_client_view_ ? non_client_view_->client_view() : NULL; |
497 } | 498 } |
498 | 499 |
499 static void set_compositor_factory_for_testing(ui::Compositor*(*factory)()) { | 500 static void set_compositor_factory_for_testing( |
| 501 ui::Compositor*(*factory)(ui::CompositorDelegate* owner)) { |
500 compositor_factory_ = factory; | 502 compositor_factory_ = factory; |
501 } | 503 } |
502 static ui::Compositor* (*compositor_factory())() { | 504 static ui::Compositor* (*compositor_factory())( |
| 505 ui::CompositorDelegate* owner) { |
503 return compositor_factory_; | 506 return compositor_factory_; |
504 } | 507 } |
505 | 508 |
506 const ui::Compositor* GetCompositor() const; | 509 const ui::Compositor* GetCompositor() const; |
507 ui::Compositor* GetCompositor(); | 510 ui::Compositor* GetCompositor(); |
508 | 511 |
509 // Invokes method of same name on the NativeWidget. | 512 // Invokes method of same name on the NativeWidget. |
510 void CalculateOffsetToAncestorWithLayer(gfx::Point* offset, | 513 void CalculateOffsetToAncestorWithLayer(gfx::Point* offset, |
511 ui::Layer** layer_parent); | 514 ui::Layer** layer_parent); |
512 | 515 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 // when the widget is shown. Set this value to false to override | 719 // when the widget is shown. Set this value to false to override |
717 // initial focus for the widget. | 720 // initial focus for the widget. |
718 bool focus_on_creation_; | 721 bool focus_on_creation_; |
719 | 722 |
720 scoped_ptr<InputMethod> input_method_; | 723 scoped_ptr<InputMethod> input_method_; |
721 | 724 |
722 // See |is_top_level()| accessor. | 725 // See |is_top_level()| accessor. |
723 bool is_top_level_; | 726 bool is_top_level_; |
724 | 727 |
725 // Factory used to create Compositors. Settable by tests. | 728 // Factory used to create Compositors. Settable by tests. |
726 static ui::Compositor*(*compositor_factory_)(); | 729 // The delegate can be NULL if you don't wish to catch the ScheduleDraw() |
| 730 // calls to it. |
| 731 static ui::Compositor*(*compositor_factory_)( |
| 732 ui::CompositorDelegate* delegate); |
727 | 733 |
728 // Tracks whether native widget has been initialized. | 734 // Tracks whether native widget has been initialized. |
729 bool native_widget_initialized_; | 735 bool native_widget_initialized_; |
730 | 736 |
731 // TODO(beng): Remove NativeWidgetGtk's dependence on these: | 737 // TODO(beng): Remove NativeWidgetGtk's dependence on these: |
732 // If true, the mouse is currently down. | 738 // If true, the mouse is currently down. |
733 bool is_mouse_button_pressed_; | 739 bool is_mouse_button_pressed_; |
734 | 740 |
735 // TODO(beng): Remove NativeWidgetGtk's dependence on these: | 741 // TODO(beng): Remove NativeWidgetGtk's dependence on these: |
736 // The following are used to detect duplicate mouse move events and not | 742 // The following are used to detect duplicate mouse move events and not |
737 // deliver them. Displaying a window may result in the system generating | 743 // deliver them. Displaying a window may result in the system generating |
738 // duplicate move events even though the mouse hasn't moved. | 744 // duplicate move events even though the mouse hasn't moved. |
739 bool last_mouse_event_was_move_; | 745 bool last_mouse_event_was_move_; |
740 gfx::Point last_mouse_event_position_; | 746 gfx::Point last_mouse_event_position_; |
741 | 747 |
742 DISALLOW_COPY_AND_ASSIGN(Widget); | 748 DISALLOW_COPY_AND_ASSIGN(Widget); |
743 }; | 749 }; |
744 | 750 |
745 } // namespace views | 751 } // namespace views |
746 | 752 |
747 #endif // VIEWS_WIDGET_WIDGET_H_ | 753 #endif // VIEWS_WIDGET_WIDGET_H_ |
OLD | NEW |