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

Side by Side Diff: ui/aura/window.h

Issue 8082017: Change Window visibility to a simple boolean for now. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/desktop.cc ('k') | ui/aura/window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_AURA_WINDOW_H_ 5 #ifndef UI_AURA_WINDOW_H_
6 #define UI_AURA_WINDOW_H_ 6 #define UI_AURA_WINDOW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 26 matching lines...) Expand all
37 class RootWindow; 37 class RootWindow;
38 } 38 }
39 39
40 // Aura window implementation. Interesting events are sent to the 40 // Aura window implementation. Interesting events are sent to the
41 // WindowDelegate. 41 // WindowDelegate.
42 // TODO(beng): resolve ownership. 42 // TODO(beng): resolve ownership.
43 class AURA_EXPORT Window : public ui::LayerDelegate { 43 class AURA_EXPORT Window : public ui::LayerDelegate {
44 public: 44 public:
45 typedef std::vector<Window*> Windows; 45 typedef std::vector<Window*> Windows;
46 46
47 enum Visibility {
48 // Don't display the window onscreen and don't let it receive mouse
49 // events. This is the default.
50 VISIBILITY_HIDDEN = 1,
51
52 // Display the window and let it receive mouse events.
53 VISIBILITY_SHOWN = 2,
54
55 // Display the window but prevent it from receiving mouse events.
56 VISIBILITY_SHOWN_NO_INPUT = 3,
57 };
58
59 explicit Window(WindowDelegate* delegate); 47 explicit Window(WindowDelegate* delegate);
60 ~Window(); 48 ~Window();
61 49
62 void Init(); 50 void Init();
63 51
64 int id() const { return id_; } 52 int id() const { return id_; }
65 void set_id(int id) { id_ = id; } 53 void set_id(int id) { id_ = id; }
66 54
67 const std::string& name() const { return name_; } 55 const std::string& name() const { return name_; }
68 void set_name(const std::string& name) { name_ = name; } 56 void set_name(const std::string& name) { name_ = name; }
69 57
70 ui::Layer* layer() { return layer_.get(); } 58 ui::Layer* layer() { return layer_.get(); }
71 const ui::Layer* layer() const { return layer_.get(); } 59 const ui::Layer* layer() const { return layer_.get(); }
72 60
73 // Changes the visibility of the window. 61 // Changes the visibility of the window.
74 void SetVisibility(Visibility visibility); 62 void Show();
75 Visibility visibility() const { return visibility_; } 63 void Hide();
64 bool visible() const { return visible_; }
76 65
77 // Assigns a LayoutManager to size and place child windows. 66 // Assigns a LayoutManager to size and place child windows.
78 // The Window takes ownership of the LayoutManager. 67 // The Window takes ownership of the LayoutManager.
79 void SetLayoutManager(LayoutManager* layout_manager); 68 void SetLayoutManager(LayoutManager* layout_manager);
80 69
81 // Changes the bounds of the window. 70 // Changes the bounds of the window.
82 void SetBounds(const gfx::Rect& new_bounds); 71 void SetBounds(const gfx::Rect& new_bounds);
83 const gfx::Rect& bounds() const; 72 const gfx::Rect& bounds() const;
84 73
85 // Marks the a portion of window as needing to be painted. 74 // Marks the a portion of window as needing to be painted.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 147
159 // Returns an animation configured with the default duration. All animations 148 // Returns an animation configured with the default duration. All animations
160 // should use this. Caller owns returned value. 149 // should use this. Caller owns returned value.
161 static ui::Animation* CreateDefaultAnimation(); 150 static ui::Animation* CreateDefaultAnimation();
162 151
163 protected: 152 protected:
164 // Returns the RootWindow or NULL if we don't yet have a RootWindow. 153 // Returns the RootWindow or NULL if we don't yet have a RootWindow.
165 virtual internal::RootWindow* GetRoot(); 154 virtual internal::RootWindow* GetRoot();
166 155
167 private: 156 private:
157 // Updates the visible state of the layer, but does not make visible-state
158 // specific changes. Called from Show()/Hide().
159 void SetVisible(bool visible);
160
168 // Schedules a paint for the Window's entire bounds. 161 // Schedules a paint for the Window's entire bounds.
169 void SchedulePaint(); 162 void SchedulePaint();
170 163
171 // Overridden from ui::LayerDelegate: 164 // Overridden from ui::LayerDelegate:
172 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE; 165 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE;
173 166
174 WindowDelegate* delegate_; 167 WindowDelegate* delegate_;
175 168
176 Visibility visibility_; 169 bool visible_;
177 170
178 scoped_ptr<ui::Layer> layer_; 171 scoped_ptr<ui::Layer> layer_;
179 172
180 // The Window's parent. 173 // The Window's parent.
181 // TODO(beng): Implement NULL-ness for toplevels. 174 // TODO(beng): Implement NULL-ness for toplevels.
182 Window* parent_; 175 Window* parent_;
183 176
184 // Child windows. Topmost is last. 177 // Child windows. Topmost is last.
185 Windows children_; 178 Windows children_;
186 179
187 int id_; 180 int id_;
188 std::string name_; 181 std::string name_;
189 182
190 scoped_ptr<EventFilter> event_filter_; 183 scoped_ptr<EventFilter> event_filter_;
191 scoped_ptr<LayoutManager> layout_manager_; 184 scoped_ptr<LayoutManager> layout_manager_;
192 185
193 void* user_data_; 186 void* user_data_;
194 187
195 DISALLOW_COPY_AND_ASSIGN(Window); 188 DISALLOW_COPY_AND_ASSIGN(Window);
196 }; 189 };
197 190
198 } // namespace aura 191 } // namespace aura
199 192
200 #endif // UI_AURA_WINDOW_H_ 193 #endif // UI_AURA_WINDOW_H_
OLDNEW
« no previous file with comments | « ui/aura/desktop.cc ('k') | ui/aura/window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698