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

Side by Side Diff: ash/common/system/tray/header_list_scroll_view.h

Issue 2453133002: [ash-md] Makes Wi-Fi header row sticky when network list is scrolled (Closed)
Patch Set: [ash-md] Makes Wi-Fi header row sticky when network list is scrolled (avoid set_id()) Created 4 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ASH_COMMON_SYSTEM_TRAY_HEADER_LIST_SCROLL_VIEW_H_
6 #define ASH_COMMON_SYSTEM_TRAY_HEADER_LIST_SCROLL_VIEW_H_
7
8 #include "ash/ash_export.h"
9 #include "base/macros.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/view.h"
12
13 namespace ash {
14
15 // A view that is used as ScrollView contents. It supports designating some of
16 // the children as sticky header rows. The sticky header rows are not scrolled
17 // above the top of the visible viewport and are stacked above other children.
18 // To indicate that a child is a sticky header row use set_id(kHeaderRowId).
sadrul 2016/11/01 18:50:16 Where is kHeaderRowId() defined?
varkha 2016/11/02 02:03:21 Acknowledged.
19 class HeaderListScrollView : public views::View {
20 public:
21 HeaderListScrollView();
22 ~HeaderListScrollView() override;
23
24 // Sets |view| as a sticky header view for all items with the same group.
25 void SetHeaderView(views::View* child);
sadrul 2016/11/01 18:50:16 This seems odd with the class level description. T
varkha 2016/11/02 02:03:21 Acknowledged.
26
27 protected:
28 // views::View.
29 void Layout() override;
30 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
31 void ViewHierarchyChanged(
32 const ViewHierarchyChangedDetails& details) override;
33 const char* GetClassName() const override;
34
35 private:
36 class HeaderListLayout;
37
38 class Header {
39 public:
40 explicit Header(views::View* header)
41 : view(header), offset(header->bounds().y()) {}
42 bool operator==(views::View* other) { return view == other; }
43
44 views::View* view;
45 int offset;
46 };
47
48 // Sets decorations on a header row to indicate whether it is sticky.
49 static void ShowHeaderSticky(views::View* header, bool show_sticky);
50
51 // Adjusts y-position of header rows allowing one or two rows to stick to the
52 // top of the visible viewport.
53 void ScrollChildren();
54
55 // Header child views that stick to the top of visible viewport when scrolled.
56 std::vector<Header> headers_;
57 HeaderListLayout* header_list_layout_ = nullptr;
58
59 DISALLOW_COPY_AND_ASSIGN(HeaderListScrollView);
60 };
61
62 } // namespace ash
63
64 #endif // ASH_COMMON_SYSTEM_TRAY_HEADER_LIST_SCROLL_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698