added MouseWheel event support for Silverlight 3.0
[moon.git] / src / window-gtk.h
blob0bd096bc682f9cd871bac2bcb8cfdad6996e5d36
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * window-gtk.h: MoonWindow implementation using gtk widgets.
5 * Contact:
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2007 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
14 #ifndef __MOON_WINDOW_GTK_H__
15 #define __MOON_WINDOW_GTK_H__
17 #include <glib.h>
18 #include <gtk/gtk.h>
20 #include "window.h"
21 #include "runtime.h"
23 /* @Namespace=System.Windows */
24 class MoonWindowGtk : public MoonWindow {
25 public:
26 /* @GenerateCBinding,GeneratePInvoke */
27 MoonWindowGtk (bool fullscreen, int w = -1, int h = -1, MoonWindow* parent = NULL);
29 virtual ~MoonWindowGtk ();
31 virtual void Resize (int width, int height);
32 virtual void SetCursor (MouseCursor cursor);
33 virtual void SetBackgroundColor (Color *color);
34 virtual void Invalidate (Rect r);
35 virtual void ProcessUpdates ();
36 virtual gboolean HandleEvent (XEvent *event);
37 virtual void Show ();
38 virtual void Hide ();
39 virtual void EnableEvents (bool first);
40 virtual void DisableEvents ();
42 virtual void GrabFocus ();
43 virtual bool HasFocus ();
45 GtkWidget* GetWidget() { return widget; }
47 /* @GenerateCBinding,GeneratePInvoke */
48 void *GetNativeWidget () { return GetWidget (); } // same as GetWidget, just without bleeding GtkWidget into the cbindings
51 virtual bool IsFullScreen () { return fullscreen; }
53 virtual GdkWindow* GetGdkWindow ();
55 private:
56 GtkWidget *widget;
57 bool fullscreen;
59 static gboolean expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data);
60 static gboolean motion_notify (GtkWidget *widget, GdkEventMotion *event, gpointer user_data);
61 static gboolean crossing_notify (GtkWidget *widget, GdkEventCrossing *event, gpointer user_data);
62 static gboolean key_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
63 static gboolean key_release (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
64 static gboolean button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
65 static gboolean button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
66 static gboolean scroll (GtkWidget *widget, GdkEventScroll *event, gpointer user_data);
67 static gboolean focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer user_data);
68 static gboolean focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer user_data);
69 static gboolean realized (GtkWidget *widget, gpointer user_data);
70 static gboolean unrealized (GtkWidget *widget, gpointer user_data);
72 static void widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data);
73 static void widget_destroyed (GtkWidget *widget, gpointer user_data);
75 void InitializeFullScreen (MoonWindow *parent);
76 void InitializeNormal ();
77 void InitializeCommon ();
80 #endif /* __MOON_WINDOW_GTK_H__ */