]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/xmcombo/xmcombo.c
Added wxToggleBitmapButton (it compiles).
[wxWidgets.git] / src / motif / xmcombo / xmcombo.c
index 99fc08a35fd6530793eaab5d9489f848f6b154de..32f5686026cf10878650046e2b747a50dd9cc02e 100644 (file)
 #include <Xm/TextF.h>
 #include <Xm/List.h>
 #include <Xm/LabelP.h>
 #include <Xm/TextF.h>
 #include <Xm/List.h>
 #include <Xm/LabelP.h>
+
+#if (XmVersion < 2000)
+
 #include <string.h>
 #include <ctype.h> /* define toupper */
 #include "combop.h"
 #include <string.h>
 #include <ctype.h> /* define toupper */
 #include "combop.h"
@@ -453,7 +456,7 @@ XmComboBoxClassRec xmComboBoxClassRec = {
     /* accept_focus                */  NULL,
     /* version                     */  XtVersion,
     /* callback_private            */  NULL,
     /* accept_focus                */  NULL,
     /* version                     */  XtVersion,
     /* callback_private            */  NULL,
-    /* tm_table                            */  NULL,
+    /* tm_table                            */  XtInheritTranslations, /* Changed from NULL: Bug #406153 */
     /* query_geometry              */  (XtGeometryHandler) QueryGeometry,
     /* display_accelerator         */  XtInheritDisplayAccelerator,
     /* extension                   */  NULL
     /* query_geometry              */  (XtGeometryHandler) QueryGeometry,
     /* display_accelerator         */  XtInheritDisplayAccelerator,
     /* extension                   */  NULL
@@ -557,7 +560,10 @@ static XtActionsRec actions[] = {
  * durchgefuehrt werden.
  */
 static XtTranslations NewEditTranslations, NewEditTranslationsNE, 
  * durchgefuehrt werden.
  */
 static XtTranslations NewEditTranslations, NewEditTranslationsNE, 
-                      NewListTranslations, NewListTranslationsE;
+#ifdef NODRAGNDROP
+                      NewListTranslations,
+#endif
+                      NewListTranslationsE;
 
 static XtConvertArgRec ConverterScreenConvertArg[] = {
     { XtBaseOffset, (XtPointer) XtOffset(Widget, core.screen), 
 
 static XtConvertArgRec ConverterScreenConvertArg[] = {
     { XtBaseOffset, (XtPointer) XtOffset(Widget, core.screen), 
@@ -792,6 +798,7 @@ static int WidgetToScreen(Widget w)
        if ( ScreenOfDisplay(display, i) == screen )
            return i;
     XtError("WidgetToScreen: data structures are destroyed.");
        if ( ScreenOfDisplay(display, i) == screen )
            return i;
     XtError("WidgetToScreen: data structures are destroyed.");
+    return 0; /* to avoid a compiler warning */
 } /* WidgetToScreen */
 
 /* --------------------------------------------------------------------
 } /* WidgetToScreen */
 
 /* --------------------------------------------------------------------
@@ -804,7 +811,6 @@ static void DoDropDownLayout(XmComboBoxWidget w)
     Position       abs_x, abs_y;
     Dimension      ArrowWidth, ListWidth, ListHeight;
     Dimension      ScreenHeight, LabelWidth;
     Position       abs_x, abs_y;
     Dimension      ArrowWidth, ListWidth, ListHeight;
     Dimension      ScreenHeight, LabelWidth;
-    Window         Decoration;
     XWindowChanges WindowChanges;
 
     /* 
     XWindowChanges WindowChanges;
 
     /* 
@@ -1263,26 +1269,34 @@ static struct { String Resource; int Flag; }
           { XmNbackground,        BACKGROUND        }
        };
 
           { XmNbackground,        BACKGROUND        }
        };
 
-static UpdateColors(XmComboBoxWidget w, int flags)
+static int UpdateColors(XmComboBoxWidget w, int flags)
 {
 {
-    Pixel  Color;
+    Pixel  Color, White, Black, EditCol;
     int    i, size = XtNumber(ColorResources);
     Widget ScrolledWin, ScrollBar;
     
     ScrolledWin = XtParent(w->combobox.ListCtrl);
     XtVaGetValues(ScrolledWin, XmNverticalScrollBar, &ScrollBar, NULL);
     int    i, size = XtNumber(ColorResources);
     Widget ScrolledWin, ScrollBar;
     
     ScrolledWin = XtParent(w->combobox.ListCtrl);
     XtVaGetValues(ScrolledWin, XmNverticalScrollBar, &ScrollBar, NULL);
+    White = WhitePixel(XtDisplay(w), WidgetToScreen((Widget) w));
+    Black = BlackPixel(XtDisplay(w), WidgetToScreen((Widget) w));
     for ( i=0; i<size; i++ )
        if ( flags & ColorResources[i].Flag ) {
     for ( i=0; i<size; i++ )
        if ( flags & ColorResources[i].Flag ) {
+            if ( ColorResources[i].Flag == BACKGROUND )
+                EditCol = White;
+            else if ( ColorResources[i].Flag == FOREGROUND )
+                EditCol = Black;
+            else
+                EditCol = Color;
            XtVaGetValues((Widget) w, ColorResources[i].Resource, &Color,
                          NULL);
            XtVaGetValues((Widget) w, ColorResources[i].Resource, &Color,
                          NULL);
-           XtVaSetValues(w->combobox.ListCtrl, 
-                         ColorResources[i].Resource, Color, NULL);
-           XtVaSetValues(ScrolledWin, 
-                         ColorResources[i].Resource, Color, NULL);
            XtVaSetValues(ScrollBar, 
                          ColorResources[i].Resource, Color, NULL);
            XtVaSetValues(ScrollBar, 
                          ColorResources[i].Resource, Color, NULL);
-           XtVaSetValues(w->combobox.EditCtrl, 
-                         ColorResources[i].Resource, Color, NULL);
+            XtVaSetValues(w->combobox.ListCtrl, 
+                          ColorResources[i].Resource, EditCol, NULL);
+            XtVaSetValues(w->combobox.EditCtrl, 
+                          ColorResources[i].Resource, EditCol, NULL);
+            XtVaSetValues(ScrolledWin, 
+                          ColorResources[i].Resource, Color, NULL);
            XtVaSetValues(w->combobox.LabelCtrl, 
                          ColorResources[i].Resource, Color, NULL);
            XtVaSetValues(w->combobox.ArrowCtrl, 
            XtVaSetValues(w->combobox.LabelCtrl, 
                          ColorResources[i].Resource, Color, NULL);
            XtVaSetValues(w->combobox.ArrowCtrl, 
@@ -1419,7 +1433,7 @@ static Boolean SetValues(XmComboBoxWidget current, XmComboBoxWidget req,
  * dauerhaft dargestellt wird.
  */
     if ( newW->combobox.ScrollBarDisplayPolicy != 
  * dauerhaft dargestellt wird.
  */
     if ( newW->combobox.ScrollBarDisplayPolicy != 
-           current->combobox.ScrollBarDisplayPolicy )
+        current->combobox.ScrollBarDisplayPolicy ) {
         if ( newW->combobox.StaticList )
             XtVaSetValues(newW->combobox.ListCtrl,
                           XmNscrollBarDisplayPolicy, newW->combobox.ScrollBarDisplayPolicy,
         if ( newW->combobox.StaticList )
             XtVaSetValues(newW->combobox.ListCtrl,
                           XmNscrollBarDisplayPolicy, newW->combobox.ScrollBarDisplayPolicy,
@@ -1427,7 +1441,8 @@ static Boolean SetValues(XmComboBoxWidget current, XmComboBoxWidget req,
         else
             XtWarning(
 "XmComboBox: ScrollBarDisplayPolicy can not be changed when StaticList == False."
         else
             XtWarning(
 "XmComboBox: ScrollBarDisplayPolicy can not be changed when StaticList == False."
-            );
+);
+    }
 /* Anzahl der in der Liste gleichzeitig darstellbaren Eintraege */
     if ( current->combobox.VisibleItemCount != 
            newW->combobox.VisibleItemCount ) {
 /* Anzahl der in der Liste gleichzeitig darstellbaren Eintraege */
     if ( current->combobox.VisibleItemCount != 
            newW->combobox.VisibleItemCount ) {
@@ -1437,11 +1452,11 @@ static Boolean SetValues(XmComboBoxWidget current, XmComboBoxWidget req,
        Update = True;
     }
     if ( current->combobox.AutomaticSelection != 
        Update = True;
     }
     if ( current->combobox.AutomaticSelection != 
-           newW->combobox.AutomaticSelection )
+        newW->combobox.AutomaticSelection ) {
        XtVaSetValues(newW->combobox.ListCtrl, 
                      XmNautomaticSelection, newW->combobox.AutomaticSelection, 
                      NULL);
        XtVaSetValues(newW->combobox.ListCtrl, 
                      XmNautomaticSelection, newW->combobox.AutomaticSelection, 
                      NULL);
-                                             
+    }
 /* 
  * benutzter Font: hier erhalten Liste und Eingabefeld jeweils die
  * gleiche Fontliste, wohingegen das Label getrennt behandelt wird.
 /* 
  * benutzter Font: hier erhalten Liste und Eingabefeld jeweils die
  * gleiche Fontliste, wohingegen das Label getrennt behandelt wird.
@@ -1596,6 +1611,8 @@ static void GetValuesAlmost(XmComboBoxWidget w, ArgList args,
                            break;
                        }
                    break;
                            break;
                        }
                    break;
+        case RWIGNORE:
+            ;
                } /* case read mode */
            } /* if entry found */
        } /* for every mirrored entry */
                } /* case read mode */
            } /* if entry found */
        } /* for every mirrored entry */
@@ -2089,7 +2106,7 @@ static void EditVerifyCallback(Widget w, XtPointer pClientData,
        XmStringTable  Items;
        int            *SelectionList;
        int            SelectionCount;
        XmStringTable  Items;
        int            *SelectionList;
        int            SelectionCount;
-       int            i, ItemCount, Start, End;
+       int            i, ItemCount, Start;
        char           *pItem;
        Boolean        Ignore;
        
        char           *pItem;
        Boolean        Ignore;
        
@@ -2321,9 +2338,8 @@ static Boolean FetchLabelTypeResource(Widget w,
                                 char *RscName, char *RscClass, 
                                unsigned char *pUChar)
 {
                                 char *RscName, char *RscClass, 
                                unsigned char *pUChar)
 {
-    XrmValue RscValue, RscDest;
+    XrmValue RscValue;
     String   RepresentationType;
     String   RepresentationType;
-    int      AInt;
     
     if ( FetchResource(w, FullName, FullClass, 
                        RscName, RscClass, 
     
     if ( FetchResource(w, FullName, FullClass, 
                        RscName, RscClass, 
@@ -2570,7 +2586,6 @@ static void InitMirrorResources(XmComboBoxWidget w)
     XmStringTable AStringTable;
     Pixmap        APixmap;
     XmFontList    AFontList;
     XmStringTable AStringTable;
     Pixmap        APixmap;
     XmFontList    AFontList;
-    XrmValue      RscValue;
     String        AString;
     KeySym        AKeySym;
     int           i, size = XtNumber(ResourceMirror);
     String        AString;
     KeySym        AKeySym;
     int           i, size = XtNumber(ResourceMirror);
@@ -2718,8 +2733,6 @@ static void Initialize(Widget request, XmComboBoxWidget newW,
     Widget       w;
     Arg          args[10];
     int          n = 0;
     Widget       w;
     Arg          args[10];
     int          n = 0;
-    XmString     xmstr;
-    Pixel        BackgroundColor;
     
 /* 
  * Da zu allem Ueberfluss die einzelnen Instanzen einer XmComboBox
     
 /* 
  * Da zu allem Ueberfluss die einzelnen Instanzen einer XmComboBox
@@ -3066,7 +3079,7 @@ Widget XmComboBoxGetLabelWidget(Widget w)
  *   Deleted       Zeigt an, ob der Eintrag geloescht wurde (True)
  *                 oder sich nur veraenderte (False)
  */
  *   Deleted       Zeigt an, ob der Eintrag geloescht wurde (True)
  *                 oder sich nur veraenderte (False)
  */
-static UpdateComboBox(XmComboBoxWidget w, int Index, Boolean Deleted)
+static int UpdateComboBox(XmComboBoxWidget w, int Index, Boolean Deleted)
 {
     int OldIndex, ItemCount;
     
 {
     int OldIndex, ItemCount;
     
@@ -3546,3 +3559,5 @@ Widget XmCreateComboBox(Widget parent, String name, ArgList arglist,
 } /* XmCreateComboBox */
 
 /* Ende von ComboBox.c */
 } /* XmCreateComboBox */
 
 /* Ende von ComboBox.c */
+
+#endif /* XmVersion < 2000 */