Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / views / controls / button / label_button_border.h
blobc56f42eda029ae8884732f0cc1e1cf821f3ff760
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/gfx/geometry/insets.h"
12 #include "ui/views/border.h"
13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/painter.h"
16 namespace views {
18 // A Border that paints a LabelButton's background frame.
19 class VIEWS_EXPORT LabelButtonBorder : public Border {
20 public:
21 explicit LabelButtonBorder(Button::ButtonStyle style);
22 ~LabelButtonBorder() override;
24 // Returns the default insets for a given |style|.
25 static gfx::Insets GetDefaultInsetsForStyle(Button::ButtonStyle style);
27 Button::ButtonStyle style() const { return style_; }
29 // Overridden from Border:
30 void Paint(const View& view, gfx::Canvas* canvas) override;
31 gfx::Insets GetInsets() const override;
32 gfx::Size GetMinimumSize() const override;
34 void set_insets(const gfx::Insets& insets) { insets_ = insets; }
36 // Get or set the painter used for the specified |focused| button |state|.
37 // LabelButtonBorder takes and retains ownership of |painter|.
38 Painter* GetPainter(bool focused, Button::ButtonState state);
39 void SetPainter(bool focused, Button::ButtonState state, Painter* painter);
41 private:
42 // The painters used for each unfocused or focused button state.
43 scoped_ptr<Painter> painters_[2][Button::STATE_COUNT];
45 // The button style supplied in part by this border.
46 Button::ButtonStyle style_;
48 gfx::Insets insets_;
50 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder);
53 } // namespace views
55 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_