Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ui/views/controls/button/label_button_border.h

Issue 11068012: Add new views::LabelButton and LabelButtonBorder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename LabelButtonBorder, remove GetLabel, etc. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
7
8 #include "ui/gfx/image/image_skia.h"
9 #include "ui/views/border.h"
10 #include "ui/views/controls/button/custom_button.h"
11
12 namespace views {
13
14 class NativeThemeDelegate;
15
16 // A Border that paints a LabelButton's background frame.
17 class VIEWS_EXPORT LabelButtonBorder : public Border {
18 public:
19 explicit LabelButtonBorder(NativeThemeDelegate* delegate);
20 virtual ~LabelButtonBorder();
21
22 bool native_theme() const { return native_theme_; }
23 void set_native_theme(bool native_theme) { native_theme_ = native_theme; }
24
25 protected:
26 struct BorderImages {
27 BorderImages();
28 // |image_ids| must contain 9 image ids.
29 explicit BorderImages(const int image_ids[]);
30 ~BorderImages();
31
32 gfx::ImageSkia top_left;
33 gfx::ImageSkia top;
34 gfx::ImageSkia top_right;
35 gfx::ImageSkia left;
36 gfx::ImageSkia center;
37 gfx::ImageSkia right;
38 gfx::ImageSkia bottom_left;
39 gfx::ImageSkia bottom;
40 gfx::ImageSkia bottom_right;
41 };
42
43 // Set the image set shown for the specified button state.
44 void SetImages(CustomButton::ButtonState state, const BorderImages& images);
45
46 private:
47 // Overridden from Border:
48 virtual void Paint(const View& view, gfx::Canvas* canvas) const OVERRIDE;
49 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE;
50
51 void PaintImages(const View& view,
52 gfx::Canvas* canvas,
53 CustomButton::ButtonState state) const;
54 void PaintNativeTheme(const View& view, gfx::Canvas* canvas) const;
55
56 // The images shown for each button state.
57 BorderImages images_[CustomButton::BS_COUNT];
58
59 // A delegate and flag controlling the native/Views theme styling.
60 NativeThemeDelegate* native_theme_delegate_;
61 bool native_theme_;
62
63 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder);
64 };
65
66 } // namespace views
67
68 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698