Commit 85d43f0e authored by sky@chromium.org's avatar sky@chromium.org

Makes the maximize/restore button handling

snapping/minimizing. FrameMaximizeButton handles all the logic for
this. If you move the mouse the drag threshold we'll trigger to
snapping behavior. moving to the left snaps to the left half, moving
to the right the right half, and below minimizes. Uses
PhantomWindowController to render the snap position. Minimizing
highlights the launcher button. To support this I had to plumb through
getting the bounds of the launcher button.

BUG=116213
TEST=none
R=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/9703026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126729 0039d316-1c4b-4281-b951-d872f2087c98
parent 85df31c5
......@@ -218,6 +218,8 @@
'wm/window_util.h',
'wm/workspace_controller.cc',
'wm/workspace_controller.h',
'wm/workspace/frame_maximize_button.cc',
'wm/workspace/frame_maximize_button.h',
'wm/workspace/managed_workspace.cc',
'wm/workspace/managed_workspace.h',
'wm/workspace/maximized_workspace.cc',
......
......@@ -96,7 +96,8 @@ void Launcher::DelegateView::Layout() {
Launcher::Launcher(aura::Window* window_container)
: widget_(NULL),
window_container_(window_container),
delegate_view_(NULL) {
delegate_view_(NULL),
launcher_view_(NULL) {
model_.reset(new LauncherModel);
if (Shell::GetInstance()->delegate()) {
delegate_.reset(
......@@ -111,15 +112,15 @@ Launcher::Launcher(aura::Window* window_container)
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = Shell::GetInstance()->GetContainer(
ash::internal::kShellWindowId_LauncherContainer);
internal::LauncherView* launcher_view =
new internal::LauncherView(model_.get(), delegate_.get());
launcher_view->Init();
launcher_view_ = new internal::LauncherView(model_.get(), delegate_.get());
launcher_view_->Init();
delegate_view_ = new DelegateView;
delegate_view_->AddChildView(launcher_view);
delegate_view_->AddChildView(launcher_view_);
params.delegate = delegate_view_;
widget_->Init(params);
widget_->GetNativeWindow()->SetName("LauncherWindow");
gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize();
gfx::Size pref =
static_cast<views::View*>(launcher_view_)->GetPreferredSize();
widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height()));
// The launcher should not take focus when it is initially shown.
widget_->set_focus_on_creation(false);
......@@ -139,4 +140,21 @@ int Launcher::GetStatusWidth() {
return delegate_view_->status_width();
}
gfx::Rect Launcher::GetScreenBoundsOfItemIconForWindow(aura::Window* window) {
if (!delegate_.get())
return gfx::Rect();
LauncherID id = delegate_->GetIDByWindow(window);
gfx::Rect bounds(launcher_view_->GetIdealBoundsOfItemIcon(id));
if (bounds.IsEmpty())
return bounds;
gfx::Point screen_origin;
views::View::ConvertPointToScreen(launcher_view_, &screen_origin);
return gfx::Rect(screen_origin.x() + bounds.x(),
screen_origin.y() + bounds.y(),
bounds.width(),
bounds.height());
}
} // namespace ash
......@@ -14,6 +14,10 @@ namespace aura {
class Window;
}
namespace gfx {
class Rect;
}
namespace views {
class Widget;
}
......@@ -22,6 +26,7 @@ namespace ash {
namespace internal {
class FocusCycler;
class LauncherView;
}
class LauncherDelegate;
......@@ -39,6 +44,10 @@ class ASH_EXPORT Launcher {
void SetStatusWidth(int width);
int GetStatusWidth();
// Returns the screen bounds of the item for the specified window. If there is
// no item for the specified window an empty rect is returned.
gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window);
LauncherDelegate* delegate() { return delegate_.get(); }
LauncherModel* model() { return model_.get(); }
......@@ -49,10 +58,6 @@ class ASH_EXPORT Launcher {
private:
class DelegateView;
// If necessary asks the delegate if an entry should be created in the
// launcher for |window|. This only asks the delegate once for a window.
void MaybeAdd(aura::Window* window);
scoped_ptr<LauncherModel> model_;
// Widget hosting the view.
......@@ -63,6 +68,8 @@ class ASH_EXPORT Launcher {
// Contents view of the widget. Houses the LauncherView.
DelegateView* delegate_view_;
internal::LauncherView* launcher_view_;
scoped_ptr<LauncherDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(Launcher);
......
......@@ -140,6 +140,10 @@ void LauncherButton::ClearState(State state) {
}
}
gfx::Rect LauncherButton::GetIconBounds() const {
return icon_view_->bounds();
}
bool LauncherButton::OnMousePressed(const views::MouseEvent& event) {
CustomButton::OnMousePressed(event);
host_->MousePressedOnButton(this, event);
......
......@@ -39,6 +39,9 @@ class LauncherButton : public views::CustomButton {
void ClearState(State state);
int state() const { return state_; }
// Returns the bounds of the icon.
gfx::Rect GetIconBounds() const;
protected:
LauncherButton(views::ButtonListener* listener, LauncherButtonHost* host);
......
......@@ -7,6 +7,7 @@
#pragma once
#include "ash/ash_export.h"
#include "ash/launcher/launcher_types.h"
#include "base/string16.h"
namespace ui {
......@@ -15,8 +16,6 @@ class MenuModel;
namespace ash {
struct LauncherItem;
// Delegate for the Launcher.
class ASH_EXPORT LauncherDelegate {
public:
......@@ -40,6 +39,10 @@ class ASH_EXPORT LauncherDelegate {
// should be no context menu. The caller takes ownership of the returned
// model.
virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item) = 0;
// Returns the id of the item associated with the specified window, or 0 if
// there isn't one.
virtual ash::LauncherID GetIDByWindow(aura::Window* window) = 0;
};
} // namespace ash
......
......@@ -260,6 +260,20 @@ void LauncherView::Init() {
// We'll layout when our bounds change.
}
gfx::Rect LauncherView::GetIdealBoundsOfItemIcon(LauncherID id) {
int index = model_->ItemIndexByID(id);
if (index == -1 || !view_model_->view_at(index)->visible())
return gfx::Rect();
const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index));
DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type);
LauncherButton* button =
static_cast<LauncherButton*>(view_model_->view_at(index));
gfx::Rect icon_bounds = button->GetIconBounds();
return gfx::Rect(ideal_bounds.x() + icon_bounds.x(),
ideal_bounds.y() + icon_bounds.y(),
icon_bounds.width(), icon_bounds.height());
}
void LauncherView::LayoutToIdealBounds() {
IdealBounds ideal_bounds;
CalculateIdealBounds(&ideal_bounds);
......
......@@ -60,6 +60,10 @@ class ASH_EXPORT LauncherView : public views::View,
void Init();
// Returns the ideal bounds of the specified item, or an empty rect if id
// isn't know.
gfx::Rect GetIdealBoundsOfItemIcon(LauncherID id);
private:
class FadeOutAnimationDelegate;
class StartFadeAnimationDelegate;
......
......@@ -641,6 +641,10 @@ void Shell::RemoveShellObserver(ShellObserver* observer) {
observers_.RemoveObserver(observer);
}
int Shell::GetGridSize() const {
return workspace_controller_->workspace_manager()->grid_size();
}
////////////////////////////////////////////////////////////////////////////////
// Shell, private:
......
......@@ -224,6 +224,9 @@ class ASH_EXPORT Shell {
SystemTray* tray() const { return tray_.get(); }
// Returns the size of the grid.
int GetGridSize() const;
static void set_initially_hide_cursor(bool hide) {
initially_hide_cursor_ = hide;
}
......
......@@ -23,6 +23,7 @@
#include "base/message_loop.h"
#include "grit/ui_resources.h"
#include "ui/aura/env.h"
#include "ui/aura/client/window_types.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window_observer.h"
#include "ui/base/resource/resource_bundle.h"
......@@ -72,8 +73,20 @@ class WindowWatcher : public aura::WindowObserver {
return i != id_to_window_.end() ? i->second : NULL;
}
ash::LauncherID GetIDByWindow(aura::Window* window) const {
for (IDToWindow::const_iterator i = id_to_window_.begin();
i != id_to_window_.end(); ++i) {
if (i->second == window)
return i->first;
}
return 0; // TODO: add a constant for this.
}
// aura::WindowObserver overrides:
virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE {
if (new_window->type() != aura::client::WINDOW_TYPE_NORMAL)
return;
static int image_count = 0;
ash::LauncherModel* model = ash::Shell::GetInstance()->launcher()->model();
ash::LauncherItem item;
......@@ -152,6 +165,10 @@ class LauncherDelegateImpl : public ash::LauncherDelegate {
return NULL;
}
virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE {
return watcher_->GetIDByWindow(window);
}
private:
// Used to update Launcher. Owned by main.
WindowWatcher* watcher_;
......
......@@ -305,6 +305,10 @@ string16 WindowTypeLauncher::GetWindowTitle() const {
return ASCIIToUTF16("Examples: Window Builder");
}
bool WindowTypeLauncher::CanMaximize() const {
return true;
}
void WindowTypeLauncher::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (sender == create_button_) {
......
......@@ -51,6 +51,7 @@ class WindowTypeLauncher : public views::WidgetDelegateView,
virtual views::View* GetContentsView() OVERRIDE;
virtual bool CanResize() const OVERRIDE;
virtual string16 GetWindowTitle() const OVERRIDE;
virtual bool CanMaximize() const OVERRIDE;
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
......
......@@ -5,6 +5,7 @@
#include "ash/wm/custom_frame_view_ash.h"
#include "ash/wm/frame_painter.h"
#include "ash/wm/workspace/frame_maximize_button.h"
#include "grit/ui_resources.h"
#include "grit/ui_strings.h" // Accessibility names
#include "ui/base/l10n/l10n_util.h"
......@@ -43,7 +44,7 @@ void CustomFrameViewAsh::Init(views::Widget* frame) {
frame_ = frame;
maximize_button_ = new views::ImageButton(this);
maximize_button_ = new FrameMaximizeButton(this);
maximize_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_APP_ACCNAME_MAXIMIZE));
AddChildView(maximize_button_);
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/workspace/frame_maximize_button.h"
#include "ash/shell.h"
#include "ash/wm/property_util.h"
#include "ash/launcher/launcher.h"
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/wm/workspace/workspace_window_resizer.h"
#include "grit/ui_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/screen.h"
#include "ui/views/widget/widget.h"
namespace ash {
FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener)
: ImageButton(listener),
is_snap_enabled_(false),
exceeded_drag_threshold_(false),
snap_type_(SNAP_NONE) {
// TODO(sky): nuke this. It's temporary while we don't have good images.
SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
}
FrameMaximizeButton::~FrameMaximizeButton() {
}
bool FrameMaximizeButton::OnMousePressed(const views::MouseEvent& event) {
is_snap_enabled_ = event.IsLeftMouseButton();
if (is_snap_enabled_) {
snap_type_ = SNAP_NONE;
press_location_ = event.location();
exceeded_drag_threshold_ = false;
}
ImageButton::OnMousePressed(event);
return true;
}
void FrameMaximizeButton::OnMouseEntered(const views::MouseEvent& event) {
ImageButton::OnMouseEntered(event);
}
void FrameMaximizeButton::OnMouseExited(const views::MouseEvent& event) {
ImageButton::OnMouseExited(event);
}
bool FrameMaximizeButton::OnMouseDragged(const views::MouseEvent& event) {
if (is_snap_enabled_) {
int delta_x = event.location().x() - press_location_.x();
int delta_y = event.location().y() - press_location_.y();
if (!exceeded_drag_threshold_) {
exceeded_drag_threshold_ =
views::View::ExceededDragThreshold(delta_x, delta_y);
}
if (exceeded_drag_threshold_)
UpdateSnap(delta_x, delta_y);
}
return ImageButton::OnMouseDragged(event);
}
void FrameMaximizeButton::OnMouseReleased(const views::MouseEvent& event) {
bool should_snap = is_snap_enabled_;
is_snap_enabled_ = false;
if (should_snap && snap_type_ != SNAP_NONE) {
SetState(BS_NORMAL);
phantom_window_.reset();
Snap();
} else {
ImageButton::OnMouseReleased(event);
}
}
void FrameMaximizeButton::OnMouseCaptureLost() {
is_snap_enabled_ = false;
phantom_window_.reset();
SchedulePaint();
ImageButton::OnMouseCaptureLost();
}
SkBitmap FrameMaximizeButton::GetImageToPaint() {
if (is_snap_enabled_) {
int id = 0;
if (GetWidget()->IsMaximized()) {
switch (snap_type_) {
case SNAP_LEFT:
id = IDR_AURA_WINDOW_MAXIMIZED_RESTORE_SNAP_LEFT_P;
break;
case SNAP_RIGHT:
id = IDR_AURA_WINDOW_MAXIMIZED_RESTORE_SNAP_RIGHT_P;
break;
case SNAP_MAXIMIZE:
case SNAP_NONE:
id = IDR_AURA_WINDOW_MAXIMIZED_RESTORE_SNAP_P;
break;
case SNAP_MINIMIZE:
id = IDR_AURA_WINDOW_MAXIMIZED_RESTORE_SNAP_MINIMIZE_P;
break;
default:
NOTREACHED();
}
} else {
switch (snap_type_) {
case SNAP_LEFT:
id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_LEFT_P;
break;
case SNAP_RIGHT:
id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_RIGHT_P;
break;
case SNAP_MAXIMIZE:
case SNAP_NONE:
id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_P;
break;
case SNAP_MINIMIZE:
id = IDR_AURA_WINDOW_MAXIMIZED_SNAP_MINIMIZE_P;
break;
default:
NOTREACHED();
}
}
return *ResourceBundle::GetSharedInstance().GetImageNamed(id).ToSkBitmap();
}
return ImageButton::GetImageToPaint();
}
void FrameMaximizeButton::UpdateSnap(int delta_x, int delta_y) {
SnapType type = SnapTypeForDelta(delta_x, delta_y);
if (type == snap_type_)
return;
SchedulePaint();
if (type == SNAP_NONE) {
phantom_window_.reset();
snap_type_ = SNAP_NONE;
return;
}
snap_type_ = type;
if (!phantom_window_.get()) {
phantom_window_.reset(new internal::PhantomWindowController(
GetWidget()->GetNativeWindow(),
internal::PhantomWindowController::TYPE_EDGE, 0));
}
phantom_window_->Show(BoundsForType(snap_type_));
}
FrameMaximizeButton::SnapType FrameMaximizeButton::SnapTypeForDelta(
int delta_x,
int delta_y) const {
if (!views::View::ExceededDragThreshold(delta_x, delta_y))
return GetWidget()->IsMaximized() ? SNAP_NONE : SNAP_MAXIMIZE;
else if (delta_x < 0 && delta_y > delta_x && delta_y < -delta_x)
return SNAP_LEFT;
else if (delta_x > 0 && delta_y > -delta_x && delta_y < delta_x)
return SNAP_RIGHT;
else if (delta_y > 0)
return SNAP_MINIMIZE;
return GetWidget()->IsMaximized() ? SNAP_NONE : SNAP_MAXIMIZE;
}
gfx::Rect FrameMaximizeButton::BoundsForType(SnapType type) const {
aura::Window* window = GetWidget()->GetNativeWindow();
int grid_size = Shell::GetInstance()->GetGridSize();
switch (type) {
case SNAP_LEFT:
return internal::WorkspaceWindowResizer::GetBoundsForWindowAlongEdge(
window, internal::WorkspaceWindowResizer::LEFT_EDGE, grid_size);
case SNAP_RIGHT:
return internal::WorkspaceWindowResizer::GetBoundsForWindowAlongEdge(
window, internal::WorkspaceWindowResizer::RIGHT_EDGE, grid_size);
case SNAP_MAXIMIZE:
return gfx::Screen::GetMonitorWorkAreaNearestWindow(window);
case SNAP_MINIMIZE: {
Launcher* launcher = Shell::GetInstance()->launcher();
gfx::Rect item_rect(launcher->GetScreenBoundsOfItemIconForWindow(window));
if (!item_rect.IsEmpty()) {
// PhantomWindowController insets slightly, outset it so the phantom
// doesn't appear inset.
item_rect.Inset(-8, -8);
return item_rect;
}
return launcher->widget()->GetWindowScreenBounds();
}
default:
NOTREACHED();
}
return gfx::Rect();
}
void FrameMaximizeButton::Snap() {
switch (snap_type_) {
case SNAP_LEFT:
case SNAP_RIGHT:
if (GetWidget()->IsMaximized()) {
ash::SetRestoreBounds(GetWidget()->GetNativeWindow(),
BoundsForType(snap_type_));
GetWidget()->Restore();
} else {
GetWidget()->SetBounds(BoundsForType(snap_type_));
}
break;
case SNAP_MAXIMIZE:
GetWidget()->Maximize();
break;
case SNAP_MINIMIZE:
GetWidget()->Minimize();
break;
default:
NOTREACHED();
}
}
} // namespace ash
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
#define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
#include "ash/ash_export.h"
#include "base/memory/scoped_ptr.h"
#include "ui/views/controls/button/image_button.h"
namespace ash {
namespace internal {
class PhantomWindowController;
}
// Button used for the maximize control on the frame. Handles snapping logic.
class ASH_EXPORT FrameMaximizeButton : public views::ImageButton {
public:
explicit FrameMaximizeButton(views::ButtonListener* listener);
virtual ~FrameMaximizeButton();
// ImageButton overrides:
virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE;
virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
virtual void OnMouseCaptureLost() OVERRIDE;
protected:
// ImageButton overrides:
virtual SkBitmap GetImageToPaint() OVERRIDE;
private:
// Where to snap to.
enum SnapType {
SNAP_LEFT,
SNAP_RIGHT,
SNAP_MAXIMIZE,
SNAP_MINIMIZE,
SNAP_NONE
};
// Updates |snap_type_| based on a mouse drag. The parameters are relative to
// the mouse pressed location.
void UpdateSnap(int delta_x, int delta_y);
// Returns the type of snap based on the specified coordaintes (relative to
// the press location).
SnapType SnapTypeForDelta(int delta_x, int delta_y) const;
// Returns the bounds of the resulting window for the specified type.
gfx::Rect BoundsForType(SnapType type) const;
// Snaps the window to the current snap position.
void Snap();
// Renders the snap position.
scoped_ptr<internal::PhantomWindowController> phantom_window_;
// Is snapping enabled? Set on press so that in drag we know whether we
// should show the snap locations.
bool is_snap_enabled_;
// Did the user drag far enough to trigger snapping?
bool exceeded_drag_threshold_;
// Location of the press.
gfx::Point press_location_;
// Current snap type.
SnapType snap_type_;
DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton);
};
} // namespace ash
#endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_
......@@ -4,6 +4,8 @@
#include "ash/wm/workspace/phantom_window_controller.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
......@@ -175,8 +177,16 @@ void PhantomWindowController::ShowNow() {
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
params.transparent = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = window_->parent();
if (type_ == TYPE_DESTINATION) {
params.parent = window_->parent();
} else {
// TYPE_EDGE is used by FrameMaximizeButton to highlight the launcher
// button, make sure the phantom appears over it.
params.parent =
Shell::GetInstance()->GetContainer(kShellWindowId_LauncherContainer);
}
params.can_activate = false;
params.keep_on_top = true;
phantom_widget_->set_focus_on_creation(false);
phantom_widget_->Init(params);
phantom_widget_->SetVisibilityChangedAnimationsEnabled(false);
......
......@@ -45,7 +45,7 @@ class ASH_EXPORT WorkspaceController :
void ToggleOverview();
// Returns the workspace manager that this controler owns.
// Returns the workspace manager that this controller owns.
WorkspaceManager* workspace_manager() {
return workspace_manager_.get();
}
......
......@@ -434,6 +434,16 @@ ui::MenuModel* ChromeLauncherDelegate::CreateContextMenu(
return new LauncherContextMenu(this, item.id);
}
ash::LauncherID ChromeLauncherDelegate::GetIDByWindow(
aura::Window* window) {
for (IDToItemMap::const_iterator i = id_to_item_map_.begin();
i != id_to_item_map_.end(); ++i) {
if (i->second.updater && i->second.updater->window() == window)
return i->first;
}
return 0;
}
void ChromeLauncherDelegate::LauncherItemAdded(int index) {
}
......
......@@ -158,6 +158,7 @@ class ChromeLauncherDelegate : public ash::LauncherDelegate,
virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE;
virtual ui::MenuModel* CreateContextMenu(
const ash::LauncherItem& item) OVERRIDE;
virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
// ash::LauncherModelObserver overrides:
virtual void LauncherItemAdded(int index) OVERRIDE;
......
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h"
#include "ash/wm/frame_painter.h"
#include "ash/wm/workspace/frame_maximize_button.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
......@@ -52,7 +53,7 @@ BrowserNonClientFrameViewAura::~BrowserNonClientFrameViewAura() {
void BrowserNonClientFrameViewAura::Init() {
// Caption buttons.
maximize_button_ = new views::ImageButton(this);
maximize_button_ = new ash::FrameMaximizeButton(this);
maximize_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE));
AddChildView(maximize_button_);
......
......@@ -31,8 +31,8 @@ ImageButton::ImageButton(ButtonListener* listener)
ImageButton::~ImageButton() {
}
void ImageButton::SetImage(ButtonState aState, const SkBitmap* anImage) {
images_[aState] = anImage ? *anImage : SkBitmap();
void ImageButton::SetImage(ButtonState state, const SkBitmap* image) {
images_[state] = image ? *image : SkBitmap();
PreferredSizeChanged();
}
......
......@@ -23,7 +23,7 @@ class VIEWS_EXPORT ImageButton : public CustomButton {
virtual ~ImageButton();
// Set the image the button should use for the provided state.
virtual void SetImage(ButtonState aState, const SkBitmap* anImage);
virtual void SetImage(ButtonState state, const SkBitmap* image);
// Set the background details.
void SetBackground(SkColor color,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment