diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 03:48:14 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 03:48:14 +0000 |
commit | 5c3039618c8877b29712a5aececb99f8b4a4dd41 (patch) | |
tree | 190f9e93f7e06cecd0c9c7164e73624bd681f658 | |
parent | e82f366761fe478f9ba29179be26937a8a376e83 (diff) | |
download | chromium_src-5c3039618c8877b29712a5aececb99f8b4a4dd41.zip chromium_src-5c3039618c8877b29712a5aececb99f8b4a4dd41.tar.gz chromium_src-5c3039618c8877b29712a5aececb99f8b4a4dd41.tar.bz2 |
Scrap WNDCLASSEX.hCursor, update GetCursorForPoint.
Default to Win arrow in View::GetCursorForPoint & RootView::UpdateCursor.
Simplify WidgetWin::SetCursor, avoid sending NULL.
Only SetCuror on client events (DWM handles non-client).
RIP TextButtonWithHandCursorOver (r57652 through r64531).
RIP WindowWin::InitClass & |resize_cursors_|.
Add OVERRIDE specifiers liberally.
BUG=35356
TEST=Cursor styles shown in Win & Linux toolkit_views.
Review URL: http://codereview.chromium.org/6880201
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83123 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/background_view.cc | 24 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/shutdown_button.cc | 12 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/shutdown_button.h | 12 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_view.cc | 15 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/user_view.h | 7 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/username_view.cc | 5 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/username_view.h | 11 | ||||
-rw-r--r-- | chrome/browser/ui/views/content_setting_bubble_contents.cc | 11 | ||||
-rw-r--r-- | ui/base/win/window_impl.cc | 29 | ||||
-rw-r--r-- | views/controls/link.cc | 13 | ||||
-rw-r--r-- | views/controls/link.h | 6 | ||||
-rw-r--r-- | views/controls/resize_area.cc | 7 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_views.h | 2 | ||||
-rw-r--r-- | views/view.cc | 7 | ||||
-rw-r--r-- | views/view.h | 11 | ||||
-rw-r--r-- | views/widget/root_view.cc | 15 | ||||
-rw-r--r-- | views/widget/widget_win.cc | 8 | ||||
-rw-r--r-- | views/widget/widget_win.h | 4 | ||||
-rw-r--r-- | views/window/window_win.cc | 15 | ||||
-rw-r--r-- | views/window/window_win.h | 7 |
20 files changed, 77 insertions, 144 deletions
diff --git a/chrome/browser/chromeos/login/background_view.cc b/chrome/browser/chromeos/login/background_view.cc index 3650562..6802b94 100644 --- a/chrome/browser/chromeos/login/background_view.cc +++ b/chrome/browser/chromeos/login/background_view.cc @@ -72,30 +72,6 @@ int GetStepId(size_t step) { } } -// The same as TextButton but switches cursor to hand cursor when mouse -// is over the button. -class TextButtonWithHandCursorOver : public views::TextButton { - public: - TextButtonWithHandCursorOver(views::ButtonListener* listener, - const std::wstring& text) - : views::TextButton(listener, text) { - } - - virtual ~TextButtonWithHandCursorOver() {} - - virtual gfx::NativeCursor GetCursorForPoint( - ui::EventType event_type, - const gfx::Point& p) { - if (!IsEnabled()) { - return NULL; - } - return gfx::GetCursor(GDK_HAND2); - } - - private: - DISALLOW_COPY_AND_ASSIGN(TextButtonWithHandCursorOver); -}; - // This gets rid of the ugly X default cursor. static void ResetXCursor() { // TODO(sky): nuke this once new window manager is in place. diff --git a/chrome/browser/chromeos/login/shutdown_button.cc b/chrome/browser/chromeos/login/shutdown_button.cc index 693a363..248a364 100644 --- a/chrome/browser/chromeos/login/shutdown_button.cc +++ b/chrome/browser/chromeos/login/shutdown_button.cc @@ -43,7 +43,7 @@ class HoverBackground : public views::Background { } // views::Background implementation. - virtual void Paint(gfx::Canvas* canvas, views::View* view) const { + virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { views::TextButton* button = static_cast<views::TextButton*>(view); if (button->state() == views::CustomButton::BS_HOT) { hover_->Paint(canvas, view); @@ -114,13 +114,9 @@ void ShutdownButton::OnLocaleChanged() { } } -gfx::NativeCursor ShutdownButton::GetCursorForPoint( - ui::EventType event_type, - const gfx::Point& p) { - if (!IsEnabled()) { - return NULL; - } - return gfx::GetCursor(GDK_HAND2); +gfx::NativeCursor ShutdownButton::GetCursorForPoint(ui::EventType event_type, + const gfx::Point& p) { + return IsEnabled() ? gfx::GetCursor(GDK_HAND2) : NULL; } void ShutdownButton::ButtonPressed(views::Button* sender, diff --git a/chrome/browser/chromeos/login/shutdown_button.h b/chrome/browser/chromeos/login/shutdown_button.h index 15cb2ad..23fbc60 100644 --- a/chrome/browser/chromeos/login/shutdown_button.h +++ b/chrome/browser/chromeos/login/shutdown_button.h @@ -24,17 +24,17 @@ class ShutdownButton : public views::TextButton, private: // views::View overrides. - virtual void OnLocaleChanged(); - virtual gfx::NativeCursor GetCursorForPoint( - ui::EventType event_type, - const gfx::Point& p); + virtual void OnLocaleChanged() OVERRIDE; + virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, + const gfx::Point& p) OVERRIDE; // views::ButtonListener implementation. - virtual void ButtonPressed(views::Button* sender, const views::Event& event); + virtual void ButtonPressed(views::Button* sender, + const views::Event& event) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(ShutdownButton); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SHUTDOWN_BUTTON_H +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SHUTDOWN_BUTTON_H_ diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc index e20d660..811bdfb 100644 --- a/chrome/browser/chromeos/login/user_view.cc +++ b/chrome/browser/chromeos/login/user_view.cc @@ -148,7 +148,7 @@ class RemoveButton : public views::TextButton { protected: // Overridden from View: - virtual void OnMouseExited(const views::MouseEvent& event) { + virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE { SetIcon(icon_); views::TextButton::SetText(std::wstring()); ClearMaxTextSize(); @@ -159,7 +159,7 @@ class RemoveButton : public views::TextButton { was_first_click_ = false; } - void NotifyClick(const views::Event& event) { + virtual void NotifyClick(const views::Event& event) OVERRIDE { if (!was_first_click_) { // On first click transform image to "remove" label. SetIcon(SkBitmap()); @@ -190,7 +190,7 @@ class RemoveButton : public views::TextButton { } } - void SetText(const std::wstring& text) { + virtual void SetText(const std::wstring& text) OVERRIDE { text_ = text; } @@ -227,17 +227,16 @@ class PodImageView : public views::ImageView { protected: // Overridden from View: - virtual void OnMouseEntered(const views::MouseEvent& event) { + virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE { views::ImageView::SetImage(image_hot_); } - virtual void OnMouseExited(const views::MouseEvent& event) { + virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE { views::ImageView::SetImage(image_); } - gfx::NativeCursor GetCursorForPoint( - ui::EventType event_type, - const gfx::Point& p) { + gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, + const gfx::Point& p) OVERRIDE { return (delegate_->IsUserSelected()) ? NULL : gfx::GetCursor(GDK_HAND2); } diff --git a/chrome/browser/chromeos/login/user_view.h b/chrome/browser/chromeos/login/user_view.h index 9afa8ab..19d5f23 100644 --- a/chrome/browser/chromeos/login/user_view.h +++ b/chrome/browser/chromeos/login/user_view.h @@ -53,8 +53,8 @@ class UserView : public views::View, UserView(Delegate* delegate, bool is_login, bool need_background); // view::View overrides. - virtual gfx::Size GetPreferredSize(); - virtual void OnLocaleChanged(); + virtual gfx::Size GetPreferredSize() OVERRIDE; + virtual void OnLocaleChanged() OVERRIDE; // Sets the user's image. If image's size is less than // 75% of window size, image size is preserved to avoid blur. Otherwise, @@ -76,7 +76,8 @@ class UserView : public views::View, virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; // Overridden from views::ButtonListener. - virtual void ButtonPressed(views::Button* sender, const views::Event& event); + virtual void ButtonPressed(views::Button* sender, + const views::Event& event) OVERRIDE; private: void Init(bool need_background); diff --git a/chrome/browser/chromeos/login/username_view.cc b/chrome/browser/chromeos/login/username_view.cc index 58b06a5..a93cb01 100644 --- a/chrome/browser/chromeos/login/username_view.cc +++ b/chrome/browser/chromeos/login/username_view.cc @@ -97,9 +97,8 @@ UsernameView* UsernameView::CreateShapedUsernameView( return new HalfRoundedView<UsernameView>(username, use_small_shape); } -gfx::NativeCursor UsernameView::GetCursorForPoint( - ui::EventType event_type, - const gfx::Point& p) { +gfx::NativeCursor UsernameView::GetCursorForPoint(ui::EventType event_type, + const gfx::Point& p) { return use_small_shape_ ? gfx::GetCursor(GDK_HAND2) : NULL; } diff --git a/chrome/browser/chromeos/login/username_view.h b/chrome/browser/chromeos/login/username_view.h index 5c5f3db..46d1c57 100644 --- a/chrome/browser/chromeos/login/username_view.h +++ b/chrome/browser/chromeos/login/username_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -37,7 +37,7 @@ class UsernameView : public views::Label { UsernameView(const std::wstring& username, bool use_small_shape); // Overriden from views::Label. - virtual void OnPaint(gfx::Canvas* canvas); + virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; // True indicates that this UsernameView is used for a user pod not // currently selected. @@ -45,10 +45,9 @@ class UsernameView : public views::Label { private: // Overriden from View. - virtual gfx::NativeCursor GetCursorForPoint( - ui::EventType event_type, - const gfx::Point& p); - virtual void OnLocaleChanged(); + virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, + const gfx::Point& p) OVERRIDE; + virtual void OnLocaleChanged() OVERRIDE; // Paints username to the bitmap with the bounds given. void PaintUsername(const gfx::Rect& bounds); diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc index 01261f3..5011140 100644 --- a/chrome/browser/ui/views/content_setting_bubble_contents.cc +++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc @@ -50,10 +50,6 @@ class ContentSettingBubbleContents::Favicon : public views::ImageView { virtual ~Favicon(); private: -#if defined(OS_WIN) - static HCURSOR g_hand_cursor; -#endif - // views::View overrides: virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; @@ -64,10 +60,6 @@ class ContentSettingBubbleContents::Favicon : public views::ImageView { views::Link* link_; }; -#if defined(OS_WIN) -HCURSOR ContentSettingBubbleContents::Favicon::g_hand_cursor = NULL; -#endif - ContentSettingBubbleContents::Favicon::Favicon( const SkBitmap& image, ContentSettingBubbleContents* parent, @@ -97,8 +89,7 @@ gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint( ui::EventType event_type, const gfx::Point& p) { #if defined(OS_WIN) - if (!g_hand_cursor) - g_hand_cursor = LoadCursor(NULL, IDC_HAND); + static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); return g_hand_cursor; #elif defined(OS_LINUX) return gfx::GetCursor(GDK_HAND2); diff --git a/ui/base/win/window_impl.cc b/ui/base/win/window_impl.cc index d265621..7c4a6cd 100644 --- a/ui/base/win/window_impl.cc +++ b/ui/base/win/window_impl.cc @@ -197,20 +197,23 @@ std::wstring WindowImpl::GetWindowClassName() { if (ClassRegistrar::GetInstance()->RetrieveClassName(class_info, &name)) return name; + HICON icon = GetDefaultWindowIcon(); + // No class found, need to register one. - WNDCLASSEX class_ex; - class_ex.cbSize = sizeof(WNDCLASSEX); - class_ex.style = class_info.style; - class_ex.lpfnWndProc = base::win::WrappedWindowProc<&WindowImpl::WndProc>; - class_ex.cbClsExtra = 0; - class_ex.cbWndExtra = 0; - class_ex.hInstance = NULL; - class_ex.hIcon = GetDefaultWindowIcon(); - class_ex.hCursor = LoadCursor(NULL, IDC_ARROW); - class_ex.hbrBackground = reinterpret_cast<HBRUSH>(class_info.background + 1); - class_ex.lpszMenuName = NULL; - class_ex.lpszClassName = name.c_str(); - class_ex.hIconSm = class_ex.hIcon; + WNDCLASSEX class_ex = { + sizeof(WNDCLASSEX), + class_info.style, + base::win::WrappedWindowProc<&WindowImpl::WndProc>, + 0, + 0, + NULL, + icon, + NULL, + reinterpret_cast<HBRUSH>(class_info.background + 1), + NULL, + name.c_str(), + icon + }; ATOM atom = RegisterClassEx(&class_ex); CHECK(atom) << GetLastError(); diff --git a/views/controls/link.cc b/views/controls/link.cc index fbb1c9b..061b36d 100644 --- a/views/controls/link.cc +++ b/views/controls/link.cc @@ -63,10 +63,6 @@ void GetColors(const SkColor* background_color, // NULL means "use default" namespace views { -#if defined(OS_WIN) -static HCURSOR g_hand_cursor = NULL; -#endif - const char Link::kViewClassName[] = "views/Link"; Link::Link() : Label(L""), @@ -157,9 +153,9 @@ void Link::SetFont(const gfx::Font& font) { ValidateStyle(); } -void Link::SetEnabled(bool f) { - if (f != enabled_) { - enabled_ = f; +void Link::SetEnabled(bool flag) { + if (flag != enabled_) { + enabled_ = flag; ValidateStyle(); SchedulePaint(); } @@ -170,8 +166,7 @@ gfx::NativeCursor Link::GetCursorForPoint(ui::EventType event_type, if (!enabled_) return NULL; #if defined(OS_WIN) - if (!g_hand_cursor) - g_hand_cursor = LoadCursor(NULL, IDC_HAND); + static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); return g_hand_cursor; #elif defined(OS_LINUX) return gfx::GetCursor(GDK_HAND2); diff --git a/views/controls/link.h b/views/controls/link.h index 79a940f..d0197ad 100644 --- a/views/controls/link.h +++ b/views/controls/link.h @@ -44,12 +44,12 @@ class Link : public Label { virtual void SetFont(const gfx::Font& font) OVERRIDE; // Set whether the link is enabled. - virtual void SetEnabled(bool f); + virtual void SetEnabled(bool flag) OVERRIDE; virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, - const gfx::Point& p); + const gfx::Point& p) OVERRIDE; - virtual std::string GetClassName() const; + virtual std::string GetClassName() const OVERRIDE; void SetHighlightedColor(const SkColor& color); void SetDisabledColor(const SkColor& color); diff --git a/views/controls/resize_area.cc b/views/controls/resize_area.cc index c04a537..8e17919 100644 --- a/views/controls/resize_area.cc +++ b/views/controls/resize_area.cc @@ -16,10 +16,6 @@ namespace views { const char ResizeArea::kViewClassName[] = "views/ResizeArea"; -#if defined(OS_WIN) -static HCURSOR g_resize_cursor = NULL; -#endif - //////////////////////////////////////////////////////////////////////////////// // ResizeArea @@ -40,8 +36,7 @@ gfx::NativeCursor ResizeArea::GetCursorForPoint(ui::EventType event_type, if (!enabled_) return NULL; #if defined(OS_WIN) - if (!g_resize_cursor) - g_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); + static HCURSOR g_resize_cursor = LoadCursor(NULL, IDC_SIZEWE); return g_resize_cursor; #elif defined(OS_LINUX) return gfx::GetCursor(GDK_SB_H_DOUBLE_ARROW); diff --git a/views/controls/textfield/native_textfield_views.h b/views/controls/textfield/native_textfield_views.h index 68ffbb4..532c8ec 100644 --- a/views/controls/textfield/native_textfield_views.h +++ b/views/controls/textfield/native_textfield_views.h @@ -107,7 +107,7 @@ class NativeTextfieldViews : public views::View, static const char kViewClassName[]; // Returns true when - // 1) built with GYP_DEFIENS="touchui=1" + // 1) built with GYP_DEFINES="touchui=1" // 2) enabled by SetEnableTextfieldViews(true) // 3) enabled by the command line flag "--enable-textfield-view". static bool IsTextfieldViewsEnabled(); diff --git a/views/view.cc b/views/view.cc index 9d1c976..177fa4b 100644 --- a/views/view.cc +++ b/views/view.cc @@ -769,11 +769,16 @@ View* View::GetEventHandlerForPoint(const gfx::Point& point) { gfx::NativeCursor View::GetCursorForPoint(ui::EventType event_type, const gfx::Point& p) { +#if defined(OS_WIN) + static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); + return arrow; +#else return NULL; +#endif } bool View::HitTest(const gfx::Point& l) const { - if (l.x() >= 0 && l.x() < width() && l.y() >= 0 && l.y() < height()) { + if (GetLocalBounds().Contains(l)) { if (HasHitTestMask()) { gfx::Path mask; GetHitTestMask(&mask); diff --git a/views/view.h b/views/view.h index 8fe4de8..5df51d6 100644 --- a/views/view.h +++ b/views/view.h @@ -583,12 +583,11 @@ class View : public AcceleratorTarget { // Returns the deepest visible descendant that contains the specified point. virtual View* GetEventHandlerForPoint(const gfx::Point& point); - // Return the cursor that should be used for this view or NULL if - // the default cursor should be used. The provided point is in the - // receiver's coordinate system. The caller is responsible for managing the - // lifetime of the returned object, though that lifetime may vary from - // platform to platform. On Windows, the cursor is a shared resource but in - // Gtk, the framework destroys the returned cursor after setting it. + // Return the cursor that should be used for this view or the default cursor. + // The provided point is in the receiver's coordinate system. The caller is + // responsible for managing the lifetime of the returned object, though that + // lifetime may vary from platform to platform. On Windows, the cursor is a + // shared resource, but Gtk destroys the returned cursor after setting it. virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, const gfx::Point& p); diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc index f69c6a4..cd9761d 100644 --- a/views/widget/root_view.cc +++ b/views/widget/root_view.cc @@ -304,12 +304,11 @@ void RootView::OnMouseMoved(const MouseEvent& event) { MouseEvent moved_event(e, this, mouse_move_handler_); mouse_move_handler_->OnMouseMoved(moved_event); - gfx::NativeCursor cursor = mouse_move_handler_->GetCursorForPoint( - moved_event.type(), moved_event.location()); - widget_->SetCursor(cursor); + if (!(event.flags() & ui::EF_IS_NON_CLIENT)) + widget_->SetCursor(mouse_move_handler_->GetCursorForPoint( + moved_event.type(), moved_event.location())); } else if (mouse_move_handler_ != NULL) { mouse_move_handler_->OnMouseExited(e); - widget_->SetCursor(NULL); } } @@ -463,7 +462,15 @@ bool RootView::ConvertPointToMouseHandler(const gfx::Point& l, gfx::Point* p) { // Input ----------------------------------------------------------------------- void RootView::UpdateCursor(const MouseEvent& event) { + if (event.flags() & ui::EF_IS_NON_CLIENT) + return; + gfx::NativeCursor cursor = NULL; +#if defined(OS_WIN) + static HCURSOR arrow = LoadCursor(NULL, IDC_ARROW); + cursor = arrow; +#endif + View* v = GetEventHandlerForPoint(event.location()); if (v && v != this) { gfx::Point l(event.location()); diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc index 937211b..1d2ab99 100644 --- a/views/widget/widget_win.cc +++ b/views/widget/widget_win.cc @@ -145,7 +145,6 @@ WidgetWin::WidgetWin() restore_focus_when_enabled_(false), accessibility_view_events_index_(-1), accessibility_view_events_(kMaxAccessibilityViewEvents), - previous_cursor_(NULL), is_input_method_win_(false) { set_native_widget(this); } @@ -439,12 +438,7 @@ void WidgetWin::SchedulePaintInRect(const gfx::Rect& rect) { } void WidgetWin::SetCursor(gfx::NativeCursor cursor) { - if (cursor) { - previous_cursor_ = ::SetCursor(cursor); - } else if (previous_cursor_) { - ::SetCursor(previous_cursor_); - previous_cursor_ = NULL; - } + ::SetCursor(cursor); } void WidgetWin::NotifyAccessibilityEvent( diff --git a/views/widget/widget_win.h b/views/widget/widget_win.h index 3c2974b..4fe63cc 100644 --- a/views/widget/widget_win.h +++ b/views/widget/widget_win.h @@ -510,10 +510,6 @@ class WidgetWin : public ui::WindowImpl, // we always mod this value with the max view events above . int accessibility_view_events_index_; - // The last cursor that was active before the current one was selected. Saved - // so that we can restore it. - gfx::NativeCursor previous_cursor_; - ViewProps props_; scoped_ptr<InputMethod> input_method_; diff --git a/views/window/window_win.cc b/views/window/window_win.cc index 76b8617..a1f0218 100644 --- a/views/window/window_win.cc +++ b/views/window/window_win.cc @@ -230,8 +230,6 @@ class WindowWin::ScopedRedrawLock { WindowWin* window_; }; -HCURSOR WindowWin::resize_cursors_[6]; - //////////////////////////////////////////////////////////////////////////////// // WindowWin, public: @@ -316,7 +314,6 @@ WindowWin::WindowWin(WindowDelegate* window_delegate) is_in_size_move_(false) { SetNativeWindow(this); is_window_ = true; - InitClass(); // Initialize these values to 0 so that subclasses can override the default // behavior before calling Init. set_window_style(0); @@ -1342,18 +1339,6 @@ void WindowWin::ExecuteSystemMenuCommand(int command) { SendMessage(GetNativeView(), WM_SYSCOMMAND, command, 0); } -void WindowWin::InitClass() { - static bool initialized = false; - if (!initialized) { - resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); - resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); - resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); - resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); - resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); - initialized = true; - } -} - namespace { BOOL CALLBACK WindowCallbackProc(HWND hwnd, LPARAM lParam) { NativeWidget* native_widget = diff --git a/views/window/window_win.h b/views/window/window_win.h index cf279f6..f998d31 100644 --- a/views/window/window_win.h +++ b/views/window/window_win.h @@ -213,13 +213,6 @@ class WindowWin : public WidgetWin, // Executes the specified SC_command. void ExecuteSystemMenuCommand(int command); - // Static resource initialization. - static void InitClass(); - enum ResizeCursor { - RC_NORMAL = 0, RC_VERTICAL, RC_HORIZONTAL, RC_NESW, RC_NWSE - }; - static HCURSOR resize_cursors_[6]; - // A delegate implementation that handles events received here. internal::NativeWindowDelegate* delegate_; |