| 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_VIEW_H_ | 5 #ifndef VIEWS_VIEW_H_ |
| 6 #define VIEWS_VIEW_H_ | 6 #define VIEWS_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/i18n/rtl.h" | 16 #include "base/i18n/rtl.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "ui/base/dragdrop/os_exchange_data.h" | 20 #include "ui/base/dragdrop/os_exchange_data.h" |
| 21 #include "ui/base/models/accelerator.h" |
| 21 #include "ui/gfx/compositor/layer_delegate.h" | 22 #include "ui/gfx/compositor/layer_delegate.h" |
| 22 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 23 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 24 #include "views/accelerator.h" | |
| 25 #include "views/background.h" | 25 #include "views/background.h" |
| 26 #include "views/border.h" | 26 #include "views/border.h" |
| 27 #include "views/events/event.h" |
| 27 | 28 |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 #include "base/win/scoped_comptr.h" | 30 #include "base/win/scoped_comptr.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 using ui::OSExchangeData; | 33 using ui::OSExchangeData; |
| 33 | 34 |
| 34 namespace gfx { | 35 namespace gfx { |
| 35 class Canvas; | 36 class Canvas; |
| 36 class Insets; | 37 class Insets; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // LayoutManager interface can be used to lay out children if required. | 92 // LayoutManager interface can be used to lay out children if required. |
| 92 // | 93 // |
| 93 // It is up to the subclass to implement Painting and storage of subclass - | 94 // It is up to the subclass to implement Painting and storage of subclass - |
| 94 // specific properties and functionality. | 95 // specific properties and functionality. |
| 95 // | 96 // |
| 96 // Unless otherwise documented, views is not thread safe and should only be | 97 // Unless otherwise documented, views is not thread safe and should only be |
| 97 // accessed from the main thread. | 98 // accessed from the main thread. |
| 98 // | 99 // |
| 99 ///////////////////////////////////////////////////////////////////////////// | 100 ///////////////////////////////////////////////////////////////////////////// |
| 100 class VIEWS_EXPORT View : public ui::LayerDelegate, | 101 class VIEWS_EXPORT View : public ui::LayerDelegate, |
| 101 public AcceleratorTarget { | 102 public ui::AcceleratorTarget { |
| 102 public: | 103 public: |
| 103 typedef std::vector<View*> Views; | 104 typedef std::vector<View*> Views; |
| 104 | 105 |
| 105 // TO BE MOVED --------------------------------------------------------------- | 106 // TO BE MOVED --------------------------------------------------------------- |
| 106 // TODO(beng): These methods are to be moved to other files/classes. | 107 // TODO(beng): These methods are to be moved to other files/classes. |
| 107 | 108 |
| 108 // TODO(beng): delete | 109 // TODO(beng): delete |
| 109 // Set whether this view is hottracked. A disabled view cannot be hottracked. | 110 // Set whether this view is hottracked. A disabled view cannot be hottracked. |
| 110 // If flag differs from the current value, SchedulePaint is invoked. | 111 // If flag differs from the current value, SchedulePaint is invoked. |
| 111 virtual void SetHotTracked(bool flag); | 112 virtual void SetHotTracked(bool flag); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Widget that contains this view. Returns NULL if this view is not part of a | 630 // Widget that contains this view. Returns NULL if this view is not part of a |
| 630 // view hierarchy with a Widget. | 631 // view hierarchy with a Widget. |
| 631 virtual InputMethod* GetInputMethod(); | 632 virtual InputMethod* GetInputMethod(); |
| 632 | 633 |
| 633 // Accelerators -------------------------------------------------------------- | 634 // Accelerators -------------------------------------------------------------- |
| 634 | 635 |
| 635 // Sets a keyboard accelerator for that view. When the user presses the | 636 // Sets a keyboard accelerator for that view. When the user presses the |
| 636 // accelerator key combination, the AcceleratorPressed method is invoked. | 637 // accelerator key combination, the AcceleratorPressed method is invoked. |
| 637 // Note that you can set multiple accelerators for a view by invoking this | 638 // Note that you can set multiple accelerators for a view by invoking this |
| 638 // method several times. | 639 // method several times. |
| 639 virtual void AddAccelerator(const Accelerator& accelerator); | 640 virtual void AddAccelerator(const ui::Accelerator& accelerator); |
| 640 | 641 |
| 641 // Removes the specified accelerator for this view. | 642 // Removes the specified accelerator for this view. |
| 642 virtual void RemoveAccelerator(const Accelerator& accelerator); | 643 virtual void RemoveAccelerator(const ui::Accelerator& accelerator); |
| 643 | 644 |
| 644 // Removes all the keyboard accelerators for this view. | 645 // Removes all the keyboard accelerators for this view. |
| 645 virtual void ResetAccelerators(); | 646 virtual void ResetAccelerators(); |
| 646 | 647 |
| 647 // Overridden from AcceleratorTarget: | 648 // Overridden from AcceleratorTarget: |
| 648 virtual bool AcceleratorPressed(const Accelerator& accelerator) OVERRIDE; | 649 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 649 | 650 |
| 650 // Focus --------------------------------------------------------------------- | 651 // Focus --------------------------------------------------------------------- |
| 651 | 652 |
| 652 // Returns whether this view currently has the focus. | 653 // Returns whether this view currently has the focus. |
| 653 virtual bool HasFocus() const; | 654 virtual bool HasFocus() const; |
| 654 | 655 |
| 655 // Returns the view that should be selected next when pressing Tab. | 656 // Returns the view that should be selected next when pressing Tab. |
| 656 View* GetNextFocusableView(); | 657 View* GetNextFocusableView(); |
| 657 const View* GetNextFocusableView() const; | 658 const View* GetNextFocusableView() const; |
| 658 | 659 |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 // true if when we were added to hierarchy we were without focus manager | 1404 // true if when we were added to hierarchy we were without focus manager |
| 1404 // attempt addition when ancestor chain changed. | 1405 // attempt addition when ancestor chain changed. |
| 1405 bool accelerator_registration_delayed_; | 1406 bool accelerator_registration_delayed_; |
| 1406 | 1407 |
| 1407 // Focus manager accelerators registered on. | 1408 // Focus manager accelerators registered on. |
| 1408 FocusManager* accelerator_focus_manager_; | 1409 FocusManager* accelerator_focus_manager_; |
| 1409 | 1410 |
| 1410 // The list of accelerators. List elements in the range | 1411 // The list of accelerators. List elements in the range |
| 1411 // [0, registered_accelerator_count_) are already registered to FocusManager, | 1412 // [0, registered_accelerator_count_) are already registered to FocusManager, |
| 1412 // and the rest are not yet. | 1413 // and the rest are not yet. |
| 1413 scoped_ptr<std::vector<Accelerator> > accelerators_; | 1414 scoped_ptr<std::vector<ui::Accelerator> > accelerators_; |
| 1414 size_t registered_accelerator_count_; | 1415 size_t registered_accelerator_count_; |
| 1415 | 1416 |
| 1416 // Focus --------------------------------------------------------------------- | 1417 // Focus --------------------------------------------------------------------- |
| 1417 | 1418 |
| 1418 // Next view to be focused when the Tab key is pressed. | 1419 // Next view to be focused when the Tab key is pressed. |
| 1419 View* next_focusable_view_; | 1420 View* next_focusable_view_; |
| 1420 | 1421 |
| 1421 // Next view to be focused when the Shift-Tab key combination is pressed. | 1422 // Next view to be focused when the Shift-Tab key combination is pressed. |
| 1422 View* previous_focusable_view_; | 1423 View* previous_focusable_view_; |
| 1423 | 1424 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1444 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1445 base::win::ScopedComPtr<NativeViewAccessibilityWin> |
| 1445 native_view_accessibility_win_; | 1446 native_view_accessibility_win_; |
| 1446 #endif | 1447 #endif |
| 1447 | 1448 |
| 1448 DISALLOW_COPY_AND_ASSIGN(View); | 1449 DISALLOW_COPY_AND_ASSIGN(View); |
| 1449 }; | 1450 }; |
| 1450 | 1451 |
| 1451 } // namespace views | 1452 } // namespace views |
| 1452 | 1453 |
| 1453 #endif // VIEWS_VIEW_H_ | 1454 #endif // VIEWS_VIEW_H_ |
| OLD | NEW |