summaryrefslogtreecommitdiffstats
path: root/ui/views/view.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 17:48:53 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-03 17:48:53 +0000
commit29d8c66a81d92d983122f93a3faa670d81883531 (patch)
tree8737e5fbb77a0f376f0dff38d31e0afcd2787db4 /ui/views/view.h
parentd9ca7c9f10b60ea73a71475d53d1919a02b4da61 (diff)
downloadchromium_src-29d8c66a81d92d983122f93a3faa670d81883531.zip
chromium_src-29d8c66a81d92d983122f93a3faa670d81883531.tar.gz
chromium_src-29d8c66a81d92d983122f93a3faa670d81883531.tar.bz2
Method sorting.
- Sort focus_manager.cc to match focus_manager.h - Re-sort view.cc so each visibility (public, protected, private, private members) match and are grouped relative to purpose. BUG=none TEST=none TBR=sky Review URL: http://codereview.chromium.org/6250132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/view.h')
-rw-r--r--ui/views/view.h167
1 files changed, 92 insertions, 75 deletions
diff --git a/ui/views/view.h b/ui/views/view.h
index 870ef92..931ea5d 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -104,6 +104,24 @@ class View {
bool enabled() const { return enabled_; }
void SetEnabled(bool enabled);
+ // Attributes ----------------------------------------------------------------
+
+ int id() const { return id_; }
+ void set_id(int id) { id_ = id; }
+ int group() const { return group_; }
+ void set_group(int group) { group_ = group; }
+
+ // Returns the View within this View's hierarchy whose id matches that
+ // specified.
+ View* GetViewById(int id) const;
+
+ // Populates a ViewVector with the Views within this View's hierarchy that
+ // match the specified group id.
+ void GetViewsWithGroup(int group, ViewVector* vec) const;
+
+ // TODO(beng): implementme
+ virtual View* GetSelectedViewForGroup(int group_id);
+
// Coordinate conversion -----------------------------------------------------
// Converts a point from the coordinate system of |source| to |target|.
@@ -148,22 +166,6 @@ class View {
// an indirect descendant. Will return true if child is also this View.
bool Contains(View* child);
- int id() const { return id_; }
- void set_id(int id) { id_ = id; }
- int group() const { return group_; }
- void set_group(int group) { group_ = group; }
-
- // Returns the View within this View's hierarchy whose id matches that
- // specified.
- View* GetViewById(int id) const;
-
- // Populates a ViewVector with the Views within this View's hierarchy that
- // match the specified group id.
- void GetViewsWithGroup(int group, ViewVector* vec) const;
-
- // TODO(beng): implementme
- virtual View* GetSelectedViewForGroup(int group_id);
-
// Painting ------------------------------------------------------------------
// Add all or part of a View's bounds to the enclosing Widget's invalid
@@ -224,20 +226,28 @@ class View {
virtual void OnViewAddedToWidget();
virtual void OnViewRemovedFromWidget();
- // Accelerators --------------------------------------------------------------
+ // Painting ------------------------------------------------------------------
- virtual bool OnAcceleratorPressed(const Accelerator& accelerator);
+ // Responsible for calling Paint() on child Views. Override to control the
+ // order child Views are painted.
+ virtual void PaintChildren(gfx::Canvas* canvas);
- // Focus ---------------------------------------------------------------------
- virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event) const;
- virtual bool IsGroupFocusTraversable() const;
- // TODO(beng): kill these, move to focus manager.
- virtual bool IsFocusableInRootView() const;
- virtual bool IsAccessibilityFocusableInRootView() const;
- virtual FocusTraversable* GetPaneFocusTraversable() const;
+ // Override to provide rendering in any part of the View's bounds. Typically
+ // this is the "contents" of the view. If you override this method you will
+ // have to call the subsequent OnPaint*() methods manually.
+ virtual void OnPaint(gfx::Canvas* canvas);
- virtual void OnFocus(/* const FocusEvent& event */);
- virtual void OnBlur();
+ // Override to paint a background before any content is drawn. Typically this
+ // is done if you are satisfied with a default OnPaint handler but wish to
+ // supply a different background.
+ virtual void OnPaintBackground(gfx::Canvas* canvas);
+
+ // Override to paint a border not specified by SetBorder().
+ virtual void OnPaintBorder(gfx::Canvas* canvas);
+
+ // Override to paint a focus border (usually a dotted rectangle) around
+ // relevant contents.
+ virtual void OnPaintFocusBorder(gfx::Canvas* canvas);
// Input ---------------------------------------------------------------------
@@ -264,28 +274,21 @@ class View {
virtual void OnMouseEntered(const MouseEvent& event);
virtual void OnMouseExited(const MouseEvent& event);
- // Painting ------------------------------------------------------------------
-
- // Responsible for calling Paint() on child Views. Override to control the
- // order child Views are painted.
- virtual void PaintChildren(gfx::Canvas* canvas);
+ // Accelerators --------------------------------------------------------------
- // Override to provide rendering in any part of the View's bounds. Typically
- // this is the "contents" of the view. If you override this method you will
- // have to call the subsequent OnPaint*() methods manually.
- virtual void OnPaint(gfx::Canvas* canvas);
+ virtual bool OnAcceleratorPressed(const Accelerator& accelerator);
- // Override to paint a background before any content is drawn. Typically this
- // is done if you are satisfied with a default OnPaint handler but wish to
- // supply a different background.
- virtual void OnPaintBackground(gfx::Canvas* canvas);
+ // Focus ---------------------------------------------------------------------
- // Override to paint a border not specified by SetBorder().
- virtual void OnPaintBorder(gfx::Canvas* canvas);
+ virtual bool SkipDefaultKeyEventProcessing(const KeyEvent& event) const;
+ virtual bool IsGroupFocusTraversable() const;
+ // TODO(beng): kill these, move to focus manager.
+ virtual bool IsFocusableInRootView() const;
+ virtual bool IsAccessibilityFocusableInRootView() const;
+ virtual FocusTraversable* GetPaneFocusTraversable() const;
- // Override to paint a focus border (usually a dotted rectangle) around
- // relevant contents.
- virtual void OnPaintFocusBorder(gfx::Canvas* canvas);
+ virtual void OnFocus(/* const FocusEvent& event */);
+ virtual void OnBlur();
private:
friend internal::RootView;
@@ -311,12 +314,16 @@ class View {
gfx::Point press_point;
};
- // Focus ---------------------------------------------------------------------
-
- // Called when |child| is inserted into this View's children_ at |index|.
- // Sets up next/previous focus views
- // TODO(beng): Move this to FocusManager.
- void InitFocusSiblings(View* child, size_t index);
+ // Tree operations -----------------------------------------------------------
+ void NotifyHierarchyChanged(View* parent, View* child, bool is_add);
+ void NotifyHierarchyChangedUp(View* parent, View* child, bool is_add);
+ void NotifyHierarchyChangedDown(View* parent, View* child, bool is_add,
+ bool has_widget);
+ void CallViewNotification(View* target,
+ View* parent,
+ View* child,
+ bool is_add,
+ bool has_widget);
// Painting ------------------------------------------------------------------
@@ -326,12 +333,7 @@ class View {
// the hierarchy beneath it.
void Paint(gfx::Canvas* canvas);
- // Drag & Drop ---------------------------------------------------------------
- int GetDragOperations(const gfx::Point& point);
- void WriteDragData(const gfx::Point& point, OSExchangeData* data);
- void StartShellDrag(const MouseEvent& event, const gfx::Point& press_point);
-
- // RootView API --------------------------------------------------------------
+ // Input --------------------------------------------------------------
// These methods are designed to be called by the RootView. The RootView
// should limit its interaction with the View to these methods and the public
// API.
@@ -339,30 +341,28 @@ class View {
bool MouseDragged(const MouseEvent& event, DragInfo* drag_info);
void MouseReleased(const MouseEvent& event);
- // Tree operations -----------------------------------------------------------
- void NotifyHierarchyChanged(View* parent, View* child, bool is_add);
- void NotifyHierarchyChangedUp(View* parent, View* child, bool is_add);
- void NotifyHierarchyChangedDown(View* parent, View* child, bool is_add,
- bool has_widget);
- void CallViewNotification(View* target,
- View* parent,
- View* child,
- bool is_add,
- bool has_widget);
+ // Focus ---------------------------------------------------------------------
- // TODO(beng): sort this section.
+ // Called when |child| is inserted into this View's children_ at |index|.
+ // Sets up next/previous focus views
+ // TODO(beng): Move this to FocusManager.
+ void InitFocusSiblings(View* child, size_t index);
- // The View's parent view. This is set and reset when the View is added and
- // removed from a hierarchy.
- View* parent_;
+ // Drag & Drop ---------------------------------------------------------------
+ int GetDragOperations(const gfx::Point& point);
+ void WriteDragData(const gfx::Point& point, OSExchangeData* data);
+ void StartShellDrag(const MouseEvent& event, const gfx::Point& press_point);
- // The View's children.
- ViewVector children_;
+ //////////////////////////////////////////////////////////////////////////////
+
+ // Creation and lifetime -----------------------------------------------------
// True if the hierarchy (i.e. the parent View) is responsible for deleting
// this View. Default is true.
bool parent_owned_;
+ // Size and disposition ------------------------------------------------------
+
// The bounds of the View, in its parent's coordinates.
gfx::Rect bounds_;
@@ -376,12 +376,28 @@ class View {
// not propagate un-handled events beyond the View in the hierarchy.
bool enabled_;
+ // An optional helper that handles layout for child views.
+ scoped_ptr<LayoutManager> layout_manager_;
+
+ // Attributes ----------------------------------------------------------------
+
// An identifier for this View. Caller must guarantee uniqueness.
int id_;
// An identifier for a group of potentially related Views.
int group_;
+ // Tree operations -----------------------------------------------------------
+
+ // The View's parent view. This is set and reset when the View is added and
+ // removed from a hierarchy.
+ View* parent_;
+
+ // The View's children.
+ ViewVector children_;
+
+ // Focus ---------------------------------------------------------------------
+
// True if this View is focusable by the FocusManager.
bool focusable_;
@@ -389,12 +405,13 @@ class View {
View* next_focusable_view_;
View* prev_focusable_view_;
- // An optional helper that handles layout for child views.
- scoped_ptr<LayoutManager> layout_manager_;
+ // Context menus -------------------------------------------------------------
// Shows the context menu.
ContextMenuController* context_menu_controller_;
+ // Drag & drop ---------------------------------------------------------------
+
// Delegate for drag and drop related functionality.
DragController* drag_controller_;