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

Side by Side Diff: ash/launcher/launcher_button.cc

Issue 9699044: tweak icon spacing for launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/launcher/launcher_button.h" 5 #include "ash/launcher/launcher_button.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/launcher/launcher_button_host.h" 9 #include "ash/launcher/launcher_button_host.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/compositor/layer.h" 12 #include "ui/gfx/compositor/layer.h"
13 #include "ui/gfx/compositor/scoped_layer_animation_settings.h" 13 #include "ui/gfx/compositor/scoped_layer_animation_settings.h"
14 #include "ui/views/controls/image_view.h" 14 #include "ui/views/controls/image_view.h"
15 15
16 namespace { 16 namespace {
17 const int kBarHeight = 4; 17 const int kBarHeight = 4;
18 const int kBarSpacing = 10; 18 const int kBarSpacing = 6;
19 const int kIconHeight = 32; 19 const int kIconHeight = 32;
20 const int kIconWidth = 48; 20 const int kIconWidth = 48;
21 const int kHopSpacing = 2; 21 const int kHopSpacing = 2;
22 const int kActiveBarColor = 0xe6ffffff; 22 const int kActiveBarColor = 0xe6ffffff;
23 const int kInactiveBarColor = 0x80ffffff; 23 const int kInactiveBarColor = 0x80ffffff;
24 const int kHopUpMS = 130; 24 const int kHopUpMS = 130;
25 const int kHopDownMS = 260; 25 const int kHopDownMS = 260;
26 26
27 // Used to allow Mouse...() messages to go to the parent view. 27 // Used to allow Mouse...() messages to go to the parent view.
28 class MouseIgnoredView : public views::View { 28 class MouseIgnoredView : public views::View {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 host_->MouseExitedButton(this); 175 host_->MouseExitedButton(this);
176 } 176 }
177 177
178 void LauncherButton::GetAccessibleState(ui::AccessibleViewState* state) { 178 void LauncherButton::GetAccessibleState(ui::AccessibleViewState* state) {
179 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; 179 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON;
180 state->name = host_->GetAccessibleName(this); 180 state->name = host_->GetAccessibleName(this);
181 } 181 }
182 182
183 void LauncherButton::Layout() { 183 void LauncherButton::Layout() {
184 int image_x = (width() - icon_view_->width()) / 2; 184 int image_x = (width() - icon_view_->width()) / 2;
185 int image_y = ShouldHop(state_) ? 0 : kHopSpacing; 185 int image_y = height() - (icon_view_->height() + kBarHeight + kBarSpacing);
186
187 if (ShouldHop(state_))
188 image_y -= kHopSpacing;
189
186 icon_view_->SetPosition(gfx::Point(image_x, image_y)); 190 icon_view_->SetPosition(gfx::Point(image_x, image_y));
187 bar_->SetBounds(0, height() - kBarHeight, width(), kBarHeight); 191 bar_->SetBounds(0, height() - kBarHeight, width(), kBarHeight);
188 } 192 }
189 193
190 bool LauncherButton::GetTooltipText( 194 bool LauncherButton::GetTooltipText(
191 const gfx::Point& p, string16* tooltip) const { 195 const gfx::Point& p, string16* tooltip) const {
192 DCHECK(tooltip); 196 DCHECK(tooltip);
193 tooltip->assign(host_->GetAccessibleName(this)); 197 tooltip->assign(host_->GetAccessibleName(this));
194 return true; 198 return true;
195 } 199 }
(...skipping 27 matching lines...) Expand all
223 bar_->set_background(views::Background::CreateSolidBackground( 227 bar_->set_background(views::Background::CreateSolidBackground(
224 kInactiveBarColor)); 228 kInactiveBarColor));
225 } 229 }
226 } 230 }
227 231
228 Layout(); 232 Layout();
229 SchedulePaint(); 233 SchedulePaint();
230 } 234 }
231 } // namespace internal 235 } // namespace internal
232 } // namespace ash 236 } // namespace ash
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