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

Side by Side Diff: views/window/window_gtk.cc

Issue 207057: Implements a couple of NOTIMPLEMENTEDs in window_gtk and comments on... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | « views/window/window_gtk.h ('k') | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "views/window/window_gtk.h" 5 #include "views/window/window_gtk.h"
6 6
7 #include "app/gfx/path.h" 7 #include "app/gfx/path.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/gfx/rect.h" 9 #include "base/gfx/rect.h"
10 #include "views/screen.h" 10 #include "views/screen.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 } 98 }
99 99
100 gfx::Rect WindowGtk::GetBounds() const { 100 gfx::Rect WindowGtk::GetBounds() const {
101 gfx::Rect bounds; 101 gfx::Rect bounds;
102 WidgetGtk::GetBounds(&bounds, true); 102 WidgetGtk::GetBounds(&bounds, true);
103 return bounds; 103 return bounds;
104 } 104 }
105 105
106 gfx::Rect WindowGtk::GetNormalBounds() const { 106 gfx::Rect WindowGtk::GetNormalBounds() const {
107 NOTIMPLEMENTED(); 107 // We currently don't support tiling, so this doesn't matter.
108 return GetBounds(); 108 return GetBounds();
109 } 109 }
110 110
111 void WindowGtk::SetBounds(const gfx::Rect& bounds, 111 void WindowGtk::SetBounds(const gfx::Rect& bounds,
112 gfx::NativeWindow other_window) { 112 gfx::NativeWindow other_window) {
113 // TODO: need to deal with other_window. 113 // TODO: need to deal with other_window.
114 WidgetGtk::SetBounds(bounds); 114 WidgetGtk::SetBounds(bounds);
115 } 115 }
116 116
117 void WindowGtk::Show() { 117 void WindowGtk::Show() {
118 gtk_widget_show_all(GetNativeView()); 118 gtk_widget_show_all(GetNativeView());
119 } 119 }
120 120
121 void WindowGtk::HideWindow() { 121 void WindowGtk::HideWindow() {
122 Hide(); 122 Hide();
123 } 123 }
124 124
125 void WindowGtk::PushForceHidden() {
126 NOTIMPLEMENTED();
127 }
128
129 void WindowGtk::PopForceHidden() {
130 NOTIMPLEMENTED();
131 }
132
133 void WindowGtk::Activate() { 125 void WindowGtk::Activate() {
134 NOTIMPLEMENTED(); 126 gtk_window_present(GTK_WINDOW(GetNativeView()));
135 } 127 }
136 128
137 void WindowGtk::Close() { 129 void WindowGtk::Close() {
138 if (window_closed_) { 130 if (window_closed_) {
139 // Don't do anything if we've already been closed. 131 // Don't do anything if we've already been closed.
140 return; 132 return;
141 } 133 }
142 134
143 if (non_client_view_->CanClose()) { 135 if (non_client_view_->CanClose()) {
144 WidgetGtk::Close(); 136 WidgetGtk::Close();
145 window_closed_ = true; 137 window_closed_ = true;
146 } 138 }
147 } 139 }
148 140
149 void WindowGtk::Maximize() { 141 void WindowGtk::Maximize() {
150 gtk_window_maximize(GetNativeWindow()); 142 gtk_window_maximize(GetNativeWindow());
151 } 143 }
152 144
153 void WindowGtk::Minimize() { 145 void WindowGtk::Minimize() {
154 gtk_window_iconify(GetNativeWindow()); 146 gtk_window_iconify(GetNativeWindow());
155 } 147 }
156 148
157 void WindowGtk::Restore() { 149 void WindowGtk::Restore() {
158 NOTIMPLEMENTED(); 150 if (IsMaximized())
151 gtk_window_unmaximize(GetNativeWindow());
152 else if (IsMinimized())
153 gtk_window_deiconify(GetNativeWindow());
154 else if (IsFullscreen())
155 SetFullscreen(false);
159 } 156 }
160 157
161 bool WindowGtk::IsActive() const { 158 bool WindowGtk::IsActive() const {
162 return gtk_window_is_active(GetNativeWindow()); 159 return gtk_window_is_active(GetNativeWindow());
163 } 160 }
164 161
165 bool WindowGtk::IsVisible() const { 162 bool WindowGtk::IsVisible() const {
166 return GTK_WIDGET_VISIBLE(GetNativeView()); 163 return GTK_WIDGET_VISIBLE(GetNativeView());
167 } 164 }
168 165
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // the native frame is being used, since this also updates the taskbar, etc. 199 // the native frame is being used, since this also updates the taskbar, etc.
203 std::wstring window_title = window_delegate_->GetWindowTitle(); 200 std::wstring window_title = window_delegate_->GetWindowTitle();
204 std::wstring localized_text; 201 std::wstring localized_text;
205 if (l10n_util::AdjustStringForLocaleDirection(window_title, &localized_text)) 202 if (l10n_util::AdjustStringForLocaleDirection(window_title, &localized_text))
206 window_title.assign(localized_text); 203 window_title.assign(localized_text);
207 204
208 gtk_window_set_title(GetNativeWindow(), WideToUTF8(window_title).c_str()); 205 gtk_window_set_title(GetNativeWindow(), WideToUTF8(window_title).c_str());
209 } 206 }
210 207
211 void WindowGtk::UpdateWindowIcon() { 208 void WindowGtk::UpdateWindowIcon() {
212 NOTIMPLEMENTED(); 209 // Doesn't matter for chrome os.
213 } 210 }
214 211
215 void WindowGtk::SetIsAlwaysOnTop(bool always_on_top) { 212 void WindowGtk::SetIsAlwaysOnTop(bool always_on_top) {
216 gtk_window_set_keep_above(GetNativeWindow(), always_on_top); 213 gtk_window_set_keep_above(GetNativeWindow(), always_on_top);
217 } 214 }
218 215
219 NonClientFrameView* WindowGtk::CreateFrameViewForWindow() { 216 NonClientFrameView* WindowGtk::CreateFrameViewForWindow() {
220 // TODO(erg): Always use a custom frame view? Are there cases where we let 217 // TODO(erg): Always use a custom frame view? Are there cases where we let
221 // the window manager deal with the X11 equivalent of the "non-client" area? 218 // the window manager deal with the X11 equivalent of the "non-client" area?
222 return new CustomFrameView(this); 219 return new CustomFrameView(this);
223 } 220 }
224 221
225 void WindowGtk::UpdateFrameAfterFrameChange() { 222 void WindowGtk::UpdateFrameAfterFrameChange() {
223 // We currently don't support different frame types on Gtk, so we don't
224 // need to implement this.
226 NOTIMPLEMENTED(); 225 NOTIMPLEMENTED();
227 } 226 }
228 227
229 WindowDelegate* WindowGtk::GetDelegate() const { 228 WindowDelegate* WindowGtk::GetDelegate() const {
230 return window_delegate_; 229 return window_delegate_;
231 } 230 }
232 231
233 NonClientView* WindowGtk::GetNonClientView() const { 232 NonClientView* WindowGtk::GetNonClientView() const {
234 return non_client_view_; 233 return non_client_view_;
235 } 234 }
236 235
237 ClientView* WindowGtk::GetClientView() const { 236 ClientView* WindowGtk::GetClientView() const {
238 return non_client_view_->client_view(); 237 return non_client_view_->client_view();
239 } 238 }
240 239
241 gfx::NativeWindow WindowGtk::GetNativeWindow() const { 240 gfx::NativeWindow WindowGtk::GetNativeWindow() const {
242 return GTK_WINDOW(GetNativeView()); 241 return GTK_WINDOW(GetNativeView());
243 } 242 }
244 243
245 bool WindowGtk::ShouldUseNativeFrame() const { 244 bool WindowGtk::ShouldUseNativeFrame() const {
246 return false; 245 return false;
247 } 246 }
248 247
249 void WindowGtk::FrameTypeChanged() { 248 void WindowGtk::FrameTypeChanged() {
249 // We currently don't support different frame types on Gtk, so we don't
250 // need to implement this.
250 NOTIMPLEMENTED(); 251 NOTIMPLEMENTED();
251 } 252 }
252 253
253 //////////////////////////////////////////////////////////////////////////////// 254 ////////////////////////////////////////////////////////////////////////////////
254 // WindowGtk, WidgetGtk overrides: 255 // WindowGtk, WidgetGtk overrides:
255 256
256 gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) { 257 gboolean WindowGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event) {
257 int hittest_code = 258 int hittest_code =
258 non_client_view_->NonClientHitTest(gfx::Point(event->x, event->y)); 259 non_client_view_->NonClientHitTest(gfx::Point(event->x, event->y));
259 switch (hittest_code) { 260 switch (hittest_code) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 WindowGtk* window_gtk) { 398 WindowGtk* window_gtk) {
398 return window_gtk->OnWindowStateEvent(widget, event); 399 return window_gtk->OnWindowStateEvent(widget, event);
399 } 400 }
400 401
401 void WindowGtk::SaveWindowPosition() { 402 void WindowGtk::SaveWindowPosition() {
402 // The delegate may have gone away on us. 403 // The delegate may have gone away on us.
403 if (!window_delegate_) 404 if (!window_delegate_)
404 return; 405 return;
405 406
406 bool maximized = window_state_ & GDK_WINDOW_STATE_MAXIMIZED; 407 bool maximized = window_state_ & GDK_WINDOW_STATE_MAXIMIZED;
407 gfx::Rect bounds; 408 window_delegate_->SaveWindowPlacement(GetBounds(), maximized);
408 WidgetGtk::GetBounds(&bounds, true);
409 window_delegate_->SaveWindowPlacement(bounds, maximized);
410 } 409 }
411 410
412 void WindowGtk::SetInitialBounds(GtkWindow* parent, 411 void WindowGtk::SetInitialBounds(GtkWindow* parent,
413 const gfx::Rect& create_bounds) { 412 const gfx::Rect& create_bounds) {
414 gfx::Rect saved_bounds(create_bounds.ToGdkRectangle()); 413 gfx::Rect saved_bounds(create_bounds.ToGdkRectangle());
415 if (window_delegate_->GetSavedWindowBounds(&saved_bounds)) { 414 if (window_delegate_->GetSavedWindowBounds(&saved_bounds)) {
416 WidgetGtk::SetBounds(saved_bounds); 415 WidgetGtk::SetBounds(saved_bounds);
417 } else { 416 } else {
418 if (create_bounds.IsEmpty()) { 417 if (create_bounds.IsEmpty()) {
419 SizeWindowToDefault(parent); 418 SizeWindowToDefault(parent);
(...skipping 20 matching lines...) Expand all
440 center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeWindow()); 439 center_rect = Screen::GetMonitorWorkAreaNearestWindow(GetNativeWindow());
441 } 440 }
442 gfx::Size size = non_client_view_->GetPreferredSize(); 441 gfx::Size size = non_client_view_->GetPreferredSize();
443 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2, 442 gfx::Rect bounds(center_rect.x() + (center_rect.width() - size.width()) / 2,
444 center_rect.y() + (center_rect.height() - size.height()) / 2, 443 center_rect.y() + (center_rect.height() - size.height()) / 2,
445 size.width(), size.height()); 444 size.width(), size.height());
446 SetBounds(bounds, NULL); 445 SetBounds(bounds, NULL);
447 } 446 }
448 447
449 } // namespace views 448 } // namespace views
OLDNEW
« no previous file with comments | « views/window/window_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698