summaryrefslogtreecommitdiffstats
path: root/ash/wm/frame_painter.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-31 21:32:52 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-31 21:32:52 +0000
commitd148d3b78afa7d5bb9c8f21f086b1d28fccb8d93 (patch)
treef659e47eabf9bccee3663e2c545cd17b242ffa11 /ash/wm/frame_painter.cc
parent7e1117ccfd480267ebda3e64042f01c86e803cd8 (diff)
downloadchromium_src-d148d3b78afa7d5bb9c8f21f086b1d28fccb8d93.zip
chromium_src-d148d3b78afa7d5bb9c8f21f086b1d28fccb8d93.tar.gz
chromium_src-d148d3b78afa7d5bb9c8f21f086b1d28fccb8d93.tar.bz2
Changes the maximize button to only minimize for panels. This resulted
in a slew of renaming. Currently the icons are completely wrong for this, but that should be fixed once we get the assets. BUG=121221 TEST=none R=jamescook@chromium.org Review URL: https://chromiumcodereview.appspot.com/9958039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130064 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/frame_painter.cc')
-rw-r--r--ash/wm/frame_painter.cc36
1 files changed, 21 insertions, 15 deletions
diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc
index 0f8fdc5..67bbc49 100644
--- a/ash/wm/frame_painter.cc
+++ b/ash/wm/frame_painter.cc
@@ -133,7 +133,7 @@ std::set<FramePainter*>* FramePainter::instances_ = NULL;
FramePainter::FramePainter()
: frame_(NULL),
window_icon_(NULL),
- maximize_button_(NULL),
+ size_button_(NULL),
close_button_(NULL),
window_(NULL),
button_separator_(NULL),
@@ -146,7 +146,8 @@ FramePainter::FramePainter()
previous_opacity_(0),
crossfade_theme_frame_(NULL),
crossfade_opacity_(0),
- crossfade_animation_(NULL) {
+ crossfade_animation_(NULL),
+ size_button_behavior_(SIZE_BUTTON_MAXIMIZES) {
if (!instances_)
instances_ = new std::set<FramePainter*>();
instances_->insert(this);
@@ -162,15 +163,17 @@ FramePainter::~FramePainter() {
void FramePainter::Init(views::Widget* frame,
views::View* window_icon,
views::ImageButton* maximize_button,
- views::ImageButton* close_button) {
+ views::ImageButton* close_button,
+ SizeButtonBehavior behavior) {
DCHECK(frame);
// window_icon may be NULL.
DCHECK(maximize_button);
DCHECK(close_button);
frame_ = frame;
window_icon_ = window_icon;
- maximize_button_ = maximize_button;
+ size_button_ = maximize_button;
close_button_ = close_button;
+ size_button_behavior_ = behavior;
// Window frame image parts.
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
@@ -258,8 +261,8 @@ int FramePainter::NonClientHitTest(views::NonClientFrameView* view,
if (close_button_->visible() &&
close_button_->GetMirroredBounds().Contains(point))
return HTCLOSE;
- if (maximize_button_->visible() &&
- maximize_button_->GetMirroredBounds().Contains(point))
+ if (size_button_->visible() &&
+ size_button_->GetMirroredBounds().Contains(point))
return HTMAXBUTTON;
// Caption is a safe default.
@@ -274,7 +277,7 @@ gfx::Size FramePainter::GetMinimumSize(views::NonClientFrameView* view) {
// Ensure we have enough space for the window icon and buttons. We allow
// the title string to collapse to zero width.
int title_width = GetTitleOffsetX() +
- maximize_button_->width() +
+ size_button_->width() +
button_separator_->width() +
close_button_->width();
if (title_width > min_size.width())
@@ -410,7 +413,7 @@ void FramePainter::PaintTitleBar(views::NonClientFrameView* view,
gfx::Rect title_bounds(
title_x,
kTitleOffsetY,
- std::max(0, maximize_button_->x() - kTitleLogoSpacing - title_x),
+ std::max(0, size_button_->x() - kTitleLogoSpacing - title_x),
title_font.GetHeight());
canvas->DrawStringInt(delegate->GetWindowTitle(),
title_font,
@@ -431,7 +434,8 @@ void FramePainter::LayoutHeader(views::NonClientFrameView* view,
IDR_AURA_WINDOW_MAXIMIZED_CLOSE,
IDR_AURA_WINDOW_MAXIMIZED_CLOSE_H,
IDR_AURA_WINDOW_MAXIMIZED_CLOSE_P);
- SetButtonImages(maximize_button_,
+ // TODO: need images for SIZE_BUTTON_MINIMIZES.
+ SetButtonImages(size_button_,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE_H,
IDR_AURA_WINDOW_MAXIMIZED_RESTORE_P);
@@ -440,7 +444,8 @@ void FramePainter::LayoutHeader(views::NonClientFrameView* view,
IDR_AURA_WINDOW_CLOSE,
IDR_AURA_WINDOW_CLOSE_H,
IDR_AURA_WINDOW_CLOSE_P);
- SetButtonImages(maximize_button_,
+ // TODO: need images for SIZE_BUTTON_MINIMIZES.
+ SetButtonImages(size_button_,
IDR_AURA_WINDOW_MAXIMIZE,
IDR_AURA_WINDOW_MAXIMIZE_H,
IDR_AURA_WINDOW_MAXIMIZE_P);
@@ -453,12 +458,13 @@ void FramePainter::LayoutHeader(views::NonClientFrameView* view,
close_size.width(),
close_size.height());
- gfx::Size maximize_size = maximize_button_->GetPreferredSize();
- maximize_button_->SetBounds(
- close_button_->x() - button_separator_->width() - maximize_size.width(),
+ gfx::Size size_button_size = size_button_->GetPreferredSize();
+ size_button_->SetBounds(
+ close_button_->x() - button_separator_->width() -
+ size_button_size.width(),
close_button_->y(),
- maximize_size.width(),
- maximize_size.height());
+ size_button_size.width(),
+ size_button_size.height());
if (window_icon_)
window_icon_->SetBoundsRect(