OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/views/widget/native_widget_mac.h" | |
6 | |
7 #include <Cocoa/Cocoa.h> | |
8 | |
9 #include "ui/gfx/font_list.h" | |
10 | |
11 namespace views { | |
12 | |
13 //////////////////////////////////////////////////////////////////////////////// | |
14 // NativeWidgetMac, public: | |
15 | |
16 NativeWidgetMac::NativeWidgetMac(internal::NativeWidgetDelegate* delegate) | |
17 : delegate_(delegate), window_(nil) { | |
18 } | |
19 | |
20 NativeWidgetMac::~NativeWidgetMac() { | |
21 } | |
22 | |
23 //////////////////////////////////////////////////////////////////////////////// | |
24 // NativeWidgetMac, internal::NativeWidgetPrivate implementation: | |
25 | |
26 void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { | |
27 // TODO(tapted): Convert position into Cocoa's flipped coordinate space. | |
28 NSRect content_rect = | |
29 NSMakeRect(0, 0, params.bounds.width(), params.bounds.height()); | |
30 // TODO(tapted): Determine a good initial style mask from |params|. | |
31 NSInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | | |
32 NSMiniaturizableWindowMask | NSResizableWindowMask; | |
33 window_.reset([[NSWindow alloc] initWithContentRect:content_rect | |
34 styleMask:style_mask | |
35 backing:NSBackingStoreBuffered | |
36 defer:NO]); | |
Andre
2014/05/22 21:22:25
delegate_->OnNativeWidgetCreated(false);
Should a
tapted
2014/05/23 01:11:30
I think for later - it will encourage us to ensure
| |
37 } | |
38 | |
39 NonClientFrameView* NativeWidgetMac::CreateNonClientFrameView() { | |
40 return NULL; | |
41 } | |
42 | |
43 bool NativeWidgetMac::ShouldUseNativeFrame() const { | |
44 return false; | |
45 } | |
46 | |
47 bool NativeWidgetMac::ShouldWindowContentsBeTransparent() const { | |
48 NOTIMPLEMENTED(); | |
49 return false; | |
50 } | |
51 | |
52 void NativeWidgetMac::FrameTypeChanged() { | |
53 NOTIMPLEMENTED(); | |
54 } | |
55 | |
56 Widget* NativeWidgetMac::GetWidget() { | |
57 return delegate_->AsWidget(); | |
58 } | |
59 | |
60 const Widget* NativeWidgetMac::GetWidget() const { | |
61 return delegate_->AsWidget(); | |
62 } | |
63 | |
64 gfx::NativeView NativeWidgetMac::GetNativeView() const { | |
65 return [window_ contentView]; | |
66 } | |
67 | |
68 gfx::NativeWindow NativeWidgetMac::GetNativeWindow() const { | |
69 return window_; | |
70 } | |
71 | |
72 Widget* NativeWidgetMac::GetTopLevelWidget() { | |
73 NOTIMPLEMENTED(); | |
74 return GetWidget(); | |
75 } | |
76 | |
77 const ui::Compositor* NativeWidgetMac::GetCompositor() const { | |
78 NOTIMPLEMENTED(); | |
79 return NULL; | |
80 } | |
81 | |
82 ui::Compositor* NativeWidgetMac::GetCompositor() { | |
83 NOTIMPLEMENTED(); | |
84 return NULL; | |
85 } | |
86 | |
87 ui::Layer* NativeWidgetMac::GetLayer() { | |
88 NOTIMPLEMENTED(); | |
89 return NULL; | |
90 } | |
91 | |
92 void NativeWidgetMac::ReorderNativeViews() { | |
93 NOTIMPLEMENTED(); | |
94 } | |
95 | |
96 void NativeWidgetMac::ViewRemoved(View* view) { | |
97 NOTIMPLEMENTED(); | |
98 } | |
99 | |
100 void NativeWidgetMac::SetNativeWindowProperty(const char* name, void* value) { | |
101 NOTIMPLEMENTED(); | |
102 } | |
103 | |
104 void* NativeWidgetMac::GetNativeWindowProperty(const char* name) const { | |
105 NOTIMPLEMENTED(); | |
106 return NULL; | |
107 } | |
108 | |
109 TooltipManager* NativeWidgetMac::GetTooltipManager() const { | |
110 NOTIMPLEMENTED(); | |
111 return NULL; | |
112 } | |
113 | |
114 void NativeWidgetMac::SetCapture() { | |
115 NOTIMPLEMENTED(); | |
116 } | |
117 | |
118 void NativeWidgetMac::ReleaseCapture() { | |
119 NOTIMPLEMENTED(); | |
120 } | |
121 | |
122 bool NativeWidgetMac::HasCapture() const { | |
123 NOTIMPLEMENTED(); | |
124 return false; | |
125 } | |
126 | |
127 InputMethod* NativeWidgetMac::CreateInputMethod() { | |
128 NOTIMPLEMENTED(); | |
129 return NULL; | |
130 } | |
131 | |
132 InputMethodDelegate* NativeWidgetMac::GetInputMethodDelegate() { | |
133 NOTIMPLEMENTED(); | |
134 return NULL; | |
135 } | |
136 | |
137 ui::InputMethod* NativeWidgetMac::GetHostInputMethod() { | |
138 NOTIMPLEMENTED(); | |
139 return NULL; | |
140 } | |
141 | |
142 void NativeWidgetMac::CenterWindow(const gfx::Size& size) { | |
143 NOTIMPLEMENTED(); | |
144 } | |
145 | |
146 void NativeWidgetMac::GetWindowPlacement(gfx::Rect* bounds, | |
147 ui::WindowShowState* maximized) const { | |
148 NOTIMPLEMENTED(); | |
149 } | |
150 | |
151 bool NativeWidgetMac::SetWindowTitle(const base::string16& title) { | |
152 NOTIMPLEMENTED(); | |
153 return false; | |
154 } | |
155 | |
156 void NativeWidgetMac::SetWindowIcons(const gfx::ImageSkia& window_icon, | |
157 const gfx::ImageSkia& app_icon) { | |
158 NOTIMPLEMENTED(); | |
159 } | |
160 | |
161 void NativeWidgetMac::InitModalType(ui::ModalType modal_type) { | |
162 NOTIMPLEMENTED(); | |
163 } | |
164 | |
165 gfx::Rect NativeWidgetMac::GetWindowBoundsInScreen() const { | |
166 NOTIMPLEMENTED(); | |
167 return gfx::Rect(); | |
168 } | |
169 | |
170 gfx::Rect NativeWidgetMac::GetClientAreaBoundsInScreen() const { | |
171 NOTIMPLEMENTED(); | |
172 return gfx::Rect(); | |
173 } | |
174 | |
175 gfx::Rect NativeWidgetMac::GetRestoredBounds() const { | |
176 NOTIMPLEMENTED(); | |
177 return gfx::Rect(); | |
178 } | |
179 | |
180 void NativeWidgetMac::SetBounds(const gfx::Rect& bounds) { | |
181 NOTIMPLEMENTED(); | |
182 } | |
183 | |
184 void NativeWidgetMac::SetSize(const gfx::Size& size) { | |
185 [window_ setContentSize:NSMakeSize(size.width(), size.height())]; | |
186 } | |
187 | |
188 void NativeWidgetMac::StackAbove(gfx::NativeView native_view) { | |
189 NOTIMPLEMENTED(); | |
190 } | |
191 | |
192 void NativeWidgetMac::StackAtTop() { | |
193 NOTIMPLEMENTED(); | |
194 } | |
195 | |
196 void NativeWidgetMac::StackBelow(gfx::NativeView native_view) { | |
197 NOTIMPLEMENTED(); | |
198 } | |
199 | |
200 void NativeWidgetMac::SetShape(gfx::NativeRegion shape) { | |
201 NOTIMPLEMENTED(); | |
202 } | |
203 | |
204 void NativeWidgetMac::Close() { | |
205 NOTIMPLEMENTED(); | |
206 } | |
207 | |
208 void NativeWidgetMac::CloseNow() { | |
209 NOTIMPLEMENTED(); | |
210 } | |
211 | |
212 void NativeWidgetMac::Show() { | |
213 NOTIMPLEMENTED(); | |
214 } | |
215 | |
216 void NativeWidgetMac::Hide() { | |
217 NOTIMPLEMENTED(); | |
218 } | |
219 | |
220 void NativeWidgetMac::ShowMaximizedWithBounds( | |
221 const gfx::Rect& restored_bounds) { | |
222 NOTIMPLEMENTED(); | |
223 } | |
224 | |
225 void NativeWidgetMac::ShowWithWindowState(ui::WindowShowState state) { | |
226 NOTIMPLEMENTED(); | |
227 } | |
228 | |
229 bool NativeWidgetMac::IsVisible() const { | |
230 NOTIMPLEMENTED(); | |
231 return true; | |
232 } | |
233 | |
234 void NativeWidgetMac::Activate() { | |
235 NOTIMPLEMENTED(); | |
236 } | |
237 | |
238 void NativeWidgetMac::Deactivate() { | |
239 NOTIMPLEMENTED(); | |
240 } | |
241 | |
242 bool NativeWidgetMac::IsActive() const { | |
243 NOTIMPLEMENTED(); | |
244 return true; | |
245 } | |
246 | |
247 void NativeWidgetMac::SetAlwaysOnTop(bool always_on_top) { | |
248 NOTIMPLEMENTED(); | |
249 } | |
250 | |
251 bool NativeWidgetMac::IsAlwaysOnTop() const { | |
252 NOTIMPLEMENTED(); | |
253 return false; | |
254 } | |
255 | |
256 void NativeWidgetMac::SetVisibleOnAllWorkspaces(bool always_visible) { | |
257 NOTIMPLEMENTED(); | |
258 } | |
259 | |
260 void NativeWidgetMac::Maximize() { | |
261 NOTIMPLEMENTED(); | |
262 } | |
263 | |
264 void NativeWidgetMac::Minimize() { | |
265 NOTIMPLEMENTED(); | |
266 } | |
267 | |
268 bool NativeWidgetMac::IsMaximized() const { | |
269 NOTIMPLEMENTED(); | |
270 return false; | |
271 } | |
272 | |
273 bool NativeWidgetMac::IsMinimized() const { | |
274 NOTIMPLEMENTED(); | |
275 return false; | |
276 } | |
277 | |
278 void NativeWidgetMac::Restore() { | |
279 NOTIMPLEMENTED(); | |
280 } | |
281 | |
282 void NativeWidgetMac::SetFullscreen(bool fullscreen) { | |
283 NOTIMPLEMENTED(); | |
284 } | |
285 | |
286 bool NativeWidgetMac::IsFullscreen() const { | |
287 NOTIMPLEMENTED(); | |
288 return false; | |
289 } | |
290 | |
291 void NativeWidgetMac::SetOpacity(unsigned char opacity) { | |
292 NOTIMPLEMENTED(); | |
293 } | |
294 | |
295 void NativeWidgetMac::SetUseDragFrame(bool use_drag_frame) { | |
296 NOTIMPLEMENTED(); | |
297 } | |
298 | |
299 void NativeWidgetMac::FlashFrame(bool flash_frame) { | |
300 NOTIMPLEMENTED(); | |
301 } | |
302 | |
303 void NativeWidgetMac::RunShellDrag(View* view, | |
304 const ui::OSExchangeData& data, | |
305 const gfx::Point& location, | |
306 int operation, | |
307 ui::DragDropTypes::DragEventSource source) { | |
308 NOTIMPLEMENTED(); | |
309 } | |
310 | |
311 void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { | |
312 NOTIMPLEMENTED(); | |
313 } | |
314 | |
315 void NativeWidgetMac::SetCursor(gfx::NativeCursor cursor) { | |
316 NOTIMPLEMENTED(); | |
317 } | |
318 | |
319 bool NativeWidgetMac::IsMouseEventsEnabled() const { | |
320 NOTIMPLEMENTED(); | |
321 return true; | |
322 } | |
323 | |
324 void NativeWidgetMac::ClearNativeFocus() { | |
325 NOTIMPLEMENTED(); | |
326 } | |
327 | |
328 gfx::Rect NativeWidgetMac::GetWorkAreaBoundsInScreen() const { | |
329 NOTIMPLEMENTED(); | |
330 return gfx::Rect(); | |
331 } | |
332 | |
333 Widget::MoveLoopResult NativeWidgetMac::RunMoveLoop( | |
334 const gfx::Vector2d& drag_offset, | |
335 Widget::MoveLoopSource source, | |
336 Widget::MoveLoopEscapeBehavior escape_behavior) { | |
337 NOTIMPLEMENTED(); | |
338 return Widget::MOVE_LOOP_CANCELED; | |
339 } | |
340 | |
341 void NativeWidgetMac::EndMoveLoop() { | |
342 NOTIMPLEMENTED(); | |
343 } | |
344 | |
345 void NativeWidgetMac::SetVisibilityChangedAnimationsEnabled(bool value) { | |
346 NOTIMPLEMENTED(); | |
347 } | |
348 | |
349 ui::NativeTheme* NativeWidgetMac::GetNativeTheme() const { | |
350 NOTIMPLEMENTED(); | |
351 return NULL; | |
352 } | |
353 | |
354 void NativeWidgetMac::OnRootViewLayout() const { | |
355 NOTIMPLEMENTED(); | |
356 } | |
357 | |
358 //////////////////////////////////////////////////////////////////////////////// | |
359 // NativeWidgetMac, NativeWidget implementation: | |
360 | |
361 ui::EventHandler* NativeWidgetMac::GetEventHandler() { | |
362 return NULL; | |
363 } | |
364 | |
365 //////////////////////////////////////////////////////////////////////////////// | |
366 // Widget, public: | |
367 | |
368 bool Widget::ConvertRect(const Widget* source, | |
369 const Widget* target, | |
370 gfx::Rect* rect) { | |
371 return false; | |
372 } | |
373 | |
374 namespace internal { | |
375 | |
376 //////////////////////////////////////////////////////////////////////////////// | |
377 // internal::NativeWidgetPrivate, public: | |
378 | |
379 // static | |
380 NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget( | |
381 internal::NativeWidgetDelegate* delegate) { | |
382 NOTIMPLEMENTED(); | |
383 return NULL; | |
384 } | |
385 | |
386 // static | |
387 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView( | |
388 gfx::NativeView native_view) { | |
389 NOTIMPLEMENTED(); | |
390 return NULL; | |
391 } | |
392 | |
393 // static | |
394 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow( | |
395 gfx::NativeWindow native_window) { | |
396 NOTIMPLEMENTED(); | |
397 return NULL; | |
398 } | |
399 | |
400 // static | |
401 NativeWidgetPrivate* NativeWidgetPrivate::GetTopLevelNativeWidget( | |
402 gfx::NativeView native_view) { | |
403 NOTIMPLEMENTED(); | |
404 return NULL; | |
405 } | |
406 | |
407 // static | |
408 void NativeWidgetPrivate::GetAllChildWidgets(gfx::NativeView native_view, | |
409 Widget::Widgets* children) { | |
410 NOTIMPLEMENTED(); | |
411 } | |
412 | |
413 // static | |
414 void NativeWidgetPrivate::GetAllOwnedWidgets(gfx::NativeView native_view, | |
415 Widget::Widgets* owned) { | |
416 NOTIMPLEMENTED(); | |
417 } | |
418 | |
419 // static | |
420 void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, | |
421 gfx::NativeView new_parent) { | |
422 NOTIMPLEMENTED(); | |
423 } | |
424 | |
425 // static | |
426 bool NativeWidgetPrivate::IsMouseButtonDown() { | |
427 NOTIMPLEMENTED(); | |
428 return false; | |
429 } | |
430 | |
431 // static | |
432 bool NativeWidgetPrivate::IsTouchDown() { | |
433 NOTIMPLEMENTED(); | |
434 return false; | |
435 } | |
436 | |
437 // static | |
438 gfx::FontList NativeWidgetPrivate::GetWindowTitleFontList() { | |
439 NOTIMPLEMENTED(); | |
440 return gfx::FontList(); | |
441 } | |
442 | |
443 } // namespace internal | |
444 } // namespace views | |
OLD | NEW |