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

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

Issue 6675005: Integrate the new input method API for Views into Chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 9 years, 8 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.cc ('k') | views/widget/widget_gtk.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 VIEWS_WIDGET_WIDGET_GTK_H_ 5 #ifndef VIEWS_WIDGET_WIDGET_GTK_H_
6 #define VIEWS_WIDGET_WIDGET_GTK_H_ 6 #define VIEWS_WIDGET_WIDGET_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <gtk/gtk.h> 9 #include <gtk/gtk.h>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "ui/base/gtk/gtk_signal.h" 12 #include "ui/base/gtk/gtk_signal.h"
13 #include "ui/base/x/active_window_watcher_x.h" 13 #include "ui/base/x/active_window_watcher_x.h"
14 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
15 #include "views/focus/focus_manager.h" 15 #include "views/focus/focus_manager.h"
16 #include "views/ime/input_method_delegate.h"
17 #include "views/ime/input_method_gtk.h"
16 #include "views/widget/native_widget.h" 18 #include "views/widget/native_widget.h"
17 #include "views/widget/widget.h" 19 #include "views/widget/widget.h"
18 20
19 namespace gfx { 21 namespace gfx {
20 class Rect; 22 class Rect;
21 } 23 }
22 24
23 namespace ui { 25 namespace ui {
24 class OSExchangeData; 26 class OSExchangeData;
25 class OSExchangeDataProviderGtk; 27 class OSExchangeDataProviderGtk;
26 } 28 }
27 using ui::OSExchangeData; 29 using ui::OSExchangeData;
28 using ui::OSExchangeDataProviderGtk; 30 using ui::OSExchangeDataProviderGtk;
29 31
30 namespace views { 32 namespace views {
31 33
32 class DropTargetGtk; 34 class DropTargetGtk;
33 class TooltipManagerGtk; 35 class TooltipManagerGtk;
34 class View; 36 class View;
35 class WindowGtk; 37 class WindowGtk;
36 38
37 namespace internal { 39 namespace internal {
38 class NativeWidgetDelegate; 40 class NativeWidgetDelegate;
39 } 41 }
40 42
41 // Widget implementation for GTK. 43 // Widget implementation for GTK.
42 class WidgetGtk : public Widget, 44 class WidgetGtk : public Widget,
43 public NativeWidget, 45 public NativeWidget,
44 public ui::ActiveWindowWatcherX::Observer { 46 public ui::ActiveWindowWatcherX::Observer,
47 public internal::InputMethodDelegate {
45 public: 48 public:
46 // Type of widget. 49 // Type of widget.
47 enum Type { 50 enum Type {
48 // Used for popup type windows (bubbles, menus ...). 51 // Used for popup type windows (bubbles, menus ...).
49 // NOTE: on X windows of this type can NOT get focus. If you need a popup 52 // NOTE: on X windows of this type can NOT get focus. If you need a popup
50 // like widget that can be focused use TYPE_WINDOW and set the window type 53 // like widget that can be focused use TYPE_WINDOW and set the window type
51 // to WINDOW_TYPE_CHROME_INFO_BUBBLE. 54 // to WINDOW_TYPE_CHROME_INFO_BUBBLE.
52 TYPE_POPUP, 55 TYPE_POPUP,
53 56
54 // A top level window with no title or control buttons. 57 // A top level window with no title or control buttons.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 virtual void NotifyAccessibilityEvent( 167 virtual void NotifyAccessibilityEvent(
165 View* view, 168 View* view,
166 ui::AccessibilityTypes::Event event_type, 169 ui::AccessibilityTypes::Event event_type,
167 bool send_native_event); 170 bool send_native_event);
168 171
169 // Clears the focus on the native widget having the focus. 172 // Clears the focus on the native widget having the focus.
170 virtual void ClearNativeFocus(); 173 virtual void ClearNativeFocus();
171 174
172 // Handles a keyboard event by sending it to our focus manager. 175 // Handles a keyboard event by sending it to our focus manager.
173 // Returns true if it's handled by the focus manager. 176 // Returns true if it's handled by the focus manager.
174 bool HandleKeyboardEvent(GdkEventKey* event); 177 bool HandleKeyboardEvent(const KeyEvent& key);
175 178
176 // Enables debug painting. See |debug_paint_enabled_| for details. 179 // Enables debug painting. See |debug_paint_enabled_| for details.
177 static void EnableDebugPaint(); 180 static void EnableDebugPaint();
178 181
179 // Sets and deletes FREEZE_UPDATES property on given |window|. 182 // Sets and deletes FREEZE_UPDATES property on given |window|.
180 // It adds the property when |enable| is true and remove if false. 183 // It adds the property when |enable| is true and remove if false.
181 // Calling this method will realize the window if it's not realized yet. 184 // Calling this method will realize the window if it's not realized yet.
182 // This property is used to help WindowManager know when the window 185 // This property is used to help WindowManager know when the window
183 // is fully painted so that WM can map the fully painted window. 186 // is fully painted so that WM can map the fully painted window.
184 // The property is based on Owen Taylor's proposal at 187 // The property is based on Owen Taylor's proposal at
185 // http://mail.gnome.org/archives/wm-spec-list/2009-June/msg00002.html. 188 // http://mail.gnome.org/archives/wm-spec-list/2009-June/msg00002.html.
186 // This is just a hint to WM, and won't change the behavior for WM 189 // This is just a hint to WM, and won't change the behavior for WM
187 // which does not support this property. 190 // which does not support this property.
188 static void UpdateFreezeUpdatesProperty(GtkWindow* window, bool enable); 191 static void UpdateFreezeUpdatesProperty(GtkWindow* window, bool enable);
189 192
190 // Overridden from NativeWidget: 193 // Overridden from NativeWidget:
191 virtual Widget* GetWidget() OVERRIDE; 194 virtual Widget* GetWidget() OVERRIDE;
192 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; 195 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
193 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE; 196 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE;
194 virtual TooltipManager* GetTooltipManager() const OVERRIDE; 197 virtual TooltipManager* GetTooltipManager() const OVERRIDE;
195 virtual bool IsScreenReaderActive() const OVERRIDE; 198 virtual bool IsScreenReaderActive() const OVERRIDE;
196 virtual void SetMouseCapture() OVERRIDE; 199 virtual void SetMouseCapture() OVERRIDE;
197 virtual void ReleaseMouseCapture() OVERRIDE; 200 virtual void ReleaseMouseCapture() OVERRIDE;
198 virtual bool HasMouseCapture() const OVERRIDE; 201 virtual bool HasMouseCapture() const OVERRIDE;
202 virtual InputMethod* GetInputMethodNative() OVERRIDE;
203 virtual void ReplaceInputMethod(InputMethod* input_method) OVERRIDE;
199 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; 204 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
200 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; 205 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
201 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 206 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
202 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE; 207 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE;
203 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; 208 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
204 virtual void Close() OVERRIDE; 209 virtual void Close() OVERRIDE;
205 virtual void CloseNow() OVERRIDE; 210 virtual void CloseNow() OVERRIDE;
206 virtual void Show() OVERRIDE; 211 virtual void Show() OVERRIDE;
207 virtual void Hide() OVERRIDE; 212 virtual void Hide() OVERRIDE;
208 virtual void SetOpacity(unsigned char opacity) OVERRIDE; 213 virtual void SetOpacity(unsigned char opacity) OVERRIDE;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 private: 295 private:
291 class DropObserver; 296 class DropObserver;
292 friend class DropObserver; 297 friend class DropObserver;
293 298
294 // Overridden from Widget 299 // Overridden from Widget
295 virtual RootView* CreateRootView() OVERRIDE; 300 virtual RootView* CreateRootView() OVERRIDE;
296 301
297 // Overridden from NativeWidget 302 // Overridden from NativeWidget
298 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 303 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
299 304
305 // Overridden from internal::InputMethodDelegate
306 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
307
300 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*); 308 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*);
301 309
302 // Returns the first ancestor of |widget| that is a window. 310 // Returns the first ancestor of |widget| that is a window.
303 static Window* GetWindowImpl(GtkWidget* widget); 311 static Window* GetWindowImpl(GtkWidget* widget);
304 312
305 // Creates the GtkWidget. 313 // Creates the GtkWidget.
306 void CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds); 314 void CreateGtkWidget(GtkWidget* parent, const gfx::Rect& bounds);
307 315
308 // Invoked from create widget to enable the various bits needed for a 316 // Invoked from create widget to enable the various bits needed for a
309 // transparent background. This is only invoked if MakeTransparent has been 317 // transparent background. This is only invoked if MakeTransparent has been
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 bool should_handle_menu_key_release_; 415 bool should_handle_menu_key_release_;
408 416
409 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the 417 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the
410 // view the drag started from. 418 // view the drag started from.
411 View* dragged_view_; 419 View* dragged_view_;
412 420
413 // If the widget has ever been painted. This is used to guarantee 421 // If the widget has ever been painted. This is used to guarantee
414 // that window manager shows the window only after the window is painted. 422 // that window manager shows the window only after the window is painted.
415 bool painted_; 423 bool painted_;
416 424
425 scoped_ptr<InputMethod> input_method_;
426
417 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); 427 DISALLOW_COPY_AND_ASSIGN(WidgetGtk);
418 }; 428 };
419 429
420 } // namespace views 430 } // namespace views
421 431
422 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ 432 #endif // VIEWS_WIDGET_WIDGET_GTK_H_
OLDNEW
« no previous file with comments | « views/widget/widget.cc ('k') | views/widget/widget_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698