diff options
Diffstat (limited to 'views/controls')
-rw-r--r-- | views/controls/menu/menu_host.cc | 15 | ||||
-rw-r--r-- | views/controls/menu/menu_host_gtk.cc | 22 | ||||
-rw-r--r-- | views/controls/menu/menu_host_gtk.h | 3 | ||||
-rw-r--r-- | views/controls/menu/menu_host_win.cc | 5 | ||||
-rw-r--r-- | views/controls/menu/menu_host_win.h | 2 | ||||
-rw-r--r-- | views/controls/menu/native_menu_host.h | 4 | ||||
-rw-r--r-- | views/controls/tabbed_pane/native_tabbed_pane_gtk.cc | 4 | ||||
-rw-r--r-- | views/controls/tabbed_pane/native_tabbed_pane_win.cc | 7 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_views_unittest.cc | 6 |
9 files changed, 30 insertions, 38 deletions
diff --git a/views/controls/menu/menu_host.cc b/views/controls/menu/menu_host.cc index ce53f92..b8ad997 100644 --- a/views/controls/menu/menu_host.cc +++ b/views/controls/menu/menu_host.cc @@ -22,10 +22,6 @@ MenuHost::MenuHost(SubmenuView* submenu) NativeMenuHost::CreateNativeMenuHost(this))), submenu_(submenu), destroying_(false) { - Widget::CreateParams params; - params.type = Widget::CreateParams::TYPE_MENU; - params.has_dropshadow = true; - GetWidget()->SetCreateParams(params); } MenuHost::~MenuHost() { @@ -35,7 +31,16 @@ void MenuHost::InitMenuHost(gfx::NativeWindow parent, const gfx::Rect& bounds, View* contents_view, bool do_capture) { - native_menu_host_->InitMenuHost(parent, bounds); + Widget::CreateParams params; + params.type = Widget::CreateParams::TYPE_MENU; + params.has_dropshadow = true; +#if defined(OS_WIN) + params.parent = parent; +#elif defined(TOOLKIT_USES_GTK) + params.parent = GTK_WIDGET(parent); +#endif + params.bounds = bounds; + GetWidget()->Init(params); GetWidget()->SetContentsView(contents_view); ShowMenuHost(do_capture); } diff --git a/views/controls/menu/menu_host_gtk.cc b/views/controls/menu/menu_host_gtk.cc index fed765d..914b135 100644 --- a/views/controls/menu/menu_host_gtk.cc +++ b/views/controls/menu/menu_host_gtk.cc @@ -23,8 +23,7 @@ namespace views { // MenuHostGtk, public: MenuHostGtk::MenuHostGtk(internal::NativeMenuHostDelegate* delegate) - : WidgetGtk(WidgetGtk::TYPE_POPUP), - did_input_grab_(false), + : did_input_grab_(false), delegate_(delegate) { } @@ -34,16 +33,6 @@ MenuHostGtk::~MenuHostGtk() { //////////////////////////////////////////////////////////////////////////////// // MenuHostGtk, NativeMenuHost implementation: -void MenuHostGtk::InitMenuHost(gfx::NativeWindow parent, - const gfx::Rect& bounds) { - make_transient_to_parent(); - WidgetGtk::Init(GTK_WIDGET(parent), bounds); - // Make sure we get destroyed when the parent is destroyed. - gtk_window_set_destroy_with_parent(GTK_WINDOW(GetNativeView()), TRUE); - gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), - GDK_WINDOW_TYPE_HINT_MENU); -} - void MenuHostGtk::StartCapturing() { DCHECK(!did_input_grab_); @@ -92,6 +81,15 @@ NativeWidget* MenuHostGtk::AsNativeWidget() { //////////////////////////////////////////////////////////////////////////////// // MenuHostGtk, WidgetGtk overrides: +void MenuHostGtk::InitNativeWidget(const Widget::CreateParams& params) { + make_transient_to_parent(); + WidgetGtk::InitNativeWidget(params); + // Make sure we get destroyed when the parent is destroyed. + gtk_window_set_destroy_with_parent(GTK_WINDOW(GetNativeView()), TRUE); + gtk_window_set_type_hint(GTK_WINDOW(GetNativeView()), + GDK_WINDOW_TYPE_HINT_MENU); +} + // TODO(beng): remove once MenuHost is-a Widget RootView* MenuHostGtk::CreateRootView() { return delegate_->CreateRootView(); diff --git a/views/controls/menu/menu_host_gtk.h b/views/controls/menu/menu_host_gtk.h index 403a4d0..6ba471f 100644 --- a/views/controls/menu/menu_host_gtk.h +++ b/views/controls/menu/menu_host_gtk.h @@ -24,12 +24,11 @@ class MenuHostGtk : public WidgetGtk, private: // Overridden from NativeMenuHost: - virtual void InitMenuHost(gfx::NativeWindow parent, - const gfx::Rect& bounds) OVERRIDE; virtual void StartCapturing() OVERRIDE; virtual NativeWidget* AsNativeWidget() OVERRIDE; // Overridden from WidgetGtk: + virtual void InitNativeWidget(const Widget::CreateParams& params) OVERRIDE; virtual RootView* CreateRootView() OVERRIDE; virtual bool ShouldReleaseCaptureOnMouseReleased() const OVERRIDE; virtual void ReleaseMouseCapture() OVERRIDE; diff --git a/views/controls/menu/menu_host_win.cc b/views/controls/menu/menu_host_win.cc index 79387e4..5c2435d 100644 --- a/views/controls/menu/menu_host_win.cc +++ b/views/controls/menu/menu_host_win.cc @@ -21,11 +21,6 @@ MenuHostWin::~MenuHostWin() { //////////////////////////////////////////////////////////////////////////////// // MenuHostWin, NativeMenuHost implementation: -void MenuHostWin::InitMenuHost(gfx::NativeWindow parent, - const gfx::Rect& bounds) { - WidgetWin::Init(parent, bounds); -} - void MenuHostWin::StartCapturing() { SetMouseCapture(); } diff --git a/views/controls/menu/menu_host_win.h b/views/controls/menu/menu_host_win.h index 1558a6e..01a1419 100644 --- a/views/controls/menu/menu_host_win.h +++ b/views/controls/menu/menu_host_win.h @@ -23,8 +23,6 @@ class MenuHostWin : public WidgetWin, private: // Overridden from NativeMenuHost: - virtual void InitMenuHost(gfx::NativeWindow parent, - const gfx::Rect& bounds) OVERRIDE; virtual void StartCapturing() OVERRIDE; virtual NativeWidget* AsNativeWidget() OVERRIDE; diff --git a/views/controls/menu/native_menu_host.h b/views/controls/menu/native_menu_host.h index 0b64ca9..8a1a0f8 100644 --- a/views/controls/menu/native_menu_host.h +++ b/views/controls/menu/native_menu_host.h @@ -24,10 +24,6 @@ class NativeMenuHost { static NativeMenuHost* CreateNativeMenuHost( internal::NativeMenuHostDelegate* delegate); - // Initializes and shows the MenuHost. - virtual void InitMenuHost(gfx::NativeWindow parent, - const gfx::Rect& bounds) = 0; - // Starts capturing input events. virtual void StartCapturing() = 0; diff --git a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc index df935db..d2286b3 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_gtk.cc @@ -154,9 +154,9 @@ void NativeTabbedPaneGtk::DoAddTabAtIndex(int index, int tab_count = GetTabCount(); DCHECK(index <= tab_count); - Widget* page_container = Widget::CreateWidget( + Widget* page_container = Widget::CreateWidget(); + page_container->Init( Widget::CreateParams(Widget::CreateParams::TYPE_CONTROL)); - page_container->Init(NULL, gfx::Rect()); page_container->SetContentsView(contents); page_container->SetFocusTraversableParent(GetWidget()->GetFocusTraversable()); page_container->SetFocusTraversableParentView(this); diff --git a/views/controls/tabbed_pane/native_tabbed_pane_win.cc b/views/controls/tabbed_pane/native_tabbed_pane_win.cc index 91e053f..3d897f6 100644 --- a/views/controls/tabbed_pane/native_tabbed_pane_win.cc +++ b/views/controls/tabbed_pane/native_tabbed_pane_win.cc @@ -291,9 +291,10 @@ void NativeTabbedPaneWin::CreateNativeControl() { SendMessage(tab_control, WM_SETFONT, reinterpret_cast<WPARAM>(font), FALSE); // Create the view container which is a child of the TabControl. - content_window_ = Widget::CreateWidget( - Widget::CreateParams(Widget::CreateParams::TYPE_CONTROL)); - content_window_->Init(tab_control, gfx::Rect()); + content_window_ = Widget::CreateWidget(); + Widget::CreateParams params(Widget::CreateParams::TYPE_CONTROL); + params.parent = tab_control; + content_window_->Init(params); // Explicitly setting the WS_EX_LAYOUTRTL property for the HWND (see above // for why we waited until |content_window_| is created before we set this diff --git a/views/controls/textfield/native_textfield_views_unittest.cc b/views/controls/textfield/native_textfield_views_unittest.cc index 92f0e25..e6d385b 100644 --- a/views/controls/textfield/native_textfield_views_unittest.cc +++ b/views/controls/textfield/native_textfield_views_unittest.cc @@ -154,10 +154,10 @@ class NativeTextfieldViewsTest : public ViewsTestBase, ASSERT_FALSE(textfield_); textfield_ = new TestTextfield(style); textfield_->SetController(this); + widget_ = Widget::CreateWidget(); Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); - params.mirror_origin_in_rtl = false; - widget_ = Widget::CreateWidget(params); - widget_->Init(NULL, gfx::Rect(100, 100, 100, 100)); + params.bounds = gfx::Rect(100, 100, 100, 100); + widget_->Init(params); View* container = new View(); widget_->SetContentsView(container); container->AddChildView(textfield_); |