]> git.saurik.com Git - wxWidgets.git/commitdiff
Added wxUSE_SPINCTRL,
authorRobert Roebling <robert@roebling.de>
Tue, 7 Dec 1999 11:59:07 +0000 (11:59 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 7 Dec 1999 11:59:07 +0000 (11:59 +0000)
  Added various HAVE_XIM patches.
  Added forty's headers to list of installed files.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

Makefile.in
distrib/msw/tmake/unx.t
include/wx/defs.h
include/wx/gtk/window.h
include/wx/gtk1/window.h
setup.h.in
src/gtk/window.cpp
src/gtk1/window.cpp

index 5dbfdea918b178c39e784e35213dc18dbc6e72e9..378d52129200db8e59a1829c5c6f233a691bea18 100644 (file)
@@ -1,5 +1,5 @@
 #
-# This file was automatically generated by tmake at 16:17, 1999/12/04
+# This file was automatically generated by tmake at 12:32, 1999/12/07
 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNX.T!
 
 #
@@ -2437,6 +2437,7 @@ SAMPLES_DIST:
        mkdir $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/Makefile.in $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/makefile.unx $(DISTDIR)/samples/forty
+       cp $(SAMPDIR)/forty/*.h $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/*.cpp $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/*.xpm $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/*.xbm $(DISTDIR)/samples/forty
index 0066a39bdc65a3ea0ff4c3d786a74e832b4ad65d..115f4821a9058ac5b24c820aebfdca2be525840b 100644 (file)
@@ -914,6 +914,7 @@ SAMPLES_DIST:
        mkdir $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/Makefile.in $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/makefile.unx $(DISTDIR)/samples/forty
+       cp $(SAMPDIR)/forty/*.h $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/*.cpp $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/*.xpm $(DISTDIR)/samples/forty
        cp $(SAMPDIR)/forty/*.xbm $(DISTDIR)/samples/forty
index 2df82c842abf59c39db3881c711f041e5fbba436..676b0ace7b0c8d7ac4f7e2978a52f74e83d22524 100644 (file)
@@ -1790,6 +1790,10 @@ typedef struct _GdkWindow       GdkPixmap;
 typedef struct _GdkCursor       GdkCursor;
 typedef struct _GdkRegion       GdkRegion;
 typedef struct _GdkDragContext  GdkDragContext;
+#ifdef HAVE_XIM
+typedef struct _GdkIC           GdkIC;
+typedef struct _GdkICAttr       GdkICAttr;
+#endif
 
 /* Stand-ins for GTK types */
 typedef struct _GtkWidget         GtkWidget;
index 9ec7f12639c5eb1486e2b3540481e8a37697c0c9..90a6cdeda52e5a148f08ab1edc906a845d54f3c4 100644 (file)
@@ -167,6 +167,12 @@ public:
     GtkWidget           *m_widget;
     GtkWidget           *m_wxwindow;
 
+#if HAVE_XIM
+    /* XIM support for wxWindows */
+    GdkIC               *m_ic;
+    GdkICAttr           *m_icattr;
+#endif
+    
     /* scrolling stuff */
     GtkAdjustment       *m_hAdjust,*m_vAdjust;
     float                m_oldHorizontalPos;
index 9ec7f12639c5eb1486e2b3540481e8a37697c0c9..90a6cdeda52e5a148f08ab1edc906a845d54f3c4 100644 (file)
@@ -167,6 +167,12 @@ public:
     GtkWidget           *m_widget;
     GtkWidget           *m_wxwindow;
 
+#if HAVE_XIM
+    /* XIM support for wxWindows */
+    GdkIC               *m_ic;
+    GdkICAttr           *m_icattr;
+#endif
+    
     /* scrolling stuff */
     GtkAdjustment       *m_hAdjust,*m_vAdjust;
     float                m_oldHorizontalPos;
index 94e16ee56e8744b787832bc8c555b0506643fc8b..be5879c04b8f932ac951023aca20254b09b78cad 100644 (file)
  * Use this control
  */
 #define wxUSE_SPINBTN 0
+/*
+ * Use this control
+ */
+#define wxUSE_SPINCTRL 0
 /*
  * Use this control
  */
index 2f617eaacd2cea3186db3ef45c7b30772b40f164..756fc358017ec752760d32e9f7184790d0c90bdb 100644 (file)
@@ -1621,7 +1621,7 @@ wxWindow *wxWindowBase::FindFocus()
    been realized, so we do this directly after realization */
 
 static gint
-gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
+gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
@@ -1642,6 +1642,98 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
     return FALSE;
 }
 
+//-----------------------------------------------------------------------------
+// "realize" from m_wxwindow
+//-----------------------------------------------------------------------------
+
+/* Initialize XIM support */
+
+static gint
+gtk_wxwindow_realized_callback( GtkWidget *widget, wxWindow *win )
+{
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+
+#ifdef USE_XIM
+    if (win->m_ic) return FALSE;
+    if (!widget) return FALSE;
+    if (!gdk_im_ready()) return FALSE;
+
+    win->m_icattr = gdk_ic_attr_new();
+    if (!win->m_icattr) return FALSE;
+    
+    gint width, height;
+    GdkEventMask mask;
+    GdkColormap *colormap;
+    GdkICAttr *attr = win->m_icattr;
+    GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
+    GdkIMStyle style;
+    GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
+                                  GDK_IM_PREEDIT_NOTHING |
+                                  GDK_IM_PREEDIT_POSITION |
+                                  GDK_IM_STATUS_NONE |
+                                  GDK_IM_STATUS_NOTHING;
+
+    if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
+       supported_style &= ~GDK_IM_PREEDIT_POSITION;
+
+    attr->style = style = gdk_im_decide_style (supported_style);
+    attr->client_window = widget->window;
+
+    if ((colormap = gtk_widget_get_colormap (widget)) !=
+           gtk_widget_get_default_colormap ())
+    {
+       attrmask |= GDK_IC_PREEDIT_COLORMAP;
+       attr->preedit_colormap = colormap;
+    }
+    
+    attrmask |= GDK_IC_PREEDIT_FOREGROUND;
+    attrmask |= GDK_IC_PREEDIT_BACKGROUND;
+    attr->preedit_foreground = widget->style->fg[GTK_STATE_NORMAL];
+    attr->preedit_background = widget->style->base[GTK_STATE_NORMAL];
+
+    switch (style & GDK_IM_PREEDIT_MASK)
+    {
+       case GDK_IM_PREEDIT_POSITION:
+         if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
+           {
+             g_warning ("over-the-spot style requires fontset");
+             break;
+           }
+
+         gdk_window_get_size (widget->window, &width, &height);
+
+         attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
+         attr->spot_location.x = 0;
+         attr->spot_location.y = height;
+         attr->preedit_area.x = 0;
+         attr->preedit_area.y = 0;
+         attr->preedit_area.width = width;
+         attr->preedit_area.height = height;
+         attr->preedit_fontset = widget->style->font;
+
+         break;
+       }
+       
+      win->m_ic = gdk_ic_new (attr, attrmask);
+     
+      if (win->m_ic == NULL)
+       g_warning ("Can't create input context.");
+      else
+       {
+         mask = gdk_window_get_events (widget->window);
+         mask |= gdk_ic_get_events (win->m_ic);
+         gdk_window_set_events (widget->window, mask);
+
+         if (GTK_WIDGET_HAS_FOCUS(widget))
+           gdk_im_begin (win->m_ic, widget->window);
+       }
+    }
+#endif
+
+    return FALSE;
+}
+
 //-----------------------------------------------------------------------------
 // InsertChild for wxWindow.
 //-----------------------------------------------------------------------------
@@ -1726,6 +1818,11 @@ void wxWindow::Init()
     m_acceptsFocus = FALSE;
 
     m_cursor = *wxSTANDARD_CURSOR;
+    
+#ifdef HAVE_XIM
+    m_ic = (GdkIC*) NULL;
+    m_icattr = (GdkICAttr*) NULL;
+#endif
 }
 
 wxWindow::wxWindow()
@@ -1901,6 +1998,13 @@ wxWindow::~wxWindow()
     if (m_parent)
         m_parent->RemoveChild( this );
 
+#ifdef HAVE_XIM
+    if (m_ic)
+        gdk_ic_destroy (m_ic);
+    if (m_icattr)
+        gdk_ic_attr_destroy (m_icattr);
+#endif
+
     if (m_widgetStyle)
     {
         gtk_style_unref( m_widgetStyle );
@@ -1978,15 +2082,42 @@ void wxWindow::PostCreation()
 #endif
     }
 
+    if (m_wxwindow && m_needParent)
+    {
+        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "focus_in_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+
+        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "focus_out_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
+    }
+    else
+    {
+        // For dialogs and frames, we are interested mainly in
+       // m_widget's focus.
+       
+        gtk_signal_connect( GTK_OBJECT(m_widget), "focus_in_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+
+        gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
+    }
+
     GtkWidget *connect_widget = GetConnectWidget();
 
     ConnectWidget( connect_widget );
 
-   /*  we cannot set colours, fonts and cursors before the widget has
+    /* We cannot set colours, fonts and cursors before the widget has
        been realized, so we do this directly after realization */
     gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
-
+    /* Initialize XIM support.  */
+    if (m_wxwindow)
+    {
+        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize",
+                            GTK_SIGNAL_FUNC(gtk_wxwindow_realized_callback), (gpointer) this );
+    }
+    
     m_hasVMT = TRUE;
 }
 
@@ -2007,12 +2138,6 @@ void wxWindow::ConnectWidget( GtkWidget *widget )
     gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event",
       GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );
 
-    gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
-      GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
-
-    gtk_signal_connect( GTK_OBJECT(widget), "focus_out_event",
-      GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
-
     gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event",
       GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );
 
index 2f617eaacd2cea3186db3ef45c7b30772b40f164..756fc358017ec752760d32e9f7184790d0c90bdb 100644 (file)
@@ -1621,7 +1621,7 @@ wxWindow *wxWindowBase::FindFocus()
    been realized, so we do this directly after realization */
 
 static gint
-gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
+gtk_window_realized_callback( GtkWidget *WXUNUSED(m_widget), wxWindow *win )
 {
     if (g_isIdle)
         wxapp_install_idle_handler();
@@ -1642,6 +1642,98 @@ gtk_window_realized_callback( GtkWidget * WXUNUSED(widget), wxWindow *win )
     return FALSE;
 }
 
+//-----------------------------------------------------------------------------
+// "realize" from m_wxwindow
+//-----------------------------------------------------------------------------
+
+/* Initialize XIM support */
+
+static gint
+gtk_wxwindow_realized_callback( GtkWidget *widget, wxWindow *win )
+{
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+
+#ifdef USE_XIM
+    if (win->m_ic) return FALSE;
+    if (!widget) return FALSE;
+    if (!gdk_im_ready()) return FALSE;
+
+    win->m_icattr = gdk_ic_attr_new();
+    if (!win->m_icattr) return FALSE;
+    
+    gint width, height;
+    GdkEventMask mask;
+    GdkColormap *colormap;
+    GdkICAttr *attr = win->m_icattr;
+    GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
+    GdkIMStyle style;
+    GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
+                                  GDK_IM_PREEDIT_NOTHING |
+                                  GDK_IM_PREEDIT_POSITION |
+                                  GDK_IM_STATUS_NONE |
+                                  GDK_IM_STATUS_NOTHING;
+
+    if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
+       supported_style &= ~GDK_IM_PREEDIT_POSITION;
+
+    attr->style = style = gdk_im_decide_style (supported_style);
+    attr->client_window = widget->window;
+
+    if ((colormap = gtk_widget_get_colormap (widget)) !=
+           gtk_widget_get_default_colormap ())
+    {
+       attrmask |= GDK_IC_PREEDIT_COLORMAP;
+       attr->preedit_colormap = colormap;
+    }
+    
+    attrmask |= GDK_IC_PREEDIT_FOREGROUND;
+    attrmask |= GDK_IC_PREEDIT_BACKGROUND;
+    attr->preedit_foreground = widget->style->fg[GTK_STATE_NORMAL];
+    attr->preedit_background = widget->style->base[GTK_STATE_NORMAL];
+
+    switch (style & GDK_IM_PREEDIT_MASK)
+    {
+       case GDK_IM_PREEDIT_POSITION:
+         if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
+           {
+             g_warning ("over-the-spot style requires fontset");
+             break;
+           }
+
+         gdk_window_get_size (widget->window, &width, &height);
+
+         attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
+         attr->spot_location.x = 0;
+         attr->spot_location.y = height;
+         attr->preedit_area.x = 0;
+         attr->preedit_area.y = 0;
+         attr->preedit_area.width = width;
+         attr->preedit_area.height = height;
+         attr->preedit_fontset = widget->style->font;
+
+         break;
+       }
+       
+      win->m_ic = gdk_ic_new (attr, attrmask);
+     
+      if (win->m_ic == NULL)
+       g_warning ("Can't create input context.");
+      else
+       {
+         mask = gdk_window_get_events (widget->window);
+         mask |= gdk_ic_get_events (win->m_ic);
+         gdk_window_set_events (widget->window, mask);
+
+         if (GTK_WIDGET_HAS_FOCUS(widget))
+           gdk_im_begin (win->m_ic, widget->window);
+       }
+    }
+#endif
+
+    return FALSE;
+}
+
 //-----------------------------------------------------------------------------
 // InsertChild for wxWindow.
 //-----------------------------------------------------------------------------
@@ -1726,6 +1818,11 @@ void wxWindow::Init()
     m_acceptsFocus = FALSE;
 
     m_cursor = *wxSTANDARD_CURSOR;
+    
+#ifdef HAVE_XIM
+    m_ic = (GdkIC*) NULL;
+    m_icattr = (GdkICAttr*) NULL;
+#endif
 }
 
 wxWindow::wxWindow()
@@ -1901,6 +1998,13 @@ wxWindow::~wxWindow()
     if (m_parent)
         m_parent->RemoveChild( this );
 
+#ifdef HAVE_XIM
+    if (m_ic)
+        gdk_ic_destroy (m_ic);
+    if (m_icattr)
+        gdk_ic_attr_destroy (m_icattr);
+#endif
+
     if (m_widgetStyle)
     {
         gtk_style_unref( m_widgetStyle );
@@ -1978,15 +2082,42 @@ void wxWindow::PostCreation()
 #endif
     }
 
+    if (m_wxwindow && m_needParent)
+    {
+        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "focus_in_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+
+        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "focus_out_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
+    }
+    else
+    {
+        // For dialogs and frames, we are interested mainly in
+       // m_widget's focus.
+       
+        gtk_signal_connect( GTK_OBJECT(m_widget), "focus_in_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
+
+        gtk_signal_connect( GTK_OBJECT(m_widget), "focus_out_event",
+            GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
+    }
+
     GtkWidget *connect_widget = GetConnectWidget();
 
     ConnectWidget( connect_widget );
 
-   /*  we cannot set colours, fonts and cursors before the widget has
+    /* We cannot set colours, fonts and cursors before the widget has
        been realized, so we do this directly after realization */
     gtk_signal_connect( GTK_OBJECT(connect_widget), "realize",
                             GTK_SIGNAL_FUNC(gtk_window_realized_callback), (gpointer) this );
-
+    /* Initialize XIM support.  */
+    if (m_wxwindow)
+    {
+        gtk_signal_connect( GTK_OBJECT(m_wxwindow), "realize",
+                            GTK_SIGNAL_FUNC(gtk_wxwindow_realized_callback), (gpointer) this );
+    }
+    
     m_hasVMT = TRUE;
 }
 
@@ -2007,12 +2138,6 @@ void wxWindow::ConnectWidget( GtkWidget *widget )
     gtk_signal_connect( GTK_OBJECT(widget), "motion_notify_event",
       GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );
 
-    gtk_signal_connect( GTK_OBJECT(widget), "focus_in_event",
-      GTK_SIGNAL_FUNC(gtk_window_focus_in_callback), (gpointer)this );
-
-    gtk_signal_connect( GTK_OBJECT(widget), "focus_out_event",
-      GTK_SIGNAL_FUNC(gtk_window_focus_out_callback), (gpointer)this );
-
     gtk_signal_connect( GTK_OBJECT(widget), "enter_notify_event",
       GTK_SIGNAL_FUNC(gtk_window_enter_callback), (gpointer)this );