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

Side by Side Diff: views/examples/bubble_example.cc

Issue 8368006: Support Windows native textfield, combobox, etc. in new bubbles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/examples/bubble_example.h" 5 #include "views/examples/bubble_example.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "views/bubble/bubble_delegate.h" 8 #include "views/bubble/bubble_delegate.h"
9 #include "views/controls/button/text_button.h" 9 #include "views/controls/button/text_button.h"
10 #include "views/controls/label.h" 10 #include "views/controls/label.h"
11 #include "views/layout/box_layout.h" 11 #include "views/layout/box_layout.h"
12 #include "views/layout/fill_layout.h" 12 #include "views/layout/fill_layout.h"
13 #include "views/widget/widget.h" 13 #include "views/widget/widget.h"
14 14
15 // TODO(msw): Remove textfield
16 #include "views/controls/textfield/textfield.h"
17
15 namespace examples { 18 namespace examples {
16 19
17 struct BubbleConfig { 20 struct BubbleConfig {
18 string16 label; 21 string16 label;
19 SkColor color; 22 SkColor color;
20 gfx::Point anchor_point; 23 gfx::Point anchor_point;
21 views::BubbleBorder::ArrowLocation arrow; 24 views::BubbleBorder::ArrowLocation arrow;
22 bool fade_in; 25 bool fade_in;
23 bool fade_out; 26 bool fade_out;
24 }; 27 };
(...skipping 10 matching lines...) Expand all
35 gfx::Point(), views::BubbleBorder::BOTTOM_RIGHT, false, true }; 38 gfx::Point(), views::BubbleBorder::BOTTOM_RIGHT, false, true };
36 39
37 class ExampleBubbleDelegateView : public views::BubbleDelegateView { 40 class ExampleBubbleDelegateView : public views::BubbleDelegateView {
38 public: 41 public:
39 ExampleBubbleDelegateView(const BubbleConfig& config) 42 ExampleBubbleDelegateView(const BubbleConfig& config)
40 : BubbleDelegateView(config.anchor_point, config.arrow, config.color), 43 : BubbleDelegateView(config.anchor_point, config.arrow, config.color),
41 label_(config.label) {} 44 label_(config.label) {}
42 45
43 protected: 46 protected:
44 virtual void Init() OVERRIDE { 47 virtual void Init() OVERRIDE {
45 SetLayoutManager(new views::FillLayout()); 48 //SetLayoutManager(new views::FillLayout());
46 views::Label* label = new views::Label(label_); 49 //views::Label* label = new views::Label(label_);
47 label->set_border(views::Border::CreateSolidBorder(10, GetColor())); 50 //label->set_border(views::Border::CreateSolidBorder(10, GetColor()));
48 AddChildView(label); 51 //label->set_background(
52 // views::Background::CreateSolidBackground(SK_ColorWHITE));
53 //AddChildView(label);
54
55 set_background(views::Background::CreateSolidBackground(SK_ColorBLUE));
56
57 // TODO(msw): Revert test textfield
58 SetLayoutManager(
59 new views::BoxLayout(views::BoxLayout::kVertical, 30, 30, 1));
60 views::Textfield* tf = new views::Textfield();
61 tf->SetText(label_);
62 tf->SetBackgroundColor(SK_ColorGREEN);
63 tf->set_default_width_in_chars(20);
64 tf->SizeToPreferredSize();
65 tf->set_border(views::Border::CreateSolidBorder(10, GetColor()));
66 set_border(views::Border::CreateSolidBorder(10, GetColor()));
67 AddChildView(tf);
49 } 68 }
50 69
51 private: 70 private:
52 string16 label_; 71 string16 label_;
53 }; 72 };
54 73
55 BubbleExample::BubbleExample(ExamplesMain* main) 74 BubbleExample::BubbleExample(ExamplesMain* main)
56 : ExampleBase(main, "Bubble") {} 75 : ExampleBase(main, "Bubble") {}
57 76
58 BubbleExample::~BubbleExample() {} 77 BubbleExample::~BubbleExample() {}
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 else 115 else
97 bubble->Show(); 116 bubble->Show();
98 117
99 if (config.fade_out) { 118 if (config.fade_out) {
100 bubble_delegate->set_close_on_esc(false); 119 bubble_delegate->set_close_on_esc(false);
101 bubble_delegate->StartFade(false); 120 bubble_delegate->StartFade(false);
102 } 121 }
103 } 122 }
104 123
105 } // namespace examples 124 } // namespace examples
OLDNEW
« views/bubble/bubble_delegate.cc ('K') | « views/bubble/bubble_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698