diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-26 19:31:24 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-26 19:31:24 +0000 |
commit | 243d16c23f758d3a9bbc8dcb01521baa770af536 (patch) | |
tree | 6c61e4049cd93d72a26a88a3bc9cfb93f0c1dd0c /views/widget | |
parent | ed84c4b34838742cd99ad8c43d817da4de0b19c6 (diff) | |
download | chromium_src-243d16c23f758d3a9bbc8dcb01521baa770af536.zip chromium_src-243d16c23f758d3a9bbc8dcb01521baa770af536.tar.gz chromium_src-243d16c23f758d3a9bbc8dcb01521baa770af536.tar.bz2 |
Rename CreateParams to InitParams.
http://crbug.com/72040
TEST=none
TBR=sky
Review URL: http://codereview.chromium.org/6901034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/widget')
-rw-r--r-- | views/widget/native_widget.h | 2 | ||||
-rw-r--r-- | views/widget/native_widget_test_utils_gtk.cc | 4 | ||||
-rw-r--r-- | views/widget/native_widget_test_utils_win.cc | 4 | ||||
-rw-r--r-- | views/widget/widget.cc | 12 | ||||
-rw-r--r-- | views/widget/widget.h | 11 | ||||
-rw-r--r-- | views/widget/widget_gtk.cc | 16 | ||||
-rw-r--r-- | views/widget/widget_gtk.h | 8 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 16 | ||||
-rw-r--r-- | views/widget/widget_win.h | 4 | ||||
-rw-r--r-- | views/widget/widget_win_unittest.cc | 2 |
10 files changed, 39 insertions, 40 deletions
diff --git a/views/widget/native_widget.h b/views/widget/native_widget.h index 1dba231..451a0e9 100644 --- a/views/widget/native_widget.h +++ b/views/widget/native_widget.h @@ -59,7 +59,7 @@ class NativeWidget { gfx::NativeView new_parent); // Initializes the NativeWidget. - virtual void InitNativeWidget(const Widget::CreateParams& params) = 0; + virtual void InitNativeWidget(const Widget::InitParams& params) = 0; // Returns the Widget associated with this NativeWidget. This function is // guaranteed to return non-NULL for the lifetime of the NativeWidget. diff --git a/views/widget/native_widget_test_utils_gtk.cc b/views/widget/native_widget_test_utils_gtk.cc index be6e129..6c478f2 100644 --- a/views/widget/native_widget_test_utils_gtk.cc +++ b/views/widget/native_widget_test_utils_gtk.cc @@ -17,7 +17,7 @@ NativeWidget* CreateNativeWidget() { NativeWidget* CreateNativeWidgetWithContents(View* contents_view) { Widget* widget = Widget::CreateWidget(); - Widget::CreateParams params(Widget::CreateParams::TYPE_WINDOW); + Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); params.delete_on_destroy = false; params.bounds = gfx::Rect(10, 10, 200, 200); widget->Init(params); @@ -26,7 +26,7 @@ NativeWidget* CreateNativeWidgetWithContents(View* contents_view) { NativeWidget* CreateNativeWidgetWithParent(NativeWidget* parent) { Widget* widget = Widget::CreateWidget(); - Widget::CreateParams params(Widget::CreateParams::TYPE_CONTROL); + Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); params.delete_on_destroy = false; params.parent = parent ? parent->GetWidget()->GetNativeView() : NULL; params.bounds = gfx::Rect(10, 10, 200, 200); diff --git a/views/widget/native_widget_test_utils_win.cc b/views/widget/native_widget_test_utils_win.cc index 37b7d27..59e1d8d 100644 --- a/views/widget/native_widget_test_utils_win.cc +++ b/views/widget/native_widget_test_utils_win.cc @@ -16,7 +16,7 @@ NativeWidget* CreateNativeWidget() { NativeWidget* CreateNativeWidgetWithContents(View* contents_view) { Widget* widget = Widget::CreateWidget(); - Widget::CreateParams params(Widget::CreateParams::TYPE_WINDOW); + Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); params.delete_on_destroy = false; params.bounds = gfx::Rect(10, 10, 200, 200); widget->Init(params); @@ -25,7 +25,7 @@ NativeWidget* CreateNativeWidgetWithContents(View* contents_view) { NativeWidget* CreateNativeWidgetWithParent(NativeWidget* parent) { Widget* widget = Widget::CreateWidget(); - Widget::CreateParams params(Widget::CreateParams::TYPE_CONTROL); + Widget::InitParams params(Widget::InitParams::TYPE_CONTROL); params.delete_on_destroy = false; params.child = false; // Implicitly set to true by ctor with TYPE_CONTROL. params.parent = parent ? parent->GetWidget()->GetNativeView() : NULL; diff --git a/views/widget/widget.cc b/views/widget/widget.cc index dd40007..380aa29 100644 --- a/views/widget/widget.cc +++ b/views/widget/widget.cc @@ -16,9 +16,9 @@ namespace views { //////////////////////////////////////////////////////////////////////////////// -// Widget, CreateParams: +// Widget, InitParams: -Widget::CreateParams::CreateParams() +Widget::InitParams::InitParams() : type(TYPE_WINDOW), child(false), transparent(false), @@ -33,7 +33,7 @@ Widget::CreateParams::CreateParams() native_widget(NULL) { } -Widget::CreateParams::CreateParams(Type type) +Widget::InitParams::InitParams(Type type) : type(type), child(type == TYPE_CONTROL), transparent(false), @@ -52,8 +52,8 @@ Widget::CreateParams::CreateParams(Type type) // Widget, public: // static -Widget::CreateParams Widget::WindowCreateParams() { - return CreateParams(CreateParams::TYPE_WINDOW); +Widget::InitParams Widget::WindowInitParams() { + return InitParams(InitParams::TYPE_WINDOW); } Widget::Widget() @@ -67,7 +67,7 @@ Widget::Widget() Widget::~Widget() { } -void Widget::Init(const CreateParams& params) { +void Widget::Init(const InitParams& params) { GetRootView(); default_theme_provider_.reset(new DefaultThemeProvider); native_widget_->InitNativeWidget(params); diff --git a/views/widget/widget.h b/views/widget/widget.h index ec33496..fa2f89d 100644 --- a/views/widget/widget.h +++ b/views/widget/widget.h @@ -62,8 +62,7 @@ class Window; class Widget : public internal::NativeWidgetDelegate, public FocusTraversable { public: - // TODO(beng): Rename to InitParams now this is required for Init(). - struct CreateParams { + struct InitParams { enum Type { TYPE_WINDOW, // A Window, like a frame window. TYPE_CONTROL, // A control, like a button. @@ -72,8 +71,8 @@ class Widget : public internal::NativeWidgetDelegate, // specialized to menus. }; - CreateParams(); - explicit CreateParams(Type type); + InitParams(); + explicit InitParams(Type type); Type type; bool child; @@ -89,7 +88,7 @@ class Widget : public internal::NativeWidgetDelegate, gfx::Rect bounds; NativeWidget* native_widget; }; - static CreateParams WindowCreateParams(); + static InitParams WindowInitParams(); Widget(); virtual ~Widget(); @@ -109,7 +108,7 @@ class Widget : public internal::NativeWidgetDelegate, const Widget* target, gfx::Rect* rect); - void Init(const CreateParams& params); + void Init(const InitParams& params); // Unconverted methods ------------------------------------------------------- diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc index 827c97c..edc8cf6 100644 --- a/views/widget/widget_gtk.cc +++ b/views/widget/widget_gtk.cc @@ -618,10 +618,10 @@ void WidgetGtk::RegisterChildExposeHandler(GtkWidget* child) { //////////////////////////////////////////////////////////////////////////////// // WidgetGtk, NativeWidget implementation: -void WidgetGtk::InitNativeWidget(const CreateParams& params) { - SetCreateParams(params); +void WidgetGtk::InitNativeWidget(const InitParams& params) { + SetInitParams(params); - CreateParams modified_params = params; + InitParams modified_params = params; gfx::NativeView parent = params.parent; if (params.parent_widget) { WidgetGtk* parent_gtk = @@ -1377,7 +1377,7 @@ void WidgetGtk::DispatchKeyEventPostIME(const KeyEvent& key) { gtk_bindings_activate_event(GTK_OBJECT(widget_), event); } -void WidgetGtk::SetCreateParams(const CreateParams& params) { +void WidgetGtk::SetInitParams(const InitParams& params) { DCHECK(!GetNativeView()); delete_on_destroy_ = params.delete_on_destroy; @@ -1388,7 +1388,7 @@ void WidgetGtk::SetCreateParams(const CreateParams& params) { if (!params.accept_events && !child_) ignore_events_ = true; - if (params.type == CreateParams::TYPE_MENU) { + if (params.type == InitParams::TYPE_MENU) { GdkEvent* event = gtk_get_current_event(); if (event) { is_mouse_button_pressed_ = event->type == GDK_BUTTON_PRESS || @@ -1449,7 +1449,7 @@ Window* WidgetGtk::GetWindowImpl(GtkWidget* widget) { return NULL; } -void WidgetGtk::CreateGtkWidget(const CreateParams& params) { +void WidgetGtk::CreateGtkWidget(const InitParams& params) { // We turn off double buffering for two reasons: // 1. We draw to a canvas then composite to the screen, which means we're // doing our own double buffering already. @@ -1503,8 +1503,8 @@ void WidgetGtk::CreateGtkWidget(const CreateParams& params) { } else { // Use our own window class to override GtkWindow's move_focus method. widget_ = gtk_views_window_new( - params.type == CreateParams::TYPE_WINDOW ? GTK_WINDOW_TOPLEVEL - : GTK_WINDOW_POPUP); + params.type == InitParams::TYPE_WINDOW ? GTK_WINDOW_TOPLEVEL + : GTK_WINDOW_POPUP); gtk_widget_set_name(widget_, "views-gtkwidget-window"); if (transient_to_parent_) { gtk_window_set_transient_for(GTK_WINDOW(widget_), diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h index 3839754..9022a35a 100644 --- a/views/widget/widget_gtk.h +++ b/views/widget/widget_gtk.h @@ -168,7 +168,7 @@ class WidgetGtk : public Widget, static void RegisterChildExposeHandler(GtkWidget* widget); // Overridden from NativeWidget: - virtual void InitNativeWidget(const CreateParams& params) OVERRIDE; + virtual void InitNativeWidget(const InitParams& params) OVERRIDE; virtual Widget* GetWidget() OVERRIDE; virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; virtual void* GetNativeWindowProperty(const char* name) OVERRIDE; @@ -276,7 +276,7 @@ class WidgetGtk : public Widget, // Overridden from internal::InputMethodDelegate virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; - void SetCreateParams(const CreateParams& params); + void SetInitParams(const InitParams& params); // This is called only when the window is transparent. CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*); @@ -290,7 +290,7 @@ class WidgetGtk : public Widget, static Window* GetWindowImpl(GtkWidget* widget); // Creates the GtkWidget. - void CreateGtkWidget(const CreateParams& params); + void CreateGtkWidget(const InitParams& params); // Invoked from create widget to enable the various bits needed for a // transparent background. This is only invoked if MakeTransparent has been @@ -339,7 +339,7 @@ class WidgetGtk : public Widget, bool transparent_; // Makes the window pass all events through to any windows behind it. - // Set during SetCreateParams before the widget is created. The actual work of + // Set during SetInitParams before the widget is created. The actual work of // making the window ignore events is done by ConfigureWidgetForIgnoreEvents. bool ignore_events_; diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 4748c43..5cacc9b 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -223,8 +223,8 @@ void WidgetWin::ViewHierarchyChanged(bool is_add, View* parent, //////////////////////////////////////////////////////////////////////////////// // WidgetWin, NativeWidget implementation: -void WidgetWin::InitNativeWidget(const Widget::CreateParams& params) { - SetCreateParams(params); +void WidgetWin::InitNativeWidget(const Widget::InitParams& params) { + SetInitParams(params); // Create the window. gfx::NativeView parent = params.parent_widget ? @@ -1002,7 +1002,7 @@ void WidgetWin::PostProcessActivateMessage(WidgetWin* widget, } } -void WidgetWin::SetCreateParams(const CreateParams& params) { +void WidgetWin::SetInitParams(const InitParams& params) { // Set non-style attributes. delete_on_destroy_ = params.delete_on_destroy; @@ -1030,14 +1030,14 @@ void WidgetWin::SetCreateParams(const CreateParams& params) { // Set type-dependent style attributes. switch (params.type) { - case CreateParams::TYPE_WINDOW: - case CreateParams::TYPE_CONTROL: + case InitParams::TYPE_WINDOW: + case InitParams::TYPE_CONTROL: break; - case CreateParams::TYPE_POPUP: + case InitParams::TYPE_POPUP: style |= WS_POPUP; ex_style |= WS_EX_TOOLWINDOW; break; - case CreateParams::TYPE_MENU: + case InitParams::TYPE_MENU: style |= WS_POPUP; is_mouse_button_pressed_ = ((GetKeyState(VK_LBUTTON) & 0x80) || @@ -1093,7 +1093,7 @@ void WidgetWin::RedrawLayeredWindowContents() { void WidgetWin::ClientAreaSizeChanged() { RECT r; - if (GetThemeProvider()->ShouldUseNativeFrame()) + if (GetThemeProvider()->ShouldUseNativeFrame() || IsZoomed()) GetClientRect(&r); else GetWindowRect(&r); diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index 5b25f2f..3d7b834 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -191,7 +191,7 @@ class WidgetWin : public ui::WindowImpl, } // Overridden from NativeWidget: - virtual void InitNativeWidget(const Widget::CreateParams& params) OVERRIDE; + virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; virtual Widget* GetWidget() OVERRIDE; virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; virtual void* GetNativeWindowProperty(const char* name) OVERRIDE; @@ -422,7 +422,7 @@ class WidgetWin : public ui::WindowImpl, static void PostProcessActivateMessage(WidgetWin* widget, int activation_state); - void SetCreateParams(const Widget::CreateParams& params); + void SetInitParams(const Widget::InitParams& params); // Synchronously paints the invalid contents of the Widget. void RedrawInvalidRect(); diff --git a/views/widget/widget_win_unittest.cc b/views/widget/widget_win_unittest.cc index 2014194..8abd577 100644 --- a/views/widget/widget_win_unittest.cc +++ b/views/widget/widget_win_unittest.cc @@ -44,7 +44,7 @@ class WidgetWinTest : public testing::Test { WidgetWin* WidgetWinTest::CreateWidgetWin() { scoped_ptr<Widget> widget(Widget::CreateWidget()); - Widget::CreateParams params(Widget::CreateParams::TYPE_WINDOW); + Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); params.delete_on_destroy = false; params.bounds = gfx::Rect(50, 50, 650, 650); widget->Init(params); |