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

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: Remove stray semicolon. 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 // Overridden from Border:
26 virtual void Paint(const View& view, gfx::Canvas* canvas) const OVERRIDE;
27 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE;
28
29 private:
30 struct BorderImages {
31 BorderImages();
32 // |image_ids| must contain 9 image ids.
33 explicit BorderImages(const int image_ids[]);
34 ~BorderImages();
35
36 gfx::ImageSkia top_left;
37 gfx::ImageSkia top;
38 gfx::ImageSkia top_right;
39 gfx::ImageSkia left;
40 gfx::ImageSkia center;
41 gfx::ImageSkia right;
42 gfx::ImageSkia bottom_left;
43 gfx::ImageSkia bottom;
44 gfx::ImageSkia bottom_right;
45 };
46
47 // Set the images shown for the specified button state.
48 void SetImages(CustomButton::ButtonState state, const BorderImages& images);
49
50 // Paint the view-style images for the specified button state.
51 void PaintImages(const View& view,
52 gfx::Canvas* canvas,
53 CustomButton::ButtonState state) const;
54
55 // Paint the native-style button border and background.
56 void PaintNativeTheme(const View& view, gfx::Canvas* canvas) const;
57
58 // The images shown for each button state.
59 BorderImages images_[CustomButton::BS_COUNT];
60
61 // A delegate and flag controlling the native/Views theme styling.
62 NativeThemeDelegate* native_theme_delegate_;
63 bool native_theme_;
64
65 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder);
66 };
67
68 } // namespace views
69
70 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | ui/views/controls/button/label_button_border.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698