- if (back)
- {
- g_itemColors[0].red = (((long) back->Red ()) << 8);
- g_itemColors[0].green = (((long) back->Green ()) << 8);
- g_itemColors[0].blue = (((long) back->Blue ()) << 8);
- g_itemColors[0].flags = DoRed | DoGreen | DoBlue;
- if (colorProc == (XmColorProc) NULL)
- {
- // Get a ptr to the actual function
- colorProc = XmSetColorCalculation ((XmColorProc) NULL);
- // And set it back to motif.
- XmSetColorCalculation (colorProc);
- }
- (*colorProc) (&g_itemColors[wxBACK_INDEX],
- &g_itemColors[wxFORE_INDEX],
- &g_itemColors[wxSELE_INDEX],
- &g_itemColors[wxTOPS_INDEX],
- &g_itemColors[wxBOTS_INDEX]);
- result = wxBACK_COLORS;
- }
- if (fore)
- {
- g_itemColors[wxFORE_INDEX].red = (((long) fore->Red ()) << 8);
- g_itemColors[wxFORE_INDEX].green = (((long) fore->Green ()) << 8);
- g_itemColors[wxFORE_INDEX].blue = (((long) fore->Blue ()) << 8);
- g_itemColors[wxFORE_INDEX].flags = DoRed | DoGreen | DoBlue;
- if (result == wxNO_COLORS)
- result = wxFORE_COLORS;
- }
-
- Display *dpy = display;
- Colormap cmap = (Colormap) wxTheApp->GetMainColormap((WXDisplay*) dpy);
-
- if (back)
- {
- /* 5 Colours to allocate */
- for (int i = 0; i < 5; i++)
- if (!YAllocColor (dpy, cmap, &g_itemColors[i]))
- result = wxNO_COLORS;
- }
- else if (fore)
- {
- /* Only 1 colour to allocate */
- if (!YAllocColor (dpy, cmap, &g_itemColors[wxFORE_INDEX]))
- result = wxNO_COLORS;
- }
-
- return (result);