Tweaks for various diffs from 2.4.0 to current HEAD

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2003-03-26 01:41:21 +00:00
parent fc0821b650
commit 9cbf6f6ea3
8 changed files with 172 additions and 62 deletions

View File

@ -188,7 +188,7 @@ enum {
wxNO_BORDER,
wxUSER_COLOURS,
wxNO_3D,
//wxOVERRIDE_KEY_TRANSLATIONS,
wxTAB_TRAVERSAL,
wxWANTS_CHARS,
wxPOPUP_WINDOW,
@ -203,6 +203,7 @@ enum {
wxICONIZE,
wxMINIMIZE,
wxMAXIMIZE,
wxCLOSE_BOX,
wxTHICK_FRAME,
wxSYSTEM_MENU,
wxMINIMIZE_BOX,
@ -733,7 +734,11 @@ enum wxKeyCode {
WXK_NUMPAD_SEPARATOR,
WXK_NUMPAD_SUBTRACT,
WXK_NUMPAD_DECIMAL,
WXK_NUMPAD_DIVIDE
WXK_NUMPAD_DIVIDE,
WXK_WINDOWS_LEFT,
WXK_WINDOWS_RIGHT,
WXK_WINDOWS_MENU
};

View File

@ -74,6 +74,7 @@ enum wxFontWeight
};
// font encodings
enum wxFontEncoding
{
@ -115,7 +116,7 @@ enum wxFontEncoding
// and for Windows
wxFONTENCODING_CP874, // WinThai
wxFONTENCODING_CP932, // Japanese (shift-JIS)
wxFONTENCODING_CP936, // Chiniese simplified (GB)
wxFONTENCODING_CP936, // Chinese simplified (GB)
wxFONTENCODING_CP949, // Korean (Hangul charset)
wxFONTENCODING_CP950, // Chinese (traditional - Big5)
wxFONTENCODING_CP1250, // WinLatin2
@ -138,16 +139,15 @@ enum wxFontEncoding
// Japanese (see http://zsigri.tripod.com/fontboard/cjk/jis.html)
wxFONTENCODING_SHIFT_JIS = wxFONTENCODING_CP932, // Shift JIS
wxFONTENCODING_EUC_JP, // Extended Unix Codepage for Japanese
wxFONTENCODING_EUC_JP = wxFONTENCODING_UTF8 + 1, // Extended Unix Codepage
// for Japanese
wxFONTENCODING_UNICODE, // Unicode - currently used only by
// wxEncodingConverter class
wxFONTENCODING_UNICODE, // Unicode (for wxEncodingConverter only)
wxFONTENCODING_MAX
};
//---------------------------------------------------------------------------
// wxNativeFontInfo is platform-specific font representation: this struct
// should be considered as opaque font description only used by the native
@ -805,7 +805,14 @@ public:
// Returns NULL if no info found, pointer must *not* be deleted by caller
static const wxLanguageInfo *GetLanguageInfo(int lang);
// Add custom language to the list of known languages.
// Find the language for the given locale string which may be either a
// canonical ISO 2 letter language code ("xx"), a language code followed by
// the country code ("xx_XX") or a Windows full language name ("Xxxxx...")
//
// Returns NULL if no info found, pointer must *not* be deleted by caller
static const wxLanguageInfo *FindLanguageInfo(const wxString& locale);
// Add custom language to the list of known languages.
// Notes: 1) wxLanguageInfo contains platform-specific data
// 2) must be called before Init to have effect
static void AddLanguage(const wxLanguageInfo& info);

View File

@ -57,6 +57,10 @@ public:
//---------------------------------------------------------------------------
// TODO: When the API stabalizes and is available on other platforms, add
// wrappers for the new wxBitmap, wxRawBitmap, wxDIB stuff...
class wxBitmap : public wxGDIObject
{
public:

View File

@ -187,14 +187,13 @@ public:
int GetCharHeight();
int GetCharWidth();
wxHtmlWindow* GetWindow();
//void SetFonts(wxString normal_face, wxString fixed_face, int *LIST);
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
int* temp = int_LIST_helper(sizes);
if (temp) {
self->SetFonts(normal_face, fixed_face, temp);
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
int* temp = NULL;
if (sizes) temp = int_LIST_helper(sizes);
self->SetFonts(normal_face, fixed_face, temp);
if (temp)
delete [] temp;
}
}
}
@ -651,6 +650,10 @@ public:
// Return value : same as SetPage
bool LoadPage(const wxString& location);
// TODO: (accept a string, convert to filename)
// Loads HTML page from file
// bool LoadFile(const wxFileName& filename);
// Append to current page
bool AppendToPage(const wxString& source);
@ -674,12 +677,12 @@ public:
// Sets fonts to be used when displaying HTML page.
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes) {
int* temp = int_LIST_helper(sizes);
if (temp) {
self->SetFonts(normal_face, fixed_face, temp);
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
int* temp = NULL;
if (sizes) temp = int_LIST_helper(sizes);
self->SetFonts(normal_face, fixed_face, temp);
if (temp)
delete [] temp;
}
}
}
@ -741,6 +744,15 @@ public:
void SetHtmlText(const wxString& html,
const wxString& basepath = wxPyEmptyString,
bool isdir = TRUE);
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
int* temp = NULL;
if (sizes) temp = int_LIST_helper(sizes);
self->SetFonts(normal_face, fixed_face, temp);
if (temp)
delete [] temp;
}
}
int Render(int x, int y, int from = 0, int dont_render = FALSE);
int GetTotalHeight();
// returns total height of the html document
@ -765,6 +777,15 @@ public:
void SetHtmlFile(const wxString &htmlfile);
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
int* temp = NULL;
if (sizes) temp = int_LIST_helper(sizes);
self->SetFonts(normal_face, fixed_face, temp);
if (temp)
delete [] temp;
}
}
void SetMargins(float top = 25.2, float bottom = 25.2,
float left = 25.2, float right = 25.2,
float spaces = 5);
@ -787,6 +808,16 @@ public:
void SetHeader(const wxString& header, int pg = wxPAGE_ALL);
void SetFooter(const wxString& footer, int pg = wxPAGE_ALL);
%addmethods {
void SetFonts(wxString normal_face, wxString fixed_face, PyObject* sizes=NULL) {
int* temp = NULL;
if (sizes) temp = int_LIST_helper(sizes);
self->SetFonts(normal_face, fixed_face, temp);
if (temp)
delete [] temp;
}
}
wxPrintData *GetPrintData() {return m_PrintData;}
wxPageSetupDialogData *GetPageSetupData() {return m_PageSetupData;}

View File

@ -30,6 +30,32 @@
%import gdi.i
%import streams.i
//---------------------------------------------------------------------------
class wxImageHistogram /* : public wxImageHistogramBase */
{
public:
wxImageHistogram();
// get the key in the histogram for the given RGB values
static unsigned long MakeKey(unsigned char r,
unsigned char g,
unsigned char b);
// find first colour that is not used in the image and has higher
// RGB values than RGB(startR, startG, startB)
//
// returns true and puts this colour in r, g, b (each of which may be NULL)
// on success or returns false if there are no more free colours
bool FindFirstUnusedColour(unsigned char *OUTPUT,
unsigned char *OUTPUT,
unsigned char *OUTPUT,
unsigned char startR = 1,
unsigned char startG = 0,
unsigned char startB = 0 ) const;
};
//---------------------------------------------------------------------------
class wxImageHandler : public wxObject {
@ -120,6 +146,7 @@ public:
void Destroy();
wxImage Scale( int width, int height );
wxImage ShrinkBy( int xFactor , int yFactor ) const ;
wxImage& Rescale(int width, int height);
void SetRGB( int x, int y, unsigned char r, unsigned char g, unsigned char b );
@ -127,7 +154,11 @@ public:
unsigned char GetGreen( int x, int y );
unsigned char GetBlue( int x, int y );
// find first colour that is not used in the image and has higher
void SetAlpha(int x, int y, unsigned char alpha);
unsigned char GetAlpha(int x, int y);
bool HasAlpha();
// find first colour that is not used in the image and has higher
// RGB values than <startR,startG,startB>
bool FindFirstUnusedColour( byte *OUTPUT, byte *OUTPUT, byte *OUTPUT,
byte startR = 0, byte startG = 0, byte startB = 0 ) const;
@ -167,33 +198,11 @@ public:
//void SetData( unsigned char *data );
%addmethods {
PyObject* GetDataBuffer() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
return PyBuffer_FromReadWriteMemory(data, len);
}
PyObject* GetData() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
return PyString_FromStringAndSize((char*)data, len);
}
void SetDataBuffer(PyObject* data) {
unsigned char* buffer;
int size;
if (!PyArg_Parse(data, "w#", &buffer, &size))
return;
if (size != self->GetWidth() * self->GetHeight() * 3) {
PyErr_SetString(PyExc_TypeError, "Incorrect buffer size");
return;
}
self->SetData(buffer);
}
void SetData(PyObject* data) {
unsigned char* dataPtr;
@ -208,6 +217,74 @@ public:
self->SetData(dataPtr);
// wxImage takes ownership of dataPtr...
}
PyObject* GetDataBuffer() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
return PyBuffer_FromReadWriteMemory(data, len);
}
void SetDataBuffer(PyObject* data) {
unsigned char* buffer;
int size;
if (!PyArg_Parse(data, "w#", &buffer, &size))
return;
if (size != self->GetWidth() * self->GetHeight() * 3) {
PyErr_SetString(PyExc_TypeError, "Incorrect buffer size");
return;
}
self->SetData(buffer);
}
PyObject* GetAlphaData() {
unsigned char* data = self->GetAlpha();
if (! data) {
RETURN_NONE();
} else {
int len = self->GetWidth() * self->GetHeight();
return PyString_FromStringAndSize((char*)data, len);
}
}
void SetAlphaData(PyObject* data) {
unsigned char* dataPtr;
if (! PyString_Check(data)) {
PyErr_SetString(PyExc_TypeError, "Expected string object");
return /* NULL */ ;
}
size_t len = self->GetWidth() * self->GetHeight();
dataPtr = (unsigned char*) malloc(len);
memcpy(dataPtr, PyString_AsString(data), len);
self->SetAlpha(dataPtr);
// wxImage takes ownership of dataPtr...
}
PyObject* GetAlphaBuffer() {
unsigned char* data = self->GetAlpha();
int len = self->GetWidth() * self->GetHeight();
return PyBuffer_FromReadWriteMemory(data, len);
}
void SetAlphaBuffer(PyObject* data) {
unsigned char* buffer;
int size;
if (!PyArg_Parse(data, "w#", &buffer, &size))
return;
if (size != self->GetWidth() * self->GetHeight()) {
PyErr_SetString(PyExc_TypeError, "Incorrect buffer size");
return;
}
self->SetAlpha(buffer);
}
}
void SetMaskColour( unsigned char r, unsigned char g, unsigned char b );
@ -235,7 +312,7 @@ public:
bool HasOption(const wxString& name) const;
unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 );
// TODO: unsigned long ComputeHistogram( wxHashTable &h );
unsigned long ComputeHistogram( wxImageHistogram& h );
static void AddHandler( wxImageHandler *handler );
static void InsertHandler( wxImageHandler *handler );

View File

@ -607,8 +607,6 @@ public:
static void OnLog(unsigned long level, const wxString& szString, int t=0);
virtual void Flush();
bool HasPendingMessages() const;
static void FlushActive();
static wxLog *GetActiveTarget();
static wxLog *SetActiveTarget(wxLog *pLogger);
@ -1398,7 +1396,7 @@ public:
//
// use the extraDir parameter if you want to look for files in another
// directory
void Initialize(int mailcapStyle = wxMAILCAP_STANDARD,
void Initialize(int mailcapStyle = wxMAILCAP_ALL,
const wxString& extraDir = wxPyEmptyString);
// and this function clears all the data from the manager
@ -1522,6 +1520,7 @@ wxART_ERROR = 'wxART_ERROR'
wxART_QUESTION = 'wxART_QUESTION'
wxART_WARNING = 'wxART_WARNING'
wxART_INFORMATION = 'wxART_INFORMATION'
wxART_MISSING_IMAGE = 'wxART_MISSING_IMAGE'
"
%{ // Python aware wxArtProvider
@ -1693,19 +1692,6 @@ public:
//----------------------------------------------------------------------
// %{
// #if wxUSE_UNICODE
// #define ADD_STRING(dict, str) \
// wxString tmp##str(str); \
// PyDict_SetItemString(dict, #str, \
// PyUnicode_FromWideChar(tmp##str.c_str(), tmp##str.Len()))
// #else
// #define ADD_STRING(dict, str) \
// PyDict_SetItemString(d, #str, PyString_FromString(str))
// #endif
// %}
%init %{
wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");

View File

@ -341,6 +341,9 @@ public:
shortHelp, longHelp, clientData)
"
// TODO?
//wxToolBarToolBase *AddTool (wxToolBarToolBase *tool);
//wxToolBarToolBase *InsertTool (size_t pos, wxToolBarToolBase *tool);
wxToolBarToolBase *AddControl(wxControl *control);
wxToolBarToolBase *InsertControl(size_t pos, wxControl *control);

View File

@ -14,9 +14,6 @@
%{
#include "helpers.h"
#ifdef OLD_GRID
#include <wx/grid.h>
#endif
#include <wx/notebook.h>
#include <wx/splitter.h>
#include <wx/imaglist.h>