Add ICU message format support
[chromium-blink-merge.git] / ui / message_center / views / padded_button.h
blob64ea7e7fa7705fb3f32188055206241f60d7e3a6
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_MESSAGE_CENTER_VIEWS_PADDED_BUTTON_H_
6 #define UI_MESSAGE_CENTER_VIEWS_PADDED_BUTTON_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/views/controls/button/image_button.h"
12 namespace message_center {
14 // PaddedButtons are ImageButtons whose image can be padded within the button.
15 // This allows the creation of buttons like the notification close and expand
16 // buttons whose clickable areas extends beyond their image areas
17 // (<http://crbug.com/168822>) without the need to create and maintain
18 // corresponding resource images with alpha padding. In the future, this class
19 // will also allow for buttons whose touch areas extend beyond their clickable
20 // area (<http://crbug.com/168856>).
21 class PaddedButton : public views::ImageButton {
22 public:
23 PaddedButton(views::ButtonListener* listener);
24 ~PaddedButton() override;
26 // Overridden from views::ImageButton:
27 gfx::Size GetPreferredSize() const override;
28 void OnPaint(gfx::Canvas* canvas) override;
29 void OnFocus() override;
31 // The SetPadding() method also sets the button's image alignment (positive
32 // values yield left/top alignments, negative values yield right/bottom ones,
33 // and zero values center/middle ones). ImageButton::SetImageAlignment() calls
34 // will not affect PaddedButton image alignments.
35 void SetPadding(int horizontal_padding, int vertical_padding);
37 void SetNormalImage(int resource_id);
38 void SetHoveredImage(int resource_id);
39 void SetPressedImage(int resource_id);
41 protected:
42 gfx::Point ComputePaddedImagePaintPosition(const gfx::ImageSkia& image);
44 private:
45 gfx::Insets padding_;
47 DISALLOW_COPY_AND_ASSIGN(PaddedButton);
50 } // namespace message_center
52 #endif // UI_MESSAGE_CENTER_VIEWS_PADDED_BUTTON_H_