diff options
-rw-r--r-- | ui/views/views.gyp | 2 | ||||
-rw-r--r-- | ui/views/widget/window_manager.cc | 100 | ||||
-rw-r--r-- | ui/views/widget/window_manager.h | 79 |
3 files changed, 0 insertions, 181 deletions
diff --git a/ui/views/views.gyp b/ui/views/views.gyp index 147c338..86327d3 100644 --- a/ui/views/views.gyp +++ b/ui/views/views.gyp @@ -366,8 +366,6 @@ 'widget/widget.h', 'widget/widget_delegate.cc', 'widget/widget_delegate.h', - 'widget/window_manager.cc', - 'widget/window_manager.h', 'window/client_view.cc', 'window/client_view.h', 'window/custom_frame_view.cc', diff --git a/ui/views/widget/window_manager.cc b/ui/views/widget/window_manager.cc deleted file mode 100644 index ead923c..0000000 --- a/ui/views/widget/window_manager.cc +++ /dev/null @@ -1,100 +0,0 @@ -// 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. - -#include "ui/views/widget/window_manager.h" - -#include "base/compiler_specific.h" -#include "ui/views/events/event.h" -#include "ui/views/widget/widget.h" - -namespace { - -views::WindowManager* window_manager = NULL; - -class NullWindowManager : public views::WindowManager { - public: - NullWindowManager() : mouse_capture_(NULL) { - } - - virtual void StartMoveDrag(views::Widget* widget, - const gfx::Point& screen_point) OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual void StartResizeDrag(views::Widget* widget, - const gfx::Point& screen_point, - int hittest_code) OVERRIDE { - NOTIMPLEMENTED(); - } - - virtual bool SetMouseCapture(views::Widget* widget) OVERRIDE { - if (mouse_capture_ == widget) - return true; - if (mouse_capture_) - return false; - mouse_capture_ = widget; - return true; - } - - virtual bool ReleaseMouseCapture(views::Widget* widget) OVERRIDE { - if (widget && mouse_capture_ != widget) - return false; - mouse_capture_ = NULL; - return true; - } - - virtual bool HasMouseCapture(const views::Widget* widget) const OVERRIDE { - return mouse_capture_ == widget; - } - - virtual bool HandleKeyEvent(views::Widget* widget, - const views::KeyEvent& event) OVERRIDE { - return false; - } - - virtual bool HandleMouseEvent(views::Widget* widget, - const views::MouseEvent& event) OVERRIDE { - if (mouse_capture_) { - views::MouseEvent translated(event, widget->GetRootView(), - mouse_capture_->GetRootView()); - mouse_capture_->OnMouseEvent(translated); - return true; - } - return false; - } - - virtual ui::TouchStatus HandleTouchEvent(views::Widget* widget, - const views::TouchEvent& event) OVERRIDE { - return ui::TOUCH_STATUS_UNKNOWN; - } - - void Register(views::Widget* widget) OVERRIDE {} - - private: - views::Widget* mouse_capture_; -}; - -} // namespace - -namespace views { - -WindowManager::WindowManager() { -} - -WindowManager::~WindowManager() { -} - -// static -void WindowManager::Install(WindowManager* wm) { - window_manager = wm; -} - -// static -WindowManager* WindowManager::Get() { - if (!window_manager) - window_manager = new NullWindowManager(); - return window_manager; -} - -} // namespace views diff --git a/ui/views/widget/window_manager.h b/ui/views/widget/window_manager.h deleted file mode 100644 index abb6232..0000000 --- a/ui/views/widget/window_manager.h +++ /dev/null @@ -1,79 +0,0 @@ -// 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. - -#ifndef UI_VIEWS_WIDGET_WINDOW_MANAGER_H_ -#define UI_VIEWS_WIDGET_WINDOW_MANAGER_H_ -#pragma once - -#include "base/basictypes.h" -#include "ui/base/events.h" -#include "ui/views/views_export.h" - -namespace gfx { -class Point; -} - -namespace views { -class KeyEvent; -class MouseEvent; -class TouchEvent; -class Widget; - -// A interface to WindowManager. -class VIEWS_EXPORT WindowManager { - public: - WindowManager(); - virtual ~WindowManager(); - - // Starts moving window given by |widget|. |point| represents the - // initial location of the mouse pointer. - virtual void StartMoveDrag(Widget* widget, const gfx::Point& point) = 0; - - // Starts resizing window give by |widget|. |point| represents the - // initial location of the mouse pointer and |hittest_code| represents - // the edge of the window a user selected to resize the window. See - // ui/base/hit_test.h for the hittest_code definition. - virtual void StartResizeDrag( - Widget* widget, const gfx::Point& point, int hittest_code) = 0; - - // Sets mouse capture on |widget|. Returns false if other widget - // already has mouse capture. - virtual bool SetMouseCapture(Widget* widget) = 0; - - // Releases the mouse capture on |widget|. Returns false if |widget| - // haven't capture the mouse. - virtual bool ReleaseMouseCapture(Widget* widget) = 0; - - // Checks if the |widget| has mouse capture. - virtual bool HasMouseCapture(const Widget* widget) const = 0; - - // WindowManager handles mouse event first. It may reisze/move window, - // or send the event to widget that has mouse capture. - virtual bool HandleKeyEvent(Widget* widget, const KeyEvent& event) = 0; - - // WindowManager handles mouse event first. It may resize/move window, - // or send the event to widget that has mouse capture. - virtual bool HandleMouseEvent(Widget* widget, const MouseEvent& event) = 0; - - // WindowManager handles touch event first. It is currently used only to - // activate windows. But it can also be used to move/resize windows. - virtual ui::TouchStatus HandleTouchEvent(Widget* widget, - const TouchEvent& event) = 0; - - // Register widget to the window manager. - virtual void Register(Widget* widget) = 0; - - // Installs window manager. - static void Install(WindowManager* wm); - - // Returns installed WindowManager. - static WindowManager* Get(); - - private: - DISALLOW_COPY_AND_ASSIGN(WindowManager); -}; - -} // namespace views - -#endif // UI_VIEWS_WIDGET_WINDOW_MANAGER_H_ |