Added wxHyperlinkCtrl, wxPowerEvent, and lots of little things to

match changes made in wx.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39452 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-05-29 19:52:17 +00:00
parent 9e89f049b8
commit d0e2ede057
15 changed files with 630 additions and 378 deletions
+118 -90
View File
File diff suppressed because it is too large Load Diff
-12
View File
@@ -679,14 +679,6 @@ enum {
wxID_HIGHEST,
wxOPEN,
wxSAVE,
wxHIDE_READONLY,
wxOVERWRITE_PROMPT,
wxFILE_MUST_EXIST,
wxMULTIPLE,
wxCHANGE_DIR,
wxACCEL_ALT,
wxACCEL_CTRL,
wxACCEL_SHIFT,
@@ -701,10 +693,6 @@ enum {
wxPD_SMOOTH,
wxPD_CAN_SKIP,
wxDD_NEW_DIR_BUTTON,
wxDD_DEFAULT_STYLE,
wxDD_CHANGE_DIR,
wxMENU_TEAROFF,
wxMB_DOCKABLE,
wxNO_FULL_REPAINT_ON_RESIZE,
+2 -1
View File
@@ -86,7 +86,8 @@ public:
// Try to expand as much of the given path as possible.
virtual bool ExpandPath(const wxString& path);
// collapse the path
virtual bool CollapsePath(const wxString& path);
virtual inline wxString GetDefaultPath() const;
virtual void SetDefaultPath(const wxString& path);
+216 -216
View File
File diff suppressed because it is too large Load Diff
+24 -18
View File
@@ -250,10 +250,18 @@ public:
void SetStyle(wxFontStyle style);
void SetWeight(wxFontWeight weight);
void SetUnderlined(bool underlined);
void SetFaceName(wxString facename);
bool SetFaceName(wxString facename);
void SetFamily(wxFontFamily family);
void SetEncoding(wxFontEncoding encoding);
// TODO:
// // sets the first facename in the given array which is found
// // to be valid. If no valid facename is given, sets the
// // first valid facename returned by wxFontEnumerator::GetFacenames().
// // Does not return a bool since it cannot fail.
// void SetFaceName(const wxArrayString &facenames);
// it is important to be able to serialize wxNativeFontInfo objects to be
// able to store them (in config file, for example)
bool FromString(const wxString& s);
@@ -734,7 +742,7 @@ size is found using a binary search.", "");
"Sets the font weight.", "");
DocDeclStr(
virtual void , SetFaceName( const wxString& faceName ),
virtual bool , SetFaceName( const wxString& faceName ),
"Sets the facename for the font. The facename, which should be a valid
font installed on the end-user's system.
@@ -758,13 +766,13 @@ then for a font belonging to the same family.", "");
DocDeclStrName(
void , SetNativeFontInfo(const wxString& info),
bool , SetNativeFontInfo(const wxString& info),
"Set the font's attributes from string representation of a
`wx.NativeFontInfo` object.", "",
SetNativeFontInfoFromString);
DocDeclStr(
void , SetNativeFontInfoUserDesc(const wxString& info),
bool , SetNativeFontInfoUserDesc(const wxString& info),
"Set the font's attributes from a string formerly returned from
`GetNativeFontInfoDesc`.", "");
@@ -838,33 +846,31 @@ public:
bool EnumerateEncodings(const wxString& facename = wxPyEmptyString);
//wxArrayString* GetEncodings();
//wxArrayString* GetFacenames();
%extend {
PyObject* GetEncodings() {
static PyObject* GetEncodings() {
PyObject* ret;
wxArrayString* arr = self->GetEncodings();
wxArrayString arr = wxFontEnumerator::GetEncodings();
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if (arr)
ret = wxArrayString2PyList_helper(*arr);
else
ret = PyList_New(0);
ret = wxArrayString2PyList_helper(arr);
wxPyEndBlockThreads(blocked);
return ret;
}
PyObject* GetFacenames() {
static PyObject* GetFacenames() {
PyObject* ret;
wxArrayString* arr = self->GetFacenames();
wxArrayString arr = wxFontEnumerator::GetFacenames();
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if (arr)
ret = wxArrayString2PyList_helper(*arr);
else
ret = PyList_New(0);
ret = wxArrayString2PyList_helper(arr);
wxPyEndBlockThreads(blocked);
return ret;
}
}
DocDeclStr(
static bool , IsValidFacename(const wxString &str),
"Convenience function that returns true if the given face name exist in
the user's system", "");
};
-35
View File
@@ -427,40 +427,5 @@ MustHaveApp(wxThread);
}
%}
//---------------------------------------------------------------------------
// enum wxPowerType
// {
// wxPOWER_SOCKET,
// wxPOWER_BATTERY,
// wxPOWER_UNKNOWN
// };
// DocDeclStr(
// wxPowerType , wxGetPowerType(),
// "Returns the type of power source as one of wx.POWER_SOCKET,
// wx.POWER_BATTERY or wx.POWER_UNKNOWN. wx.POWER_UNKNOWN is also the
// default on platforms where this feature is not implemented.", "");
// enum wxBatteryState
// {
// wxBATTERY_NORMAL_STATE, // system is fully usable
// wxBATTERY_LOW_STATE, // start to worry
// wxBATTERY_CRITICAL_STATE, // save quickly
// wxBATTERY_SHUTDOWN_STATE, // too late
// wxBATTERY_UNKNOWN_STATE
// };
// DocDeclStr(
// wxBatteryState , wxGetBatteryState(),
// "Returns battery state as one of wx.BATTERY_NORMAL_STATE,
// wx.BATTERY_LOW_STATE}, wx.BATTERY_CRITICAL_STATE,
// wx.BATTERY_SHUTDOWN_STATE or wx.BATTERY_UNKNOWN_STATE.
// wx.BATTERY_UNKNOWN_STATE is also the default on platforms where this
// feature is not implemented.", "");
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
+118
View File
@@ -0,0 +1,118 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _hyperlink.i
// Purpose: SWIG interface defs for wxHyperlinkCtrl
//
// Author: Robin Dunn
//
// Created: 28-May-2006
// RCS-ID: $Id$
// Copyright: (c) 2006 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%{
#include <wx/hyperlink.h>
%}
MAKE_CONST_WXSTRING(HyperlinkCtrlNameStr);
enum {
wxHL_CONTEXTMENU,
wxHL_DEFAULT_STYLE
};
//---------------------------------------------------------------------------
%newgroup
MustHaveApp(wxHyperlinkCtrl);
DocStr( wxHyperlinkCtrl,
"A static text control that emulates a hyperlink. The link is displayed
in an appropriate text style, derived from the control's normal font.
When the mouse rolls over the link, the cursor changes to a hand and
the link's color changes to the active color.
Clicking on the link does not launch a web browser; instead, a
wx.HyperlinkEvent is fired. Use the wx.EVT_HYPERLINK to catch link
events.
", "");
class wxHyperlinkCtrl : public wxControl
{
public:
%pythonAppend wxHyperlinkCtrl "self._setOORInfo(self)"
%pythonAppend wxHyperlinkCtrl() ""
// Constructor.
wxHyperlinkCtrl(wxWindow *parent,
wxWindowID id,
const wxString& label, const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxPyHyperlinkCtrlNameStr);
%RenameCtor(PreHyperlinkCtrl, wxHyperlinkCtrl());
// Creation function (for two-step construction).
bool Create(wxWindow *parent,
wxWindowID id,
const wxString& label, const wxString& url,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxHL_DEFAULT_STYLE,
const wxString& name = wxPyHyperlinkCtrlNameStr);
// get/set
wxColour GetHoverColour() const;
void SetHoverColour(const wxColour &colour);
wxColour GetNormalColour() const;
void SetNormalColour(const wxColour &colour);
wxColour GetVisitedColour() const;
void SetVisitedColour(const wxColour &colour);
wxString GetURL() const;
void SetURL (const wxString &url);
void SetVisited(bool visited = true);
bool GetVisited() const;
};
%constant wxEventType wxEVT_COMMAND_HYPERLINK;
//
// An event fired when the user clicks on the label in a hyperlink control.
// See HyperlinkControl for details.
//
class wxHyperlinkEvent : public wxCommandEvent
{
public:
wxHyperlinkEvent(wxObject *generator, wxWindowID id, const wxString& url);
// Returns the URL associated with the hyperlink control
// that the user clicked on.
wxString GetURL() const;
void SetURL(const wxString &url);
};
%pythoncode {
EVT_HYPERLINK = wx.PyEventBinder( wxEVT_COMMAND_HYPERLINK, 1 )
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
+19
View File
@@ -84,6 +84,9 @@ enum {
wxLIST_HITTEST_TOLEFT,
wxLIST_HITTEST_TORIGHT,
wxLIST_HITTEST_ONITEM,
// GetSubItemRect constants
wxLIST_GETSUBITEMRECT_WHOLEITEM,
};
@@ -544,6 +547,13 @@ public:
self->GetItemRect(item, rect, code);
return rect;
}
// MSW only so far...
// wxRect GetSubItemRect(long item, long subItem, int code = wxLIST_RECT_BOUNDS) {
// wxRect rect;
// self->GetSubItemRect(item, subItem, rect, code);
// return rect;
// }
}
@@ -660,6 +670,15 @@ public:
"Determines which item (if any) is at the specified point, giving
details in the second return value (see wx.LIST_HITTEST flags.)", "");
DocDeclAStrName(
long, HitTest(const wxPoint& point, int& OUTPUT, long* OUTPUT),
"HitTestSubItem(Point point) -> (item, where, subItem)",
"Determines which item (if any) is at the specified point, giving details in
the second return value (see wx.LIST_HITTEST flags) and also the subItem, if
any.", "",
HitTestSubItem);
// Inserts an item, returning the index of the new item if successful,
// -1 otherwise.
long InsertItem(wxListItem& info);
+108
View File
@@ -0,0 +1,108 @@
/////////////////////////////////////////////////////////////////////////////
// Name: _power.i
// Purpose: SWIG interface for wx poser events and functions
//
// Author: Robin Dunn
//
// Created: 28-May-2006
// RCS-ID: $Id$
// Copyright: (c) 2006 by Total Control Software
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Not a %module
//---------------------------------------------------------------------------
%newgroup
%{
#include <wx/power.h>
%}
%{
#ifndef wxHAS_POWER_EVENTS
// Dummy class and other definitions for platforms that don't have them
class wxPowerEvent : public wxEvent
{
public:
wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) {}
void Veto() {}
bool IsVetoed() const { return false; }
virtual wxEvent *Clone() const { return new wxPowerEvent(*this); }
};
enum {
wxEVT_POWER_SUSPENDING,
wxEVT_POWER_SUSPENDED,
wxEVT_POWER_SUSPEND_CANCEL,
wxEVT_POWER_RESUME,
};
wxPowerType wxGetPowerType() { return wxPOWER_UNKNOWN; }
wxBatteryState wxGetBatteryState() { return wxBATTERY_UNKNOWN_STATE; }
#endif
%}
enum wxPowerType
{
wxPOWER_SOCKET,
wxPOWER_BATTERY,
wxPOWER_UNKNOWN
};
enum wxBatteryState
{
wxBATTERY_NORMAL_STATE, // system is fully usable
wxBATTERY_LOW_STATE, // start to worry
wxBATTERY_CRITICAL_STATE, // save quickly
wxBATTERY_SHUTDOWN_STATE, // too late
wxBATTERY_UNKNOWN_STATE
};
DocStr(wxPowerEvent,
"wx.PowerEvent is generated when the system online status changes.
Currently this is only implemented for Windows.",
"");
class wxPowerEvent : public wxEvent
{
public:
wxPowerEvent(wxEventType evtType);
// Veto the operation (only makes sense with EVT_POWER_SUSPENDING)
void Veto();
bool IsVetoed() const;
};
%constant wxEventType wxEVT_POWER_SUSPENDING;
%constant wxEventType wxEVT_POWER_SUSPENDED;
%constant wxEventType wxEVT_POWER_SUSPEND_CANCEL;
%constant wxEventType wxEVT_POWER_RESUME;
%pythoncode {
EVT_POWER_SUSPENDING = wx.PyEventBinder( wxEVT_POWER_SUSPENDING , 1 )
EVT_POWER_SUSPENDED = wx.PyEventBinder( wxEVT_POWER_SUSPENDED , 1 )
EVT_POWER_SUSPEND_CANCEL = wx.PyEventBinder( wxEVT_POWER_SUSPEND_CANCEL , 1 )
EVT_POWER_RESUME = wx.PyEventBinder( wxEVT_POWER_RESUME , 1 )
}
DocDeclStr(
wxPowerType , wxGetPowerType(),
"return the current system power state: online or offline", "");
DocDeclStr(
wxBatteryState , wxGetBatteryState(),
"return approximate battery state", "");
//---------------------------------------------------------------------------
+1
View File
@@ -43,6 +43,7 @@ enum {
wxTB_NOALIGN,
wxTB_HORZ_LAYOUT,
wxTB_HORZ_TEXT,
wxTB_NO_TOOLTIPS,
};
+10 -1
View File
@@ -980,9 +980,18 @@ functions so should not be required by the application programmer.", "");
"Removes a child window. This is called automatically by window
deletion functions so should not be required by the application
programmer.", "");
DocStr(SetDoubleBuffered,
"Currently wxGTK2 only.", "");
#ifdef __WXGTK__
void SetDoubleBuffered(bool on);
#else
%extend {
void SetDoubleBuffered(bool on) {}
}
#endif
// looking for windows
// -------------------
+1 -1
View File
@@ -59,7 +59,7 @@ MAKE_CONST_WXSTRING_NOSWIG(ControlNameStr);
%include _cshelp.i
%include _dragimg.i
%include _datectrl.i
%include _hyperlink.i
//---------------------------------------------------------------------------
+2 -4
View File
@@ -1146,10 +1146,8 @@ public:
const wxString& normal_face = wxPyEmptyString,
const wxString& fixed_face = wxPyEmptyString);
int Render(int x, int y, int from = 0, int dont_render = false, int maxHeight = INT_MAX,
//int *known_pagebreaks = NULL, int number_of_pages = 0
int* choices=NULL, int LCOUNT = 0
);
int Render(int x, int y, wxArrayInt& known_pagebreaks, int from = 0,
int dont_render = FALSE, int to = INT_MAX);
int GetTotalHeight();
// returns total height of the html document
// (compare Render's return value with this)
+1
View File
@@ -48,5 +48,6 @@ MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
%include _clipbrd.i
%include _display.i
%include _stdpaths.i
%include _power.i
//---------------------------------------------------------------------------