wxNO_BORDER,
wxUSER_COLOURS,
wxNO_3D,
-//wxOVERRIDE_KEY_TRANSLATIONS,
+
wxTAB_TRAVERSAL,
wxWANTS_CHARS,
wxPOPUP_WINDOW,
wxICONIZE,
wxMINIMIZE,
wxMAXIMIZE,
+ wxCLOSE_BOX,
wxTHICK_FRAME,
wxSYSTEM_MENU,
wxMINIMIZE_BOX,
WXK_NUMPAD_SEPARATOR,
WXK_NUMPAD_SUBTRACT,
WXK_NUMPAD_DECIMAL,
- WXK_NUMPAD_DIVIDE
+ WXK_NUMPAD_DIVIDE,
+
+ WXK_WINDOWS_LEFT,
+ WXK_WINDOWS_RIGHT,
+ WXK_WINDOWS_MENU
};
};
+
// font encodings
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
// 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
// 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);
//---------------------------------------------------------------------------
+
+// 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:
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;
- }
}
}
// 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);
// 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;
- }
}
}
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
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);
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;}
%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 {
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 );
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;
//void SetData( unsigned char *data );
%addmethods {
- PyObject* GetDataBuffer() {
+ PyObject* GetData() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
- return PyBuffer_FromReadWriteMemory(data, len);
+ return PyString_FromStringAndSize((char*)data, len);
}
+ void SetData(PyObject* data) {
+ unsigned char* dataPtr;
- PyObject* GetData() {
+ if (! PyString_Check(data)) {
+ PyErr_SetString(PyExc_TypeError, "Expected string object");
+ return /* NULL */ ;
+ }
+
+ size_t len = self->GetWidth() * self->GetHeight() * 3;
+ dataPtr = (unsigned char*) malloc(len);
+ memcpy(dataPtr, PyString_AsString(data), len);
+ self->SetData(dataPtr);
+ // wxImage takes ownership of dataPtr...
+ }
+
+
+
+ PyObject* GetDataBuffer() {
unsigned char* data = self->GetData();
int len = self->GetWidth() * self->GetHeight() * 3;
- return PyString_FromStringAndSize((char*)data, len);
+ return PyBuffer_FromReadWriteMemory(data, len);
}
-
void SetDataBuffer(PyObject* data) {
unsigned char* buffer;
int size;
PyErr_SetString(PyExc_TypeError, "Incorrect buffer size");
return;
}
-
self->SetData(buffer);
}
- void SetData(PyObject* data) {
+
+
+ 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)) {
return /* NULL */ ;
}
- size_t len = self->GetWidth() * self->GetHeight() * 3;
+ size_t len = self->GetWidth() * self->GetHeight();
dataPtr = (unsigned char*) malloc(len);
memcpy(dataPtr, PyString_AsString(data), len);
- self->SetData(dataPtr);
+ 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 );
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 );
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);
//
// 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
wxART_QUESTION = 'wxART_QUESTION'
wxART_WARNING = 'wxART_WARNING'
wxART_INFORMATION = 'wxART_INFORMATION'
+wxART_MISSING_IMAGE = 'wxART_MISSING_IMAGE'
"
%{ // Python aware wxArtProvider
//----------------------------------------------------------------------
-// %{
-// #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");
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);
%{
#include "helpers.h"
-#ifdef OLD_GRID
-#include <wx/grid.h>
-#endif
#include <wx/notebook.h>
#include <wx/splitter.h>
#include <wx/imaglist.h>