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

Side by Side Diff: views/widget/widget_gtk.cc

Issue 114054: Splits TooltipManager so that it can be ported and stubs out the GTK... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/widget/widget_gtk.h ('k') | views/widget/widget_win.h » ('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) 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/widget/widget_gtk.h" 5 #include "views/widget/widget_gtk.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "views/fill_layout.h" 8 #include "views/fill_layout.h"
9 #include "views/widget/root_view.h" 9 #include "views/widget/root_view.h"
10 #include "views/widget/tooltip_manager_gtk.h"
10 #include "views/window/window_gtk.h" 11 #include "views/window/window_gtk.h"
11 12
12 namespace views { 13 namespace views {
13 14
14 // Returns the position of a widget on screen. 15 // Returns the position of a widget on screen.
15 static void GetWidgetPositionOnScreen(GtkWidget* widget, int* x, int *y) { 16 static void GetWidgetPositionOnScreen(GtkWidget* widget, int* x, int *y) {
16 while (widget) { 17 while (widget) {
17 if (GTK_IS_WINDOW(widget)) { 18 if (GTK_IS_WINDOW(widget)) {
18 int window_x, window_y; 19 int window_x, window_y;
19 gtk_window_get_position(GTK_WINDOW(widget), &window_x, &window_y); 20 gtk_window_get_position(GTK_WINDOW(widget), &window_x, &window_y);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // 146 //
146 // g_signal_connect(G_OBJECT(widget_), "drag_motion", 147 // g_signal_connect(G_OBJECT(widget_), "drag_motion",
147 // G_CALLBACK(drag_motion_event_cb), NULL); 148 // G_CALLBACK(drag_motion_event_cb), NULL);
148 // g_signal_connect(G_OBJECT(widget_), "drag_leave", 149 // g_signal_connect(G_OBJECT(widget_), "drag_leave",
149 // G_CALLBACK(drag_leave_event_cb), NULL); 150 // G_CALLBACK(drag_leave_event_cb), NULL);
150 // g_signal_connect(G_OBJECT(widget_), "drag_drop", 151 // g_signal_connect(G_OBJECT(widget_), "drag_drop",
151 // G_CALLBACK(drag_drop_event_cb), NULL); 152 // G_CALLBACK(drag_drop_event_cb), NULL);
152 // g_signal_connect(G_OBJECT(widget_), "drag_data_received", 153 // g_signal_connect(G_OBJECT(widget_), "drag_data_received",
153 // G_CALLBACK(drag_data_received_event_cb), NULL); 154 // G_CALLBACK(drag_data_received_event_cb), NULL);
154 155
156 tooltip_manager_.reset(new TooltipManagerGtk(this));
157
155 if (type_ == TYPE_CHILD) { 158 if (type_ == TYPE_CHILD) {
156 WidgetGtk* parent_widget = GetViewForNative(parent); 159 WidgetGtk* parent_widget = GetViewForNative(parent);
157 parent_widget->AddChild(widget_); 160 parent_widget->AddChild(widget_);
158 parent_widget->PositionChild(widget_, bounds.x(), bounds.y(), 161 parent_widget->PositionChild(widget_, bounds.x(), bounds.y(),
159 bounds.width(), bounds.height()); 162 bounds.width(), bounds.height());
160 } 163 }
161 } 164 }
162 165
163 void WidgetGtk::AddChild(GtkWidget* child) { 166 void WidgetGtk::AddChild(GtkWidget* child) {
164 gtk_container_add(GTK_CONTAINER(child_widget_parent_), child); 167 gtk_container_add(GTK_CONTAINER(child_widget_parent_), child);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 return GTK_WIDGET_VISIBLE(widget_); 297 return GTK_WIDGET_VISIBLE(widget_);
295 } 298 }
296 299
297 bool WidgetGtk::IsActive() const { 300 bool WidgetGtk::IsActive() const {
298 // If this only applies to windows, it shouldn't be in widget. 301 // If this only applies to windows, it shouldn't be in widget.
299 DCHECK(GTK_IS_WINDOW(widget_)); 302 DCHECK(GTK_IS_WINDOW(widget_));
300 return gtk_window_is_active(GTK_WINDOW(widget_)); 303 return gtk_window_is_active(GTK_WINDOW(widget_));
301 } 304 }
302 305
303 TooltipManager* WidgetGtk::GetTooltipManager() { 306 TooltipManager* WidgetGtk::GetTooltipManager() {
304 NOTIMPLEMENTED(); 307 return tooltip_manager_.get();
305 return NULL;
306 } 308 }
307 309
308 bool WidgetGtk::GetAccelerator(int cmd_id, Accelerator* accelerator) { 310 bool WidgetGtk::GetAccelerator(int cmd_id, Accelerator* accelerator) {
309 NOTIMPLEMENTED(); 311 NOTIMPLEMENTED();
310 return false; 312 return false;
311 } 313 }
312 314
313 Window* WidgetGtk::GetWindow() { 315 Window* WidgetGtk::GetWindow() {
314 return GetWindowImpl(widget_); 316 return GetWindowImpl(widget_);
315 } 317 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 void WidgetGtk::HandleGrabBroke() { 675 void WidgetGtk::HandleGrabBroke() {
674 if (has_capture_) { 676 if (has_capture_) {
675 if (is_mouse_down_) 677 if (is_mouse_down_)
676 root_view_->ProcessMouseDragCanceled(); 678 root_view_->ProcessMouseDragCanceled();
677 is_mouse_down_ = false; 679 is_mouse_down_ = false;
678 has_capture_ = false; 680 has_capture_ = false;
679 } 681 }
680 } 682 }
681 683
682 } // namespace views 684 } // namespace views
OLDNEW
« no previous file with comments | « views/widget/widget_gtk.h ('k') | views/widget/widget_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698