-#if (GTK_MINOR_VERSION == 0)
-/* these functions are copied verbatim from GTK 1.2 */
-static void
-gdkx_XConvertCase (KeySym symbol,
- KeySym *lower,
- KeySym *upper)
-{
- register KeySym sym = symbol;
-
- g_return_if_fail (lower != NULL);
- g_return_if_fail (upper != NULL);
-
- *lower = sym;
- *upper = sym;
-
- switch (sym >> 8)
- {
-#if defined (GDK_A) && defined (GDK_Ooblique)
- case 0: /* Latin 1 */
- if ((sym >= GDK_A) && (sym <= GDK_Z))
- *lower += (GDK_a - GDK_A);
- else if ((sym >= GDK_a) && (sym <= GDK_z))
- *upper -= (GDK_a - GDK_A);
- else if ((sym >= GDK_Agrave) && (sym <= GDK_Odiaeresis))
- *lower += (GDK_agrave - GDK_Agrave);
- else if ((sym >= GDK_agrave) && (sym <= GDK_odiaeresis))
- *upper -= (GDK_agrave - GDK_Agrave);
- else if ((sym >= GDK_Ooblique) && (sym <= GDK_Thorn))
- *lower += (GDK_oslash - GDK_Ooblique);
- else if ((sym >= GDK_oslash) && (sym <= GDK_thorn))
- *upper -= (GDK_oslash - GDK_Ooblique);
- break;
-#endif /* LATIN1 */
-
-#if defined (GDK_Aogonek) && defined (GDK_tcedilla)
- case 1: /* Latin 2 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym == GDK_Aogonek)
- *lower = GDK_aogonek;
- else if (sym >= GDK_Lstroke && sym <= GDK_Sacute)
- *lower += (GDK_lstroke - GDK_Lstroke);
- else if (sym >= GDK_Scaron && sym <= GDK_Zacute)
- *lower += (GDK_scaron - GDK_Scaron);
- else if (sym >= GDK_Zcaron && sym <= GDK_Zabovedot)
- *lower += (GDK_zcaron - GDK_Zcaron);
- else if (sym == GDK_aogonek)
- *upper = GDK_Aogonek;
- else if (sym >= GDK_lstroke && sym <= GDK_sacute)
- *upper -= (GDK_lstroke - GDK_Lstroke);
- else if (sym >= GDK_scaron && sym <= GDK_zacute)
- *upper -= (GDK_scaron - GDK_Scaron);
- else if (sym >= GDK_zcaron && sym <= GDK_zabovedot)
- *upper -= (GDK_zcaron - GDK_Zcaron);
- else if (sym >= GDK_Racute && sym <= GDK_Tcedilla)
- *lower += (GDK_racute - GDK_Racute);
- else if (sym >= GDK_racute && sym <= GDK_tcedilla)
- *upper -= (GDK_racute - GDK_Racute);
- break;
-#endif /* LATIN2 */
-
-#if defined (GDK_Hstroke) && defined (GDK_Cabovedot)
- case 2: /* Latin 3 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= GDK_Hstroke && sym <= GDK_Hcircumflex)
- *lower += (GDK_hstroke - GDK_Hstroke);
- else if (sym >= GDK_Gbreve && sym <= GDK_Jcircumflex)
- *lower += (GDK_gbreve - GDK_Gbreve);
- else if (sym >= GDK_hstroke && sym <= GDK_hcircumflex)
- *upper -= (GDK_hstroke - GDK_Hstroke);
- else if (sym >= GDK_gbreve && sym <= GDK_jcircumflex)
- *upper -= (GDK_gbreve - GDK_Gbreve);
- else if (sym >= GDK_Cabovedot && sym <= GDK_Scircumflex)
- *lower += (GDK_cabovedot - GDK_Cabovedot);
- else if (sym >= GDK_cabovedot && sym <= GDK_scircumflex)
- *upper -= (GDK_cabovedot - GDK_Cabovedot);
- break;
-#endif /* LATIN3 */
-
-#if defined (GDK_Rcedilla) && defined (GDK_Amacron)
- case 3: /* Latin 4 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= GDK_Rcedilla && sym <= GDK_Tslash)
- *lower += (GDK_rcedilla - GDK_Rcedilla);
- else if (sym >= GDK_rcedilla && sym <= GDK_tslash)
- *upper -= (GDK_rcedilla - GDK_Rcedilla);
- else if (sym == GDK_ENG)
- *lower = GDK_eng;
- else if (sym == GDK_eng)
- *upper = GDK_ENG;
- else if (sym >= GDK_Amacron && sym <= GDK_Umacron)
- *lower += (GDK_amacron - GDK_Amacron);
- else if (sym >= GDK_amacron && sym <= GDK_umacron)
- *upper -= (GDK_amacron - GDK_Amacron);
- break;
-#endif /* LATIN4 */
-
-#if defined (GDK_Serbian_DJE) && defined (GDK_Cyrillic_yu)
- case 6: /* Cyrillic */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= GDK_Serbian_DJE && sym <= GDK_Serbian_DZE)
- *lower -= (GDK_Serbian_DJE - GDK_Serbian_dje);
- else if (sym >= GDK_Serbian_dje && sym <= GDK_Serbian_dze)
- *upper += (GDK_Serbian_DJE - GDK_Serbian_dje);
- else if (sym >= GDK_Cyrillic_YU && sym <= GDK_Cyrillic_HARDSIGN)
- *lower -= (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
- else if (sym >= GDK_Cyrillic_yu && sym <= GDK_Cyrillic_hardsign)
- *upper += (GDK_Cyrillic_YU - GDK_Cyrillic_yu);
- break;
-#endif /* CYRILLIC */
-
-#if defined (GDK_Greek_ALPHAaccent) && defined (GDK_Greek_finalsmallsigma)
- case 7: /* Greek */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (sym >= GDK_Greek_ALPHAaccent && sym <= GDK_Greek_OMEGAaccent)
- *lower += (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
- else if (sym >= GDK_Greek_alphaaccent && sym <= GDK_Greek_omegaaccent &&
- sym != GDK_Greek_iotaaccentdieresis &&
- sym != GDK_Greek_upsilonaccentdieresis)
- *upper -= (GDK_Greek_alphaaccent - GDK_Greek_ALPHAaccent);
- else if (sym >= GDK_Greek_ALPHA && sym <= GDK_Greek_OMEGA)
- *lower += (GDK_Greek_alpha - GDK_Greek_ALPHA);
- else if (sym >= GDK_Greek_alpha && sym <= GDK_Greek_omega &&
- sym != GDK_Greek_finalsmallsigma)
- *upper -= (GDK_Greek_alpha - GDK_Greek_ALPHA);
- break;
-#endif /* GREEK */
- }
-}
-
-static guint
-gdk_keyval_to_upper (guint keyval)
-{
- if (keyval)
- {
- KeySym lower_val = 0;
- KeySym upper_val = 0;
-
- gdkx_XConvertCase (keyval, &lower_val, &upper_val);
- return upper_val;
- }
- return 0;
+static void draw_frame( GtkWidget *widget, wxWindow *win )
+{
+ if (!win->m_hasVMT)
+ return;
+
+ int dw = 0;
+ int dh = 0;
+
+ if (win->m_hasScrolling)
+ {
+ GtkScrolledWindow *scroll_window = GTK_SCROLLED_WINDOW(widget);
+
+ GtkRequisition vscroll_req;
+ vscroll_req.width = 2;
+ vscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->vscrollbar)->klass )->size_request )
+ (scroll_window->vscrollbar, &vscroll_req );
+
+ GtkRequisition hscroll_req;
+ hscroll_req.width = 2;
+ hscroll_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT(scroll_window->hscrollbar)->klass )->size_request )
+ (scroll_window->hscrollbar, &hscroll_req );
+
+ GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(widget)->klass );
+
+ if (scroll_window->vscrollbar_visible)
+ {
+ dw += vscroll_req.width;
+ dw += scroll_class->scrollbar_spacing;
+ }
+
+ if (scroll_window->hscrollbar_visible)
+ {
+ dh += hscroll_req.height;
+ dh += scroll_class->scrollbar_spacing;
+ }
+ }
+
+ int dx = 0;
+ int dy = 0;
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ {
+ dx += widget->allocation.x;
+ dy += widget->allocation.y;
+ }
+
+ if (win->HasFlag(wxRAISED_BORDER))
+ {
+ gtk_draw_shadow( widget->style,
+ widget->window,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_OUT,
+ dx, dy,
+ widget->allocation.width-dw, widget->allocation.height-dh );
+ return;
+ }
+
+ if (win->HasFlag(wxSUNKEN_BORDER))
+ {
+ gtk_draw_shadow( widget->style,
+ widget->window,
+ GTK_STATE_NORMAL,
+ GTK_SHADOW_IN,
+ dx, dy,
+ widget->allocation.width-dw, widget->allocation.height-dh );
+ return;
+ }
+
+ if (win->HasFlag(wxSIMPLE_BORDER))
+ {
+ GdkGC *gc;
+ gc = gdk_gc_new( widget->window );
+ gdk_gc_set_foreground( gc, &widget->style->black );
+ gdk_draw_rectangle( widget->window, gc, FALSE,
+ dx, dy,
+ widget->allocation.width-dw-1, widget->allocation.height-dh-1 );
+ gdk_gc_unref( gc );
+ return;
+ }
+}
+
+//-----------------------------------------------------------------------------
+// "expose_event" of m_widget
+//-----------------------------------------------------------------------------
+
+static void gtk_window_own_expose_callback( GtkWidget *widget, GdkEventExpose *gdk_event, wxWindow *win )
+{
+ if (gdk_event->count > 0) return;
+ draw_frame( widget, win );
+}
+
+//-----------------------------------------------------------------------------
+// "draw" of m_widget
+//-----------------------------------------------------------------------------
+
+static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNUSED(rect), wxWindow *win )
+{
+ draw_frame( widget, win );