| 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 #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_H_ | 5 #ifndef VIEWS_CONTROLS_NATIVE_CONTROL_H_ |
| 6 #define VIEWS_CONTROLS_NATIVE_CONTROL_H_ | 6 #define VIEWS_CONTROLS_NATIVE_CONTROL_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "views/view.h" | 10 #include "views/view.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void NativeControlDestroyed(); | 74 void NativeControlDestroyed(); |
| 75 | 75 |
| 76 // Overridden so that the control properly reflects parent's visibility. | 76 // Overridden so that the control properly reflects parent's visibility. |
| 77 virtual void VisibilityChanged(View* starting_from, bool is_visible); | 77 virtual void VisibilityChanged(View* starting_from, bool is_visible); |
| 78 | 78 |
| 79 // Controls that have fixed sizes should call these methods to specify the | 79 // Controls that have fixed sizes should call these methods to specify the |
| 80 // actual size and how they should be aligned within their parent. | 80 // actual size and how they should be aligned within their parent. |
| 81 void SetFixedWidth(int width, Alignment alignment); | 81 void SetFixedWidth(int width, Alignment alignment); |
| 82 void SetFixedHeight(int height, Alignment alignment); | 82 void SetFixedHeight(int height, Alignment alignment); |
| 83 | 83 |
| 84 // Derived classes interested in receiving key down notification should | 84 // Invoked when a key is pressed on the control. |
| 85 // override this method and return true. In which case OnKeyDown is called | 85 // Should return true if the key message was processed, false otherwise. |
| 86 // when a key down message is sent to the control. | |
| 87 // Note that this method is called at the time of the control creation: the | |
| 88 // behavior will not change if the returned value changes after the control | |
| 89 // has been created. | |
| 90 virtual bool NotifyOnKeyDown() const { return false; } | |
| 91 | |
| 92 // Invoked when a key is pressed on the control (if NotifyOnKeyDown returns | |
| 93 // true). Should return true if the key message was processed, false | |
| 94 // otherwise. | |
| 95 virtual bool OnKeyDown(int virtual_key_code) { return false; } | 86 virtual bool OnKeyDown(int virtual_key_code) { return false; } |
| 96 | 87 |
| 97 // Returns additional extended style flags. When subclasses call | 88 // Returns additional extended style flags. When subclasses call |
| 98 // CreateWindowEx in order to create the underlying control, they must OR the | 89 // CreateWindowEx in order to create the underlying control, they must OR the |
| 99 // ExStyle parameter with the value returned by this function. | 90 // ExStyle parameter with the value returned by this function. |
| 100 // | 91 // |
| 101 // We currently use this method in order to add flags such as WS_EX_LAYOUTRTL | 92 // We currently use this method in order to add flags such as WS_EX_LAYOUTRTL |
| 102 // to the HWND for views with right-to-left UI layout. | 93 // to the HWND for views with right-to-left UI layout. |
| 103 DWORD GetAdditionalExStyle() const; | 94 DWORD GetAdditionalExStyle() const; |
| 104 | 95 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 127 WPARAM w_param, LPARAM l_param); | 118 WPARAM w_param, LPARAM l_param); |
| 128 | 119 |
| 129 NativeControlContainer* container_; | 120 NativeControlContainer* container_; |
| 130 | 121 |
| 131 DISALLOW_COPY_AND_ASSIGN(NativeControl); | 122 DISALLOW_COPY_AND_ASSIGN(NativeControl); |
| 132 }; | 123 }; |
| 133 | 124 |
| 134 } // namespace views | 125 } // namespace views |
| 135 | 126 |
| 136 #endif // VIEWS_CONTROLS_NATIVE_CONTROL_H_ | 127 #endif // VIEWS_CONTROLS_NATIVE_CONTROL_H_ |
| OLD | NEW |