Derive wxBitmap from wxBitmapBase in wxMotif, with the appropriate

changes to wxIcon.
  Fix deprecation warnings and use %p to format WXWidget in debug output
(fixes the 4 non-deprecation warnings).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-01-19 09:52:29 +00:00
parent 2fda214570
commit 1bc822dfb5
14 changed files with 204 additions and 282 deletions

View File

@@ -123,7 +123,7 @@ wizard.cpp Generic
appcmn.cpp Common Base appcmn.cpp Common Base
artprov.cpp Common artprov.cpp Common
artstd.cpp Common artstd.cpp Common
bmpbase.cpp Common NotGTK,NotOS2,NotMSW,NotX,NotMicro bmpbase.cpp Common NotGTK,NotOS2,NotMSW,NotMicro
choiccmn.cpp Common choiccmn.cpp Common
clipcmn.cpp Common clipcmn.cpp Common
clntdata.cpp Common Base clntdata.cpp Common Base

View File

@@ -32,7 +32,7 @@ class WXDLLEXPORT wxImage;
class WXDLLEXPORT wxMask; class WXDLLEXPORT wxMask;
class WXDLLEXPORT wxPalette; class WXDLLEXPORT wxPalette;
#if defined(__WXMGL__) || defined(__WXMAC__) #if defined(__WXMGL__) || defined(__WXMAC__) || defined(__WXMOTIF__)
// Only used by some ports // Only used by some ports
// FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes // FIXME -- make all ports (but MSW which uses wxGDIImage) use these base classes

View File

@@ -100,32 +100,35 @@ public:
#define M_BITMAPDATA ((wxBitmapRefData *)m_refData) #define M_BITMAPDATA ((wxBitmapRefData *)m_refData)
class WXDLLEXPORT wxBitmapHandler: public wxObject class WXDLLEXPORT wxBitmapHandler: public wxBitmapHandlerBase
{ {
DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
public: public:
wxBitmapHandler() { m_name = ""; m_extension = ""; m_type = 0; }; wxBitmapHandler() : wxBitmapHandlerBase() { }
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1)
{
return false;
}
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1);
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight); int desiredWidth, int desiredHeight)
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); {
return false;
}
void SetName(const wxString& name) { m_name = name; } virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
void SetExtension(const wxString& ext) { m_extension = ext; } int type, const wxPalette *palette = NULL)
void SetType(long type) { m_type = type; } {
wxString GetName() const { return m_name; } return false;
wxString GetExtension() const { return m_extension; } }
long GetType() const { return m_type; } private:
protected: DECLARE_DYNAMIC_CLASS(wxBitmapHandler)
wxString m_name;
wxString m_extension;
long m_type;
}; };
#define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData()) #define M_BITMAPHANDLERDATA ((wxBitmapRefData *)bitmap->GetRefData())
class WXDLLEXPORT wxBitmap: public wxGDIObject class WXDLLEXPORT wxBitmap: public wxBitmapBase
{ {
DECLARE_DYNAMIC_CLASS(wxBitmap) DECLARE_DYNAMIC_CLASS(wxBitmap)
@@ -149,10 +152,11 @@ public:
wxBitmap(char **data, wxControl* control); wxBitmap(char **data, wxControl* control);
// Load a file or resource // Load a file or resource
wxBitmap(const wxString& name, int type = wxBITMAP_TYPE_XPM); wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM);
// Constructor for generalised creation from data // Constructor for generalised creation from data
wxBitmap(void *data, long type, int width, int height, int depth = 1); wxBitmap(void *data, wxBitmapType type,
int width, int height, int depth = 1);
// If depth is omitted, will create a bitmap compatible with the display // If depth is omitted, will create a bitmap compatible with the display
wxBitmap(int width, int height, int depth = -1); wxBitmap(int width, int height, int depth = -1);
@@ -163,12 +167,15 @@ public:
~wxBitmap(); ~wxBitmap();
virtual bool Create(int width, int height, int depth = -1); virtual bool Create(int width, int height, int depth = -1);
virtual bool Create(void *data, long type, int width, int height, int depth = 1); virtual bool Create(void *data, wxBitmapType type,
int width, int height, int depth = 1);
wxBitmap GetSubBitmap( const wxRect& rect ) const; wxBitmap GetSubBitmap( const wxRect& rect ) const;
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_XPM); virtual bool LoadFile(const wxString& name,
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL); wxBitmapType type = wxBITMAP_TYPE_XPM);
virtual bool SaveFile(const wxString& name, wxBitmapType type,
const wxPalette *cmap = NULL) const;
wxImage ConvertToImage() const; wxImage ConvertToImage() const;
@@ -197,16 +204,7 @@ public:
bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; } bool operator != (const wxBitmap& bitmap) const { return m_refData != bitmap.m_refData; }
// Format handling // Format handling
static wxList& GetHandlers() { return sm_handlers; }
static void AddHandler(wxBitmapHandler *handler);
static void InsertHandler(wxBitmapHandler *handler);
static bool RemoveHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& name);
static wxBitmapHandler *FindHandler(const wxString& extension, long bitmapType);
static wxBitmapHandler *FindHandler(long bitmapType);
static void InitStandardHandlers(); static void InitStandardHandlers();
static void CleanUpHandlers();
// Motif implementation // Motif implementation
public: public:
@@ -217,9 +215,6 @@ public:
virtual WXPixmap GetInsensPixmap(WXWidget w = (WXWidget) 0) ; virtual WXPixmap GetInsensPixmap(WXWidget w = (WXWidget) 0) ;
void SetPixmapNull() { M_BITMAPDATA->m_pixmap = 0; } void SetPixmapNull() { M_BITMAPDATA->m_pixmap = 0; }
protected:
static wxList sm_handlers;
protected: protected:
bool CreateFromXpm(const char **bits); bool CreateFromXpm(const char **bits);
bool CreateFromImage(const wxImage& image, int depth); bool CreateFromImage(const wxImage& image, int depth);

View File

@@ -39,11 +39,11 @@ public:
wxIcon(const char **data); wxIcon(const char **data);
wxIcon(char **data); wxIcon(char **data);
wxIcon(const wxString& name, long flags = wxBITMAP_TYPE_XPM, wxIcon(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM,
int desiredWidth = -1, int desiredHeight = -1); int desiredWidth = -1, int desiredHeight = -1);
~wxIcon(); ~wxIcon();
bool LoadFile(const wxString& name, long flags = wxBITMAP_TYPE_XPM, bool LoadFile(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM,
int desiredWidth = -1, int desiredHeight = -1); int desiredWidth = -1, int desiredHeight = -1);
// create from bitmap (which should have a mask unless it's monochrome): // create from bitmap (which should have a mask unless it's monochrome):

View File

@@ -19,7 +19,7 @@
#pragma hdrstop #pragma hdrstop
#endif #endif
#if defined(__WXMGL__) || defined(__WXMAC__) #if defined(__WXMGL__) || defined(__WXMAC__) || defined(__WXMOTIF__)
#include "wx/wx.h" #include "wx/wx.h"
#include "wx/setup.h" #include "wx/setup.h"
@@ -60,51 +60,51 @@ bool wxBitmapBase::RemoveHandler(const wxString& name)
wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name) wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& name)
{ {
wxNode *node = sm_handlers.First(); wxList::Node *node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
if ( handler->GetName() == name ) if ( handler->GetName() == name )
return handler; return handler;
node = node->Next(); node = node->GetNext();
} }
return NULL; return NULL;
} }
wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType) wxBitmapHandler *wxBitmapBase::FindHandler(const wxString& extension, wxBitmapType bitmapType)
{ {
wxNode *node = sm_handlers.First(); wxList::Node *node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
if ( handler->GetExtension() == extension && if ( handler->GetExtension() == extension &&
(bitmapType == -1 || handler->GetType() == bitmapType) ) (bitmapType == -1 || handler->GetType() == bitmapType) )
return handler; return handler;
node = node->Next(); node = node->GetNext();
} }
return NULL; return NULL;
} }
wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType) wxBitmapHandler *wxBitmapBase::FindHandler(wxBitmapType bitmapType)
{ {
wxNode *node = sm_handlers.First(); wxList::Node *node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
if (handler->GetType() == bitmapType) if (handler->GetType() == bitmapType)
return handler; return handler;
node = node->Next(); node = node->GetNext();
} }
return NULL; return NULL;
} }
void wxBitmapBase::CleanUpHandlers() void wxBitmapBase::CleanUpHandlers()
{ {
wxNode *node = sm_handlers.First(); wxList::Node *node = sm_handlers.GetFirst();
while ( node ) while ( node )
{ {
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data(); wxBitmapHandler *handler = (wxBitmapHandler *)node->GetData();
wxNode *next = node->Next(); wxList::Node *next = node->GetNext();
delete handler; delete handler;
delete node; delete node;
node = next; node = next;
@@ -122,5 +122,5 @@ public:
IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule) IMPLEMENT_DYNAMIC_CLASS(wxBitmapBaseModule, wxModule)
#endif // defined(__WXMGL__) || defined(__WXMAC__) #endif // defined(__WXMGL__) || defined(__WXMAC__) || defined(__WXMOTIF__)

View File

@@ -151,7 +151,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
int topY = m_view->GetViewRect().y - m_view->GetTopMargin(); int topY = m_view->GetViewRect().y - m_view->GetTopMargin();
int maxPositions = ((wxTabLayer *)m_view->GetLayers().Nth(0)->Data())->Number(); int maxPositions = ((wxTabLayer *)m_view->GetLayers().Item(0)->GetData())->GetCount();
// Only down to the bottom of the tab, not to the top of the view // Only down to the bottom of the tab, not to the top of the view
if ( GetRowPosition() < (maxPositions - 1) ) if ( GetRowPosition() < (maxPositions - 1) )
@@ -335,7 +335,7 @@ void wxTabControl::OnDraw(wxDC& dc, bool lastInRow)
// TAB is not selected - just draw TAB outline and RH edge // TAB is not selected - just draw TAB outline and RH edge
// if the TAB is the last in the row // if the TAB is the last in the row
int maxPositions = ((wxTabLayer*)m_view->GetLayers().Nth(0)->Data())->Number(); int maxPositions = ((wxTabLayer*)m_view->GetLayers().Item(0)->GetData())->GetCount();
wxTabControl* tabBelow = 0; wxTabControl* tabBelow = 0;
wxTabControl* tabBelowRight = 0; wxTabControl* tabBelowRight = 0;
if (GetColPosition() > 0) if (GetColPosition() > 0)
@@ -545,7 +545,7 @@ wxTabView::~wxTabView()
wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *existingTab) wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *existingTab)
{ {
// First, find which layer we should be adding to. // First, find which layer we should be adding to.
wxNode *node = m_layers.Last(); wxNode *node = m_layers.GetLast();
if (!node) if (!node)
{ {
wxTabLayer *newLayer = new wxTabLayer; wxTabLayer *newLayer = new wxTabLayer;
@@ -553,36 +553,36 @@ wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *exi
} }
// Check if adding another tab control would go off the // Check if adding another tab control would go off the
// right-hand edge of the layer. // right-hand edge of the layer.
wxTabLayer *tabLayer = (wxTabLayer *)node->Data(); wxTabLayer *tabLayer = (wxTabLayer *)node->GetData();
wxNode *lastTabNode = tabLayer->Last(); wxNode *lastTabNode = tabLayer->GetLast();
if (lastTabNode) if (lastTabNode)
{ {
wxTabControl *lastTab = (wxTabControl *)lastTabNode->Data(); wxTabControl *lastTab = (wxTabControl *)lastTabNode->GetData();
// Start another layer (row). // Start another layer (row).
// Tricky choice: can't just check if will be overlapping the edge, because // Tricky choice: can't just check if will be overlapping the edge, because
// this happens anyway for 2nd and subsequent rows. // this happens anyway for 2nd and subsequent rows.
// Should check this for 1st row, and then subsequent rows should not exceed 1st // Should check this for 1st row, and then subsequent rows should not exceed 1st
// in length. // in length.
if (((tabLayer == m_layers.First()->Data()) && ((lastTab->GetX() + 2*lastTab->GetWidth() + GetHorizontalTabSpacing()) if (((tabLayer == m_layers.GetFirst()->GetData()) && ((lastTab->GetX() + 2*lastTab->GetWidth() + GetHorizontalTabSpacing())
> GetViewRect().width)) || > GetViewRect().width)) ||
((tabLayer != m_layers.First()->Data()) && (tabLayer->Number() == ((wxTabLayer *)m_layers.First()->Data())->Number()))) ((tabLayer != m_layers.GetFirst()->GetData()) && (tabLayer->GetCount() == ((wxTabLayer *)m_layers.GetFirst()->GetData())->GetCount())))
{ {
tabLayer = new wxTabLayer; tabLayer = new wxTabLayer;
m_layers.Append(tabLayer); m_layers.Append(tabLayer);
lastTabNode = (wxNode *) NULL; lastTabNode = (wxNode *) NULL;
} }
} }
int layer = m_layers.Number() - 1; int layer = m_layers.GetCount() - 1;
wxTabControl *tabControl = existingTab; wxTabControl *tabControl = existingTab;
if (!existingTab) if (!existingTab)
tabControl = OnCreateTabControl(); tabControl = OnCreateTabControl();
tabControl->SetRowPosition(tabLayer->Number()); tabControl->SetRowPosition(tabLayer->GetCount());
tabControl->SetColPosition(layer); tabControl->SetColPosition(layer);
wxTabControl *lastTab = (wxTabControl *) NULL; wxTabControl *lastTab = (wxTabControl *) NULL;
if (lastTabNode) if (lastTabNode)
lastTab = (wxTabControl *)lastTabNode->Data(); lastTab = (wxTabControl *)lastTabNode->GetData();
// Top of new tab // Top of new tab
int verticalOffset = (- GetTopMargin()) - ((layer+1)*GetTabHeight()); int verticalOffset = (- GetTopMargin()) - ((layer+1)*GetTabHeight());
@@ -608,14 +608,14 @@ wxTabControl *wxTabView::AddTab(int id, const wxString& label, wxTabControl *exi
// Remove the tab without deleting the window // Remove the tab without deleting the window
bool wxTabView::RemoveTab(int id) bool wxTabView::RemoveTab(int id)
{ {
wxNode *layerNode = m_layers.First(); wxNode *layerNode = m_layers.GetFirst();
while (layerNode) while (layerNode)
{ {
wxTabLayer *layer = (wxTabLayer *)layerNode->Data(); wxTabLayer *layer = (wxTabLayer *)layerNode->GetData();
wxNode *tabNode = layer->First(); wxNode *tabNode = layer->GetFirst();
while (tabNode) while (tabNode)
{ {
wxTabControl *tab = (wxTabControl *)tabNode->Data(); wxTabControl *tab = (wxTabControl *)tabNode->GetData();
if (tab->GetId() == id) if (tab->GetId() == id)
{ {
if (id == m_tabSelection) if (id == m_tabSelection)
@@ -628,9 +628,9 @@ bool wxTabView::RemoveTab(int id)
LayoutTabs(); LayoutTabs();
return TRUE; return TRUE;
} }
tabNode = tabNode->Next(); tabNode = tabNode->GetNext();
} }
layerNode = layerNode->Next(); layerNode = layerNode->GetNext();
} }
return FALSE; return FALSE;
} }
@@ -659,21 +659,21 @@ int wxTabView::GetTotalTabHeight()
{ {
int minY = 0; int minY = 0;
wxNode *layerNode = m_layers.First(); wxNode *layerNode = m_layers.GetFirst();
while (layerNode) while (layerNode)
{ {
wxTabLayer *layer = (wxTabLayer *)layerNode->Data(); wxTabLayer *layer = (wxTabLayer *)layerNode->GetData();
wxNode *tabNode = layer->First(); wxNode *tabNode = layer->GetFirst();
while (tabNode) while (tabNode)
{ {
wxTabControl *tab = (wxTabControl *)tabNode->Data(); wxTabControl *tab = (wxTabControl *)tabNode->GetData();
if (tab->GetY() < minY) if (tab->GetY() < minY)
minY = tab->GetY(); minY = tab->GetY();
tabNode = tabNode->Next(); tabNode = tabNode->GetNext();
} }
layerNode = layerNode->Next(); layerNode = layerNode->GetNext();
} }
return - minY; return - minY;
@@ -681,21 +681,21 @@ int wxTabView::GetTotalTabHeight()
void wxTabView::ClearTabs(bool deleteTabs) void wxTabView::ClearTabs(bool deleteTabs)
{ {
wxNode *layerNode = m_layers.First(); wxNode *layerNode = m_layers.GetFirst();
while (layerNode) while (layerNode)
{ {
wxTabLayer *layer = (wxTabLayer *)layerNode->Data(); wxTabLayer *layer = (wxTabLayer *)layerNode->GetData();
wxNode *tabNode = layer->First(); wxNode *tabNode = layer->GetFirst();
while (tabNode) while (tabNode)
{ {
wxTabControl *tab = (wxTabControl *)tabNode->Data(); wxTabControl *tab = (wxTabControl *)tabNode->GetData();
if (deleteTabs) if (deleteTabs)
delete tab; delete tab;
wxNode *next = tabNode->Next(); wxNode *next = tabNode->GetNext();
delete tabNode; delete tabNode;
tabNode = next; tabNode = next;
} }
wxNode *nextLayerNode = layerNode->Next(); wxNode *nextLayerNode = layerNode->GetNext();
delete layer; delete layer;
delete layerNode; delete layerNode;
layerNode = nextLayerNode; layerNode = nextLayerNode;
@@ -711,20 +711,20 @@ void wxTabView::LayoutTabs(void)
// Make a list of the tab controls, deleting the wxTabLayers. // Make a list of the tab controls, deleting the wxTabLayers.
wxList controls; wxList controls;
wxNode *layerNode = m_layers.First(); wxNode *layerNode = m_layers.GetFirst();
while (layerNode) while (layerNode)
{ {
wxTabLayer *layer = (wxTabLayer *)layerNode->Data(); wxTabLayer *layer = (wxTabLayer *)layerNode->GetData();
wxNode *tabNode = layer->First(); wxNode *tabNode = layer->GetFirst();
while (tabNode) while (tabNode)
{ {
wxTabControl *tab = (wxTabControl *)tabNode->Data(); wxTabControl *tab = (wxTabControl *)tabNode->GetData();
controls.Append(tab); controls.Append(tab);
wxNode *next = tabNode->Next(); wxNode *next = tabNode->GetNext();
delete tabNode; delete tabNode;
tabNode = next; tabNode = next;
} }
wxNode *nextLayerNode = layerNode->Next(); wxNode *nextLayerNode = layerNode->GetNext();
delete layer; delete layer;
delete layerNode; delete layerNode;
layerNode = nextLayerNode; layerNode = nextLayerNode;
@@ -735,10 +735,10 @@ void wxTabView::LayoutTabs(void)
wxTabLayer *currentLayer = new wxTabLayer; wxTabLayer *currentLayer = new wxTabLayer;
m_layers.Append(currentLayer); m_layers.Append(currentLayer);
wxNode *node = controls.First(); wxNode *node = controls.GetFirst();
while (node) while (node)
{ {
wxTabControl *tabControl = (wxTabControl *)node->Data(); wxTabControl *tabControl = (wxTabControl *)node->GetData();
if (lastTab) if (lastTab)
{ {
// Start another layer (row). // Start another layer (row).
@@ -746,9 +746,9 @@ void wxTabView::LayoutTabs(void)
// this happens anyway for 2nd and subsequent rows. // this happens anyway for 2nd and subsequent rows.
// Should check this for 1st row, and then subsequent rows should not exceed 1st // Should check this for 1st row, and then subsequent rows should not exceed 1st
// in length. // in length.
if (((currentLayer == m_layers.First()->Data()) && ((lastTab->GetX() + 2*lastTab->GetWidth() + GetHorizontalTabSpacing()) if (((currentLayer == m_layers.GetFirst()->GetData()) && ((lastTab->GetX() + 2*lastTab->GetWidth() + GetHorizontalTabSpacing())
> GetViewRect().width)) || > GetViewRect().width)) ||
((currentLayer != m_layers.First()->Data()) && (currentLayer->Number() == ((wxTabLayer *)m_layers.First()->Data())->Number()))) ((currentLayer != m_layers.GetFirst()->GetData()) && (currentLayer->GetCount() == ((wxTabLayer *)m_layers.GetFirst()->GetData())->GetCount())))
{ {
currentLayer = new wxTabLayer; currentLayer = new wxTabLayer;
m_layers.Append(currentLayer); m_layers.Append(currentLayer);
@@ -756,9 +756,9 @@ void wxTabView::LayoutTabs(void)
} }
} }
int layer = m_layers.Number() - 1; int layer = m_layers.GetCount() - 1;
tabControl->SetRowPosition(currentLayer->Number()); tabControl->SetRowPosition(currentLayer->GetCount());
tabControl->SetColPosition(layer); tabControl->SetColPosition(layer);
// Top of new tab // Top of new tab
@@ -776,7 +776,7 @@ void wxTabView::LayoutTabs(void)
currentLayer->Append(tabControl); currentLayer->Append(tabControl);
lastTab = tabControl; lastTab = tabControl;
node = node->Next(); node = node->GetNext();
} }
// Move the selected tab to the bottom // Move the selected tab to the bottom
@@ -809,19 +809,19 @@ void wxTabView::Draw(wxDC& dc)
} }
// Draw layers in reverse order // Draw layers in reverse order
wxNode *node = m_layers.Last(); wxNode *node = m_layers.GetLast();
while (node) while (node)
{ {
wxTabLayer *layer = (wxTabLayer *)node->Data(); wxTabLayer *layer = (wxTabLayer *)node->GetData();
wxNode *node2 = layer->First(); wxNode *node2 = layer->GetFirst();
while (node2) while (node2)
{ {
wxTabControl *control = (wxTabControl *)node2->Data(); wxTabControl *control = (wxTabControl *)node2->GetData();
control->OnDraw(dc, (node2->Next() == NULL)); control->OnDraw(dc, (node2->GetNext() == NULL));
node2 = node2->Next(); node2 = node2->GetNext();
} }
node = node->Previous(); node = node->GetPrevious();
} }
@@ -883,14 +883,14 @@ bool wxTabView::OnEvent(wxMouseEvent& event)
wxTabControl *hitControl = (wxTabControl *) NULL; wxTabControl *hitControl = (wxTabControl *) NULL;
wxNode *node = m_layers.First(); wxNode *node = m_layers.GetFirst();
while (node) while (node)
{ {
wxTabLayer *layer = (wxTabLayer *)node->Data(); wxTabLayer *layer = (wxTabLayer *)node->GetData();
wxNode *node2 = layer->First(); wxNode *node2 = layer->GetFirst();
while (node2) while (node2)
{ {
wxTabControl *control = (wxTabControl *)node2->Data(); wxTabControl *control = (wxTabControl *)node2->GetData();
if (control->HitTest((int)x, (int)y)) if (control->HitTest((int)x, (int)y))
{ {
hitControl = control; hitControl = control;
@@ -898,11 +898,11 @@ bool wxTabView::OnEvent(wxMouseEvent& event)
node2 = (wxNode *) NULL; node2 = (wxNode *) NULL;
} }
else else
node2 = node2->Next(); node2 = node2->GetNext();
} }
if (node) if (node)
node = node->Next(); node = node->GetNext();
} }
if (!hitControl) if (!hitControl)
@@ -928,7 +928,7 @@ bool wxTabView::ChangeTab(wxTabControl *control)
if (control == currentTab) if (control == currentTab)
return TRUE; return TRUE;
if (m_layers.Number() == 0) if (m_layers.GetCount() == 0)
return FALSE; return FALSE;
if (!OnTabPreActivate(control->GetId(), oldTab)) if (!OnTabPreActivate(control->GetId(), oldTab))
@@ -954,10 +954,10 @@ bool wxTabView::ChangeTab(wxTabControl *control)
// without calling app activation code // without calling app activation code
bool wxTabView::MoveSelectionTab(wxTabControl *control) bool wxTabView::MoveSelectionTab(wxTabControl *control)
{ {
if (m_layers.Number() == 0) if (m_layers.GetCount() == 0)
return FALSE; return FALSE;
wxTabLayer *firstLayer = (wxTabLayer *)m_layers.First()->Data(); wxTabLayer *firstLayer = (wxTabLayer *)m_layers.GetFirst()->GetData();
// Find what column this tab is at, so we can swap with the one at the bottom. // Find what column this tab is at, so we can swap with the one at the bottom.
// If we're on the bottom layer, then no need to swap. // If we're on the bottom layer, then no need to swap.
@@ -968,7 +968,7 @@ bool wxTabView::MoveSelectionTab(wxTabControl *control)
wxNode *thisNode = FindTabNodeAndColumn(control, &col); wxNode *thisNode = FindTabNodeAndColumn(control, &col);
if (!thisNode) if (!thisNode)
return FALSE; return FALSE;
wxNode *otherNode = firstLayer->Nth(col); wxNode *otherNode = firstLayer->Item(col);
if (!otherNode) if (!otherNode)
return FALSE; return FALSE;
@@ -976,7 +976,7 @@ bool wxTabView::MoveSelectionTab(wxTabControl *control)
if (otherNode == thisNode) if (otherNode == thisNode)
return TRUE; return TRUE;
wxTabControl *otherTab = (wxTabControl *)otherNode->Data(); wxTabControl *otherTab = (wxTabControl *)otherNode->GetData();
// We now have pointers to the tab to be changed to, // We now have pointers to the tab to be changed to,
// and the tab on the first layer. Swap tab structures and // and the tab on the first layer. Swap tab structures and
@@ -1060,19 +1060,19 @@ void wxTabView::SetTabSelection(int sel, bool activateTool)
// Find tab control for id // Find tab control for id
wxTabControl *wxTabView::FindTabControlForId(int id) const wxTabControl *wxTabView::FindTabControlForId(int id) const
{ {
wxNode *node1 = m_layers.First(); wxNode *node1 = m_layers.GetFirst();
while (node1) while (node1)
{ {
wxTabLayer *layer = (wxTabLayer *)node1->Data(); wxTabLayer *layer = (wxTabLayer *)node1->GetData();
wxNode *node2 = layer->First(); wxNode *node2 = layer->GetFirst();
while (node2) while (node2)
{ {
wxTabControl *control = (wxTabControl *)node2->Data(); wxTabControl *control = (wxTabControl *)node2->GetData();
if (control->GetId() == id) if (control->GetId() == id)
return control; return control;
node2 = node2->Next(); node2 = node2->GetNext();
} }
node1 = node1->Next(); node1 = node1->GetNext();
} }
return (wxTabControl *) NULL; return (wxTabControl *) NULL;
} }
@@ -1080,37 +1080,37 @@ wxTabControl *wxTabView::FindTabControlForId(int id) const
// Find tab control for layer, position (starting from zero) // Find tab control for layer, position (starting from zero)
wxTabControl *wxTabView::FindTabControlForPosition(int layer, int position) const wxTabControl *wxTabView::FindTabControlForPosition(int layer, int position) const
{ {
wxNode *node1 = m_layers.Nth(layer); wxNode *node1 = m_layers.Item(layer);
if (!node1) if (!node1)
return (wxTabControl *) NULL; return (wxTabControl *) NULL;
wxTabLayer *tabLayer = (wxTabLayer *)node1->Data(); wxTabLayer *tabLayer = (wxTabLayer *)node1->GetData();
wxNode *node2 = tabLayer->Nth(position); wxNode *node2 = tabLayer->Item(position);
if (!node2) if (!node2)
return (wxTabControl *) NULL; return (wxTabControl *) NULL;
return (wxTabControl *)node2->Data(); return (wxTabControl *)node2->GetData();
} }
// Find the node and the column at which this control is positioned. // Find the node and the column at which this control is positioned.
wxNode *wxTabView::FindTabNodeAndColumn(wxTabControl *control, int *col) const wxNode *wxTabView::FindTabNodeAndColumn(wxTabControl *control, int *col) const
{ {
wxNode *node1 = m_layers.First(); wxNode *node1 = m_layers.GetFirst();
while (node1) while (node1)
{ {
wxTabLayer *layer = (wxTabLayer *)node1->Data(); wxTabLayer *layer = (wxTabLayer *)node1->GetData();
int c = 0; int c = 0;
wxNode *node2 = layer->First(); wxNode *node2 = layer->GetFirst();
while (node2) while (node2)
{ {
wxTabControl *cnt = (wxTabControl *)node2->Data(); wxTabControl *cnt = (wxTabControl *)node2->GetData();
if (cnt == control) if (cnt == control)
{ {
*col = c; *col = c;
return node2; return node2;
} }
node2 = node2->Next(); node2 = node2->GetNext();
c ++; c ++;
} }
node1 = node1->Next(); node1 = node1->GetNext();
} }
return (wxNode *) NULL; return (wxNode *) NULL;
} }
@@ -1259,7 +1259,7 @@ wxWindow *wxPanelTabView::GetTabWindow(int id) const
wxNode *node = m_tabWindows.Find((long)id); wxNode *node = m_tabWindows.Find((long)id);
if (!node) if (!node)
return (wxWindow *) NULL; return (wxWindow *) NULL;
return (wxWindow *)node->Data(); return (wxWindow *)node->GetData();
} }
void wxPanelTabView::ClearWindows(bool deleteWindows) void wxPanelTabView::ClearWindows(bool deleteWindows)

View File

@@ -113,8 +113,6 @@ wxBitmapRefData::~wxBitmapRefData()
m_bitmapMask = NULL; m_bitmapMask = NULL;
} }
wxList wxBitmap::sm_handlers;
#define M_BMPDATA ((wxBitmapRefData *)m_refData) #define M_BMPDATA ((wxBitmapRefData *)m_refData)
wxBitmap::wxBitmap() wxBitmap::wxBitmap()
@@ -138,14 +136,15 @@ wxBitmap::wxBitmap(int w, int h, int d)
(void)Create(w, h, d); (void)Create(w, h, d);
} }
wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth) wxBitmap::wxBitmap(void *data, wxBitmapType type,
int width, int height, int depth)
{ {
(void) Create(data, type, width, height, depth); (void) Create(data, type, width, height, depth);
} }
wxBitmap::wxBitmap(const wxString& filename, int type) wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type)
{ {
LoadFile(filename, (int)type); LoadFile(filename, type);
} }
// Create from XPM data // Create from XPM data
@@ -198,7 +197,7 @@ bool wxBitmap::Create(int w, int h, int d)
return M_BITMAPDATA->m_ok; return M_BITMAPDATA->m_ok;
} }
bool wxBitmap::LoadFile(const wxString& filename, long type) bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
{ {
UnRef(); UnRef();
@@ -220,7 +219,8 @@ bool wxBitmap::LoadFile(const wxString& filename, long type)
return handler->LoadFile(this, filename, type, -1, -1); return handler->LoadFile(this, filename, type, -1, -1);
} }
bool wxBitmap::Create(void *data, long type, int width, int height, int depth) bool wxBitmap::Create(void *data, wxBitmapType type,
int width, int height, int depth)
{ {
UnRef(); UnRef();
@@ -229,7 +229,8 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
wxBitmapHandler *handler = FindHandler(type); wxBitmapHandler *handler = FindHandler(type);
if ( handler == NULL ) { if ( handler == NULL ) {
wxLogWarning("no data bitmap handler for type %ld defined.", type); wxLogWarning("no data bitmap handler for type %ld defined.",
(long)type);
return FALSE; return FALSE;
} }
@@ -237,7 +238,8 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth)
return handler->Create(this, data, type, width, height, depth); return handler->Create(this, data, type, width, height, depth);
} }
bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *palette) bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
const wxPalette *palette) const
{ {
wxBitmapHandler *handler = FindHandler(type); wxBitmapHandler *handler = FindHandler(type);
@@ -320,68 +322,6 @@ wxBitmap wxBitmap::GetSubBitmap( const wxRect& rect) const
return ret; return ret;
} }
void wxBitmap::AddHandler(wxBitmapHandler *handler)
{
sm_handlers.Append(handler);
}
void wxBitmap::InsertHandler(wxBitmapHandler *handler)
{
sm_handlers.Insert(handler);
}
bool wxBitmap::RemoveHandler(const wxString& name)
{
wxBitmapHandler *handler = FindHandler(name);
if ( handler )
{
sm_handlers.DeleteObject(handler);
return TRUE;
}
else
return FALSE;
}
wxBitmapHandler *wxBitmap::FindHandler(const wxString& name)
{
wxNode *node = sm_handlers.First();
while ( node )
{
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
if ( handler->GetName() == name )
return handler;
node = node->Next();
}
return NULL;
}
wxBitmapHandler *wxBitmap::FindHandler(const wxString& extension, long bitmapType)
{
wxNode *node = sm_handlers.First();
while ( node )
{
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
if ( handler->GetExtension() == extension &&
(bitmapType == -1 || handler->GetType() == bitmapType) )
return handler;
node = node->Next();
}
return NULL;
}
wxBitmapHandler *wxBitmap::FindHandler(long bitmapType)
{
wxNode *node = sm_handlers.First();
while ( node )
{
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
if (handler->GetType() == bitmapType)
return handler;
node = node->Next();
}
return NULL;
}
/* /*
* wxMask * wxMask
*/ */
@@ -453,24 +393,6 @@ bool wxMask::Create(const wxBitmap& WXUNUSED(bitmap), const wxColour& WXUNUSED(c
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(type),
int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth))
{
return FALSE;
}
bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), long WXUNUSED(type),
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight))
{
return FALSE;
}
bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), int WXUNUSED(type),
const wxPalette *WXUNUSED(palette))
{
return FALSE;
}
/* /*
* Standard handlers * Standard handlers
*/ */
@@ -489,10 +411,13 @@ public:
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight); int desiredWidth, int desiredHeight);
}; };
IMPLEMENT_DYNAMIC_CLASS(wxXBMFileHandler, wxBitmapHandler) IMPLEMENT_DYNAMIC_CLASS(wxXBMFileHandler, wxBitmapHandler)
bool wxXBMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), bool wxXBMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{ {
M_BITMAPHANDLERDATA->m_freePixmap = TRUE; M_BITMAPHANDLERDATA->m_freePixmap = TRUE;
@@ -534,11 +459,13 @@ public:
m_type = wxBITMAP_TYPE_XBM_DATA; m_type = wxBITMAP_TYPE_XBM_DATA;
}; };
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1);
}; };
IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler) IMPLEMENT_DYNAMIC_CLASS(wxXBMDataHandler, wxBitmapHandler)
bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags), bool wxXBMDataHandler::Create( wxBitmap *bitmap, void *data,
long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth)) int width, int height, int WXUNUSED(depth))
{ {
M_BITMAPHANDLERDATA->m_width = width; M_BITMAPHANDLERDATA->m_width = width;
@@ -620,13 +547,16 @@ public:
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags, virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight); int desiredWidth, int desiredHeight);
virtual bool SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette = NULL); virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
wxBitmapType type, const wxPalette *palette = NULL);
}; };
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler) IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name,
int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight) ) long WXUNUSED(flags),
int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight) )
{ {
Display *dpy = (Display*) wxGetDisplay(); Display *dpy = (Display*) wxGetDisplay();
M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy; M_BITMAPHANDLERDATA->m_display = (WXDisplay*) dpy;
@@ -687,7 +617,8 @@ bool wxXPMFileHandler::LoadFile( wxBitmap *bitmap, const wxString& name, long WX
} }
} }
bool wxXPMFileHandler::SaveFile( wxBitmap *bitmap, const wxString& name, int WXUNUSED(type), bool wxXPMFileHandler::SaveFile( const wxBitmap *bitmap, const wxString& name,
wxBitmapType WXUNUSED(type),
const wxPalette *WXUNUSED(palette)) const wxPalette *WXUNUSED(palette))
{ {
if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap) if (M_BITMAPHANDLERDATA->m_ok && M_BITMAPHANDLERDATA->m_pixmap)
@@ -717,11 +648,13 @@ public:
m_type = wxBITMAP_TYPE_XPM_DATA; m_type = wxBITMAP_TYPE_XPM_DATA;
}; };
virtual bool Create(wxBitmap *bitmap, void *data, long flags, int width, int height, int depth = 1); virtual bool Create(wxBitmap *bitmap, void *data, long flags,
int width, int height, int depth = 1);
}; };
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler) IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags), bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data,
long WXUNUSED(flags),
int width, int height, int WXUNUSED(depth)) int width, int height, int WXUNUSED(depth))
{ {
M_BITMAPHANDLERDATA->m_width = width; M_BITMAPHANDLERDATA->m_width = width;
@@ -800,19 +733,6 @@ bool wxXPMDataHandler::Create( wxBitmap *bitmap, void *data, long WXUNUSED(flags
#endif // wxHAVE_LIB_XPM #endif // wxHAVE_LIB_XPM
void wxBitmap::CleanUpHandlers()
{
wxNode *node = sm_handlers.First();
while ( node )
{
wxBitmapHandler *handler = (wxBitmapHandler *)node->Data();
wxNode *next = node->Next();
delete handler;
delete node;
node = next;
}
}
void wxBitmap::InitStandardHandlers() void wxBitmap::InitStandardHandlers()
{ {
// Initialize all standard bitmap or derived class handlers here. // Initialize all standard bitmap or derived class handlers here.

View File

@@ -51,6 +51,7 @@ ALL_SOURCES = \
common/appcmn.cpp \ common/appcmn.cpp \
common/artprov.cpp \ common/artprov.cpp \
common/artstd.cpp \ common/artstd.cpp \
common/bmpbase.cpp \
common/choiccmn.cpp \ common/choiccmn.cpp \
common/clipcmn.cpp \ common/clipcmn.cpp \
common/clntdata.cpp \ common/clntdata.cpp \
@@ -631,6 +632,7 @@ COMMONOBJS = \
appcmn.o \ appcmn.o \
artprov.o \ artprov.o \
artstd.o \ artstd.o \
bmpbase.o \
choiccmn.o \ choiccmn.o \
clipcmn.o \ clipcmn.o \
clntdata.o \ clntdata.o \

View File

@@ -169,8 +169,8 @@ bool wxFrame::Create(wxWindow *parent,
SetTitle( title ); SetTitle( title );
wxLogTrace(wxTRACE_Messages, wxLogTrace(wxTRACE_Messages,
"Created frame (0x%08x) with work area 0x%08x and client " "Created frame (0x%p) with work area 0x%p and client "
"area 0x%08x", m_mainWidget, m_workArea, m_clientArea); "area 0x%p", m_mainWidget, m_workArea, m_clientArea);
XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE, XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this); wxUniversalRepaintProc, (XtPointer) this);

View File

@@ -54,11 +54,11 @@ wxIcon::wxIcon(const char **data)
(void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); (void) Create((void*) data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
} }
wxIcon::wxIcon(const wxString& icon_file, long flags, wxIcon::wxIcon(const wxString& icon_file, wxBitmapType type,
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
LoadFile(icon_file, flags, desiredWidth, desiredHeight); LoadFile(icon_file, type, desiredWidth, desiredHeight);
} }
void wxIcon::CopyFromBitmap(const wxBitmap& bmp) void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
@@ -71,7 +71,7 @@ wxIcon::~wxIcon()
{ {
} }
bool wxIcon::LoadFile(const wxString& filename, long type, bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
int desiredWidth, int desiredHeight) int desiredWidth, int desiredHeight)
{ {
UnRef(); UnRef();
@@ -81,7 +81,8 @@ bool wxIcon::LoadFile(const wxString& filename, long type,
wxBitmapHandler *handler = FindHandler(type); wxBitmapHandler *handler = FindHandler(type);
if ( handler ) if ( handler )
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight); return handler->LoadFile(this, filename, type,
desiredWidth, desiredHeight);
else else
return FALSE; return FALSE;
} }

View File

@@ -77,10 +77,10 @@ wxPaletteRefData::~wxPaletteRefData()
{ {
Display *display = (Display*) NULL; Display *display = (Display*) NULL;
wxNode *node, *next; wxList::Node *node, *next;
for (node = m_palettes.First(); node; node = next) { for (node = m_palettes.GetFirst(); node; node = next) {
wxXPalette *c = (wxXPalette *)node->Data(); wxXPalette *c = (wxXPalette *)node->GetData();
unsigned long *pix_array = c->m_pix_array; unsigned long *pix_array = c->m_pix_array;
Colormap cmap = (Colormap) c->m_cmap; Colormap cmap = (Colormap) c->m_cmap;
bool destroyable = c->m_destroyable; bool destroyable = c->m_destroyable;
@@ -103,7 +103,7 @@ wxPaletteRefData::~wxPaletteRefData()
if (destroyable) if (destroyable)
XFreeColormap(display, cmap); XFreeColormap(display, cmap);
next = node->Next(); next = node->GetNext();
m_palettes.DeleteNode(node); m_palettes.DeleteNode(node);
delete c; delete c;
} }
@@ -189,27 +189,28 @@ bool wxPalette::GetRGB(int index, unsigned char *WXUNUSED(red), unsigned char *W
WXColormap wxPalette::GetXColormap(WXDisplay* display) const 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); return wxTheApp->GetMainColormap(display);
wxNode* node = M_PALETTEDATA->m_palettes.First(); wxList::Node* node = M_PALETTEDATA->m_palettes.GetFirst();
if (!display && node) if (!display && node)
{ {
wxXPalette* p = (wxXPalette*) node->Data(); wxXPalette* p = (wxXPalette*) node->GetData();
return p->m_cmap; return p->m_cmap;
} }
while (node) while (node)
{ {
wxXPalette* p = (wxXPalette*) node->Data(); wxXPalette* p = (wxXPalette*) node->GetData();
if (p->m_display == display) if (p->m_display == display)
return p->m_cmap; return p->m_cmap;
node = node->Next(); node = node->GetNext();
} }
/* Make a new one: */ /* Make a new one: */
wxXPalette *c = new wxXPalette; wxXPalette *c = new wxXPalette;
wxXPalette *first = (wxXPalette *)M_PALETTEDATA->m_palettes.First()->Data(); wxXPalette *first =
(wxXPalette *)M_PALETTEDATA->m_palettes.GetFirst()->GetData();
XColor xcol; XColor xcol;
int pix_array_n = first->m_pix_array_n; int pix_array_n = first->m_pix_array_n;
@@ -224,9 +225,11 @@ WXColormap wxPalette::GetXColormap(WXDisplay* display) const
for (i = 0; i < pix_array_n; i++) for (i = 0; i < pix_array_n; i++)
{ {
xcol.pixel = first->m_pix_array[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] = 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; // wxPalette* nonConstThis = (wxPalette*) this;
@@ -317,11 +320,12 @@ unsigned long *wxPalette::GetXPixArray(WXDisplay *display, int *n)
{ {
if (!M_PALETTEDATA) if (!M_PALETTEDATA)
return (unsigned long*) 0; return (unsigned long*) 0;
wxNode *node; wxList::Node *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 (c->m_display == display)
{ {
if (n) if (n)

View File

@@ -82,10 +82,10 @@ public:
void wxRegionRefData::SetRects(const wxRectList& rectList) void wxRegionRefData::SetRects(const wxRectList& rectList)
{ {
DeleteRects(); DeleteRects();
m_usingRects = (rectList.Number() > 0); m_usingRects = (rectList.GetCount() > 0);
if (m_usingRects) if (m_usingRects)
{ {
m_rectCount = rectList.Number(); m_rectCount = rectList.GetCount();
m_rects = new wxRect[m_rectCount]; m_rects = new wxRect[m_rectCount];
} }

View File

@@ -87,7 +87,7 @@ wxTopLevelWindowMotif::~wxTopLevelWindowMotif()
SetMainWidget( (WXWidget)0 ); SetMainWidget( (WXWidget)0 );
// If this is the last top-level window, exit. // If this is the last top-level window, exit.
if (wxTheApp && (wxTopLevelWindows.Number() == 0)) if (wxTheApp && (wxTopLevelWindows.GetCount() == 0))
{ {
wxTheApp->SetTopWindow(NULL); wxTheApp->SetTopWindow(NULL);

View File

@@ -961,16 +961,16 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
GetClientSize(& w, & h); GetClientSize(& w, & h);
} }
wxNode *cnode = m_children.First(); wxWindowList::Node *cnode = m_children.GetFirst();
while (cnode) while (cnode)
{ {
wxWindow *child = (wxWindow*) cnode->Data(); wxWindow *child = cnode->GetData();
int sx = 0; int sx = 0;
int sy = 0; int sy = 0;
child->GetSize( &sx, &sy ); child->GetSize( &sx, &sy );
wxPoint pos( child->GetPosition() ); wxPoint pos( child->GetPosition() );
child->SetSize( pos.x + dx, pos.y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE ); child->SetSize( pos.x + dx, pos.y + dy, sx, sy, wxSIZE_ALLOW_MINUS_ONE );
cnode = cnode->Next(); cnode = cnode->GetNext();
} }
int x1 = (dx >= 0) ? x : x - dx; int x1 = (dx >= 0) ? x : x - dx;
@@ -1079,10 +1079,10 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
// Now send expose events // Now send expose events
wxNode* node = updateRects.First(); wxList::Node* node = updateRects.GetFirst();
while (node) while (node)
{ {
wxRect* rect = (wxRect*) node->Data(); wxRect* rect = (wxRect*) node->GetData();
XExposeEvent event; XExposeEvent event;
event.type = Expose; event.type = Expose;
@@ -1099,17 +1099,17 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
XSendEvent(display, window, False, ExposureMask, (XEvent *)&event); XSendEvent(display, window, False, ExposureMask, (XEvent *)&event);
node = node->Next(); node = node->GetNext();
} }
// Delete the update rects // Delete the update rects
node = updateRects.First(); node = updateRects.GetFirst();
while (node) while (node)
{ {
wxRect* rect = (wxRect*) node->Data(); wxRect* rect = (wxRect*) node->GetData();
delete rect; delete rect;
node = node->Next(); node = node->GetNext();
} }
XmUpdateDisplay((Widget) GetMainWidget()); XmUpdateDisplay((Widget) GetMainWidget());
@@ -1813,8 +1813,8 @@ bool wxAddWindowToTable(Widget w, wxWindow *win)
wxWidgetHashTable->Put((long) w, win); wxWidgetHashTable->Put((long) w, win);
wxLogTrace("widget", "Widget 0x%08x <-> window %p (%s)", wxLogTrace("widget", "Widget 0x%p <-> window %p (%s)",
w, win, win->GetClassInfo()->GetClassName()); (WXWidget)w, win, win->GetClassInfo()->GetClassName());
return TRUE; return TRUE;
} }