Changes needed for new RTL methods, and also various other updates to

wx CVS.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41012 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-09-04 23:52:47 +00:00
parent 746b24a09d
commit e81b607b43
10 changed files with 140 additions and 26 deletions

View File

@@ -213,6 +213,9 @@ Added wx.NativePixelBuffer, wx.AlphPixelBuffer and related iterator
and accessor classes. They allow platform independent direct access
to the platform specific pixel buffer inside of a wx.Bitmap object.
The beginnings of support for RTL languages has been added, thanks to
a Google SoC project.

View File

@@ -82,6 +82,24 @@ public:
int , GetCommand(),
"Get the AcceleratorEntry's command ID.", "");
DocDeclStr(
bool , IsOk() const,
"", "");
DocDeclStr(
wxString , ToString() const,
"Returns a string representation for the this accelerator. The string
is formatted using the <flags>-<keycode> format where <flags> maybe a
hyphen-separed list of \"shift|alt|ctrl\"
", "");
DocDeclStr(
bool , FromString(const wxString &str),
"Returns true if the given string correctly initialized this object.", "");
%property(Command, GetCommand, doc="See `GetCommand`");
%property(Flags, GetFlags, doc="See `GetFlags`");
%property(KeyCode, GetKeyCode, doc="See `GetKeyCode`");

View File

@@ -153,6 +153,11 @@ all top level windows have been closed and destroyed.", "");
:see: `wx.Exit`", "");
DocDeclStr(
virtual wxLayoutDirection , GetLayoutDirection() const,
"Return the layout direction for the current locale.", "");
DocDeclStr(
virtual void, ExitMainLoop(),
"Exit the main GUI loop during the next iteration of the main

View File

@@ -611,6 +611,7 @@ enum {
wxID_CLOSE_ALL,
wxID_PREFERENCES,
wxID_EDIT,
wxID_CUT,
wxID_COPY,
wxID_PASTE,
@@ -633,6 +634,7 @@ enum {
wxID_VIEW_SORTSIZE,
wxID_VIEW_SORTTYPE,
wxID_FILE,
wxID_FILE1,
wxID_FILE2,
wxID_FILE3,

View File

@@ -38,11 +38,18 @@ bool wxIsStockID(wxWindowID id);
// given ID
bool wxIsStockLabel(wxWindowID id, const wxString& label);
enum wxStockLabelQueryFlag
{
wxSTOCK_NOFLAGS = 0,
wxSTOCK_WITH_MNEMONIC = 1,
wxSTOCK_WITH_ACCELERATOR = 2
};
// Returns label that should be used for given stock UI element (e.g. "&OK"
// for wxID_OK):
wxString wxGetStockLabel(wxWindowID id,
bool withCodes = true,
wxString accelerator = wxPyEmptyString);
long flags = wxSTOCK_WITH_MNEMONIC);
MustHaveApp(wxBell);

View File

@@ -22,6 +22,13 @@
//---------------------------------------------------------------------------
%newgroup
enum wxLayoutDirection
{
wxLayout_Default,
wxLayout_LeftToRight,
wxLayout_RightToLeft
};
enum wxLanguage
{

View File

@@ -33,7 +33,7 @@ public:
// append any kind of item (normal/check/radio/separator)
wxMenuItem* Append(int id,
const wxString& text,
const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
@@ -76,7 +76,7 @@ public:
// insert an item before given position
wxMenuItem* Insert(size_t pos,
int id,
const wxString& text,
const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);
@@ -104,7 +104,7 @@ public:
// prepend any item to the menu
wxMenuItem* Prepend(int id,
const wxString& text,
const wxString& text = wxPyEmptyString,
const wxString& help = wxPyEmptyString,
wxItemKind kind = wxITEM_NORMAL);

View File

@@ -608,6 +608,7 @@ this sizer. See `Add` for a description of the parameters.", "");
// virtual wxSizerItem* PrependSpacer(int size);
// virtual wxSizerItem* PrependStretchSpacer(int prop = 1);
DocAStr(Remove,
"Remove(self, item) -> bool",
"Removes an item from the sizer and destroys it. This method does not
@@ -692,6 +693,48 @@ the item to be found.", "");
}
}
%Rename(_ReplaceWin,
bool, Replace( wxWindow *oldwin, wxWindow *newwin, bool recursive = false ));
%Rename(_ReplaceSizer,
bool, Replace( wxSizer *oldsz, wxSizer *newsz, bool recursive = false ));
%Rename(_ReplaceItem,
bool, Replace( size_t index, wxSizerItem *newitem ));
%pythoncode {
def Replace(self, olditem, item, recursive=False):
"""
Detaches the given ``olditem`` from the sizer and replaces it with
``item`` which can be a window, sizer, or `wx.SizerItem`. The
detached child is destroyed only if it is not a window, (because
windows are owned by their parent, not the sizer.) The
``recursive`` parameter can be used to search for the given
element recursivly in subsizers.
This method does not cause any layout or resizing to take place,
call `Layout` to do so.
Returns ``True`` if the child item was found and removed.
"""
if isinstance(olditem, wx.Window):
return self._ReplaceWin(olditem, item, recursive)
elif isinstnace(olditem, wx.Sizer):
return self._ReplaceSizer(olditem, item, recursive)
elif isinstnace(olditem, int):
return self._ReplaceItem(olditem, item)
else:
raise TypeError("Expected Window, Sizer, or integer for first parameter.")
}
DocDeclStr(
void , SetContainingWindow(wxWindow *window),
"Set (or unset) the window this sizer is used in.", "");
DocDeclStr(
wxWindow *, GetContainingWindow() const,
"Get the window this sizer is used in.", "");
%pythoncode {
def SetItemMinSize(self, item, *args):
"""

View File

@@ -373,6 +373,25 @@ autogenerated) id", "");
autogenerated) id", "");
DocDeclStr(
virtual wxLayoutDirection , GetLayoutDirection() const,
"Get the layout direction (LTR or RTL) for this window. Returns
``wx.Layout_Default`` if layout direction is not supported.", "");
DocDeclStr(
virtual void , SetLayoutDirection(wxLayoutDirection dir),
"Set the layout direction (LTR or RTL) for this window.", "");
DocDeclStr(
virtual wxCoord , AdjustForLayoutDirection(wxCoord x,
wxCoord width,
wxCoord widthTotal) const,
"Mirror coordinates for RTL layout if this window uses it and if the
mirroring is not done automatically like Win32.", "");
// moving/resizing
@@ -2049,11 +2068,9 @@ opaque.", "");
%property(ExtraStyle, GetExtraStyle, SetExtraStyle, doc="See `GetExtraStyle` and `SetExtraStyle`");
%property(Font, GetFont, SetFont, doc="See `GetFont` and `SetFont`");
%property(ForegroundColour, GetForegroundColour, SetForegroundColour, doc="See `GetForegroundColour` and `SetForegroundColour`");
%property(FullTextExtent, GetFullTextExtent, doc="See `GetFullTextExtent`");
%property(GrandParent, GetGrandParent, doc="See `GetGrandParent`");
%property(Handle, GetHandle, doc="See `GetHandle`");
%property(HelpText, GetHelpText, SetHelpText, doc="See `GetHelpText` and `SetHelpText`");
%property(HelpTextAtPoint, GetHelpTextAtPoint, doc="See `GetHelpTextAtPoint`");
%property(Id, GetId, SetId, doc="See `GetId` and `SetId`");
%property(Label, GetLabel, SetLabel, doc="See `GetLabel` and `SetLabel`");
%property(MaxHeight, GetMaxHeight, doc="See `GetMaxHeight`");
@@ -2068,12 +2085,8 @@ opaque.", "");
%property(Rect, GetRect, SetRect, doc="See `GetRect` and `SetRect`");
%property(ScreenPosition, GetScreenPosition, doc="See `GetScreenPosition`");
%property(ScreenRect, GetScreenRect, doc="See `GetScreenRect`");
%property(ScrollPos, GetScrollPos, SetScrollPos, doc="See `GetScrollPos` and `SetScrollPos`");
%property(ScrollRange, GetScrollRange, doc="See `GetScrollRange`");
%property(ScrollThumb, GetScrollThumb, doc="See `GetScrollThumb`");
%property(Size, GetSize, SetSize, doc="See `GetSize` and `SetSize`");
%property(Sizer, GetSizer, SetSizer, doc="See `GetSizer` and `SetSizer`");
%property(TextExtent, GetTextExtent, doc="See `GetTextExtent`");
%property(ThemeEnabled, GetThemeEnabled, SetThemeEnabled, doc="See `GetThemeEnabled` and `SetThemeEnabled`");
%property(ToolTip, GetToolTip, SetToolTip, doc="See `GetToolTip` and `SetToolTip`");
%property(UpdateClientRect, GetUpdateClientRect, doc="See `GetUpdateClientRect`");
@@ -2084,6 +2097,10 @@ opaque.", "");
%property(WindowStyleFlag, GetWindowStyleFlag, SetWindowStyleFlag, doc="See `GetWindowStyleFlag` and `SetWindowStyleFlag`");
%property(WindowVariant, GetWindowVariant, SetWindowVariant, doc="See `GetWindowVariant` and `SetWindowVariant`");
%property(Shown, IsShown, Show, doc="See `IsShown` and `Show`");
%property(Enabled, IsEnabled, Enable, doc="See `IsEnabled` and `Enable`");
%property(TopLevel, IsTopLevel, doc="See `IsTopLevel`");
};

View File

@@ -264,6 +264,7 @@ class wxPyDockArt : public wxDefaultDockArt
DEC_PYCALLBACK__INTCOLOUR(SetColour);
virtual void DrawSash(wxDC& dc,
wxWindow* window,
int orientation,
const wxRect& rect)
{
@@ -271,18 +272,20 @@ class wxPyDockArt : public wxDefaultDockArt
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawSash"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)",
odc, orientation, orect));
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiO)",
odc, owin, orientation, orect));
Py_DECREF(odc);
Py_DECREF(orect);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxDefaultDockArt::DrawSash(dc, orientation, rect);
wxDefaultDockArt::DrawSash(dc, window, orientation, rect);
}
virtual void DrawBackground(wxDC& dc,
wxWindow* window,
int orientation,
const wxRect& rect)
{
@@ -290,18 +293,20 @@ class wxPyDockArt : public wxDefaultDockArt
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawBackground"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiO)",
odc, orientation, orect));
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiO)",
odc, owin, orientation, orect));
Py_DECREF(odc);
Py_DECREF(orect);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxDefaultDockArt::DrawBackground(dc, orientation, rect);
wxDefaultDockArt::DrawBackground(dc, window, orientation, rect);
}
virtual void DrawCaption(wxDC& dc,
wxWindow* window,
const wxString& text,
const wxRect& rect,
wxPaneInfo& pane)
@@ -310,11 +315,12 @@ class wxPyDockArt : public wxDefaultDockArt
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawCaption"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* otext = wx2PyString(text);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOO)",
odc, otext, orect, opane));
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOOO)",
odc, owin, otext, orect, opane));
Py_DECREF(odc);
Py_DECREF(otext);
Py_DECREF(orect);
@@ -322,10 +328,11 @@ class wxPyDockArt : public wxDefaultDockArt
}
wxPyEndBlockThreads(blocked);
if (! found)
wxDefaultDockArt::DrawCaption(dc, text, rect, pane);
wxDefaultDockArt::DrawCaption(dc, window, text, rect, pane);
}
virtual void DrawGripper(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxPaneInfo& pane)
{
@@ -333,19 +340,21 @@ class wxPyDockArt : public wxDefaultDockArt
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawGripper"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, orect, opane));
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOOO)", odc, owin, orect, opane));
Py_DECREF(odc);
Py_DECREF(orect);
Py_DECREF(opane);
}
wxPyEndBlockThreads(blocked);
if (! found)
wxDefaultDockArt::DrawGripper(dc, rect, pane);
wxDefaultDockArt::DrawGripper(dc, window, rect, pane);
}
virtual void DrawBorder(wxDC& dc,
wxWindow* window,
const wxRect& rect,
wxPaneInfo& pane)
{
@@ -353,6 +362,7 @@ class wxPyDockArt : public wxDefaultDockArt
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawBorder"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOO)", odc, orect, opane));
@@ -362,10 +372,11 @@ class wxPyDockArt : public wxDefaultDockArt
}
wxPyEndBlockThreads(blocked);
if (! found)
wxDefaultDockArt::DrawBorder(dc, rect, pane);
wxDefaultDockArt::DrawBorder(dc, window, rect, pane);
}
virtual void DrawPaneButton(wxDC& dc,
wxWindow* window,
int button,
int button_state,
const wxRect& rect,
@@ -375,10 +386,11 @@ class wxPyDockArt : public wxDefaultDockArt
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ((found = wxPyCBH_findCallback(m_myInst, "DrawPaneButton"))) {
PyObject* odc = wxPyMake_wxObject(&dc, false);
PyObject* owin = wxPyMake_wxObject(window, false);
PyObject* orect = wxPyConstructObject((void*)&rect, wxT("wxRect"), 0);
PyObject* opane = wxPyConstructObject((void*)&pane, wxT("wxPaneInfo"), 0);
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiIOO)",
odc, button, button_state,
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOiIOO)",
odc, owin, button, button_state,
orect, opane));
Py_DECREF(odc);
Py_DECREF(orect);
@@ -386,7 +398,7 @@ class wxPyDockArt : public wxDefaultDockArt
}
wxPyEndBlockThreads(blocked);
if (! found)
wxDefaultDockArt::DrawPaneButton(dc, button, button_state, rect, pane);
wxDefaultDockArt::DrawPaneButton(dc, window, button, button_state, rect, pane);
}
PYPRIVATE;