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

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: Created 9 years, 9 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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 181
179 // Overridden from NativeWidget: 182 // Overridden from NativeWidget:
180 virtual Widget* GetWidget() OVERRIDE; 183 virtual Widget* GetWidget() OVERRIDE;
181 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; 184 virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE;
182 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE; 185 virtual void* GetNativeWindowProperty(const char* name) OVERRIDE;
183 virtual TooltipManager* GetTooltipManager() const OVERRIDE; 186 virtual TooltipManager* GetTooltipManager() const OVERRIDE;
184 virtual bool IsScreenReaderActive() const OVERRIDE; 187 virtual bool IsScreenReaderActive() const OVERRIDE;
185 virtual void SetNativeCapture() OVERRIDE; 188 virtual void SetNativeCapture() OVERRIDE;
186 virtual void ReleaseNativeCapture() OVERRIDE; 189 virtual void ReleaseNativeCapture() OVERRIDE;
187 virtual bool HasNativeCapture() const OVERRIDE; 190 virtual bool HasNativeCapture() const OVERRIDE;
191 virtual InputMethod* GetInputMethodNative() OVERRIDE;
192 virtual void ReplaceInputMethod(InputMethod* input_method) OVERRIDE;
188 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; 193 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
189 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; 194 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
190 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 195 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
191 virtual void MoveAbove(Widget* widget) OVERRIDE; 196 virtual void MoveAbove(Widget* widget) OVERRIDE;
192 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; 197 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
193 virtual void Close() OVERRIDE; 198 virtual void Close() OVERRIDE;
194 virtual void CloseNow() OVERRIDE; 199 virtual void CloseNow() OVERRIDE;
195 virtual void Show() OVERRIDE; 200 virtual void Show() OVERRIDE;
196 virtual void Hide() OVERRIDE; 201 virtual void Hide() OVERRIDE;
197 virtual void SetOpacity(unsigned char opacity) OVERRIDE; 202 virtual void SetOpacity(unsigned char opacity) OVERRIDE;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 private: 290 private:
286 class DropObserver; 291 class DropObserver;
287 friend class DropObserver; 292 friend class DropObserver;
288 293
289 // Overridden from Widget 294 // Overridden from Widget
290 virtual RootView* CreateRootView() OVERRIDE; 295 virtual RootView* CreateRootView() OVERRIDE;
291 296
292 // Overridden from NativeWidget 297 // Overridden from NativeWidget
293 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 298 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
294 299
300 // Overridden from internal::InputMethodDelegate
301 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
302
295 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*); 303 CHROMEGTK_CALLBACK_1(WidgetGtk, gboolean, OnWindowPaint, GdkEventExpose*);
296 304
297 // Process a mouse click. 305 // Process a mouse click.
298 bool ProcessMousePressed(GdkEventButton* event); 306 bool ProcessMousePressed(GdkEventButton* event);
299 void ProcessMouseReleased(GdkEventButton* event); 307 void ProcessMouseReleased(GdkEventButton* event);
300 // Process scroll event. 308 // Process scroll event.
301 bool ProcessScroll(GdkEventScroll* event); 309 bool ProcessScroll(GdkEventScroll* event);
302 310
303 // Returns the first ancestor of |widget| that is a window. 311 // Returns the first ancestor of |widget| that is a window.
304 static Window* GetWindowImpl(GtkWidget* widget); 312 static Window* GetWindowImpl(GtkWidget* widget);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // This is false by default. 426 // This is false by default.
419 bool is_double_buffered_; 427 bool is_double_buffered_;
420 428
421 // Indicates if we should handle the upcoming Alt key release event. 429 // Indicates if we should handle the upcoming Alt key release event.
422 bool should_handle_menu_key_release_; 430 bool should_handle_menu_key_release_;
423 431
424 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the 432 // Valid for the lifetime of StartDragForViewFromMouseEvent, indicates the
425 // view the drag started from. 433 // view the drag started from.
426 View* dragged_view_; 434 View* dragged_view_;
427 435
436 scoped_ptr<InputMethod> input_method_;
sadrul 2011/03/21 19:57:45 Would it be possible to move input_method_ to Widg
James Su 2011/03/21 21:34:07 IMHO, it's not possible, different input method im
437
428 DISALLOW_COPY_AND_ASSIGN(WidgetGtk); 438 DISALLOW_COPY_AND_ASSIGN(WidgetGtk);
429 }; 439 };
430 440
431 } // namespace views 441 } // namespace views
432 442
433 #endif // VIEWS_WIDGET_WIDGET_GTK_H_ 443 #endif // VIEWS_WIDGET_WIDGET_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698