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

Side by Side Diff: ui/views/examples/widget_example.cc

Issue 15861012: Polish new dialog style layout and sizing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove long title example debugging code. Created 7 years, 7 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
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 "ui/views/examples/widget_example.h" 5 #include "ui/views/examples/widget_example.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "ui/views/controls/button/label_button.h" 8 #include "ui/views/controls/button/label_button.h"
9 #include "ui/views/controls/label.h" 9 #include "ui/views/controls/label.h"
10 #include "ui/views/layout/box_layout.h" 10 #include "ui/views/layout/box_layout.h"
11 #include "ui/views/view.h" 11 #include "ui/views/view.h"
12 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
13 #include "ui/views/window/dialog_delegate.h" 13 #include "ui/views/window/dialog_delegate.h"
14 14
15 namespace views { 15 namespace views {
16 namespace examples { 16 namespace examples {
17 17
18 namespace { 18 namespace {
19 19
20 class DialogExample : public DialogDelegateView { 20 class DialogExample : public DialogDelegateView {
21 public: 21 public:
22 DialogExample(); 22 DialogExample();
23 virtual ~DialogExample(); 23 virtual ~DialogExample();
24 virtual string16 GetWindowTitle() const OVERRIDE; 24 virtual string16 GetWindowTitle() const OVERRIDE;
25 virtual View* CreateExtraView() OVERRIDE; 25 virtual View* CreateExtraView() OVERRIDE;
26 virtual View* CreateTitlebarExtraView() OVERRIDE;
26 virtual View* CreateFootnoteView() OVERRIDE; 27 virtual View* CreateFootnoteView() OVERRIDE;
27 }; 28 };
28 29
29 DialogExample::DialogExample() { 30 DialogExample::DialogExample() {
30 set_background(Background::CreateSolidBackground(SK_ColorGRAY)); 31 set_background(Background::CreateSolidBackground(SK_ColorGRAY));
31 SetLayoutManager(new BoxLayout(BoxLayout::kVertical, 10, 10, 10)); 32 SetLayoutManager(new BoxLayout(BoxLayout::kVertical, 10, 10, 10));
32 AddChildView(new Label(ASCIIToUTF16("Dialog contents label!"))); 33 AddChildView(new Label(ASCIIToUTF16("Dialog contents label!")));
33 } 34 }
34 35
35 DialogExample::~DialogExample() { 36 DialogExample::~DialogExample() {}
36 }
37 37
38 string16 DialogExample::GetWindowTitle() const { 38 string16 DialogExample::GetWindowTitle() const {
39 return ASCIIToUTF16("Dialog Widget Example"); 39 return ASCIIToUTF16("Dialog Widget Example");
40 } 40 }
41 41
42 View* DialogExample::CreateExtraView() { 42 View* DialogExample::CreateExtraView() {
43 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Extra button!")); 43 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Extra button!"));
44 button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON); 44 button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
45 return button; 45 return button;
46 } 46 }
47 47
48 View* DialogExample::CreateTitlebarExtraView() {
49 Label* label = new Label(ASCIIToUTF16("Extra view!"));
50 label->SetEnabledColor(SK_ColorBLUE);
51 return label;
52 }
53
48 View* DialogExample::CreateFootnoteView() { 54 View* DialogExample::CreateFootnoteView() {
49 return new Label(ASCIIToUTF16("Footnote label!")); 55 return new Label(ASCIIToUTF16("Footnote label!"));
50 } 56 }
51 57
52 } // namespace 58 } // namespace
53 59
54 WidgetExample::WidgetExample() : ExampleBase("Widget") { 60 WidgetExample::WidgetExample() : ExampleBase("Widget") {
55 } 61 }
56 62
57 WidgetExample::~WidgetExample() { 63 WidgetExample::~WidgetExample() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL)); 117 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL));
112 break; 118 break;
113 case CLOSE_WIDGET: 119 case CLOSE_WIDGET:
114 sender->GetWidget()->Close(); 120 sender->GetWidget()->Close();
115 break; 121 break;
116 } 122 }
117 } 123 }
118 124
119 } // namespace examples 125 } // namespace examples
120 } // namespace views 126 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/bubble/bubble_frame_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698