#ifndef ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
#define ASH_FRAME_CAPTION_BUTTONS_FRAME_CAPTION_BUTTON_CONTAINER_VIEW_H_
#include "ash/ash_export.h"
#include "ash/frame/caption_buttons/alternate_frame_size_button_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/view.h"
namespace views {
class Widget;
}
namespace ash {
class FrameCaptionButton;
class FrameMaximizeButton;
class ASH_EXPORT FrameCaptionButtonContainerView
: public views::View,
public views::ButtonListener,
public AlternateFrameSizeButtonDelegate {
public:
static const char kViewClassName[];
enum MinimizeAllowed {
MINIMIZE_ALLOWED,
MINIMIZE_DISALLOWED
};
FrameCaptionButtonContainerView(views::Widget* frame,
MinimizeAllowed minimize_allowed);
virtual ~FrameCaptionButtonContainerView();
class TestApi {
public:
explicit TestApi(FrameCaptionButtonContainerView* container_view)
: container_view_(container_view) {
}
FrameCaptionButton* minimize_button() const {
return container_view_->minimize_button_;
}
FrameCaptionButton* size_button() const {
return container_view_->size_button_;
}
FrameCaptionButton* close_button() const {
return container_view_->close_button_;
}
private:
FrameCaptionButtonContainerView* container_view_;
DISALLOW_COPY_AND_ASSIGN(TestApi);
};
FrameMaximizeButton* GetOldStyleSizeButton();
void SetButtonImages(CaptionButtonIcon icon,
int icon_image_id,
int inactive_icon_image_id,
int hovered_background_image_id,
int pressed_background_image_id);
void SetPaintAsActive(bool paint_as_active);
void ResetWindowControls();
int NonClientHitTest(const gfx::Point& point) const;
void UpdateSizeButtonVisibility(bool force_hidden);
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void Layout() OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
private:
friend class FrameCaptionButtonContainerViewTest;
struct ButtonIconIds {
ButtonIconIds();
ButtonIconIds(int icon_id,
int inactive_icon_id,
int hovered_background_id,
int pressed_background_id);
~ButtonIconIds();
int icon_image_id;
int inactive_icon_image_id;
int hovered_background_image_id;
int pressed_background_image_id;
};
void SetButtonIcon(FrameCaptionButton* button,
CaptionButtonIcon icon,
Animate animate);
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
virtual bool IsMinimizeButtonVisible() const OVERRIDE;
virtual void SetButtonsToNormal(Animate animate) OVERRIDE;
virtual void SetButtonIcons(CaptionButtonIcon minimize_button_icon,
CaptionButtonIcon close_button_icon,
Animate animate) OVERRIDE;
virtual const FrameCaptionButton* GetButtonClosestTo(
const gfx::Point& position_in_screen) const OVERRIDE;
virtual void SetHoveredAndPressedButtons(
const FrameCaptionButton* to_hover,
const FrameCaptionButton* to_press) OVERRIDE;
views::Widget* frame_;
FrameCaptionButton* minimize_button_;
FrameCaptionButton* size_button_;
FrameCaptionButton* close_button_;
std::map<CaptionButtonIcon, ButtonIconIds> button_icon_id_map_;
DISALLOW_COPY_AND_ASSIGN(FrameCaptionButtonContainerView);
};
}
#endif