Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: views/view.h

Issue 6976048: views: Add OnEnabledChanged() method to View class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix DisableOnHover test? Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/textfield/textfield.cc ('k') | views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // GetPreferredSize. 298 // GetPreferredSize.
299 virtual gfx::Size GetMinimumSize(); 299 virtual gfx::Size GetMinimumSize();
300 300
301 // Return the height necessary to display this view with the provided width. 301 // Return the height necessary to display this view with the provided width.
302 // View's implementation returns the value from getPreferredSize.cy. 302 // View's implementation returns the value from getPreferredSize.cy.
303 // Override if your View's preferred height depends upon the width (such 303 // Override if your View's preferred height depends upon the width (such
304 // as with Labels). 304 // as with Labels).
305 virtual int GetHeightForWidth(int w); 305 virtual int GetHeightForWidth(int w);
306 306
307 // Set whether the receiving view is visible. Painting is scheduled as needed 307 // Set whether the receiving view is visible. Painting is scheduled as needed
308 virtual void SetVisible(bool flag); 308 virtual void SetVisible(bool visible);
309 309
310 // Return whether a view is visible 310 // Return whether a view is visible
311 virtual bool IsVisible() const; 311 virtual bool IsVisible() const;
312 312
313 // Return whether a view and its ancestors are visible. Returns true if the 313 // Return whether a view and its ancestors are visible. Returns true if the
314 // path from this view to the root view is visible. 314 // path from this view to the root view is visible.
315 virtual bool IsVisibleInRootView() const; 315 virtual bool IsVisibleInRootView() const;
316 316
317 // Set whether this view is enabled. A disabled view does not receive keyboard 317 // Set whether this view is enabled. A disabled view does not receive keyboard
318 // or mouse inputs. If flag differs from the current value, SchedulePaint is 318 // or mouse inputs. If flag differs from the current value, SchedulePaint is
319 // invoked. 319 // invoked.
320 virtual void SetEnabled(bool flag); 320 void SetEnabled(bool enabled);
321 321
322 // Returns whether the view is enabled. 322 // Returns whether the view is enabled.
323 virtual bool IsEnabled() const; 323 virtual bool IsEnabled() const;
324 324
325 // Transformations ----------------------------------------------------------- 325 // Transformations -----------------------------------------------------------
326 326
327 // Methods for setting transformations for a view (e.g. rotation, scaling). 327 // Methods for setting transformations for a view (e.g. rotation, scaling).
328 328
329 const ui::Transform& GetTransform() const; 329 const ui::Transform& GetTransform() const;
330 330
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 // Override returning true when the view needs to be notified when its visible 931 // Override returning true when the view needs to be notified when its visible
932 // bounds relative to the root view may have changed. Only used by 932 // bounds relative to the root view may have changed. Only used by
933 // NativeViewHost. 933 // NativeViewHost.
934 virtual bool NeedsNotificationWhenVisibleBoundsChange() const; 934 virtual bool NeedsNotificationWhenVisibleBoundsChange() const;
935 935
936 // Notification that this View's visible bounds relative to the root view may 936 // Notification that this View's visible bounds relative to the root view may
937 // have changed. The visible bounds are the region of the View not clipped by 937 // have changed. The visible bounds are the region of the View not clipped by
938 // its ancestors. This is used for clipping NativeViewHost. 938 // its ancestors. This is used for clipping NativeViewHost.
939 virtual void OnVisibleBoundsChanged(); 939 virtual void OnVisibleBoundsChanged();
940 940
941 // TODO(beng): eliminate in protected. 941 // Override to be notified when the enabled state of this View has
942 // Whether this view is enabled. 942 // changed. The default implementation calls SchedulePaint() on this View.
943 bool enabled_; 943 virtual void OnEnabledChanged();
944 944
945 // Tree operations ----------------------------------------------------------- 945 // Tree operations -----------------------------------------------------------
946 946
947 // This method is invoked when the tree changes. 947 // This method is invoked when the tree changes.
948 // 948 //
949 // When a view is removed, it is invoked for all children and grand 949 // When a view is removed, it is invoked for all children and grand
950 // children. For each of these views, a notification is sent to the 950 // children. For each of these views, a notification is sent to the
951 // view and all parents. 951 // view and all parents.
952 // 952 //
953 // When a view is added, a notification is sent to the view, all its 953 // When a view is added, a notification is sent to the view, all its
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1314
1315 // This view's children. 1315 // This view's children.
1316 typedef std::vector<View*> ViewVector; 1316 typedef std::vector<View*> ViewVector;
1317 ViewVector children_; 1317 ViewVector children_;
1318 1318
1319 // Size and disposition ------------------------------------------------------ 1319 // Size and disposition ------------------------------------------------------
1320 1320
1321 // This View's bounds in the parent coordinate system. 1321 // This View's bounds in the parent coordinate system.
1322 gfx::Rect bounds_; 1322 gfx::Rect bounds_;
1323 1323
1324 // Visible state 1324 // Whether this view is visible.
1325 bool is_visible_; 1325 bool is_visible_;
1326 1326
1327 // Whether this view is enabled.
1328 bool enabled_;
1329
1327 // Whether or not RegisterViewForVisibleBoundsNotification on the RootView 1330 // Whether or not RegisterViewForVisibleBoundsNotification on the RootView
1328 // has been invoked. 1331 // has been invoked.
1329 bool registered_for_visible_bounds_notification_; 1332 bool registered_for_visible_bounds_notification_;
1330 1333
1331 // List of descendants wanting notification when their visible bounds change. 1334 // List of descendants wanting notification when their visible bounds change.
1332 scoped_ptr<ViewVector> descendants_to_notify_; 1335 scoped_ptr<ViewVector> descendants_to_notify_;
1333 1336
1334 // Transformations ----------------------------------------------------------- 1337 // Transformations -----------------------------------------------------------
1335 1338
1336 // The transformation matrix (rotation, translate, scale). 1339 // The transformation matrix (rotation, translate, scale).
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 // The Windows-specific accessibility implementation for this View. 1432 // The Windows-specific accessibility implementation for this View.
1430 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_; 1433 scoped_refptr<NativeViewAccessibilityWin> native_view_accessibility_win_;
1431 #endif 1434 #endif
1432 1435
1433 DISALLOW_COPY_AND_ASSIGN(View); 1436 DISALLOW_COPY_AND_ASSIGN(View);
1434 }; 1437 };
1435 1438
1436 } // namespace views 1439 } // namespace views
1437 1440
1438 #endif // VIEWS_VIEW_H_ 1441 #endif // VIEWS_VIEW_H_
OLDNEW
« no previous file with comments | « views/controls/textfield/textfield.cc ('k') | views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698