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

Side by Side Diff: ui/app_list/views/folder_header_view.cc

Issue 581853003: App list: The line under folder headings has a fixed margin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use insets. Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "ui/app_list/views/folder_header_view.h" 5 #include "ui/app_list/views/folder_header_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/app_list/app_list_constants.h" 10 #include "ui/app_list/app_list_constants.h"
11 #include "ui/app_list/app_list_folder_item.h" 11 #include "ui/app_list/app_list_folder_item.h"
12 #include "ui/app_list/views/app_list_folder_view.h" 12 #include "ui/app_list/views/app_list_folder_view.h"
13 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/canvas.h" 14 #include "ui/gfx/canvas.h"
15 #include "ui/resources/grit/ui_resources.h" 15 #include "ui/resources/grit/ui_resources.h"
16 #include "ui/strings/grit/ui_strings.h" 16 #include "ui/strings/grit/ui_strings.h"
17 #include "ui/views/border.h" 17 #include "ui/views/border.h"
18 #include "ui/views/controls/button/image_button.h" 18 #include "ui/views/controls/button/image_button.h"
19 #include "ui/views/controls/textfield/textfield.h" 19 #include "ui/views/controls/textfield/textfield.h"
20 #include "ui/views/painter.h" 20 #include "ui/views/painter.h"
21 21
22 namespace app_list { 22 namespace app_list {
23 23
24 namespace { 24 namespace {
25 25
26 const int kPreferredWidth = 360; 26 const int kPreferredWidth = 360;
27 const int kPreferredHeight = 48; 27 const int kPreferredHeight = 48;
28 const int kIconDimension = 24; 28 const int kIconDimension = 24;
29 const int kPadding = 14; 29 const int kPadding = 14;
30 const int kBottomSeparatorWidth = 380; 30 const int kBottomSeparatorPadding = 9;
31 const int kBottomSeparatorHeight = 1; 31 const int kBottomSeparatorHeight = 1;
32 const int kMaxFolderNameWidth = 300; 32 const int kMaxFolderNameWidth = 300;
33 33
34 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); 34 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0);
35 35
36 } // namespace 36 } // namespace
37 37
38 class FolderHeaderView::FolderNameView : public views::Textfield { 38 class FolderHeaderView::FolderNameView : public views::Textfield {
39 public: 39 public:
40 FolderNameView() { 40 FolderNameView() {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 } 185 }
186 186
187 void FolderHeaderView::OnPaint(gfx::Canvas* canvas) { 187 void FolderHeaderView::OnPaint(gfx::Canvas* canvas) {
188 views::View::OnPaint(canvas); 188 views::View::OnPaint(canvas);
189 189
190 gfx::Rect rect(GetContentsBounds()); 190 gfx::Rect rect(GetContentsBounds());
191 if (rect.IsEmpty() || !folder_name_visible_) 191 if (rect.IsEmpty() || !folder_name_visible_)
192 return; 192 return;
193 193
194 // Draw bottom separator line. 194 // Draw bottom separator line.
195 rect.set_x((rect.width() - kBottomSeparatorWidth) / 2 + rect.x()); 195 rect.Inset(kBottomSeparatorPadding, 0);
196 rect.set_y(rect.y() + rect.height() - kBottomSeparatorHeight); 196 rect.set_y(rect.bottom() - kBottomSeparatorHeight);
197 rect.set_width(kBottomSeparatorWidth);
198 rect.set_height(kBottomSeparatorHeight); 197 rect.set_height(kBottomSeparatorHeight);
199 canvas->FillRect(rect, kTopSeparatorColor); 198 canvas->FillRect(rect, kTopSeparatorColor);
200 } 199 }
201 200
202 void FolderHeaderView::ContentsChanged(views::Textfield* sender, 201 void FolderHeaderView::ContentsChanged(views::Textfield* sender,
203 const base::string16& new_contents) { 202 const base::string16& new_contents) {
204 // Temporarily remove from observer to ignore data change caused by us. 203 // Temporarily remove from observer to ignore data change caused by us.
205 if (!folder_item_) 204 if (!folder_item_)
206 return; 205 return;
207 206
(...skipping 13 matching lines...) Expand all
221 void FolderHeaderView::ButtonPressed(views::Button* sender, 220 void FolderHeaderView::ButtonPressed(views::Button* sender,
222 const ui::Event& event) { 221 const ui::Event& event) {
223 delegate_->NavigateBack(folder_item_, event); 222 delegate_->NavigateBack(folder_item_, event);
224 } 223 }
225 224
226 void FolderHeaderView::ItemNameChanged() { 225 void FolderHeaderView::ItemNameChanged() {
227 Update(); 226 Update();
228 } 227 }
229 228
230 } // namespace app_list 229 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698