X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af111fc33841cc8bdc4d6cf027702805333bdd2a..d1adc25737bf5c001a2218fd6d8281262a811ace:/src/motif/palette.cpp diff --git a/src/motif/palette.cpp b/src/motif/palette.cpp index 44ce0e92f7..2540f1ecdd 100644 --- a/src/motif/palette.cpp +++ b/src/motif/palette.cpp @@ -20,7 +20,7 @@ /* Wolfram Gloger I have implemented basic colormap support for the X11 versions of -wxWindows, notably wxPalette::Create(). The way I did it is to +wxWidgets, notably wxPalette::Create(). The way I did it is to allocate additional read-only color cells in the default colormap. In general you will get arbitrary pixel values assigned to these new cells and therefore I added a method wxColourMap::TransferBitmap() @@ -34,22 +34,29 @@ recommended; only the window manager should do this... Also, it is not the functionality that wxPalette::Create() aims to provide. */ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "palette.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/palette.h" #include "wx/window.h" #include "wx/app.h" #include "wx/utils.h" +#ifdef __VMS__ +#pragma message disable nosimpint +#endif #include +#ifdef __VMS__ +#pragma message enable nosimpint +#endif #include "wx/motif/private.h" -#if !USE_SHARED_LIBRARIES IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxXPalette, wxObject) -#endif /* * Palette @@ -73,10 +80,10 @@ wxPaletteRefData::~wxPaletteRefData() { Display *display = (Display*) NULL; - wxNode *node, *next; + wxList::compatibility_iterator node, next; - for (node = m_palettes.First(); node; node = next) { - wxXPalette *c = (wxXPalette *)node->Data(); + for (node = m_palettes.GetFirst(); node; node = next) { + wxXPalette *c = (wxXPalette *)node->GetData(); unsigned long *pix_array = c->m_pix_array; Colormap cmap = (Colormap) c->m_cmap; bool destroyable = c->m_destroyable; @@ -99,8 +106,8 @@ wxPaletteRefData::~wxPaletteRefData() if (destroyable) XFreeColormap(display, cmap); - next = node->Next(); - m_palettes.DeleteNode(node); + next = node->GetNext(); + m_palettes.Erase(node); delete c; } } @@ -185,27 +192,28 @@ bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *W WXColormap wxPalette::GetXColormap(WXDisplay* display) const { - if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.Number() == 0)) + if (!M_PALETTEDATA || (M_PALETTEDATA->m_palettes.GetCount() == 0)) return wxTheApp->GetMainColormap(display); - wxNode* node = M_PALETTEDATA->m_palettes.First(); + wxList::compatibility_iterator node = M_PALETTEDATA->m_palettes.GetFirst(); if (!display && node) { - wxXPalette* p = (wxXPalette*) node->Data(); + wxXPalette* p = (wxXPalette*) node->GetData(); return p->m_cmap; } while (node) { - wxXPalette* p = (wxXPalette*) node->Data(); + wxXPalette* p = (wxXPalette*) node->GetData(); if (p->m_display == display) return p->m_cmap; - node = node->Next(); + node = node->GetNext(); } /* Make a new one: */ wxXPalette *c = new wxXPalette; - wxXPalette *first = (wxXPalette *)M_PALETTEDATA->m_palettes.First()->Data(); + wxXPalette *first = + (wxXPalette *)M_PALETTEDATA->m_palettes.GetFirst()->GetData(); XColor xcol; int pix_array_n = first->m_pix_array_n; @@ -220,9 +228,11 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const for (i = 0; i < pix_array_n; i++) { xcol.pixel = first->m_pix_array[i]; - XQueryColor((Display*) first->m_display, (Colormap) first->m_cmap, &xcol); + XQueryColor((Display*) first->m_display, + (Colormap) first->m_cmap, &xcol); c->m_pix_array[i] = - (XAllocColor((Display*) display, (Colormap) c->m_cmap, &xcol) == 0) ? 0 : xcol.pixel; + (XAllocColor((Display*) display, (Colormap) c->m_cmap, &xcol) == 0) + ? 0 : xcol.pixel; } // wxPalette* nonConstThis = (wxPalette*) this; @@ -313,11 +323,12 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n) { if (!M_PALETTEDATA) return (unsigned long*) 0; - wxNode *node; + wxList::compatibility_iterator node; - for (node = M_PALETTEDATA->m_palettes.First(); node; node = node->Next()) + for (node = M_PALETTEDATA->m_palettes.GetFirst(); node; + node = node->GetNext()) { - wxXPalette *c = (wxXPalette *)node->Data(); + wxXPalette *c = (wxXPalette *)node->GetData(); if (c->m_display == display) { if (n)