Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: ui/views/widget/widget.h

Issue 6286013: V2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/root_view.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget.h
===================================================================
--- ui/views/widget/widget.h (revision 0)
+++ ui/views/widget/widget.h (revision 0)
@@ -0,0 +1,131 @@
+// 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_WIDGET_H_
+#define UI_VIEWS_WIDGET_WIDGET_H_
+
+#include "base/logging.h"
+#include "base/scoped_ptr.h"
+#include "base/task.h"
+#include "gfx/point.h"
+#include "ui/views/native_types.h"
+#include "ui/views/widget/native_widget_listener.h"
+
+namespace gfx {
+class Path;
+class Rect;
+}
+
+namespace ui {
+namespace internal {
+class RootView;
+}
+class NativeWidget;
+class ThemeProvider;
+class View;
+
+////////////////////////////////////////////////////////////////////////////////
+// Widget class
+//
+// Encapsulates the platform-specific rendering, event receiving and widget
+// management aspects of the UI framework.
+//
+// Owns a RootView and thus a View hierarchy. Can contain child Widgets.
+// Widget is a platform-independent type that communicates with a platform or
+// context specific NativeWidget implementation.
+//
+// TODO(beng): Consider ownership of this object vs. NativeWidget.
+class Widget : public internal::NativeWidgetListener {
+ public:
+ explicit Widget(View* contents_view);
+ virtual ~Widget();
+
+ bool set_delete_on_destroy(bool delete_on_destroy) {
+ delete_on_destroy_ = delete_on_destroy;
+ }
+
+ // Initialization.
+ void InitWithNativeViewParent(gfx::NativeView parent,
+ const gfx::Rect& bounds);
+ void InitWithWidgetParent(Widget* parent, const gfx::Rect& bounds);
+ void InitWithViewParent(View* parent, const gfx::Rect& bounds);
+
+ // Returns the bounding rect of the Widget in screen coordinates.
+ gfx::Rect GetWindowScreenBounds() const;
+
+ // Returns the bounding rect of the Widget's client area, in screen
+ // coordinates.
+ gfx::Rect GetClientAreaScreenBounds() const;
+
+ // Sets the bounding rect of the Widget, in the coordinate system of its
+ // parent.
+ void SetBounds(const gfx::Rect& bounds);
+
+ void SetShape(const gfx::Path& shape);
+
+ void Show();
+ void Hide();
+
+ void Close();
+
+ void MoveAbove(Widget* other);
+ void SetAlwaysOnTop(bool always_on_top);
+
+ // Causes the specified rectangle to be added to the invalid rectangle for the
+ // Widget.
+ void InvalidateRect(const gfx::Rect& invalid_rect);
+
+ // Returns a ThemeProvider that can be used to provide resources when
+ // rendering Views associated with this Widget.
+ ThemeProvider* GetThemeProvider() const;
+
+ NativeWidget* native_widget() const { return native_widget_.get(); }
+
+ private:
+ // NativeWidgetListener implementation:
+ virtual void OnClose();
+ virtual void OnDestroy();
+ virtual void OnDisplayChanged();
+ virtual bool OnKeyEvent(const KeyEvent& event);
+ virtual void OnMouseCaptureLost();
+ virtual bool OnMouseEvent(const MouseEvent& event);
+ virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
+ virtual void OnNativeWidgetCreated();
+ virtual void OnPaint(gfx::Canvas* canvas);
+ virtual void OnSizeChanged(const gfx::Size& size);
+ virtual void OnWorkAreaChanged();
+
+ // Causes the Widget to be destroyed immediately.
+ void CloseNow();
+
+ // A NativeWidget implementation. This can be changed dynamically to a
+ // different implementation during the lifetime of the Widget.
+ scoped_ptr<NativeWidget> native_widget_;
+
+ // A RootView that owns the View hierarchy within this Widget.
+ scoped_ptr<internal::RootView> root_view_;
+
+ // True when any mouse button is pressed.
+ bool is_mouse_button_pressed_;
+
+ // The following are used to detect duplicate mouse move events and not
+ // deliver them. Displaying a window may result in the system generating
+ // duplicate move events even though the mouse hasn't moved.
+ bool last_mouse_event_was_move_;
+ gfx::Point last_mouse_event_position_;
+
+ // Handles closing the Widget after a return to the message loop to allow the
+ // stack to unwind.
+ ScopedRunnableMethodFactory<Widget> close_widget_factory_;
+
+ // True if the Widget should be automatically deleted when it is destroyed.
+ bool delete_on_destroy_;
+
+ DISALLOW_COPY_AND_ASSIGN(Widget);
+};
+
+} // namespace ui
+
+#endif // UI_VIEWS_WIDGET_WIDGET_H_
+
Property changes on: ui\views\widget\widget.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ui/views/widget/root_view.cc ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698