Fixes for differences between wxMSW and wxGTK`

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4975 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
1999-12-15 19:46:19 +00:00
parent 6de20863de
commit 5bff6bb8ea
4 changed files with 94 additions and 37 deletions

View File

@@ -41,10 +41,12 @@ class TestPanel(wxPanel):
b = wxGenBitmapButton(self, -1, None, (100, 130)) b = wxGenBitmapButton(self, -1, None, (100, 130))
EVT_BUTTON(self, b.GetId(), self.OnButton) EVT_BUTTON(self, b.GetId(), self.OnButton)
bmp = wxBitmap('bitmaps/lb1.bmp', wxBITMAP_TYPE_BMP) bmp = wxBitmap('bitmaps/lb1.bmp', wxBITMAP_TYPE_BMP)
if wxPlatform == '__WXMSW__':
mask = wxMaskColour(bmp, wxBLUE) mask = wxMaskColour(bmp, wxBLUE)
bmp.SetMask(mask) bmp.SetMask(mask)
b.SetBitmapLabel(bmp) b.SetBitmapLabel(bmp)
bmp = wxBitmap('bitmaps/lb2.bmp', wxBITMAP_TYPE_BMP) bmp = wxBitmap('bitmaps/lb2.bmp', wxBITMAP_TYPE_BMP)
if wxPlatform == '__WXMSW__':
mask = wxMaskColour(bmp, wxBLUE) mask = wxMaskColour(bmp, wxBLUE)
bmp.SetMask(mask) bmp.SetMask(mask)
b.SetBitmapSelected(bmp) b.SetBitmapSelected(bmp)
@@ -57,10 +59,12 @@ class TestPanel(wxPanel):
b = wxGenBitmapToggleButton(self, -1, None, (100, 230)) b = wxGenBitmapToggleButton(self, -1, None, (100, 230))
EVT_BUTTON(self, b.GetId(), self.OnToggleButton) EVT_BUTTON(self, b.GetId(), self.OnToggleButton)
bmp = wxBitmap('bitmaps/lb1.bmp', wxBITMAP_TYPE_BMP) bmp = wxBitmap('bitmaps/lb1.bmp', wxBITMAP_TYPE_BMP)
if wxPlatform == '__WXMSW__':
mask = wxMaskColour(bmp, wxBLUE) mask = wxMaskColour(bmp, wxBLUE)
bmp.SetMask(mask) bmp.SetMask(mask)
b.SetBitmapLabel(bmp) b.SetBitmapLabel(bmp)
bmp = wxBitmap('bitmaps/lb2.bmp', wxBITMAP_TYPE_BMP) bmp = wxBitmap('bitmaps/lb2.bmp', wxBITMAP_TYPE_BMP)
if wxPlatform == '__WXMSW__':
mask = wxMaskColour(bmp, wxBLUE) mask = wxMaskColour(bmp, wxBLUE)
bmp.SetMask(mask) bmp.SetMask(mask)
b.SetBitmapSelected(bmp) b.SetBitmapSelected(bmp)

View File

@@ -33,28 +33,25 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class wxGDIImage { // class wxGDIImage {
public: // public:
long GetHandle(); // long GetHandle();
void SetHandle(long handle); // void SetHandle(long handle);
// bool Ok();
bool Ok(); // int GetWidth();
// int GetHeight();
int GetWidth(); // int GetDepth();
int GetHeight(); // void SetWidth(int w);
int GetDepth(); // void SetHeight(int h);
// void SetDepth(int d);
void SetWidth(int w); // void SetSize(const wxSize& size);
void SetHeight(int h); // };
void SetDepth(int d);
void SetSize(const wxSize& size);
};
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class wxBitmap : public wxGDIImage { class wxBitmap
//: public wxGDIImage
{
public: public:
wxBitmap(const wxString& name, long type); wxBitmap(const wxString& name, long type);
~wxBitmap(); ~wxBitmap();
@@ -67,8 +64,25 @@ public:
#ifdef __WXMSW__ #ifdef __WXMSW__
void SetPalette(wxPalette& palette); void SetPalette(wxPalette& palette);
#endif #endif
// wxGDIImage methods
#ifdef __WXMSW__
long GetHandle();
void SetHandle(long handle);
#endif
bool Ok();
int GetWidth();
int GetHeight();
int GetDepth();
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
#ifdef __WXMSW__
void SetSize(const wxSize& size);
#endif
}; };
%new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1); %new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
#ifdef __WXMSW__ #ifdef __WXMSW__
@@ -108,24 +122,60 @@ public:
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class wxIcon : public wxGDIImage { class wxIcon
//: public wxGDIImage
{
public: public:
wxIcon(const wxString& name, long flags, wxIcon(const wxString& name, long flags,
int desiredWidth = -1, int desiredHeight = -1); int desiredWidth = -1, int desiredHeight = -1);
~wxIcon(); ~wxIcon();
bool LoadFile(const wxString& name, long flags); bool LoadFile(const wxString& name, long flags);
// wxGDIImage methods
#ifdef __WXMSW__
long GetHandle();
void SetHandle(long handle);
#endif
bool Ok();
int GetWidth();
int GetHeight();
int GetDepth();
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
#ifdef __WXMSW__
void SetSize(const wxSize& size);
#endif
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
class wxCursor : public wxGDIImage { class wxCursor
//: public wxGDIImage
{
public: public:
#ifdef __WXMSW__ #ifdef __WXMSW__
wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0); wxCursor(const wxString& cursorName, long flags, int hotSpotX=0, int hotSpotY=0);
#endif #endif
~wxCursor(); ~wxCursor();
// wxGDIImage methods
#ifdef __WXMSW__
long GetHandle();
void SetHandle(long handle);
#endif
bool Ok();
#ifdef __WXMSW__
int GetWidth();
int GetHeight();
int GetDepth();
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
void SetSize(const wxSize& size);
#endif
}; };
%name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id); %name(wxStockCursor) %new wxCursor* wxPyStockCursor(int id);
@@ -266,7 +316,7 @@ public:
#ifdef __WXMSW__ #ifdef __WXMSW__
typedef unsigned long wxDash; typedef unsigned long wxDash;
#else #else
typedef byte wxDash; typedef char wxDash;
#endif #endif

View File

@@ -79,9 +79,13 @@
} }
#ifdef __WXMSW__
%typemap(python,in) wxDash* LIST = unsigned long* LIST; %typemap(python,in) wxDash* LIST = unsigned long* LIST;
%typemap(python,freearg) wxDash* LIST = unsigned long* LIST; %typemap(python,freearg) wxDash* LIST = unsigned long* LIST;
#else
%typemap(python,in) wxDash* LIST = byte* LIST;
%typemap(python,freearg) wxDash* LIST = byte* LIST;
#endif
%typemap(python,in) char** LIST { %typemap(python,in) char** LIST {

View File

@@ -141,12 +141,14 @@ public:
void EnableTool(int toolIndex, bool enable); void EnableTool(int toolIndex, bool enable);
#ifdef __WXMSW__
wxToolBarTool* FindToolForPosition(long x, long y); wxToolBarTool* FindToolForPosition(long x, long y);
wxSize GetToolSize(); wxSize GetToolSize();
wxSize GetToolBitmapSize(); wxSize GetToolBitmapSize();
void SetToolBitmapSize(const wxSize& size); void SetToolBitmapSize(const wxSize& size);
wxSize GetToolMargins();
wxSize GetMaxSize(); wxSize GetMaxSize();
#endif
wxSize GetToolMargins();
// wxObject* GetToolClientData(int toolIndex); // wxObject* GetToolClientData(int toolIndex);
bool GetToolEnabled(int toolIndex); bool GetToolEnabled(int toolIndex);
wxString GetToolLongHelp(int toolIndex); wxString GetToolLongHelp(int toolIndex);
@@ -164,16 +166,13 @@ public:
void SetToolPacking(int packing); void SetToolPacking(int packing);
void SetToolSeparation(int separation); void SetToolSeparation(int separation);
void ToggleTool(int toolIndex, const bool toggle); void ToggleTool(int toolIndex, const bool toggle);
#ifdef __WXMSW__
void SetToggle(int toolIndex, bool toggle); void SetToggle(int toolIndex, bool toggle);
void SetMaxRowsCols(int rows, int cols); void SetMaxRowsCols(int rows, int cols);
int GetMaxRows(); int GetMaxRows();
int GetMaxCols(); int GetMaxCols();
#endif
}; };
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------