OLD | NEW |
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/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/views/background.h" | 10 #include "ui/views/background.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace examples { | 21 namespace examples { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 class DialogExample : public DialogDelegateView { | 25 class DialogExample : public DialogDelegateView { |
26 public: | 26 public: |
27 DialogExample(); | 27 DialogExample(); |
28 ~DialogExample() override; | 28 ~DialogExample() override; |
29 base::string16 GetWindowTitle() const override; | 29 base::string16 GetWindowTitle() const override; |
30 View* CreateExtraView() override; | 30 View* CreateExtraView() override; |
31 View* CreateTitlebarExtraView() override; | |
32 View* CreateFootnoteView() override; | 31 View* CreateFootnoteView() override; |
33 }; | 32 }; |
34 | 33 |
35 class ModalDialogExample : public DialogExample { | 34 class ModalDialogExample : public DialogExample { |
36 public: | 35 public: |
37 ModalDialogExample() {} | 36 ModalDialogExample() {} |
38 | 37 |
39 // WidgetDelegate: | 38 // WidgetDelegate: |
40 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; } | 39 ui::ModalType GetModalType() const override { return ui::MODAL_TYPE_WINDOW; } |
41 | 40 |
(...skipping 12 matching lines...) Expand all Loading... |
54 base::string16 DialogExample::GetWindowTitle() const { | 53 base::string16 DialogExample::GetWindowTitle() const { |
55 return ASCIIToUTF16("Dialog Widget Example"); | 54 return ASCIIToUTF16("Dialog Widget Example"); |
56 } | 55 } |
57 | 56 |
58 View* DialogExample::CreateExtraView() { | 57 View* DialogExample::CreateExtraView() { |
59 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Extra button!")); | 58 LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Extra button!")); |
60 button->SetStyle(Button::STYLE_BUTTON); | 59 button->SetStyle(Button::STYLE_BUTTON); |
61 return button; | 60 return button; |
62 } | 61 } |
63 | 62 |
64 View* DialogExample::CreateTitlebarExtraView() { | |
65 Label* label = new Label(ASCIIToUTF16("Extra view!")); | |
66 label->SetEnabledColor(SK_ColorBLUE); | |
67 return label; | |
68 } | |
69 | |
70 View* DialogExample::CreateFootnoteView() { | 63 View* DialogExample::CreateFootnoteView() { |
71 return new Label(ASCIIToUTF16("Footnote label!")); | 64 return new Label(ASCIIToUTF16("Footnote label!")); |
72 } | 65 } |
73 | 66 |
74 } // namespace | 67 } // namespace |
75 | 68 |
76 WidgetExample::WidgetExample() : ExampleBase("Widget") { | 69 WidgetExample::WidgetExample() : ExampleBase("Widget") { |
77 } | 70 } |
78 | 71 |
79 WidgetExample::~WidgetExample() { | 72 WidgetExample::~WidgetExample() { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL)); | 132 ShowWidget(sender, Widget::InitParams(Widget::InitParams::TYPE_CONTROL)); |
140 break; | 133 break; |
141 case CLOSE_WIDGET: | 134 case CLOSE_WIDGET: |
142 sender->GetWidget()->Close(); | 135 sender->GetWidget()->Close(); |
143 break; | 136 break; |
144 } | 137 } |
145 } | 138 } |
146 | 139 |
147 } // namespace examples | 140 } // namespace examples |
148 } // namespace views | 141 } // namespace views |
OLD | NEW |