Compare commits
1 Commits
before_gtk
...
wxPy_last_
Author | SHA1 | Date | |
---|---|---|---|
|
bd72e111fa |
@@ -1,90 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/scrolwin.h
|
||||
// Purpose: wxGenericScrolledWindow class
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GENERIC_SCROLLWIN_H_
|
||||
#define _WX_GENERIC_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
extern WXDLLEXPORT_DATA(const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGenericScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxGenericScrolledWindow : public wxPanel,
|
||||
public wxScrollHelper
|
||||
{
|
||||
public:
|
||||
wxGenericScrolledWindow() : wxScrollHelper(this) { }
|
||||
wxGenericScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxScrollHelper(this)
|
||||
{
|
||||
Create(parent, winid, pos, size, style, name);
|
||||
}
|
||||
|
||||
virtual ~wxGenericScrolledWindow();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID winid,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
virtual void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
virtual void DoSetVirtualSize(int x, int y);
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
protected:
|
||||
// this is needed for wxEVT_PAINT processing hack described in
|
||||
// wxScrollHelperEvtHandler::ProcessEvent()
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
// we need to return a special WM_GETDLGCODE value to process just the
|
||||
// arrows but let the other navigation characters through
|
||||
#ifdef __WXMSW__
|
||||
virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
#endif // __WXMSW__
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxGenericScrolledWindow)
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_SCROLLWIN_H_
|
||||
|
@@ -1,193 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_SCROLLWIN_H_
|
||||
#define _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow()
|
||||
{ Init(); }
|
||||
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{ Create(parent, id, pos, size, style, name); }
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target, bool pushEventHandler = FALSE );
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
// Set the scrolled area of the window.
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
// Default action is to set the virtual size and alter scrollbars
|
||||
// accordingly.
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWidgets scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars();
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
void GtkVScroll( float value, unsigned int scroll_type );
|
||||
void GtkHScroll( float value, unsigned int scroll_type );
|
||||
void GtkVConnectEvent();
|
||||
void GtkHConnectEvent();
|
||||
void GtkVDisconnectEvent();
|
||||
void GtkHDisconnectEvent();
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Overridden from wxWidgets due callback being static
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
// FIXME: these next four members are duplicated in the GtkAdjustment
|
||||
// members of wxWindow. Can they be safely removed from here?
|
||||
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
double m_scaleY,m_scaleX;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// vi:sts=4:sw=4:et
|
@@ -1,300 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/window.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKWINDOWH__
|
||||
#define __GTKWINDOWH__
|
||||
|
||||
// helper structure that holds class that holds GtkIMContext object and
|
||||
// some additional data needed for key events processing
|
||||
struct wxGtkIMData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK;
|
||||
typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindowGTK();
|
||||
wxWindowGTK(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindowGTK();
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Update();
|
||||
virtual void ClearBackground();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
// I don't want users to override what's done in idle so everything that
|
||||
// has to be done in idle time in order for wxGTK to work is done in
|
||||
// OnInternalIdle
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// Internal represention of Update()
|
||||
void GtkUpdate();
|
||||
|
||||
// For compatibility across platforms (not in event table)
|
||||
void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
|
||||
|
||||
// wxGTK-specific: called recursively by Enable,
|
||||
// to give widgets an oppprtunity to correct their colours after they
|
||||
// have been changed by Enable
|
||||
virtual void OnParentEnable( bool WXUNUSED(enable) ) {}
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
|
||||
void PostCreation();
|
||||
|
||||
// Internal addition of child windows. differs from class
|
||||
// to class not by using virtual functions but by using
|
||||
// the m_insertCallback.
|
||||
void DoAddChild(wxWindowGTK *child);
|
||||
|
||||
// This methods sends wxPaintEvents to the window. It reads the
|
||||
// update region, breaks it up into rects and sends an event
|
||||
// for each rect. It is also responsible for background erase
|
||||
// events and NC paint events. It is called from "draw" and
|
||||
// "expose" handlers as well as from ::Update()
|
||||
void GtkSendPaintEvents();
|
||||
|
||||
// The methods below are required because many native widgets
|
||||
// are composed of several subwidgets and setting a style for
|
||||
// the widget means setting it for all subwidgets as well.
|
||||
// also, it is nor clear, which native widget is the top
|
||||
// widget where (most of) the input goes. even tooltips have
|
||||
// to be applied to all subwidgets.
|
||||
virtual GtkWidget* GetConnectWidget();
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
|
||||
// Returns the X11 context which renders on the X11 client
|
||||
// side (which can be remote) and which usually is not
|
||||
// anti-aliased and is thus faster
|
||||
// MR: Now returns the default pango_context for the widget as GtkGetPangoDefaultContext to
|
||||
// not depend on libpangox - which is completely deprecated.
|
||||
//BCI: Remove GtkGetPangoX11Context and m_x11Context completely when symbols may be removed
|
||||
PangoContext *GtkGetPangoX11Context();
|
||||
PangoContext *m_x11Context; // MR: Now unused
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Called from GTK signales handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||
|
||||
// fix up the mouse event coords, used by wxListBox only so far
|
||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||
wxCoord& WXUNUSED(x),
|
||||
wxCoord& WXUNUSED(y)) { }
|
||||
|
||||
// is this window transparent for the mouse events (as wxStaticBox is)?
|
||||
virtual bool IsTransparentForMouse() const { return FALSE; }
|
||||
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return FALSE; }
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_oldClientWidth,m_oldClientHeight;
|
||||
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
|
||||
|
||||
// this widget will be queried for GTK's focus events
|
||||
GtkWidget *m_focusWidget;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
wxGtkIMData *m_imData;
|
||||
#else // GTK 1
|
||||
#ifdef HAVE_XIM
|
||||
// XIM support for wxWidgets
|
||||
GdkIC *m_ic;
|
||||
GdkICAttr *m_icattr;
|
||||
#endif // HAVE_XIM
|
||||
#endif // GTK 2/1
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
// The area to be cleared (and not just refreshed)
|
||||
// We cannot make this distinction under GTK 2.0.
|
||||
wxRegion m_clearRegion;
|
||||
#endif
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
||||
bool m_hasScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_acceptsFocus:1; // true if not static
|
||||
bool m_hasFocus:1; // true if == FindFocus()
|
||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||
#ifdef __WXGTK20__
|
||||
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||
// chain needs update
|
||||
#endif
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||
|
||||
// Copies m_children tab order to GTK focus chain:
|
||||
void RealizeTabOrder();
|
||||
#endif
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||
// creates empty GtkRcStyle if there are no modifications, otherwise
|
||||
// returns NULL in such case.
|
||||
GtkRcStyle *CreateWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowGTK)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win);
|
||||
|
||||
#endif // __GTKWINDOWH__
|
@@ -1,193 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/scrolwin.h
|
||||
// Purpose: wxScrolledWindow class
|
||||
// Author: Robert Roebling
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_GTK_SCROLLWIN_H_
|
||||
#define _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers and constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
|
||||
|
||||
// default scrolled window style
|
||||
#ifndef wxScrolledWindowStyle
|
||||
#define wxScrolledWindowStyle (wxHSCROLL | wxVSCROLL)
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow()
|
||||
{ Init(); }
|
||||
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
{ Create(parent, id, pos, size, style, name); }
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in
|
||||
// some rare occasions you might want it to scroll another
|
||||
// window (e.g. a child of it in order to scroll only a portion
|
||||
// the area between the scrollbars (spreadsheet: only cell area
|
||||
// will move).
|
||||
virtual void SetTargetWindow( wxWindow *target, bool pushEventHandler = FALSE );
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
// Set the scrolled area of the window.
|
||||
virtual void DoSetVirtualSize( int x, int y );
|
||||
|
||||
// wxWindow's GetBestVirtualSize returns the actual window size,
|
||||
// whereas we want to return the virtual size
|
||||
virtual wxSize GetBestVirtualSize() const;
|
||||
|
||||
// Return the size best suited for the current window
|
||||
// (this isn't a virtual size, this is a sensible size for the window)
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// Number of pixels per user unit (0 or -1 for no scrollbar)
|
||||
// Length of virtual canvas in user units
|
||||
// Length of page in user units
|
||||
// Default action is to set the virtual size and alter scrollbars
|
||||
// accordingly.
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = FALSE );
|
||||
|
||||
// Physically scroll the window
|
||||
virtual void Scroll(int x_pos, int y_pos);
|
||||
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
virtual void GetScrollPixelsPerUnit(int *x_unit, int *y_unit) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction.
|
||||
// If TRUE, wxWidgets scrolls the canvas and only a bit of
|
||||
// the canvas is invalidated; no Clear() is necessary.
|
||||
// If FALSE, the whole canvas is invalidated and a Clear() is
|
||||
// necessary. Disable for when the scroll increment is used
|
||||
// to actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) {}
|
||||
|
||||
// Override this function if you don't want to have wxScrolledWindow
|
||||
// automatically change the origin according to the scroll position.
|
||||
void PrepareDC(wxDC& dc) { DoPrepareDC(dc); }
|
||||
|
||||
// lay out the window and its children
|
||||
virtual bool Layout();
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars();
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// implementation from now on
|
||||
void OnScroll(wxScrollWinEvent& event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
void GtkVScroll( float value, unsigned int scroll_type );
|
||||
void GtkHScroll( float value, unsigned int scroll_type );
|
||||
void GtkVConnectEvent();
|
||||
void GtkHConnectEvent();
|
||||
void GtkVDisconnectEvent();
|
||||
void GtkHDisconnectEvent();
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Overridden from wxWidgets due callback being static
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
protected:
|
||||
wxWindow *m_targetWindow;
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
// FIXME: these next four members are duplicated in the GtkAdjustment
|
||||
// members of wxWindow. Can they be safely removed from here?
|
||||
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
double m_scaleY,m_scaleX;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GTK_SCROLLWIN_H_
|
||||
|
||||
// vi:sts=4:sw=4:et
|
@@ -1,300 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/gtk/window.h
|
||||
// Purpose:
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GTKWINDOWH__
|
||||
#define __GTKWINDOWH__
|
||||
|
||||
// helper structure that holds class that holds GtkIMContext object and
|
||||
// some additional data needed for key events processing
|
||||
struct wxGtkIMData;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// callback definition for inserting a window (internal)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK;
|
||||
typedef void (*wxInsertChildFunction)( wxWindowGTK*, wxWindowGTK* );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxWindowGTK
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxWindowGTK : public wxWindowBase
|
||||
{
|
||||
public:
|
||||
// creating the window
|
||||
// -------------------
|
||||
wxWindowGTK();
|
||||
wxWindowGTK(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxWindowGTK();
|
||||
|
||||
// implement base class (pure) virtual methods
|
||||
// -------------------------------------------
|
||||
|
||||
virtual bool Destroy();
|
||||
|
||||
virtual void Raise();
|
||||
virtual void Lower();
|
||||
|
||||
virtual bool Show( bool show = TRUE );
|
||||
virtual bool Enable( bool enable = TRUE );
|
||||
|
||||
virtual bool IsRetained() const;
|
||||
|
||||
virtual void SetFocus();
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
virtual bool Reparent( wxWindowBase *newParent );
|
||||
|
||||
virtual void WarpPointer(int x, int y);
|
||||
|
||||
virtual void Refresh( bool eraseBackground = TRUE,
|
||||
const wxRect *rect = (const wxRect *) NULL );
|
||||
virtual void Update();
|
||||
virtual void ClearBackground();
|
||||
|
||||
virtual bool SetBackgroundColour( const wxColour &colour );
|
||||
virtual bool SetForegroundColour( const wxColour &colour );
|
||||
virtual bool SetCursor( const wxCursor &cursor );
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
virtual bool SetBackgroundStyle(wxBackgroundStyle style) ;
|
||||
|
||||
virtual int GetCharHeight() const;
|
||||
virtual int GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
int *x, int *y,
|
||||
int *descent = (int *) NULL,
|
||||
int *externalLeading = (int *) NULL,
|
||||
const wxFont *theFont = (const wxFont *) NULL)
|
||||
const;
|
||||
|
||||
#if wxUSE_MENUS_NATIVE
|
||||
virtual bool DoPopupMenu( wxMenu *menu, int x, int y );
|
||||
#endif // wxUSE_MENUS_NATIVE
|
||||
|
||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
||||
int range, bool refresh = TRUE );
|
||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
||||
virtual int GetScrollPos( int orient ) const;
|
||||
virtual int GetScrollThumb( int orient ) const;
|
||||
virtual int GetScrollRange( int orient ) const;
|
||||
virtual void ScrollWindow( int dx, int dy,
|
||||
const wxRect* rect = (wxRect *) NULL );
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
virtual void SetDropTarget( wxDropTarget *dropTarget );
|
||||
#endif // wxUSE_DRAG_AND_DROP
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void AddChild( wxWindowBase *child );
|
||||
virtual void RemoveChild( wxWindowBase *child );
|
||||
#endif
|
||||
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXWidget GetHandle() const { return m_widget; }
|
||||
|
||||
// I don't want users to override what's done in idle so everything that
|
||||
// has to be done in idle time in order for wxGTK to work is done in
|
||||
// OnInternalIdle
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
// Internal represention of Update()
|
||||
void GtkUpdate();
|
||||
|
||||
// For compatibility across platforms (not in event table)
|
||||
void OnIdle(wxIdleEvent& WXUNUSED(event)) {}
|
||||
|
||||
// wxGTK-specific: called recursively by Enable,
|
||||
// to give widgets an oppprtunity to correct their colours after they
|
||||
// have been changed by Enable
|
||||
virtual void OnParentEnable( bool WXUNUSED(enable) ) {}
|
||||
|
||||
// Used by all window classes in the widget creation process.
|
||||
bool PreCreation( wxWindowGTK *parent, const wxPoint &pos, const wxSize &size );
|
||||
void PostCreation();
|
||||
|
||||
// Internal addition of child windows. differs from class
|
||||
// to class not by using virtual functions but by using
|
||||
// the m_insertCallback.
|
||||
void DoAddChild(wxWindowGTK *child);
|
||||
|
||||
// This methods sends wxPaintEvents to the window. It reads the
|
||||
// update region, breaks it up into rects and sends an event
|
||||
// for each rect. It is also responsible for background erase
|
||||
// events and NC paint events. It is called from "draw" and
|
||||
// "expose" handlers as well as from ::Update()
|
||||
void GtkSendPaintEvents();
|
||||
|
||||
// The methods below are required because many native widgets
|
||||
// are composed of several subwidgets and setting a style for
|
||||
// the widget means setting it for all subwidgets as well.
|
||||
// also, it is nor clear, which native widget is the top
|
||||
// widget where (most of) the input goes. even tooltips have
|
||||
// to be applied to all subwidgets.
|
||||
virtual GtkWidget* GetConnectWidget();
|
||||
virtual bool IsOwnGtkWindow( GdkWindow *window );
|
||||
void ConnectWidget( GtkWidget *widget );
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Returns the default context which usually is anti-aliased
|
||||
PangoContext *GtkGetPangoDefaultContext();
|
||||
|
||||
// Returns the X11 context which renders on the X11 client
|
||||
// side (which can be remote) and which usually is not
|
||||
// anti-aliased and is thus faster
|
||||
// MR: Now returns the default pango_context for the widget as GtkGetPangoDefaultContext to
|
||||
// not depend on libpangox - which is completely deprecated.
|
||||
//BCI: Remove GtkGetPangoX11Context and m_x11Context completely when symbols may be removed
|
||||
PangoContext *GtkGetPangoX11Context();
|
||||
PangoContext *m_x11Context; // MR: Now unused
|
||||
#endif
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void ApplyToolTip( GtkTooltips *tips, const wxChar *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
// Called from GTK signales handlers. it indicates that
|
||||
// the layouting functions have to be called later on
|
||||
// (i.e. in idle time, implemented in OnInternalIdle() ).
|
||||
void GtkUpdateSize() { m_sizeSet = FALSE; }
|
||||
|
||||
// fix up the mouse event coords, used by wxListBox only so far
|
||||
virtual void FixUpMouseEvent(GtkWidget * WXUNUSED(widget),
|
||||
wxCoord& WXUNUSED(x),
|
||||
wxCoord& WXUNUSED(y)) { }
|
||||
|
||||
// is this window transparent for the mouse events (as wxStaticBox is)?
|
||||
virtual bool IsTransparentForMouse() const { return FALSE; }
|
||||
|
||||
// is this a radiobutton (used by radiobutton code itself only)?
|
||||
virtual bool IsRadioButton() const { return FALSE; }
|
||||
|
||||
// position and size of the window
|
||||
int m_x, m_y;
|
||||
int m_width, m_height;
|
||||
int m_oldClientWidth,m_oldClientHeight;
|
||||
|
||||
// see the docs in src/gtk/window.cpp
|
||||
GtkWidget *m_widget; // mostly the widget seen by the rest of GTK
|
||||
GtkWidget *m_wxwindow; // mostly the client area as per wxWidgets
|
||||
|
||||
// this widget will be queried for GTK's focus events
|
||||
GtkWidget *m_focusWidget;
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
wxGtkIMData *m_imData;
|
||||
#else // GTK 1
|
||||
#ifdef HAVE_XIM
|
||||
// XIM support for wxWidgets
|
||||
GdkIC *m_ic;
|
||||
GdkICAttr *m_icattr;
|
||||
#endif // HAVE_XIM
|
||||
#endif // GTK 2/1
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
// The area to be cleared (and not just refreshed)
|
||||
// We cannot make this distinction under GTK 2.0.
|
||||
wxRegion m_clearRegion;
|
||||
#endif
|
||||
|
||||
// scrolling stuff
|
||||
GtkAdjustment *m_hAdjust,*m_vAdjust;
|
||||
float m_oldHorizontalPos;
|
||||
float m_oldVerticalPos;
|
||||
|
||||
// extra (wxGTK-specific) flags
|
||||
bool m_needParent:1; // ! wxFrame, wxDialog, wxNotebookPage ?
|
||||
bool m_noExpose:1; // wxGLCanvas has its own redrawing
|
||||
bool m_nativeSizeEvent:1; // wxGLCanvas sends wxSizeEvent upon "alloc_size"
|
||||
bool m_hasScrolling:1;
|
||||
bool m_hasVMT:1;
|
||||
bool m_sizeSet:1;
|
||||
bool m_resizing:1;
|
||||
bool m_acceptsFocus:1; // true if not static
|
||||
bool m_hasFocus:1; // true if == FindFocus()
|
||||
bool m_isScrolling:1; // dragging scrollbar thumb?
|
||||
bool m_clipPaintRegion:1; // TRUE after ScrollWindow()
|
||||
#ifdef __WXGTK20__
|
||||
bool m_dirtyTabOrder:1; // tab order changed, GTK focus
|
||||
// chain needs update
|
||||
#endif
|
||||
bool m_needsStyleChange:1; // May not be able to change
|
||||
// background style until OnIdle
|
||||
|
||||
// C++ has no virtual methods in the constrcutor of any class but we need
|
||||
// different methods of inserting a child window into a wxFrame,
|
||||
// wxMDIFrame, wxNotebook etc. this is the callback that will get used.
|
||||
wxInsertChildFunction m_insertCallback;
|
||||
|
||||
// implement the base class pure virtuals
|
||||
virtual void DoClientToScreen( int *x, int *y ) const;
|
||||
virtual void DoScreenToClient( int *x, int *y ) const;
|
||||
virtual void DoGetPosition( int *x, int *y ) const;
|
||||
virtual void DoGetSize( int *width, int *height ) const;
|
||||
virtual void DoGetClientSize( int *width, int *height ) const;
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
virtual void DoMoveWindow(int x, int y, int width, int height);
|
||||
|
||||
virtual void DoCaptureMouse();
|
||||
virtual void DoReleaseMouse();
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif // wxUSE_TOOLTIPS
|
||||
|
||||
protected:
|
||||
// common part of all ctors (not virtual because called from ctor)
|
||||
void Init();
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
virtual void DoMoveInTabOrder(wxWindow *win, MoveKind move);
|
||||
|
||||
// Copies m_children tab order to GTK focus chain:
|
||||
void RealizeTabOrder();
|
||||
#endif
|
||||
|
||||
// Called by ApplyWidgetStyle (which is called by SetFont() and
|
||||
// SetXXXColour etc to apply style changed to native widgets) to create
|
||||
// modified GTK style with non-standard attributes. If forceStyle=true,
|
||||
// creates empty GtkRcStyle if there are no modifications, otherwise
|
||||
// returns NULL in such case.
|
||||
GtkRcStyle *CreateWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// Overridden in many GTK widgets who have to handle subwidgets
|
||||
virtual void ApplyWidgetStyle(bool forceStyle = false);
|
||||
|
||||
// helper function to ease native widgets wrapping, called by
|
||||
// ApplyWidgetStyle -- override this, not ApplyWidgetStyle
|
||||
virtual void DoApplyWidgetStyle(GtkRcStyle *style);
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxWindowGTK)
|
||||
DECLARE_NO_COPY_CLASS(wxWindowGTK)
|
||||
};
|
||||
|
||||
extern WXDLLIMPEXP_CORE wxWindow *wxFindFocusedChild(wxWindowGTK *win);
|
||||
|
||||
#endif // __GTKWINDOWH__
|
@@ -1,238 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: include/wx/scrolwin.h
|
||||
// Purpose: wxScrolledWindow, wxScrolledControl and wxScrollHelper
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 30.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_SCROLWIN_H_BASE_
|
||||
#define _WX_SCROLWIN_H_BASE_
|
||||
|
||||
#include "wx/window.h"
|
||||
|
||||
class WXDLLEXPORT wxScrollHelperEvtHandler;
|
||||
class WXDLLEXPORT wxTimer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrollHelper: this class implements the scrolling logic which is used by
|
||||
// wxScrolledWindow and wxScrolledControl. It is a mix-in: just derive from it
|
||||
// to implement scrolling in your class.
|
||||
// ----------------------------------------------------------------------------
|
||||
#if !defined(__WXGTK__) || defined(__WXUNIVERSAL__)
|
||||
|
||||
class WXDLLEXPORT wxScrollHelper
|
||||
{
|
||||
public:
|
||||
// ctor and dtor
|
||||
wxScrollHelper(wxWindow *winToScroll = (wxWindow *)NULL);
|
||||
void SetWindow(wxWindow *winToScroll);
|
||||
virtual ~wxScrollHelper();
|
||||
|
||||
// configure the scrolling
|
||||
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
||||
int noUnitsX, int noUnitsY,
|
||||
int xPos = 0, int yPos = 0,
|
||||
bool noRefresh = false );
|
||||
|
||||
// scroll to the given (in logical coords) position
|
||||
virtual void Scroll(int x, int y);
|
||||
|
||||
// get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
|
||||
int GetScrollPageSize(int orient) const;
|
||||
void SetScrollPageSize(int orient, int pageSize);
|
||||
|
||||
// Set the x, y scrolling increments.
|
||||
void SetScrollRate( int xstep, int ystep );
|
||||
|
||||
// get the size of one logical unit in physical ones
|
||||
virtual void GetScrollPixelsPerUnit(int *pixelsPerUnitX,
|
||||
int *pixelsPerUnitY) const;
|
||||
|
||||
// Enable/disable Windows scrolling in either direction. If true, wxWidgets
|
||||
// scrolls the canvas and only a bit of the canvas is invalidated; no
|
||||
// Clear() is necessary. If false, the whole canvas is invalidated and a
|
||||
// Clear() is necessary. Disable for when the scroll increment is used to
|
||||
// actually scroll a non-constant distance
|
||||
virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
|
||||
|
||||
// Get the view start
|
||||
virtual void GetViewStart(int *x, int *y) const;
|
||||
|
||||
// Set the scale factor, used in PrepareDC
|
||||
void SetScale(double xs, double ys) { m_scaleX = xs; m_scaleY = ys; }
|
||||
double GetScaleX() const { return m_scaleX; }
|
||||
double GetScaleY() const { return m_scaleY; }
|
||||
|
||||
// translate between scrolled and unscrolled coordinates
|
||||
void CalcScrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcScrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcScrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcScrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
void CalcUnscrolledPosition(int x, int y, int *xx, int *yy) const
|
||||
{ DoCalcUnscrolledPosition(x, y, xx, yy); }
|
||||
wxPoint CalcUnscrolledPosition(const wxPoint& pt) const
|
||||
{
|
||||
wxPoint p2;
|
||||
DoCalcUnscrolledPosition(pt.x, pt.y, &p2.x, &p2.y);
|
||||
return p2;
|
||||
}
|
||||
|
||||
virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
|
||||
|
||||
// Adjust the scrollbars
|
||||
virtual void AdjustScrollbars(void);
|
||||
|
||||
// Calculate scroll increment
|
||||
virtual int CalcScrollInc(wxScrollWinEvent& event);
|
||||
|
||||
// Normally the wxScrolledWindow will scroll itself, but in some rare
|
||||
// occasions you might want it to scroll [part of] another window (e.g. a
|
||||
// child of it in order to scroll only a portion the area between the
|
||||
// scrollbars (spreadsheet: only cell area will move).
|
||||
virtual void SetTargetWindow(wxWindow *target);
|
||||
virtual wxWindow *GetTargetWindow() const;
|
||||
|
||||
void SetTargetRect(const wxRect& rect) { m_rectToScroll = rect; }
|
||||
wxRect GetTargetRect() const { return m_rectToScroll; }
|
||||
|
||||
// Override this function to draw the graphic (or just process EVT_PAINT)
|
||||
virtual void OnDraw(wxDC& WXUNUSED(dc)) { }
|
||||
|
||||
// change the DC origin according to the scroll position.
|
||||
virtual void DoPrepareDC(wxDC& dc);
|
||||
|
||||
// are we generating the autoscroll events?
|
||||
bool IsAutoScrolling() const { return m_timerAutoScroll != NULL; }
|
||||
|
||||
// stop generating the scroll events when mouse is held outside the window
|
||||
void StopAutoScrolling();
|
||||
|
||||
// this method can be overridden in a derived class to forbid sending the
|
||||
// auto scroll events - note that unlike StopAutoScrolling() it doesn't
|
||||
// stop the timer, so it will be called repeatedly and will typically
|
||||
// return different values depending on the current mouse position
|
||||
//
|
||||
// the base class version just returns true
|
||||
virtual bool SendAutoScrollEvents(wxScrollWinEvent& event) const;
|
||||
|
||||
// the methods to be called from the window event handlers
|
||||
void HandleOnScroll(wxScrollWinEvent& event);
|
||||
void HandleOnSize(wxSizeEvent& event);
|
||||
void HandleOnPaint(wxPaintEvent& event);
|
||||
void HandleOnChar(wxKeyEvent& event);
|
||||
void HandleOnMouseEnter(wxMouseEvent& event);
|
||||
void HandleOnMouseLeave(wxMouseEvent& event);
|
||||
#if wxUSE_MOUSEWHEEL
|
||||
void HandleOnMouseWheel(wxMouseEvent& event);
|
||||
#endif // wxUSE_MOUSEWHEEL
|
||||
|
||||
// FIXME: this is needed for now for wxPlot compilation, should be removed
|
||||
// once it is fixed!
|
||||
void OnScroll(wxScrollWinEvent& event) { HandleOnScroll(event); }
|
||||
|
||||
protected:
|
||||
// get pointer to our scroll rect if we use it or NULL
|
||||
const wxRect *GetScrollRect() const
|
||||
{
|
||||
return m_rectToScroll.width != 0 ? &m_rectToScroll : NULL;
|
||||
}
|
||||
|
||||
// get the size of the target window
|
||||
wxSize GetTargetSize() const
|
||||
{
|
||||
return m_rectToScroll.width != 0 ? m_rectToScroll.GetSize()
|
||||
: m_targetWindow->GetClientSize();
|
||||
}
|
||||
|
||||
void GetTargetSize(int *w, int *h)
|
||||
{
|
||||
wxSize size = GetTargetSize();
|
||||
if ( w )
|
||||
*w = size.x;
|
||||
if ( h )
|
||||
*h = size.y;
|
||||
}
|
||||
|
||||
// change just the target window (unlike SetWindow which changes m_win as
|
||||
// well)
|
||||
void DoSetTargetWindow(wxWindow *target);
|
||||
|
||||
// delete the event handler we installed
|
||||
void DeleteEvtHandler();
|
||||
|
||||
double m_scaleX;
|
||||
double m_scaleY;
|
||||
|
||||
wxWindow *m_win,
|
||||
*m_targetWindow;
|
||||
|
||||
wxRect m_rectToScroll;
|
||||
|
||||
wxTimer *m_timerAutoScroll;
|
||||
|
||||
int m_xScrollPixelsPerLine;
|
||||
int m_yScrollPixelsPerLine;
|
||||
int m_xScrollPosition;
|
||||
int m_yScrollPosition;
|
||||
int m_xScrollLines;
|
||||
int m_yScrollLines;
|
||||
int m_xScrollLinesPerPage;
|
||||
int m_yScrollLinesPerPage;
|
||||
|
||||
bool m_xScrollingEnabled;
|
||||
bool m_yScrollingEnabled;
|
||||
|
||||
#if wxUSE_MOUSEWHEEL
|
||||
int m_wheelRotation;
|
||||
#endif // wxUSE_MOUSEWHEEL
|
||||
|
||||
wxScrollHelperEvtHandler *m_handler;
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxScrollHelper)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxScrolledWindow: a wxWindow which knows how to scroll
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXGTK__) && !defined(__WXUNIVERSAL__)
|
||||
#include "wx/gtk/scrolwin.h"
|
||||
#else // !wxGTK
|
||||
#include "wx/generic/scrolwin.h"
|
||||
|
||||
class WXDLLEXPORT wxScrolledWindow : public wxGenericScrolledWindow
|
||||
{
|
||||
public:
|
||||
wxScrolledWindow() { }
|
||||
wxScrolledWindow(wxWindow *parent,
|
||||
wxWindowID winid = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxScrolledWindowStyle,
|
||||
const wxString& name = wxPanelNameStr)
|
||||
: wxGenericScrolledWindow(parent, winid, pos, size, style, name)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS_NO_COPY(wxScrolledWindow)
|
||||
};
|
||||
|
||||
#define wxSCROLLED_WINDOW_IS_GENERIC 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_SCROLWIN_H_BASE_
|
||||
|
1533
include/wx/window.h
1533
include/wx/window.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1044
src/gtk/scrolwin.cpp
1044
src/gtk/scrolwin.cpp
File diff suppressed because it is too large
Load Diff
4904
src/gtk/window.cpp
4904
src/gtk/window.cpp
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4904
src/gtk1/window.cpp
4904
src/gtk1/window.cpp
File diff suppressed because it is too large
Load Diff
24
wxPython/.cvsignore
Normal file
24
wxPython/.cvsignore
Normal file
@@ -0,0 +1,24 @@
|
||||
.DS_Store
|
||||
.emacs.desktop
|
||||
.gdb_history
|
||||
BUILD
|
||||
MANIFEST
|
||||
_build_dmg
|
||||
_build_rpm
|
||||
build
|
||||
build-dbg
|
||||
build-gtk
|
||||
build-gtk2
|
||||
build-gtk2-dbg.unicode
|
||||
build-gtk2.unicode
|
||||
build-pkg
|
||||
build-pkg-debug
|
||||
build-x11
|
||||
build.local
|
||||
build.unicode
|
||||
build_options.py
|
||||
dist
|
||||
licence
|
||||
s.bat
|
||||
temp
|
||||
update.log
|
109
wxPython/SWIG/README.txt
Normal file
109
wxPython/SWIG/README.txt
Normal file
@@ -0,0 +1,109 @@
|
||||
SWIG 1.3.x Patches
|
||||
==================
|
||||
|
||||
This directory holds a set of patches for the CVS version of SWIG that
|
||||
are required if you wish to use SWIG for wxPython development, or for
|
||||
building your own extension modules that need to interface with
|
||||
wxPython. These have been submitted to SWIG's SourceForge patch
|
||||
tracker, so hopefully they will get incorporated into the main SWIG
|
||||
source tree soon.
|
||||
|
||||
wxPython currently uses the 1.3.24 version of SWIG, which you can get
|
||||
from https://sourceforge.net/projects/swig/, plus the patch(es) in this
|
||||
directory. Download the SWIG sources, apply the patch(es) here and
|
||||
then build as normal. If you want to use both the patched version of
|
||||
SWIG and the stock version, then you can configure the patched version
|
||||
to use a different --prefix and then specify that executable when
|
||||
running setup.py, like this:
|
||||
|
||||
python setup.py SWIG=/path/to/my/swig [other params]
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
swig-1.3.24.patch
|
||||
|
||||
A bug was introduced in SWIG 1.3.23 and remains in 1.3.24 that
|
||||
causes compilation problems with wxPython (copies are being made
|
||||
of objects that don't have a copy constructor.) This patch fixes
|
||||
the code generator to use a reference to the object instead of
|
||||
making a copy.
|
||||
|
||||
Part of my autodoc patch was disabled becuase a unit-test failed.
|
||||
It turns out that the failure was due to a name clash in the unit
|
||||
test itself, so I re-enabled that section of code in this patch.
|
||||
|
||||
Don't generate the autodocs string for a class if it has a
|
||||
docstring attribute.
|
||||
|
||||
Some typos fixed, etc.
|
||||
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
This patch was added to SWIG's CVS on 10/2/2004 and a modified version
|
||||
of it is in 1.3.23 and 1.3.24.
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
swig.python-2.patch
|
||||
|
||||
Adds the following features to the Python Module in SWIG. See the
|
||||
updated docs in the patch for more details.
|
||||
|
||||
%feature("autodoc")
|
||||
%feature("docstring")
|
||||
%feature("pythonprepend")
|
||||
%feature("pythonappend")
|
||||
|
||||
%module(docstring="string")
|
||||
%module(package="string")
|
||||
|
||||
https://sourceforge.net/tracker/index.php?func=detail&aid=1023309&group_id=1645&atid=301645
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
This patch was applied to SWIG's CVS on 07/12/2004 and is in the
|
||||
1.3.22 relese.
|
||||
------------------------------------------------------------------------
|
||||
|
||||
swig.xmlout.patch Fixes a couple problems in the XML output
|
||||
of SWIG: an extra "/>" was removed and
|
||||
newlines in attribute values were changed
|
||||
to the #10; entity reference so they will
|
||||
be preserved by parsers.
|
||||
|
||||
Also, added options for dumping or
|
||||
writing to a file the XML of the parse
|
||||
tree *after* other language modules have
|
||||
been run (previously you could only do
|
||||
the XML output *instead of* a regular
|
||||
language module.)
|
||||
See SF Patch #864689
|
||||
|
||||
|
||||
|
||||
------------------------------------------------------------------------
|
||||
These patches have already been checked in to SWIG's CVS and are in
|
||||
the 1.3.20 release.
|
||||
------------------------------------------------------------------------
|
||||
|
||||
swig.SplitLines.patch Adds a new SplitLines function to the DOH
|
||||
library. See SF Patch #829317.
|
||||
*Checked in 10/31/2003*
|
||||
|
||||
swig.xml.patch Adds an option that drastically reduces
|
||||
the size of the XML output of SWIG, which
|
||||
increases the performance of the
|
||||
build_renamers script used in the wxPython
|
||||
build. See SF Patch #829319.
|
||||
*Checked in 10/31/2003*
|
||||
|
||||
swig.python.patch Lots of changes for SWIG's Python module,
|
||||
especially in how the proxy code is
|
||||
generated. See swig.python.patch.txt for
|
||||
more details, also SF Patch #829325.
|
||||
*Checked in 10/31/2003*
|
||||
|
||||
------------------------------------------------------------------------
|
201
wxPython/SWIG/swig-1.3.24.patch
Normal file
201
wxPython/SWIG/swig-1.3.24.patch
Normal file
@@ -0,0 +1,201 @@
|
||||
? .configure
|
||||
? .emacs.desktop
|
||||
? .test
|
||||
? mytests
|
||||
? switch_cvs.py
|
||||
? Source/Modules/mystuff
|
||||
Index: Doc/Manual/Python.html
|
||||
===================================================================
|
||||
RCS file: /cvsroot/swig/SWIG/Doc/Manual/Python.html,v
|
||||
retrieving revision 1.20
|
||||
diff -u -4 -r1.20 Python.html
|
||||
--- Doc/Manual/Python.html 25 Oct 2004 20:42:08 -0000 1.20
|
||||
+++ Doc/Manual/Python.html 15 Apr 2005 23:11:25 -0000
|
||||
@@ -3869,10 +3869,10 @@
|
||||
|
||||
<H2><a name="Python_nn65"></a>26.10 Docstring Features</H2>
|
||||
|
||||
|
||||
-Usign docstrings in Python code is becoming more and more important
|
||||
-ans more tools are coming on the scene that take advantage of them,
|
||||
+Using docstrings in Python code is becoming more and more important
|
||||
+and more tools are coming on the scene that take advantage of them,
|
||||
everything from full-blown documentaiton generators to class browsers
|
||||
and popup call-tips in Python-aware IDEs. Given the way that SWIG
|
||||
generates the proxy code by default, your users will normally get
|
||||
something like <tt>"function_name(*args)"</tt> in the popup calltip of
|
||||
Index: Lib/python/pyrun.swg
|
||||
===================================================================
|
||||
RCS file: /cvsroot/swig/SWIG/Lib/python/pyrun.swg,v
|
||||
retrieving revision 1.53
|
||||
diff -u -4 -r1.53 pyrun.swg
|
||||
--- Lib/python/pyrun.swg 11 Dec 2004 23:38:44 -0000 1.53
|
||||
+++ Lib/python/pyrun.swg 15 Apr 2005 23:11:25 -0000
|
||||
@@ -455,9 +455,10 @@
|
||||
} else {
|
||||
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
|
||||
type, otype);
|
||||
}
|
||||
- Py_DECREF(str);
|
||||
+ if (str)
|
||||
+ Py_DECREF(str);
|
||||
return;
|
||||
}
|
||||
}
|
||||
PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
|
||||
Index: Source/Modules/python.cxx
|
||||
===================================================================
|
||||
RCS file: /cvsroot/swig/SWIG/Source/Modules/python.cxx,v
|
||||
retrieving revision 1.81
|
||||
diff -u -4 -r1.81 python.cxx
|
||||
--- Source/Modules/python.cxx 13 Dec 2004 22:12:47 -0000 1.81
|
||||
+++ Source/Modules/python.cxx 15 Apr 2005 23:11:26 -0000
|
||||
@@ -74,9 +74,9 @@
|
||||
-modern - Use modern python features only, without compatibility code\n\
|
||||
-apply - Use apply() in proxy classes\n\
|
||||
-new_vwm - New value wrapper mode, use only when everything else fails \n\
|
||||
-new_repr - Use more informative version of __repr__ in proxy classes\n\
|
||||
- -old_repr - Use shorter ald old version of __repr__ in proxy classes\n\
|
||||
+ -old_repr - Use shorter and old version of __repr__ in proxy classes\n\
|
||||
-noexcept - No automatic exception handling\n\
|
||||
-noh - Don't generate the output header file\n\
|
||||
-noproxy - Don't generate proxy classes \n\n";
|
||||
|
||||
@@ -749,10 +749,15 @@
|
||||
|
||||
// Do the param type too?
|
||||
if (showTypes) {
|
||||
type = SwigType_base(type);
|
||||
- lookup = Swig_symbol_clookup(type, 0);
|
||||
- if (lookup) type = Getattr(lookup, "sym:name");
|
||||
+ SwigType* qt = SwigType_typedef_resolve_all(type);
|
||||
+ if (SwigType_isenum(qt))
|
||||
+ type = NewString("int");
|
||||
+ else {
|
||||
+ lookup = Swig_symbol_clookup(type, 0);
|
||||
+ if (lookup) type = Getattr(lookup, "sym:name");
|
||||
+ }
|
||||
Printf(doc, "%s ", type);
|
||||
}
|
||||
|
||||
if (name) {
|
||||
@@ -853,13 +858,19 @@
|
||||
}
|
||||
|
||||
switch ( ad_type ) {
|
||||
case AUTODOC_CLASS:
|
||||
- if (CPlusPlus) {
|
||||
- Printf(doc, "Proxy of C++ %s class", class_name);
|
||||
- } else {
|
||||
- Printf(doc, "Proxy of C %s struct", class_name);
|
||||
- }
|
||||
+ {
|
||||
+ // Only do the autodoc if there isn't a docstring for the class
|
||||
+ String* str = Getattr(n, "feature:docstring");
|
||||
+ if (str == NULL || Len(str) == 0) {
|
||||
+ if (CPlusPlus) {
|
||||
+ Printf(doc, "Proxy of C++ %s class", class_name);
|
||||
+ } else {
|
||||
+ Printf(doc, "Proxy of C %s struct", class_name);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
break;
|
||||
case AUTODOC_CTOR:
|
||||
if ( Strcmp(class_name, symname) == 0) {
|
||||
String* paramList = make_autodocParmList(n, showTypes);
|
||||
@@ -1027,10 +1038,12 @@
|
||||
Printf(methods,"\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function);
|
||||
|
||||
if (n && Getattr(n,"feature:callback")) {
|
||||
if (have_docstring(n)) {
|
||||
+ String* ds = docstring(n, AUTODOC_FUNC, "", false);
|
||||
+ Replaceall(ds, "\n", "\\n");
|
||||
Printf(methods,"(char *)\"%s\\nswig_ptr: %s\"",
|
||||
- docstring(n, AUTODOC_FUNC, "", false),
|
||||
+ ds,
|
||||
Getattr(n,"feature:callback:name"));
|
||||
} else {
|
||||
Printf(methods,"(char *)\"swig_ptr: %s\"",Getattr(n,"feature:callback:name"));
|
||||
}
|
||||
@@ -1950,11 +1963,13 @@
|
||||
Printf(f_shadow, modern ? "(object)" : "(_object)");
|
||||
}
|
||||
}
|
||||
Printf(f_shadow,":\n");
|
||||
- if ( have_docstring(n) )
|
||||
- Printv(f_shadow, tab4, docstring(n, AUTODOC_CLASS, tab4), "\n", NIL);
|
||||
-
|
||||
+ if ( have_docstring(n) ) {
|
||||
+ String* str = docstring(n, AUTODOC_CLASS, tab4);
|
||||
+ if (str != NULL && Len(str))
|
||||
+ Printv(f_shadow, tab4, str, "\n", NIL);
|
||||
+ }
|
||||
if (!modern) {
|
||||
Printv(f_shadow,tab4,"__swig_setmethods__ = {}\n",NIL);
|
||||
if (Len(base_class)) {
|
||||
Printf(f_shadow,"%sfor _s in [%s]: __swig_setmethods__.update(_s.__swig_setmethods__)\n",tab4,base_class);
|
||||
@@ -2139,11 +2154,11 @@
|
||||
Replaceall(pycode,"$action", pyaction);
|
||||
Delete(pyaction);
|
||||
Printv(f_shadow,pycode,"\n",NIL);
|
||||
} else {
|
||||
- Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "): ", NIL);
|
||||
+ Printv(f_shadow, tab4, "def ", symname, "(*args", (allow_kwargs ? ", **kwargs" : ""), "):", NIL);
|
||||
if (!have_addtofunc(n)) {
|
||||
- Printv(f_shadow, "return ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n", NIL);
|
||||
+ Printv(f_shadow, " return ", funcCallHelper(Swig_name_member(class_name,symname), allow_kwargs), "\n", NIL);
|
||||
} else {
|
||||
Printv(f_shadow, "\n", NIL);
|
||||
if ( have_docstring(n) )
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_METHOD, tab8), "\n", NIL);
|
||||
@@ -2175,12 +2190,9 @@
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
if (shadow) {
|
||||
- //
|
||||
- // static + autodoc/prepend/append + def args not working!!!, disable by now
|
||||
- //
|
||||
- if (0 && !classic && !Getattr(n,"feature:python:callback") && have_addtofunc(n)) {
|
||||
+ if ( !classic && !Getattr(n,"feature:python:callback") && have_addtofunc(n)) {
|
||||
int kw = (check_kwargs(n) && !Getattr(n,"sym:overloaded")) ? 1 : 0;
|
||||
Printv(f_shadow, tab4, "def ", symname, "(*args", (kw ? ", **kwargs" : ""), "):\n", NIL);
|
||||
if ( have_docstring(n) )
|
||||
Printv(f_shadow, tab8, docstring(n, AUTODOC_STATICFUNC, tab8), "\n", NIL);
|
||||
Index: Source/Swig/cwrap.c
|
||||
===================================================================
|
||||
RCS file: /cvsroot/swig/SWIG/Source/Swig/cwrap.c,v
|
||||
retrieving revision 1.51
|
||||
diff -u -4 -r1.51 cwrap.c
|
||||
--- Source/Swig/cwrap.c 4 Dec 2004 08:33:02 -0000 1.51
|
||||
+++ Source/Swig/cwrap.c 15 Apr 2005 23:11:26 -0000
|
||||
@@ -172,17 +172,26 @@
|
||||
tycode = SwigType_type(type);
|
||||
if (tycode == T_REFERENCE) {
|
||||
if (pvalue) {
|
||||
SwigType *tvalue;
|
||||
- String *defname, *defvalue, *rvalue;
|
||||
+ String *defname, *defvalue, *rvalue, *qvalue;
|
||||
rvalue = SwigType_typedef_resolve_all(pvalue);
|
||||
+ qvalue = SwigType_typedef_qualified(rvalue);
|
||||
defname = NewStringf("%s_defvalue", lname);
|
||||
tvalue = Copy(type);
|
||||
SwigType_del_reference(tvalue);
|
||||
- defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname), rvalue);
|
||||
+ tycode = SwigType_type(tvalue);
|
||||
+ if (tycode != T_USER) {
|
||||
+ /* plain primitive type, we copy the the def value */
|
||||
+ defvalue = NewStringf("%s = %s", SwigType_lstr(tvalue,defname),qvalue);
|
||||
+ } else {
|
||||
+ /* user type, we copy the reference value */
|
||||
+ defvalue = NewStringf("%s = %s",SwigType_str(type,defname),qvalue);
|
||||
+ }
|
||||
Wrapper_add_localv(w,defname, defvalue, NIL);
|
||||
Delete(tvalue);
|
||||
Delete(rvalue);
|
||||
+ Delete(qvalue);
|
||||
Delete(defname);
|
||||
Delete(defvalue);
|
||||
}
|
||||
} else if (!pvalue && ((tycode == T_POINTER) || (tycode == T_STRING))) {
|
147
wxPython/b
Executable file
147
wxPython/b
Executable file
@@ -0,0 +1,147 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Are we using bash on win32? If so source that file and then exit.
|
||||
if [ "$OSTYPE" = "cygwin" ]; then
|
||||
source b.win32
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
function getpyver {
|
||||
if [ "$1" = "15" ]; then
|
||||
PYVER=1.5
|
||||
elif [ "$1" = "20" ]; then
|
||||
PYVER=2.0
|
||||
elif [ "$1" = "21" ]; then
|
||||
PYVER=2.1
|
||||
elif [ "$1" = "22" ]; then
|
||||
PYVER=2.2
|
||||
elif [ "$1" = "23" ]; then
|
||||
PYVER=2.3
|
||||
elif [ "$1" = "24" ]; then
|
||||
PYVER=2.4
|
||||
else
|
||||
echo You must specify Python version as first parameter.
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
getpyver $1
|
||||
shift
|
||||
|
||||
python$PYVER -c "import sys;print '\n', sys.version, '\n'"
|
||||
|
||||
|
||||
SETUP="python$PYVER -u setup.py"
|
||||
FLAGS="USE_SWIG=1 SWIG=/opt/swig/bin/swig"
|
||||
OTHERFLAGS=""
|
||||
PORTFLAGS=""
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "gtk1" -o "$1" = "gtk" ]; then
|
||||
PORTFLAGS="WXPORT=gtk UNICODE=0"
|
||||
shift
|
||||
elif [ "$1" = "gtk2" ]; then
|
||||
PORTFLAGS="WXPORT=gtk2 UNICODE=1"
|
||||
shift
|
||||
fi
|
||||
|
||||
FLAGS="$FLAGS $PORTFLAGS"
|
||||
|
||||
|
||||
|
||||
|
||||
# "c" --> clean
|
||||
if [ "$1" = "c" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS clean $*"
|
||||
OTHERCMD="rm -f wx/*.so"
|
||||
|
||||
# "d" --> clean extension modules only
|
||||
elif [ "$1" = "d" ]; then
|
||||
shift
|
||||
CMD="rm -f wx/*.so"
|
||||
|
||||
# "t" --> touch *.i files
|
||||
elif [ "$1" = "t" ]; then
|
||||
shift
|
||||
CMD='find . -name "*.i" | xargs touch'
|
||||
|
||||
# "i" --> install
|
||||
elif [ "$1" = "i" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*"
|
||||
|
||||
# "s" --> source dist
|
||||
elif [ "$1" = "s" ]; then
|
||||
shift
|
||||
CMD="$SETUP $OTHERFLAGS sdist $*"
|
||||
|
||||
# "r" --> rpm dist
|
||||
elif [ "$1" = "r" ]; then
|
||||
WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"`
|
||||
for VER in 21 22; do
|
||||
getpyver $VER
|
||||
|
||||
echo "*****************************************************************"
|
||||
echo "******* Building wxPython for Python $PYVER"
|
||||
echo "*****************************************************************"
|
||||
|
||||
SETUP="python$PYVER -u setup.py"
|
||||
|
||||
# save the original
|
||||
cp setup.py setup.py.save
|
||||
|
||||
# fix up setup.py the way we want...
|
||||
sed "s/BUILD_GLCANVAS = /BUILD_GLCANVAS = 0 #/" < setup.py.save > setup.py.temp
|
||||
sed "s/GL_ONLY = /GL_ONLY = 1 #/" < setup.py.temp > setup.py
|
||||
|
||||
# build wxPython-gl RPM
|
||||
$SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER
|
||||
### --requires=python$PYVER
|
||||
rm dist/wxPython-gl*.tar.gz
|
||||
|
||||
# Build wxPython RPM
|
||||
cp setup.py setup.py.temp
|
||||
sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py
|
||||
$SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER
|
||||
### --requires=python$PYVER
|
||||
|
||||
# put the oringal setup.py back
|
||||
cp setup.py.save setup.py
|
||||
rm setup.py.*
|
||||
|
||||
# rename the binary RPM's
|
||||
mv dist/wxPython-$WXPYVER-1.i386.rpm dist/wxPython-$WXPYVER-1-Py$VER.i386.rpm
|
||||
mv dist/wxPython-gl-$WXPYVER-1.i386.rpm dist/wxPython-gl-$WXPYVER-1-Py$VER.i386.rpm
|
||||
|
||||
done
|
||||
|
||||
# rebuild the source dists without the munched up setup.py
|
||||
$SETUP $OTHERFLAGS bdist_rpm --source-only
|
||||
exit 0
|
||||
|
||||
|
||||
# "f" --> FINAL (no debug)
|
||||
elif [ "$1" = "f" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*"
|
||||
|
||||
# (no command arg) --> normal build for development
|
||||
else
|
||||
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*"
|
||||
fi
|
||||
|
||||
|
||||
echo $CMD
|
||||
eval $CMD
|
||||
RC=$?
|
||||
|
||||
if [ "$RC" = "0" -a "$OTHERCMD" != "" ]; then
|
||||
echo $OTHERCMD
|
||||
$OTHERCMD
|
||||
RC=$?
|
||||
fi
|
||||
|
||||
exit $RC
|
3
wxPython/b.bat
Executable file
3
wxPython/b.bat
Executable file
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
|
||||
call bash.bat -c "b.win32 %*"
|
116
wxPython/b.win32
Normal file
116
wxPython/b.win32
Normal file
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash
|
||||
# ----------------------------------------------------------------------
|
||||
|
||||
# To Robin: I tried to avoid making any changes to the existing
|
||||
# build scripts, but my env requires me to specify Windows paths...
|
||||
# if this breaks something at your end, let me know and we can
|
||||
# figure out some solution for both of us.
|
||||
if [ "$SWIGDIR" = "" ]; then
|
||||
SWIGDIR=$PROJECTS\\SWIG-cvs
|
||||
fi
|
||||
|
||||
FLAGS="USE_SWIG=1 SWIG=$SWIGDIR\\swig.exe"
|
||||
|
||||
# Use non-default python?
|
||||
case $1 in
|
||||
21 | 2.1) VER=21; shift ;;
|
||||
22 | 2.2) VER=22; shift ;;
|
||||
23 | 2.3) VER=23; shift ;;
|
||||
24 | 2.4) VER=24; shift ;;
|
||||
|
||||
*) VER=24
|
||||
esac
|
||||
|
||||
PYTHON=$TOOLS/python$VER/python.exe
|
||||
|
||||
SETUP="$PYTHON -u setup.py"
|
||||
$PYTHON -c "import sys;print '\n', sys.version, '\n'"
|
||||
|
||||
|
||||
|
||||
# "c" --> clean
|
||||
if [ "$1" = "c" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS clean $@"
|
||||
OTHERCMD="rm wx/*.pyd"
|
||||
|
||||
# just remove the *.pyd's
|
||||
elif [ "$1" = "d" ]; then
|
||||
shift
|
||||
CMD="rm wx/*.pyd"
|
||||
|
||||
# touch all the *.i files so swig will regenerate
|
||||
elif [ "$1" = "t" ]; then
|
||||
shift
|
||||
CMD=
|
||||
find . -name "*.i" | xargs -l touch
|
||||
|
||||
# "i" --> install
|
||||
elif [ "$1" = "i" ]; then
|
||||
shift
|
||||
CMD="$SETUP build install"
|
||||
|
||||
# "r" --> make installer
|
||||
elif [ "$1" = "r" ]; then
|
||||
shift
|
||||
CMD="$PYTHON -u distrib\make_installer.py $@"
|
||||
|
||||
# "s" --> source dist
|
||||
elif [ "$1" = "s" ]; then
|
||||
shift
|
||||
CMD="$SETUP sdist"
|
||||
|
||||
# "f" --> FINAL
|
||||
elif [ "$1" == "f" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS FINAL=1 build_ext --inplace $@"
|
||||
|
||||
# "h" --> HYBRID
|
||||
elif [ "$1" = "h" ]; then
|
||||
shift
|
||||
CMD="$SETUP $FLAGS HYBRID=1 build_ext --inplace $@"
|
||||
|
||||
# "a" --> make all installers
|
||||
elif [ "$1" = "a" ]; then
|
||||
shift
|
||||
CMD=
|
||||
|
||||
# $0 22 d
|
||||
# $0 22 h
|
||||
# $0 22 r
|
||||
# $0 22 d UNICODE=1
|
||||
# $0 22 h UNICODE=1
|
||||
# $0 22 r UNICODE=1
|
||||
|
||||
$0 23 d
|
||||
$0 23 h
|
||||
$0 23 r
|
||||
$0 23 d UNICODE=1
|
||||
$0 23 h UNICODE=1
|
||||
$0 23 r UNICODE=1
|
||||
|
||||
|
||||
# "b" --> both debug and hybrid builds
|
||||
elif [ "$1" = "b" ]; then
|
||||
shift
|
||||
CMD="echo Finished!"
|
||||
$0 $VER $@
|
||||
$0 $VER h $@
|
||||
|
||||
# (no command arg) --> normal debug build for development
|
||||
else
|
||||
CMD="$SETUP $FLAGS HYBRID=0 build_ext --inplace --debug $@"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$CMD" != "" ]; then
|
||||
echo $CMD
|
||||
$CMD
|
||||
fi
|
||||
|
||||
if [ "$OTHERCMD" != "" ]; then
|
||||
echo $OTHERCMD
|
||||
$OTHERCMD
|
||||
fi
|
||||
|
1138
wxPython/config.py
Normal file
1138
wxPython/config.py
Normal file
File diff suppressed because it is too large
Load Diff
1
wxPython/contrib/.cvsignore
Normal file
1
wxPython/contrib/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
update.log
|
3
wxPython/contrib/README
Normal file
3
wxPython/contrib/README
Normal file
@@ -0,0 +1,3 @@
|
||||
These sub directories contain add-on modules that are not part of the
|
||||
core wxPython, either because of licensing issues, optional code in
|
||||
wxWindows, contrib code in wxWindows, or whatever.
|
211
wxPython/contrib/activex/_activex_ex.py
Normal file
211
wxPython/contrib/activex/_activex_ex.py
Normal file
@@ -0,0 +1,211 @@
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Some helper and utility functions for ActiveX
|
||||
|
||||
|
||||
t4 = " " * 4
|
||||
t8 = " " * 8
|
||||
|
||||
def GetAXInfo(ax):
|
||||
"""
|
||||
Returns a printable summary of the TypeInfo from the ActiveX instance
|
||||
passed in.
|
||||
"""
|
||||
|
||||
def ProcessFuncX(f, out, name):
|
||||
out.append(name)
|
||||
out.append(t4 + "retType: %s" % f.retType.vt_type)
|
||||
if f.params:
|
||||
out.append(t4 + "params:")
|
||||
for p in f.params:
|
||||
out.append(t8 + p.name)
|
||||
out.append(t8+t4+ "in:%s out:%s optional:%s type:%s" % (p.isIn, p.isOut, p.isOptional, p.vt_type))
|
||||
out.append('')
|
||||
|
||||
def ProcessPropX(p, out):
|
||||
out.append(GernerateAXModule.trimPropName(p.name))
|
||||
out.append(t4+ "type:%s arg:%s canGet:%s canSet:%s" % (p.type.vt_type, p.arg.vt_type, p.canGet, p.canSet))
|
||||
out.append('')
|
||||
|
||||
out = []
|
||||
|
||||
out.append("PROPERTIES")
|
||||
out.append("-"*20)
|
||||
for p in ax.GetAXProperties():
|
||||
ProcessPropX(p, out)
|
||||
out.append('\n\n')
|
||||
|
||||
out.append("METHODS")
|
||||
out.append("-"*20)
|
||||
for m in ax.GetAXMethods():
|
||||
ProcessFuncX(m, out, GernerateAXModule.trimMethodName(m.name))
|
||||
out.append('\n\n')
|
||||
|
||||
out.append("EVENTS")
|
||||
out.append("-"*20)
|
||||
for e in ax.GetAXEvents():
|
||||
ProcessFuncX(e, out, GernerateAXModule.trimEventName(e.name))
|
||||
out.append('\n\n')
|
||||
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
|
||||
class GernerateAXModule:
|
||||
def __init__(self, ax, className, modulePath, moduleName=None, verbose=False):
|
||||
"""
|
||||
Make a Python module file with a class that has been specialized
|
||||
for the AcitveX object.
|
||||
|
||||
ax An instance of the ActiveXWindow class
|
||||
className The name to use for the new class
|
||||
modulePath The path where the new module should be written to
|
||||
moduleName The name of the .py file to create. If not given
|
||||
then the className will be used.
|
||||
"""
|
||||
import os
|
||||
if moduleName is None:
|
||||
moduleName = className + '.py'
|
||||
filename = os.path.join(modulePath, moduleName)
|
||||
if verbose:
|
||||
print "Creating module in:", filename
|
||||
print " ProgID: ", ax.GetCLSID().GetProgIDString()
|
||||
print " CLSID: ", ax.GetCLSID().GetCLSIDString()
|
||||
print
|
||||
self.mf = file(filename, "w")
|
||||
self.WriteFileHeader(ax)
|
||||
self.WriteEvents(ax)
|
||||
self.WriteClassHeader(ax, className)
|
||||
self.WriteMethods(ax)
|
||||
self.WriteProperties(ax)
|
||||
self.WriteDocs(ax)
|
||||
self.mf.close()
|
||||
del self.mf
|
||||
|
||||
|
||||
def WriteFileHeader(self, ax):
|
||||
self.write("# This module was generated by the wx.activex.GernerateAXModule class\n"
|
||||
"# (See also the genaxmodule script.)\n")
|
||||
self.write("import wx")
|
||||
self.write("import wx.activex\n")
|
||||
self.write("clsID = '%s'\nprogID = '%s'\n"
|
||||
% (ax.GetCLSID().GetCLSIDString(), ax.GetCLSID().GetProgIDString()))
|
||||
self.write("\n")
|
||||
|
||||
|
||||
def WriteEvents(self, ax):
|
||||
events = ax.GetAXEvents()
|
||||
if events:
|
||||
self.write("# Create eventTypes and event binders")
|
||||
for e in events:
|
||||
self.write("wxEVT_%s = wx.activex.RegisterActiveXEvent('%s')"
|
||||
% (self.trimEventName(e.name), e.name))
|
||||
self.write()
|
||||
for e in events:
|
||||
n = self.trimEventName(e.name)
|
||||
self.write("EVT_%s = wx.PyEventBinder(wxEVT_%s, 1)" % (n,n))
|
||||
self.write("\n")
|
||||
|
||||
|
||||
def WriteClassHeader(self, ax, className):
|
||||
self.write("# Derive a new class from ActiveXWindow")
|
||||
self.write("""\
|
||||
class %s(wx.activex.ActiveXWindow):
|
||||
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
|
||||
size=wx.DefaultSize, style=0, name='%s'):
|
||||
wx.activex.ActiveXWindow.__init__(self, parent,
|
||||
wx.activex.CLSID('%s'),
|
||||
ID, pos, size, style, name)
|
||||
""" % (className, className, ax.GetCLSID().GetCLSIDString()) )
|
||||
|
||||
|
||||
def WriteMethods(self, ax):
|
||||
methods = ax.GetAXMethods()
|
||||
if methods:
|
||||
self.write(t4, "# Methods exported by the ActiveX object")
|
||||
for m in methods:
|
||||
name = self.trimMethodName(m.name)
|
||||
self.write(t4, "def %s(self%s):" % (name, self.getParameters(m, True)))
|
||||
self.write(t8, "return self.CallAXMethod('%s'%s)" % (m.name, self.getParameters(m, False)))
|
||||
self.write()
|
||||
|
||||
|
||||
def WriteProperties(self, ax):
|
||||
props = ax.GetAXProperties()
|
||||
if props:
|
||||
self.write(t4, "# Getters, Setters and properties")
|
||||
for p in props:
|
||||
getterName = setterName = "None"
|
||||
if p.canGet:
|
||||
getterName = "_get_" + p.name
|
||||
self.write(t4, "def %s(self):" % getterName)
|
||||
self.write(t8, "return self.GetAXProp('%s')" % p.name)
|
||||
if p.canSet:
|
||||
setterName = "_set_" + p.name
|
||||
self.write(t4, "def %s(self, %s):" % (setterName, p.arg.name))
|
||||
self.write(t8, "self.SetAXProp('%s', %s)" % (p.name, p.arg.name))
|
||||
|
||||
self.write(t4, "%s = property(%s, %s)" %
|
||||
(self.trimPropName(p.name), getterName, setterName))
|
||||
self.write()
|
||||
|
||||
|
||||
def WriteDocs(self, ax):
|
||||
self.write()
|
||||
doc = GetAXInfo(ax)
|
||||
for line in doc.split('\n'):
|
||||
self.write("# ", line)
|
||||
|
||||
|
||||
|
||||
def write(self, *args):
|
||||
for a in args:
|
||||
self.mf.write(a)
|
||||
self.mf.write("\n")
|
||||
|
||||
|
||||
def trimEventName(name):
|
||||
if name.startswith("On"):
|
||||
name = name[2:]
|
||||
return name
|
||||
trimEventName = staticmethod(trimEventName)
|
||||
|
||||
|
||||
def trimPropName(name):
|
||||
#name = name[0].lower() + name[1:]
|
||||
name = name.lower()
|
||||
import keyword
|
||||
if name in keyword.kwlist: name += '_'
|
||||
return name
|
||||
trimPropName = staticmethod(trimPropName)
|
||||
|
||||
|
||||
def trimMethodName(name):
|
||||
import keyword
|
||||
if name in keyword.kwlist: name += '_'
|
||||
return name
|
||||
trimMethodName = staticmethod(trimMethodName)
|
||||
|
||||
|
||||
def getParameters(self, m, withDefaults):
|
||||
import keyword
|
||||
st = ""
|
||||
# collect the input parameters, if both isIn and isOut are
|
||||
# False then assume it is an input paramater
|
||||
params = []
|
||||
for p in m.params:
|
||||
if p.isIn or (not p.isIn and not p.isOut):
|
||||
params.append(p)
|
||||
# did we get any?
|
||||
for p in params:
|
||||
name = p.name
|
||||
if name in keyword.kwlist: name += '_'
|
||||
st += ", "
|
||||
st += name
|
||||
if withDefaults and p.isOptional:
|
||||
st += '=None'
|
||||
return st
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
16
wxPython/contrib/activex/_activex_rename.i
Normal file
16
wxPython/contrib/activex/_activex_rename.i
Normal file
@@ -0,0 +1,16 @@
|
||||
// A bunch of %rename directives generated by BuildRenamers in config.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef BUILDING_RENAMERS
|
||||
|
||||
%rename(ParamX) wxParamX;
|
||||
%rename(FuncX) wxFuncX;
|
||||
%rename(PropX) wxPropX;
|
||||
%rename(ParamXArray) wxParamXArray;
|
||||
%rename(FuncXArray) wxFuncXArray;
|
||||
%rename(PropXArray) wxPropXArray;
|
||||
%rename(ActiveXWindow) wxActiveXWindow;
|
||||
%rename(ActiveXEvent) wxActiveXEvent;
|
||||
%rename(IEHtmlWindowBase) wxIEHtmlWindowBase;
|
||||
|
||||
#endif
|
2
wxPython/contrib/activex/_activex_reverse.txt
Normal file
2
wxPython/contrib/activex/_activex_reverse.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
EVT*
|
1164
wxPython/contrib/activex/activex.i
Normal file
1164
wxPython/contrib/activex/activex.i
Normal file
File diff suppressed because it is too large
Load Diff
669
wxPython/contrib/activex/activex.py
Normal file
669
wxPython/contrib/activex/activex.py
Normal file
@@ -0,0 +1,669 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
import _activex
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class CLSID(object):
|
||||
"""
|
||||
This class wraps the Windows CLSID structure and is used to
|
||||
specify the class of the ActiveX object that is to be created. A
|
||||
CLSID can be constructed from either a ProgID string, (such as
|
||||
'WordPad.Document.1') or a classID string, (such as
|
||||
'{CA8A9783-280D-11CF-A24D-444553540000}').
|
||||
"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ CLSID instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, String id) -> CLSID
|
||||
|
||||
This class wraps the Windows CLSID structure and is used to
|
||||
specify the class of the ActiveX object that is to be created. A
|
||||
CLSID can be constructed from either a ProgID string, (such as
|
||||
'WordPad.Document.1') or a classID string, (such as
|
||||
'{CA8A9783-280D-11CF-A24D-444553540000}').
|
||||
"""
|
||||
newobj = _activex.new_CLSID(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_activex.delete_CLSID):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetCLSIDString(*args, **kwargs):
|
||||
"""GetCLSIDString(self) -> String"""
|
||||
return _activex.CLSID_GetCLSIDString(*args, **kwargs)
|
||||
|
||||
def GetProgIDString(*args, **kwargs):
|
||||
"""GetProgIDString(self) -> String"""
|
||||
return _activex.CLSID_GetProgIDString(*args, **kwargs)
|
||||
|
||||
def __str__(self): return self.GetCLSIDString()
|
||||
|
||||
class CLSIDPtr(CLSID):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = CLSID
|
||||
_activex.CLSID_swigregister(CLSIDPtr)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ParamX(object):
|
||||
"""Proxy of C++ ParamX class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxParamX instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
flags = property(_activex.ParamX_flags_get)
|
||||
isPtr = property(_activex.ParamX_isPtr_get)
|
||||
isSafeArray = property(_activex.ParamX_isSafeArray_get)
|
||||
isOptional = property(_activex.ParamX_isOptional_get)
|
||||
vt = property(_activex.ParamX_vt_get)
|
||||
name = property(_activex.ParamX_name_get)
|
||||
vt_type = property(_activex.ParamX_vt_type_get)
|
||||
|
||||
isIn = property(_activex.ParamX_IsIn)
|
||||
|
||||
isOut = property(_activex.ParamX_IsOut)
|
||||
|
||||
isRetVal = property(_activex.ParamX_IsRetVal)
|
||||
|
||||
|
||||
class ParamXPtr(ParamX):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = ParamX
|
||||
_activex.ParamX_swigregister(ParamXPtr)
|
||||
|
||||
class FuncX(object):
|
||||
"""Proxy of C++ FuncX class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxFuncX instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
name = property(_activex.FuncX_name_get)
|
||||
memid = property(_activex.FuncX_memid_get)
|
||||
hasOut = property(_activex.FuncX_hasOut_get)
|
||||
retType = property(_activex.FuncX_retType_get)
|
||||
params = property(_activex.FuncX_params_get)
|
||||
|
||||
class FuncXPtr(FuncX):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = FuncX
|
||||
_activex.FuncX_swigregister(FuncXPtr)
|
||||
|
||||
class PropX(object):
|
||||
"""Proxy of C++ PropX class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxPropX instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
name = property(_activex.PropX_name_get)
|
||||
memid = property(_activex.PropX_memid_get)
|
||||
type = property(_activex.PropX_type_get)
|
||||
arg = property(_activex.PropX_arg_get)
|
||||
putByRef = property(_activex.PropX_putByRef_get)
|
||||
canGet = property(_activex.PropX_CanGet)
|
||||
|
||||
canSet = property(_activex.PropX_CanSet)
|
||||
|
||||
|
||||
class PropXPtr(PropX):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = PropX
|
||||
_activex.PropX_swigregister(PropXPtr)
|
||||
|
||||
class ParamXArray(object):
|
||||
"""Proxy of C++ ParamXArray class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxParamXArray instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __nonzero__(*args, **kwargs):
|
||||
"""__nonzero__(self) -> bool"""
|
||||
return _activex.ParamXArray___nonzero__(*args, **kwargs)
|
||||
|
||||
def __len__(*args, **kwargs):
|
||||
"""__len__(self) -> int"""
|
||||
return _activex.ParamXArray___len__(*args, **kwargs)
|
||||
|
||||
def __getitem__(*args, **kwargs):
|
||||
"""__getitem__(self, int idx) -> ParamX"""
|
||||
return _activex.ParamXArray___getitem__(*args, **kwargs)
|
||||
|
||||
|
||||
class ParamXArrayPtr(ParamXArray):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = ParamXArray
|
||||
_activex.ParamXArray_swigregister(ParamXArrayPtr)
|
||||
|
||||
class FuncXArray(object):
|
||||
"""Proxy of C++ FuncXArray class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxFuncXArray instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __nonzero__(*args, **kwargs):
|
||||
"""__nonzero__(self) -> bool"""
|
||||
return _activex.FuncXArray___nonzero__(*args, **kwargs)
|
||||
|
||||
def __len__(*args, **kwargs):
|
||||
"""__len__(self) -> int"""
|
||||
return _activex.FuncXArray___len__(*args, **kwargs)
|
||||
|
||||
def __getitem__(*args, **kwargs):
|
||||
"""__getitem__(self, int idx) -> FuncX"""
|
||||
return _activex.FuncXArray___getitem__(*args, **kwargs)
|
||||
|
||||
|
||||
class FuncXArrayPtr(FuncXArray):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = FuncXArray
|
||||
_activex.FuncXArray_swigregister(FuncXArrayPtr)
|
||||
|
||||
class PropXArray(object):
|
||||
"""Proxy of C++ PropXArray class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxPropXArray instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __nonzero__(*args, **kwargs):
|
||||
"""__nonzero__(self) -> bool"""
|
||||
return _activex.PropXArray___nonzero__(*args, **kwargs)
|
||||
|
||||
def __len__(*args, **kwargs):
|
||||
"""__len__(self) -> int"""
|
||||
return _activex.PropXArray___len__(*args, **kwargs)
|
||||
|
||||
def __getitem__(*args, **kwargs):
|
||||
"""__getitem__(self, int idx) -> PropX"""
|
||||
return _activex.PropXArray___getitem__(*args, **kwargs)
|
||||
|
||||
|
||||
class PropXArrayPtr(PropXArray):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = PropXArray
|
||||
_activex.PropXArray_swigregister(PropXArrayPtr)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ActiveXWindow(_core.Window):
|
||||
"""
|
||||
ActiveXWindow derives from wxWindow and the constructor accepts a
|
||||
CLSID for the ActiveX Control that should be created. The
|
||||
ActiveXWindow class simply adds methods that allow you to query
|
||||
some of the TypeInfo exposed by the ActiveX object, and also to
|
||||
get/set properties or call methods by name. The Python
|
||||
implementation automatically handles converting parameters and
|
||||
return values to/from the types expected by the ActiveX code as
|
||||
specified by the TypeInfo.
|
||||
|
||||
"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxActiveXWindow instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, CLSID clsId, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize, long style=0,
|
||||
String name=PanelNameStr) -> ActiveXWindow
|
||||
|
||||
Creates an ActiveX control from the clsID given and makes it act
|
||||
as much like a regular wx.Window as possible.
|
||||
"""
|
||||
newobj = _activex.new_ActiveXWindow(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def GetCLSID(*args, **kwargs):
|
||||
"""
|
||||
GetCLSID(self) -> CLSID
|
||||
|
||||
Return the CLSID used to construct this ActiveX window
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetCLSID(*args, **kwargs)
|
||||
|
||||
def GetAXEventCount(*args, **kwargs):
|
||||
"""
|
||||
GetAXEventCount(self) -> int
|
||||
|
||||
Number of events defined for this control
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXEventCount(*args, **kwargs)
|
||||
|
||||
def GetAXEventDesc(*args, **kwargs):
|
||||
"""
|
||||
GetAXEventDesc(self, int idx) -> FuncX
|
||||
|
||||
Returns event description by index
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXEventDesc(*args, **kwargs)
|
||||
|
||||
def GetAXPropCount(*args, **kwargs):
|
||||
"""
|
||||
GetAXPropCount(self) -> int
|
||||
|
||||
Number of properties defined for this control
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXPropCount(*args, **kwargs)
|
||||
|
||||
def GetAXPropDesc(*args):
|
||||
"""
|
||||
GetAXPropDesc(self, int idx) -> PropX
|
||||
GetAXPropDesc(self, String name) -> PropX
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXPropDesc(*args)
|
||||
|
||||
def GetAXMethodCount(*args, **kwargs):
|
||||
"""
|
||||
GetAXMethodCount(self) -> int
|
||||
|
||||
Number of methods defined for this control
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXMethodCount(*args, **kwargs)
|
||||
|
||||
def GetAXMethodDesc(*args):
|
||||
"""
|
||||
GetAXMethodDesc(self, int idx) -> FuncX
|
||||
GetAXMethodDesc(self, String name) -> FuncX
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXMethodDesc(*args)
|
||||
|
||||
def GetAXEvents(*args, **kwargs):
|
||||
"""
|
||||
GetAXEvents(self) -> FuncXArray
|
||||
|
||||
Returns a sequence of FuncX objects describing the events
|
||||
available for this ActiveX object.
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXEvents(*args, **kwargs)
|
||||
|
||||
def GetAXMethods(*args, **kwargs):
|
||||
"""
|
||||
GetAXMethods(self) -> FuncXArray
|
||||
|
||||
Returns a sequence of FuncX objects describing the methods
|
||||
available for this ActiveX object.
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXMethods(*args, **kwargs)
|
||||
|
||||
def GetAXProperties(*args, **kwargs):
|
||||
"""
|
||||
GetAXProperties(self) -> PropXArray
|
||||
|
||||
Returns a sequence of PropX objects describing the properties
|
||||
available for this ActiveX object.
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXProperties(*args, **kwargs)
|
||||
|
||||
def SetAXProp(*args, **kwargs):
|
||||
"""
|
||||
SetAXProp(self, String name, PyObject value)
|
||||
|
||||
Set a property of the ActiveX object by name.
|
||||
"""
|
||||
return _activex.ActiveXWindow_SetAXProp(*args, **kwargs)
|
||||
|
||||
def GetAXProp(*args, **kwargs):
|
||||
"""
|
||||
GetAXProp(self, String name) -> PyObject
|
||||
|
||||
Get the value of an ActiveX property by name.
|
||||
"""
|
||||
return _activex.ActiveXWindow_GetAXProp(*args, **kwargs)
|
||||
|
||||
def _CallAXMethod(*args):
|
||||
"""
|
||||
_CallAXMethod(self, String name, PyObject args) -> PyObject
|
||||
|
||||
The implementation for CallMethod. Calls an ActiveX method, by
|
||||
name passing the parameters given in args.
|
||||
"""
|
||||
return _activex.ActiveXWindow__CallAXMethod(*args)
|
||||
|
||||
def CallAXMethod(self, name, *args):
|
||||
"""
|
||||
Front-end for _CallMethod. Simply passes all positional args
|
||||
after the name as a single tuple to _CallMethod.
|
||||
"""
|
||||
return self._CallAXMethod(name, args)
|
||||
|
||||
|
||||
class ActiveXWindowPtr(ActiveXWindow):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = ActiveXWindow
|
||||
_activex.ActiveXWindow_swigregister(ActiveXWindowPtr)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def RegisterActiveXEvent(*args, **kwargs):
|
||||
"""
|
||||
RegisterActiveXEvent(String eventName) -> wxEventType
|
||||
|
||||
Creates a standard wx event ID for the given eventName.
|
||||
"""
|
||||
return _activex.RegisterActiveXEvent(*args, **kwargs)
|
||||
class ActiveXEvent(_core.CommandEvent):
|
||||
"""
|
||||
An instance of ActiveXEvent is sent to the handler for all bound
|
||||
ActiveX events. Any event parameters from the ActiveX cntrol are
|
||||
turned into attributes of the Python proxy for this event object.
|
||||
Additionally, there is a property called eventName that will
|
||||
return (surprisingly <wink>) the name of the ActiveX event.
|
||||
"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxActiveXEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
eventName = property(_activex.ActiveXEvent_EventName)
|
||||
|
||||
def _preCallInit(*args, **kwargs):
|
||||
"""_preCallInit(self, PyObject pyself)"""
|
||||
return _activex.ActiveXEvent__preCallInit(*args, **kwargs)
|
||||
|
||||
def _postCallCleanup(*args, **kwargs):
|
||||
"""_postCallCleanup(self, PyObject pyself)"""
|
||||
return _activex.ActiveXEvent__postCallCleanup(*args, **kwargs)
|
||||
|
||||
|
||||
class ActiveXEventPtr(ActiveXEvent):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = ActiveXEvent
|
||||
_activex.ActiveXEvent_swigregister(ActiveXEventPtr)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class IEHtmlWindowBase(ActiveXWindow):
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxIEHtmlWindowBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
newobj = _activex.new_IEHtmlWindowBase(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def SetCharset(*args, **kwargs): return _activex.IEHtmlWindowBase_SetCharset(*args, **kwargs)
|
||||
def LoadString(*args, **kwargs): return _activex.IEHtmlWindowBase_LoadString(*args, **kwargs)
|
||||
def LoadStream(*args, **kwargs): return _activex.IEHtmlWindowBase_LoadStream(*args, **kwargs)
|
||||
def GetStringSelection(*args, **kwargs): return _activex.IEHtmlWindowBase_GetStringSelection(*args, **kwargs)
|
||||
def GetText(*args, **kwargs): return _activex.IEHtmlWindowBase_GetText(*args, **kwargs)
|
||||
|
||||
class IEHtmlWindowBasePtr(IEHtmlWindowBase):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = IEHtmlWindowBase
|
||||
_activex.IEHtmlWindowBase_swigregister(IEHtmlWindowBasePtr)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Some helper and utility functions for ActiveX
|
||||
|
||||
|
||||
t4 = " " * 4
|
||||
t8 = " " * 8
|
||||
|
||||
def GetAXInfo(ax):
|
||||
"""
|
||||
Returns a printable summary of the TypeInfo from the ActiveX instance
|
||||
passed in.
|
||||
"""
|
||||
|
||||
def ProcessFuncX(f, out, name):
|
||||
out.append(name)
|
||||
out.append(t4 + "retType: %s" % f.retType.vt_type)
|
||||
if f.params:
|
||||
out.append(t4 + "params:")
|
||||
for p in f.params:
|
||||
out.append(t8 + p.name)
|
||||
out.append(t8+t4+ "in:%s out:%s optional:%s type:%s" % (p.isIn, p.isOut, p.isOptional, p.vt_type))
|
||||
out.append('')
|
||||
|
||||
def ProcessPropX(p, out):
|
||||
out.append(GernerateAXModule.trimPropName(p.name))
|
||||
out.append(t4+ "type:%s arg:%s canGet:%s canSet:%s" % (p.type.vt_type, p.arg.vt_type, p.canGet, p.canSet))
|
||||
out.append('')
|
||||
|
||||
out = []
|
||||
|
||||
out.append("PROPERTIES")
|
||||
out.append("-"*20)
|
||||
for p in ax.GetAXProperties():
|
||||
ProcessPropX(p, out)
|
||||
out.append('\n\n')
|
||||
|
||||
out.append("METHODS")
|
||||
out.append("-"*20)
|
||||
for m in ax.GetAXMethods():
|
||||
ProcessFuncX(m, out, GernerateAXModule.trimMethodName(m.name))
|
||||
out.append('\n\n')
|
||||
|
||||
out.append("EVENTS")
|
||||
out.append("-"*20)
|
||||
for e in ax.GetAXEvents():
|
||||
ProcessFuncX(e, out, GernerateAXModule.trimEventName(e.name))
|
||||
out.append('\n\n')
|
||||
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
|
||||
class GernerateAXModule:
|
||||
def __init__(self, ax, className, modulePath, moduleName=None, verbose=False):
|
||||
"""
|
||||
Make a Python module file with a class that has been specialized
|
||||
for the AcitveX object.
|
||||
|
||||
ax An instance of the ActiveXWindow class
|
||||
className The name to use for the new class
|
||||
modulePath The path where the new module should be written to
|
||||
moduleName The name of the .py file to create. If not given
|
||||
then the className will be used.
|
||||
"""
|
||||
import os
|
||||
if moduleName is None:
|
||||
moduleName = className + '.py'
|
||||
filename = os.path.join(modulePath, moduleName)
|
||||
if verbose:
|
||||
print "Creating module in:", filename
|
||||
print " ProgID: ", ax.GetCLSID().GetProgIDString()
|
||||
print " CLSID: ", ax.GetCLSID().GetCLSIDString()
|
||||
print
|
||||
self.mf = file(filename, "w")
|
||||
self.WriteFileHeader(ax)
|
||||
self.WriteEvents(ax)
|
||||
self.WriteClassHeader(ax, className)
|
||||
self.WriteMethods(ax)
|
||||
self.WriteProperties(ax)
|
||||
self.WriteDocs(ax)
|
||||
self.mf.close()
|
||||
del self.mf
|
||||
|
||||
|
||||
def WriteFileHeader(self, ax):
|
||||
self.write("# This module was generated by the wx.activex.GernerateAXModule class\n"
|
||||
"# (See also the genaxmodule script.)\n")
|
||||
self.write("import wx")
|
||||
self.write("import wx.activex\n")
|
||||
self.write("clsID = '%s'\nprogID = '%s'\n"
|
||||
% (ax.GetCLSID().GetCLSIDString(), ax.GetCLSID().GetProgIDString()))
|
||||
self.write("\n")
|
||||
|
||||
|
||||
def WriteEvents(self, ax):
|
||||
events = ax.GetAXEvents()
|
||||
if events:
|
||||
self.write("# Create eventTypes and event binders")
|
||||
for e in events:
|
||||
self.write("wxEVT_%s = wx.activex.RegisterActiveXEvent('%s')"
|
||||
% (self.trimEventName(e.name), e.name))
|
||||
self.write()
|
||||
for e in events:
|
||||
n = self.trimEventName(e.name)
|
||||
self.write("EVT_%s = wx.PyEventBinder(wxEVT_%s, 1)" % (n,n))
|
||||
self.write("\n")
|
||||
|
||||
|
||||
def WriteClassHeader(self, ax, className):
|
||||
self.write("# Derive a new class from ActiveXWindow")
|
||||
self.write("""\
|
||||
class %s(wx.activex.ActiveXWindow):
|
||||
def __init__(self, parent, ID=-1, pos=wx.DefaultPosition,
|
||||
size=wx.DefaultSize, style=0, name='%s'):
|
||||
wx.activex.ActiveXWindow.__init__(self, parent,
|
||||
wx.activex.CLSID('%s'),
|
||||
ID, pos, size, style, name)
|
||||
""" % (className, className, ax.GetCLSID().GetCLSIDString()) )
|
||||
|
||||
|
||||
def WriteMethods(self, ax):
|
||||
methods = ax.GetAXMethods()
|
||||
if methods:
|
||||
self.write(t4, "# Methods exported by the ActiveX object")
|
||||
for m in methods:
|
||||
name = self.trimMethodName(m.name)
|
||||
self.write(t4, "def %s(self%s):" % (name, self.getParameters(m, True)))
|
||||
self.write(t8, "return self.CallAXMethod('%s'%s)" % (m.name, self.getParameters(m, False)))
|
||||
self.write()
|
||||
|
||||
|
||||
def WriteProperties(self, ax):
|
||||
props = ax.GetAXProperties()
|
||||
if props:
|
||||
self.write(t4, "# Getters, Setters and properties")
|
||||
for p in props:
|
||||
getterName = setterName = "None"
|
||||
if p.canGet:
|
||||
getterName = "_get_" + p.name
|
||||
self.write(t4, "def %s(self):" % getterName)
|
||||
self.write(t8, "return self.GetAXProp('%s')" % p.name)
|
||||
if p.canSet:
|
||||
setterName = "_set_" + p.name
|
||||
self.write(t4, "def %s(self, %s):" % (setterName, p.arg.name))
|
||||
self.write(t8, "self.SetAXProp('%s', %s)" % (p.name, p.arg.name))
|
||||
|
||||
self.write(t4, "%s = property(%s, %s)" %
|
||||
(self.trimPropName(p.name), getterName, setterName))
|
||||
self.write()
|
||||
|
||||
|
||||
def WriteDocs(self, ax):
|
||||
self.write()
|
||||
doc = GetAXInfo(ax)
|
||||
for line in doc.split('\n'):
|
||||
self.write("# ", line)
|
||||
|
||||
|
||||
|
||||
def write(self, *args):
|
||||
for a in args:
|
||||
self.mf.write(a)
|
||||
self.mf.write("\n")
|
||||
|
||||
|
||||
def trimEventName(name):
|
||||
if name.startswith("On"):
|
||||
name = name[2:]
|
||||
return name
|
||||
trimEventName = staticmethod(trimEventName)
|
||||
|
||||
|
||||
def trimPropName(name):
|
||||
#name = name[0].lower() + name[1:]
|
||||
name = name.lower()
|
||||
import keyword
|
||||
if name in keyword.kwlist: name += '_'
|
||||
return name
|
||||
trimPropName = staticmethod(trimPropName)
|
||||
|
||||
|
||||
def trimMethodName(name):
|
||||
import keyword
|
||||
if name in keyword.kwlist: name += '_'
|
||||
return name
|
||||
trimMethodName = staticmethod(trimMethodName)
|
||||
|
||||
|
||||
def getParameters(self, m, withDefaults):
|
||||
import keyword
|
||||
st = ""
|
||||
# collect the input parameters, if both isIn and isOut are
|
||||
# False then assume it is an input paramater
|
||||
params = []
|
||||
for p in m.params:
|
||||
if p.isIn or (not p.isIn and not p.isOut):
|
||||
params.append(p)
|
||||
# did we get any?
|
||||
for p in params:
|
||||
name = p.name
|
||||
if name in keyword.kwlist: name += '_'
|
||||
st += ", "
|
||||
st += name
|
||||
if withDefaults and p.isOptional:
|
||||
st += '=None'
|
||||
return st
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
|
5405
wxPython/contrib/activex/activex_wrap.cpp
Normal file
5405
wxPython/contrib/activex/activex_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
133
wxPython/contrib/activex/wxie/IEHtmlStream.h
Normal file
133
wxPython/contrib/activex/wxie/IEHtmlStream.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
// This module contains the declarations of the stream adapters and such that
|
||||
// used to be in IEHtmlWin.cpp, so that they can be used independently in the
|
||||
// wxPython wrappers...
|
||||
|
||||
|
||||
#ifndef _IEHTMLSTREAM_H_
|
||||
#define _IEHTMLSTREAM_H_
|
||||
|
||||
|
||||
class IStreamAdaptorBase : public IStream
|
||||
{
|
||||
private:
|
||||
DECLARE_OLE_UNKNOWN(IStreamAdaptorBase);
|
||||
|
||||
public:
|
||||
string prepend;
|
||||
|
||||
IStreamAdaptorBase() {}
|
||||
virtual ~IStreamAdaptorBase() {}
|
||||
|
||||
virtual int Read(char *buf, int cb) = 0;
|
||||
|
||||
// ISequentialStream
|
||||
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten) {return E_NOTIMPL;}
|
||||
|
||||
// IStream
|
||||
HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Revert(void) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Clone(IStream __RPC_FAR *__RPC_FAR *ppstm) {return E_NOTIMPL;}
|
||||
};
|
||||
|
||||
|
||||
|
||||
class IStreamAdaptor : public IStreamAdaptorBase
|
||||
{
|
||||
private:
|
||||
istream *m_is;
|
||||
|
||||
public:
|
||||
IStreamAdaptor(istream *is);
|
||||
~IStreamAdaptor();
|
||||
int Read(char *buf, int cb);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class IwxStreamAdaptor : public IStreamAdaptorBase
|
||||
{
|
||||
private:
|
||||
wxInputStream *m_is;
|
||||
|
||||
public:
|
||||
IwxStreamAdaptor(wxInputStream *is);
|
||||
~IwxStreamAdaptor();
|
||||
int Read(char *buf, int cb);
|
||||
};
|
||||
|
||||
|
||||
class wxOwnedMemInputStream : public wxMemoryInputStream
|
||||
{
|
||||
public:
|
||||
char *m_data;
|
||||
|
||||
wxOwnedMemInputStream(char *data, size_t len);
|
||||
~wxOwnedMemInputStream();
|
||||
};
|
||||
|
||||
|
||||
wxAutoOleInterface<IHTMLTxtRange> wxieGetSelRange(IOleObject *oleObject);
|
||||
|
||||
#endif
|
478
wxPython/contrib/activex/wxie/IEHtmlWin.cpp
Normal file
478
wxPython/contrib/activex/wxie/IEHtmlWin.cpp
Normal file
@@ -0,0 +1,478 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
#include "IEHtmlWin.h"
|
||||
#include <wx/strconv.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <oleidl.h>
|
||||
#include <winerror.h>
|
||||
#include <exdispid.h>
|
||||
#include <exdisp.h>
|
||||
#include <olectl.h>
|
||||
#include <Mshtml.h>
|
||||
#include <sstream>
|
||||
#include <IEHtmlStream.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Stream adapters and such
|
||||
|
||||
HRESULT STDMETHODCALLTYPE IStreamAdaptorBase::Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead)
|
||||
{
|
||||
if (prepend.size() > 0)
|
||||
{
|
||||
int n = wxMin(prepend.size(), cb);
|
||||
prepend.copy((char *) pv, n);
|
||||
prepend = prepend.substr(n);
|
||||
if (pcbRead)
|
||||
*pcbRead = n;
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
int rc = Read((char *) pv, cb);
|
||||
if (pcbRead)
|
||||
*pcbRead = rc;
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
DEFINE_OLE_TABLE(IStreamAdaptorBase)
|
||||
OLE_IINTERFACE(IUnknown)
|
||||
OLE_IINTERFACE(ISequentialStream)
|
||||
OLE_IINTERFACE(IStream)
|
||||
END_OLE_TABLE;
|
||||
|
||||
|
||||
IStreamAdaptor::IStreamAdaptor(istream *is)
|
||||
: IStreamAdaptorBase(), m_is(is)
|
||||
{
|
||||
wxASSERT(m_is != NULL);
|
||||
}
|
||||
|
||||
IStreamAdaptor::~IStreamAdaptor()
|
||||
{
|
||||
delete m_is;
|
||||
}
|
||||
|
||||
int IStreamAdaptor::Read(char *buf, int cb)
|
||||
{
|
||||
m_is->read(buf, cb);
|
||||
return m_is->gcount();
|
||||
}
|
||||
|
||||
|
||||
IwxStreamAdaptor::IwxStreamAdaptor(wxInputStream *is)
|
||||
: IStreamAdaptorBase(), m_is(is)
|
||||
{
|
||||
wxASSERT(m_is != NULL);
|
||||
}
|
||||
IwxStreamAdaptor::~IwxStreamAdaptor()
|
||||
{
|
||||
delete m_is;
|
||||
}
|
||||
|
||||
// ISequentialStream
|
||||
int IwxStreamAdaptor::Read(char *buf, int cb)
|
||||
{
|
||||
m_is->Read(buf, cb);
|
||||
return m_is->LastRead();
|
||||
};
|
||||
|
||||
wxOwnedMemInputStream::wxOwnedMemInputStream(char *data, size_t len)
|
||||
: wxMemoryInputStream(data, len), m_data(data)
|
||||
{}
|
||||
|
||||
wxOwnedMemInputStream::~wxOwnedMemInputStream()
|
||||
{
|
||||
free(m_data);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
BEGIN_EVENT_TABLE(wxIEHtmlWin, wxActiveX)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
static const CLSID CLSID_MozillaBrowser =
|
||||
{ 0x1339B54C, 0x3453, 0x11D2,
|
||||
{ 0x93, 0xB9, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00 } };
|
||||
|
||||
|
||||
//#define PROGID "Shell.Explorer"
|
||||
#define PROGID CLSID_WebBrowser
|
||||
//#define PROGID CLSID_MozillaBrowser
|
||||
//#define PROGID CLSID_HTMLDocument
|
||||
//#define PROGID "MSCAL.Calendar"
|
||||
//#define PROGID ""
|
||||
//#define PROGID "SoftwareFX.ChartFX.20"
|
||||
|
||||
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name) :
|
||||
wxActiveX(parent, PROGID, id, pos, size, style, name)
|
||||
{
|
||||
SetupBrowser();
|
||||
}
|
||||
|
||||
|
||||
wxIEHtmlWin::~wxIEHtmlWin()
|
||||
{
|
||||
}
|
||||
|
||||
void wxIEHtmlWin::SetupBrowser()
|
||||
{
|
||||
HRESULT hret;
|
||||
|
||||
// Get IWebBrowser2 Interface
|
||||
hret = m_webBrowser.QueryInterface(IID_IWebBrowser2, m_ActiveX);
|
||||
assert(SUCCEEDED(hret));
|
||||
|
||||
// web browser setup
|
||||
m_webBrowser->put_MenuBar(VARIANT_FALSE);
|
||||
m_webBrowser->put_AddressBar(VARIANT_FALSE);
|
||||
m_webBrowser->put_StatusBar(VARIANT_FALSE);
|
||||
m_webBrowser->put_ToolBar(VARIANT_FALSE);
|
||||
|
||||
m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
|
||||
m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
|
||||
|
||||
m_webBrowser->Navigate( L"about:blank", NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
|
||||
void wxIEHtmlWin::SetEditMode(bool seton)
|
||||
{
|
||||
m_bAmbientUserMode = ! seton;
|
||||
AmbientPropertyChanged(DISPID_AMBIENT_USERMODE);
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::GetEditMode()
|
||||
{
|
||||
return ! m_bAmbientUserMode;
|
||||
};
|
||||
|
||||
|
||||
void wxIEHtmlWin::SetCharset(const wxString& charset)
|
||||
{
|
||||
// HTML Document ?
|
||||
IDispatch *pDisp = NULL;
|
||||
HRESULT hret = m_webBrowser->get_Document(&pDisp);
|
||||
wxAutoOleInterface<IDispatch> disp(pDisp);
|
||||
|
||||
if (disp.Ok())
|
||||
{
|
||||
wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
|
||||
if (doc.Ok())
|
||||
doc->put_charset((BSTR) (const wchar_t *) charset.wc_str(wxConvUTF8));
|
||||
//doc->put_charset((BSTR) wxConvUTF8.cMB2WC(charset).data());
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
void wxIEHtmlWin::LoadUrl(const wxString& url)
|
||||
{
|
||||
VARIANTARG navFlag, targetFrame, postData, headers;
|
||||
navFlag.vt = VT_EMPTY;
|
||||
navFlag.vt = VT_I2;
|
||||
navFlag.iVal = navNoReadFromCache;
|
||||
targetFrame.vt = VT_EMPTY;
|
||||
postData.vt = VT_EMPTY;
|
||||
headers.vt = VT_EMPTY;
|
||||
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->Navigate((BSTR) (const wchar_t *) url.wc_str(wxConvUTF8),
|
||||
&navFlag, &targetFrame, &postData, &headers);
|
||||
};
|
||||
|
||||
|
||||
bool wxIEHtmlWin::LoadString(const wxString& html)
|
||||
{
|
||||
char *data = NULL;
|
||||
size_t len = html.length();
|
||||
#ifdef UNICODE
|
||||
len *= 2;
|
||||
#endif
|
||||
data = (char *) malloc(len);
|
||||
memcpy(data, html.c_str(), len);
|
||||
return LoadStream(new wxOwnedMemInputStream(data, len));
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(IStreamAdaptorBase *pstrm)
|
||||
{
|
||||
// need to prepend this as poxy MSHTML will not recognise a HTML comment
|
||||
// as starting a html document and treats it as plain text
|
||||
// Does nayone know how to force it to html mode ?
|
||||
pstrm->prepend = "<html>";
|
||||
|
||||
// strip leading whitespace as it can confuse MSHTML
|
||||
wxAutoOleInterface<IStream> strm(pstrm);
|
||||
|
||||
// Document Interface
|
||||
IDispatch *pDisp = NULL;
|
||||
HRESULT hret = m_webBrowser->get_Document(&pDisp);
|
||||
if (! pDisp)
|
||||
return false;
|
||||
wxAutoOleInterface<IDispatch> disp(pDisp);
|
||||
|
||||
|
||||
// get IPersistStreamInit
|
||||
wxAutoOleInterface<IPersistStreamInit>
|
||||
pPersistStreamInit(IID_IPersistStreamInit, disp);
|
||||
|
||||
if (pPersistStreamInit.Ok())
|
||||
{
|
||||
HRESULT hr = pPersistStreamInit->InitNew();
|
||||
if (SUCCEEDED(hr))
|
||||
hr = pPersistStreamInit->Load(strm);
|
||||
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(istream *is)
|
||||
{
|
||||
// wrap reference around stream
|
||||
IStreamAdaptor *pstrm = new IStreamAdaptor(is);
|
||||
pstrm->AddRef();
|
||||
|
||||
return LoadStream(pstrm);
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(wxInputStream *is)
|
||||
{
|
||||
// wrap reference around stream
|
||||
IwxStreamAdaptor *pstrm = new IwxStreamAdaptor(is);
|
||||
pstrm->AddRef();
|
||||
|
||||
return LoadStream(pstrm);
|
||||
};
|
||||
|
||||
|
||||
bool wxIEHtmlWin::GoBack()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoBack();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::GoForward()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoForward();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::GoHome()
|
||||
{
|
||||
try
|
||||
{
|
||||
CallMethod(_T("GoHome"));
|
||||
return true;
|
||||
}
|
||||
catch(exception&)
|
||||
{
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::GoSearch()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoSearch();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::Refresh(wxIEHtmlRefreshLevel level)
|
||||
{
|
||||
VARIANTARG levelArg;
|
||||
HRESULT hret = 0;
|
||||
|
||||
levelArg.vt = VT_I2;
|
||||
levelArg.iVal = level;
|
||||
hret = m_webBrowser->Refresh2(&levelArg);
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::Stop()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->Stop();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static wxAutoOleInterface<IHTMLSelectionObject> GetSelObject(IOleObject *oleObject)
|
||||
{
|
||||
// Query for IWebBrowser interface
|
||||
wxAutoOleInterface<IWebBrowser2> wb(IID_IWebBrowser2, oleObject);
|
||||
if (! wb.Ok())
|
||||
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||
|
||||
IDispatch *iDisp = NULL;
|
||||
HRESULT hr = wb->get_Document(&iDisp);
|
||||
if (hr != S_OK)
|
||||
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||
|
||||
// Query for Document Interface
|
||||
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
|
||||
iDisp->Release();
|
||||
|
||||
if (! hd.Ok())
|
||||
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||
|
||||
IHTMLSelectionObject *_so = NULL;
|
||||
hr = hd->get_selection(&_so);
|
||||
|
||||
// take ownership of selection object
|
||||
wxAutoOleInterface<IHTMLSelectionObject> so(_so);
|
||||
|
||||
return so;
|
||||
};
|
||||
|
||||
wxAutoOleInterface<IHTMLTxtRange> wxieGetSelRange(IOleObject *oleObject)
|
||||
{
|
||||
wxAutoOleInterface<IHTMLTxtRange> tr;
|
||||
|
||||
wxAutoOleInterface<IHTMLSelectionObject> so(GetSelObject(oleObject));
|
||||
if (! so)
|
||||
return tr;
|
||||
|
||||
IDispatch *iDisp = NULL;
|
||||
HRESULT hr = so->createRange(&iDisp);
|
||||
if (hr != S_OK)
|
||||
return tr;
|
||||
|
||||
// Query for IHTMLTxtRange interface
|
||||
tr.QueryInterface(IID_IHTMLTxtRange, iDisp);
|
||||
iDisp->Release();
|
||||
return tr;
|
||||
};
|
||||
|
||||
|
||||
wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
|
||||
{
|
||||
wxAutoOleInterface<IHTMLTxtRange> tr(wxieGetSelRange(m_oleObject));
|
||||
if (! tr)
|
||||
return wxEmptyString;
|
||||
|
||||
BSTR text = NULL;
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
if (asHTML)
|
||||
hr = tr->get_htmlText(&text);
|
||||
else
|
||||
hr = tr->get_text(&text);
|
||||
if (hr != S_OK)
|
||||
return wxEmptyString;
|
||||
|
||||
wxString s = text;
|
||||
SysFreeString(text);
|
||||
|
||||
return s;
|
||||
};
|
||||
|
||||
wxString wxIEHtmlWin::GetText(bool asHTML)
|
||||
{
|
||||
if (! m_webBrowser.Ok())
|
||||
return wxEmptyString;
|
||||
|
||||
// get document dispatch interface
|
||||
IDispatch *iDisp = NULL;
|
||||
HRESULT hr = m_webBrowser->get_Document(&iDisp);
|
||||
if (hr != S_OK)
|
||||
return wxEmptyString;
|
||||
|
||||
// Query for Document Interface
|
||||
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
|
||||
iDisp->Release();
|
||||
|
||||
if (! hd.Ok())
|
||||
return wxEmptyString;
|
||||
|
||||
// get body element
|
||||
IHTMLElement *_body = NULL;
|
||||
hd->get_body(&_body);
|
||||
if (! _body)
|
||||
return wxEmptyString;
|
||||
wxAutoOleInterface<IHTMLElement> body(_body);
|
||||
|
||||
// get inner text
|
||||
BSTR text = NULL;
|
||||
hr = E_FAIL;
|
||||
|
||||
if (asHTML)
|
||||
hr = body->get_innerHTML(&text);
|
||||
else
|
||||
hr = body->get_innerText(&text);
|
||||
if (hr != S_OK)
|
||||
return wxEmptyString;
|
||||
|
||||
wxString s = text;
|
||||
SysFreeString(text);
|
||||
|
||||
return s;
|
||||
};
|
120
wxPython/contrib/activex/wxie/IEHtmlWin.h
Normal file
120
wxPython/contrib/activex/wxie/IEHtmlWin.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
/*! \file iehtmlwin.h
|
||||
\brief implements wxIEHtmlWin window class
|
||||
*/
|
||||
#ifndef _IEHTMLWIN_H_
|
||||
#define _IEHTMLWIN_H_
|
||||
#pragma warning( disable : 4101 4786)
|
||||
#pragma warning( disable : 4786)
|
||||
|
||||
|
||||
#include <wx/setup.h>
|
||||
#include <wx/wx.h>
|
||||
#include <exdisp.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include "wxactivex.h"
|
||||
|
||||
|
||||
enum wxIEHtmlRefreshLevel
|
||||
{
|
||||
wxIEHTML_REFRESH_NORMAL = 0,
|
||||
wxIEHTML_REFRESH_IFEXPIRED = 1,
|
||||
wxIEHTML_REFRESH_CONTINUE = 2,
|
||||
wxIEHTML_REFRESH_COMPLETELY = 3
|
||||
};
|
||||
|
||||
class IStreamAdaptorBase;
|
||||
|
||||
class wxIEHtmlWin : public wxActiveX
|
||||
{
|
||||
public:
|
||||
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxIEHtmlWin();
|
||||
|
||||
void LoadUrl(const wxString& url);
|
||||
bool LoadString(const wxString& html);
|
||||
bool LoadStream(istream *strm);
|
||||
bool LoadStream(wxInputStream *is);
|
||||
|
||||
void SetCharset(const wxString& charset);
|
||||
void SetEditMode(bool seton);
|
||||
bool GetEditMode();
|
||||
wxString GetStringSelection(bool asHTML = false);
|
||||
wxString GetText(bool asHTML = false);
|
||||
|
||||
bool GoBack();
|
||||
bool GoForward();
|
||||
bool GoHome();
|
||||
bool GoSearch();
|
||||
bool Refresh(wxIEHtmlRefreshLevel level);
|
||||
bool Stop();
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
protected:
|
||||
void SetupBrowser();
|
||||
bool LoadStream(IStreamAdaptorBase *pstrm);
|
||||
|
||||
wxAutoOleInterface<IWebBrowser2> m_webBrowser;
|
||||
};
|
||||
|
||||
#endif /* _IEHTMLWIN_H_ */
|
6
wxPython/contrib/activex/wxie/README.1st.txt
Normal file
6
wxPython/contrib/activex/wxie/README.1st.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
The contents of this dir are from the 9-Jan-2004 version of wxie.zip
|
||||
downloaded from:
|
||||
|
||||
http://members.optusnet.com.au/~blackpaw1/wxactivex.html
|
||||
|
||||
|
205
wxPython/contrib/activex/wxie/default.doxygen
Normal file
205
wxPython/contrib/activex/wxie/default.doxygen
Normal file
@@ -0,0 +1,205 @@
|
||||
# Doxyfile 1.3-rc2
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# General configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = wxActiveX
|
||||
PROJECT_NUMBER =
|
||||
OUTPUT_DIRECTORY =
|
||||
OUTPUT_LANGUAGE = English
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = NO
|
||||
STRIP_FROM_PATH =
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
SHORT_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
VERBATIM_HEADERS = YES
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = YES
|
||||
INHERIT_DOCS = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
DISTRIBUTE_GROUP_DOC = YES
|
||||
TAB_SIZE = 8
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ALIASES =
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SHOW_USED_FILES = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_FORMAT = "$file($line): $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = .\wxactivex.h .\iehtmlwin.h
|
||||
FILE_PATTERNS = *.cpp \
|
||||
*.c \
|
||||
*.h \
|
||||
*.cxx \
|
||||
*.idl
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = YES
|
||||
COLS_IN_ALPHA_INDEX = 4
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = doxydoc
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = no
|
||||
CHM_FILE = wxactivex.chm
|
||||
HHC_LOCATION = hhc.exe
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = NO
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = YES
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
TEMPLATE_RELATIONS = YES
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
CGI_NAME = search.cgi
|
||||
CGI_URL =
|
||||
DOC_URL =
|
||||
DOC_ABSPATH =
|
||||
BIN_ABSPATH = /usr/local/bin/
|
||||
EXT_DOC_PATHS =
|
53
wxPython/contrib/activex/wxie/license.txt
Normal file
53
wxPython/contrib/activex/wxie/license.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
|
||||
|
24
wxPython/contrib/activex/wxie/makefile
Normal file
24
wxPython/contrib/activex/wxie/makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
CC = gcc
|
||||
|
||||
PROGRAM = wxIE
|
||||
|
||||
CFLAGS = -I/m/snowball/icicle/gswd/devenv/include -D__WXMOTIF__
|
||||
LFLAGS = -L/m/snowball/icicle/devenv/lib
|
||||
|
||||
# implementation
|
||||
|
||||
.SUFFIXES: .o .cpp
|
||||
|
||||
SOURCES:sh= /bin/ls *.cpp
|
||||
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
|
||||
.cpp.o :
|
||||
$(CC) -c $(CFLAGS) `wx-config --cflags` -o $@ $<
|
||||
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(OBJECTS) $(LFLAGS) `wx-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAM)
|
||||
|
24
wxPython/contrib/activex/wxie/makefile.gtk
Normal file
24
wxPython/contrib/activex/wxie/makefile.gtk
Normal file
@@ -0,0 +1,24 @@
|
||||
CC = gcc
|
||||
|
||||
PROGRAM = wxIE
|
||||
|
||||
CFLAGS = -I/m/snowball/icicle/gswd/devenv/include -D__WXGTK__
|
||||
LFLAGS = -L/m/snowball/icicle/devenv/lib
|
||||
|
||||
# implementation
|
||||
|
||||
.SUFFIXES: .o .cpp
|
||||
|
||||
SOURCES:sh= /bin/ls *.cpp
|
||||
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
|
||||
.cpp.o :
|
||||
$(CC) -c $(CFLAGS) `wx-config --cflags` -o $@ $<
|
||||
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(OBJECTS) $(LFLAGS) `wx-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAM)
|
||||
|
24
wxPython/contrib/activex/wxie/makefile.mtf
Normal file
24
wxPython/contrib/activex/wxie/makefile.mtf
Normal file
@@ -0,0 +1,24 @@
|
||||
CC = gcc
|
||||
|
||||
PROGRAM = wxIE
|
||||
|
||||
CFLAGS = -I/m/snowball/icicle/gswd/devenv/include -D__WXMOTIF__
|
||||
LFLAGS = -L/m/snowball/icicle/devenv/lib
|
||||
|
||||
# implementation
|
||||
|
||||
.SUFFIXES: .o .cpp
|
||||
|
||||
SOURCES:sh= /bin/ls *.cpp
|
||||
|
||||
OBJECTS = $(SOURCES:.cpp=.o)
|
||||
|
||||
.cpp.o :
|
||||
$(CC) -c $(CFLAGS) `wx-config --cflags` -o $@ $<
|
||||
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CC) -o $(PROGRAM) $(OBJECTS) $(LFLAGS) `wx-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o $(PROGRAM)
|
||||
|
2
wxPython/contrib/activex/wxie/notes.txt
Normal file
2
wxPython/contrib/activex/wxie/notes.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Flash needs the following GUID for its event interface
|
||||
{D27CDB6D-AE6D-11CF-96B8-444553540000}
|
149
wxPython/contrib/activex/wxie/readme.txt
Normal file
149
wxPython/contrib/activex/wxie/readme.txt
Normal file
@@ -0,0 +1,149 @@
|
||||
Lindsay Mathieson
|
||||
Email : <lmathieson@optusnet.com.au>
|
||||
|
||||
This is prelimanary stuff - the controls need extra methods and events etc,
|
||||
feel free to email with suggestions &/or patches.
|
||||
|
||||
Tested with wxWindows 2.3.2.
|
||||
Built with MS Visual C++ 6.0 & DevStudio
|
||||
Minor use of templates and STL
|
||||
|
||||
-----------------------------------------------------------
|
||||
This sample illustrates using wxActiveX and wxIEHtmlWin too:
|
||||
1. Host an arbitrary ActiveX control
|
||||
1.1 - Capture and logging of all events from control
|
||||
2. Specifically host the MSHTML Control
|
||||
|
||||
|
||||
wxActiveX:
|
||||
==========
|
||||
wxActiveX is used to host and siplay any activeX control, all the wxWindows developer
|
||||
needs to know is either the ProgID or CLSID of the control in question.
|
||||
|
||||
Derived From:
|
||||
- wxWindow
|
||||
|
||||
Include Files:
|
||||
- wxactivex.h
|
||||
|
||||
Source Files:
|
||||
- wxactivex.cpp
|
||||
|
||||
Event Handling:
|
||||
---------------
|
||||
- EVT_ACTIVEX(id, eventName, handler) (handler = void OnActiveX(wxActiveXEvent& event))
|
||||
- EVT_ACTIVEX_DISPID(id, eventDispId, handler) (handler = void OnActiveX(wxActiveXEvent& event))
|
||||
class wxActiveXEvent : public wxNotifyEvent
|
||||
wxString EventName();
|
||||
int ParamCount() const;
|
||||
wxString ParamType(int idx);
|
||||
wxString ParamName(int idx);
|
||||
wxVariant operator[] (int idx) const; // parameter by index
|
||||
wxVariant& operator[] (int idx);
|
||||
wxVariant operator[] (wxString name) const; // named parameters
|
||||
wxVariant& operator[] (wxString name);
|
||||
|
||||
|
||||
Members:
|
||||
--------
|
||||
wxActiveX::wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1);
|
||||
- Creates a activeX control identified by clsid
|
||||
e.g
|
||||
wxFrame *frame = new wxFrame(this, -1, "test");
|
||||
wxActiveX *X = new wxActiveX(frame, CLSID_WebBrowser);
|
||||
|
||||
wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1);
|
||||
- Creates a activeX control identified by progId
|
||||
e.g.
|
||||
wxFrame *frame = new wxFrame(this, -1, "test");
|
||||
wxActiveX *X = new wxActiveX(frame, "MSCAL.Calendar");
|
||||
|
||||
|
||||
wxActiveX::~wxActiveX();
|
||||
- Destroys the control
|
||||
- disconnects all connection points
|
||||
|
||||
- int GetEventCount() const;
|
||||
Number of events generated by control
|
||||
|
||||
- const FuncX& GetEvent(int idx) const;
|
||||
Names, Params and Typeinfo for events
|
||||
|
||||
HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *eventSink);
|
||||
- Connects a event sink. Connections are automaticlly diconnected in the destructor
|
||||
e.g.
|
||||
FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(iecontrol);
|
||||
hret = iecontrol->ConnectAdvise(DIID_DWebBrowserEvents2, events);
|
||||
if (! SUCCEEDED(hret))
|
||||
delete events;
|
||||
|
||||
|
||||
Sample Events:
|
||||
--------------
|
||||
EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
|
||||
|
||||
void wxIEFrame::OnMSHTMLBeforeNavigate2X(wxActiveXEvent& event)
|
||||
{
|
||||
wxString url = event["Url"];
|
||||
|
||||
int rc = wxMessageBox(url, "Allow open url ?", wxYES_NO);
|
||||
|
||||
if (rc != wxYES)
|
||||
event["Cancel"] = true;
|
||||
};
|
||||
|
||||
|
||||
wxIEHtmlWin:
|
||||
============
|
||||
wxIEHtmlWin is a specialisation of the wxActiveX control for hosting the MSHTML control.
|
||||
|
||||
Derived From:
|
||||
- wxActiveX
|
||||
- wxWindow
|
||||
|
||||
Event Handling:
|
||||
---------------
|
||||
- see wxActiveX
|
||||
Members:
|
||||
--------
|
||||
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
|
||||
- Constructs and initialises the MSHTML control
|
||||
- LoadUrl("about:blank") is called
|
||||
|
||||
wxIEHtmlWin::~wxIEHtmlWin();
|
||||
- destroys the control
|
||||
|
||||
void wxIEHtmlWin::LoadUrl(const wxString&);
|
||||
- Attempts to browse to the url, the control uses its internal (MS)
|
||||
network streams
|
||||
|
||||
bool wxIEHtmlWin::LoadString(wxString html);
|
||||
- Load the passed HTML string
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(istream *strm);
|
||||
- load the passed HTML stream. The control takes ownership of
|
||||
the pointer, deleting when finished.
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(wxInputStream *is);
|
||||
- load the passed HTML stream. The control takes ownership of
|
||||
the pointer, deleting when finished.
|
||||
|
||||
void wxIEHtmlWin::SetCharset(wxString charset);
|
||||
- Sets the charset of the loaded document
|
||||
|
||||
void wxIEHtmlWin::SetEditMode(bool seton);
|
||||
- Sets edit mode.
|
||||
NOTE: This does work, but is bare bones - we need more events exposed before
|
||||
this is usable as an HTML editor.
|
||||
|
||||
bool wxIEHtmlWin::GetEditMode();
|
||||
- Returns the edit mode setting
|
||||
|
||||
wxString wxIEHtmlWin::GetStringSelection(bool asHTML = false);
|
||||
- Returns the currently selected text (plain or HTML text)
|
||||
|
||||
wxString GetText(bool asHTML = false);
|
||||
- Returns the body text (plain or HTML text)
|
||||
|
||||
Lindsay Mathieson
|
||||
Email : <lmathieson@optusnet.com.au>
|
70
wxPython/contrib/activex/wxie/resource.h
Normal file
70
wxPython/contrib/activex/wxie/resource.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by wxIE.rc
|
||||
//
|
||||
#define DUMMY 4
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
284
wxPython/contrib/activex/wxie/wxActiveXFrame.cpp
Normal file
284
wxPython/contrib/activex/wxie/wxActiveXFrame.cpp
Normal file
@@ -0,0 +1,284 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/filedlg.h"
|
||||
#include "wx/textdlg.h"
|
||||
#include "wxActiveXFrame.h"
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
#include "wx/splitter.h"
|
||||
#include "wx/textctrl.h"
|
||||
#include "wx/clipbrd.h"
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
MENU_GETTYPEINFO = 700,
|
||||
MENU_INVOKEMETHOD,
|
||||
MENU_TEST
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(wxActiveXFrame, wxFrame)
|
||||
EVT_MENU(MENU_GETTYPEINFO, wxActiveXFrame::OnGetTypeInfo)
|
||||
EVT_MENU(MENU_INVOKEMETHOD, wxActiveXFrame::OnInvokeMethod)
|
||||
EVT_MENU(MENU_TEST, wxActiveXFrame::OnTest)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
wxActiveXFrame::wxActiveXFrame(wxWindow *parent, wxString title) :
|
||||
wxFrame(parent, -1, title)
|
||||
{
|
||||
// create a menu bar
|
||||
wxMenu *xMenu = new wxMenu("", wxMENU_TEAROFF);
|
||||
|
||||
xMenu->Append(MENU_GETTYPEINFO, "Get Type Info", "");
|
||||
xMenu->Append(MENU_INVOKEMETHOD, "Invoke Method (no params)", "");
|
||||
xMenu->Append(MENU_TEST, "Test", "For debugging purposes");
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(xMenu, "&ActiveX");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
wxSplitterWindow *sp = new wxSplitterWindow(this);
|
||||
X = new wxActiveX(sp, title, 101);
|
||||
|
||||
textLog = new wxTextCtrl(sp, -1, "", wxPoint(0,0), wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);
|
||||
|
||||
sp->SplitHorizontally(X, textLog, 0);
|
||||
|
||||
// conenct all events
|
||||
for (int i = 0; i < X->GetEventCount(); i++)
|
||||
{
|
||||
const wxActiveX::FuncX& func = X->GetEventDesc(i);
|
||||
const wxEventType& ev = RegisterActiveXEvent((DISPID) func.memid);
|
||||
Connect(101, ev, (wxObjectEventFunction) OnActiveXEvent);
|
||||
};
|
||||
}
|
||||
|
||||
wxString VarTypeAsString(VARTYPE vt)
|
||||
{
|
||||
#define VT(vtype, desc) case vtype : return desc
|
||||
|
||||
if (vt & VT_BYREF)
|
||||
vt -= VT_BYREF;
|
||||
|
||||
if (vt & VT_ARRAY)
|
||||
vt -= VT_ARRAY;
|
||||
|
||||
switch (vt)
|
||||
{
|
||||
VT(VT_SAFEARRAY, "SafeArray");
|
||||
VT(VT_EMPTY, "empty");
|
||||
VT(VT_NULL, "null");
|
||||
VT(VT_UI1, "byte");
|
||||
VT(VT_I1, "char");
|
||||
VT(VT_I2, "short");
|
||||
VT(VT_I4, "long");
|
||||
VT(VT_UI2, "unsigned short");
|
||||
VT(VT_UI4, "unsigned long");
|
||||
VT(VT_INT, "int");
|
||||
VT(VT_UINT, "unsigned int");
|
||||
VT(VT_R4, "real(4)");
|
||||
VT(VT_R8, "real(8)");
|
||||
VT(VT_CY, "Currency");
|
||||
VT(VT_DATE, "wxDate");
|
||||
VT(VT_BSTR, "wxString");
|
||||
VT(VT_DISPATCH, "IDispatch");
|
||||
VT(VT_ERROR, "SCode Error");
|
||||
VT(VT_BOOL, "bool");
|
||||
VT(VT_VARIANT, "wxVariant");
|
||||
VT(VT_UNKNOWN, "IUknown");
|
||||
VT(VT_VOID, "void");
|
||||
VT(VT_PTR, "void *");
|
||||
VT(VT_USERDEFINED, "*user defined*");
|
||||
|
||||
default:
|
||||
{
|
||||
wxString s;
|
||||
s << "Unknown(" << vt << ")";
|
||||
return s;
|
||||
};
|
||||
};
|
||||
|
||||
#undef VT
|
||||
};
|
||||
|
||||
#define ENDL "\r\n"
|
||||
|
||||
|
||||
void OutFunc(wxString& os, const wxActiveX::FuncX& func)
|
||||
{
|
||||
os << VarTypeAsString(func.retType.vt) << " " << func.name << "(";
|
||||
for (unsigned int p = 0; p < func.params.size(); p++)
|
||||
{
|
||||
const wxActiveX::ParamX& param = func.params[p];
|
||||
if (param.IsIn() && param.IsOut())
|
||||
os << "[IN OUT] ";
|
||||
else if (param.IsIn())
|
||||
os << "[IN] ";
|
||||
else if (param.IsIn())
|
||||
os << "[OUT] ";
|
||||
os << VarTypeAsString(param.vt) << " " << (param.isPtr ? "*" : "") << param.name;
|
||||
if (p < func.params.size() - 1)
|
||||
os << ", ";
|
||||
};
|
||||
os << ")" << ENDL;
|
||||
};
|
||||
|
||||
void wxActiveXFrame::OnGetTypeInfo(wxCommandEvent& event)
|
||||
{
|
||||
wxString os;
|
||||
|
||||
int i =0;
|
||||
os <<
|
||||
"Props" << ENDL <<
|
||||
"=====" << ENDL;
|
||||
for (i = 0; i < X->GetPropCount(); i++)
|
||||
{
|
||||
wxActiveX::PropX prop = X->GetPropDesc(i);
|
||||
os << VarTypeAsString(prop.type.vt) << " " << prop.name << "(";
|
||||
if (prop.CanSet())
|
||||
{
|
||||
os << VarTypeAsString(prop.arg.vt);
|
||||
};
|
||||
os << ")" << ENDL;
|
||||
|
||||
};
|
||||
os << ENDL;
|
||||
|
||||
os <<
|
||||
"Events" << ENDL <<
|
||||
"======" << ENDL;
|
||||
for (i = 0; i < X->GetEventCount(); i++)
|
||||
OutFunc(os, X->GetEventDesc(i));
|
||||
os << ENDL;
|
||||
|
||||
os <<
|
||||
"Methods" << ENDL <<
|
||||
"=======" << ENDL;
|
||||
for (i = 0; i < X->GetMethodCount(); i++)
|
||||
OutFunc(os, X->GetMethodDesc(i));
|
||||
os << ENDL;
|
||||
|
||||
|
||||
if (wxTheClipboard->Open())
|
||||
{
|
||||
wxDataObjectSimple *wo = new wxTextDataObject(os);
|
||||
wxTheClipboard->SetData(wo);
|
||||
wxTheClipboard->Flush();
|
||||
wxTheClipboard->Close();
|
||||
};
|
||||
|
||||
wxMessageBox(os, "Type Info", wxOK, this);
|
||||
};
|
||||
|
||||
void wxActiveXFrame::OnInvokeMethod(wxCommandEvent& event)
|
||||
{
|
||||
//wxTextEntryDialog dlg(this, "Method");
|
||||
//if (dlg.ShowModal() == wxID_OK)
|
||||
// X->CallMethod(dlg.GetValue());
|
||||
};
|
||||
|
||||
void wxActiveXFrame::OnTest(wxCommandEvent& event)
|
||||
{
|
||||
// flash testing
|
||||
wxVariant args[] = {0L, "http://www.macromedia.com/support/flash/ts/documents/java_script_comm/flash_to_javascript.swf"};
|
||||
X->CallMethod("LoadMovie", args);
|
||||
//X->Prop("Movie") = "http://www.macromedia.com/support/flash/ts/documents/java_script_comm/flash_to_javascript.swf";
|
||||
|
||||
// mc cal testing
|
||||
//X->Prop("year") = 1964L;
|
||||
//X->Prop("Value") = wxDateTime::Now();
|
||||
|
||||
// pdf testing
|
||||
//wxVariant file = "C:\\WINNT\\wx2\\docs\\pdf\\dialoged.pdf";
|
||||
//X->CallMethod("LoadFile", &file);
|
||||
};
|
||||
|
||||
void wxActiveXFrame::OnActiveXEvent(wxActiveXEvent& event)
|
||||
{
|
||||
#ifdef UNICODE
|
||||
wostringstream os;
|
||||
#else
|
||||
ostringstream os;
|
||||
#endif
|
||||
|
||||
os << (const wxChar *) event.EventName() << wxT("(");
|
||||
|
||||
for (int p = 0; p < event.ParamCount(); p++)
|
||||
{
|
||||
os <<
|
||||
(const wxChar *) event.ParamType(p) << wxT(" ") <<
|
||||
(const wxChar *) event.ParamName(p) << wxT(" = ") <<
|
||||
(const wxChar *) (wxString) event[p];
|
||||
if (p < event.ParamCount() - 1)
|
||||
os << wxT(", ");
|
||||
};
|
||||
os << wxT(")") << endl;
|
||||
wxString data = os.str().c_str();
|
||||
textLog->AppendText(data);
|
||||
};
|
||||
|
77
wxPython/contrib/activex/wxie/wxActiveXFrame.h
Normal file
77
wxPython/contrib/activex/wxie/wxActiveXFrame.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
#ifndef wxActiveXFrame_h
|
||||
#define wxActiveXFrame_h
|
||||
|
||||
#include "wxactivex.h"
|
||||
|
||||
class wxActiveXFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
wxActiveX *X;
|
||||
wxTextCtrl *textLog;
|
||||
|
||||
wxActiveXFrame(wxWindow *parent, wxString title);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnGetTypeInfo(wxCommandEvent& event);
|
||||
void OnInvokeMethod(wxCommandEvent& event);
|
||||
void OnTest(wxCommandEvent& event);
|
||||
void OnActiveXEvent(wxActiveXEvent& event);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
404
wxPython/contrib/activex/wxie/wxIE.dsp
Normal file
404
wxPython/contrib/activex/wxie/wxIE.dsp
Normal file
@@ -0,0 +1,404 @@
|
||||
# Microsoft Developer Studio Project File - Name="wxIE" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=wxIE - Win32 Unicode Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "wxIE.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "wxIE.mak" CFG="wxIE - Win32 Unicode Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "wxIE - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "wxIE - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "wxIE - Win32 Unicode Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "wxIE - Win32 Unicode Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "wxIE - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "$(WXWIN)\include" /I "$(WXWIN)\contrib\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc09 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc09 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /libpath:"$(WXWIN)\Lib" /libpath:"$(WXWIN)\contrib\Lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(WXWIN)\lib\vc_dll\mswd" /I "$(WXWIN)\include" /I "$(WXWIN)\contrib\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc09 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc09 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxbase25d.lib wxbase25d_net.lib wxbase25d_xml.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /pdbtype:sept /libpath:"$(WXWIN)\Lib" /libpath:"$(WXWIN)\lib\vc_dll" /libpath:"$(WXWIN)\contrib\Lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Unicode Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "wxIE___Win32_Unicode_Debug"
|
||||
# PROP BASE Intermediate_Dir "wxIE___Win32_Unicode_Debug"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "wxIE___Win32_Unicode_Debug"
|
||||
# PROP Intermediate_Dir "wxIE___Win32_Unicode_Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(WXWIN)\include" /I "$(WXWIN)\contrib\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /Yu"wx/wxprec.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(WXWIN)\include" /I "$(WXWIN)\contrib\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D UNICODE=1 /Yu"wx/wxprec.h" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0xc09 /d "_DEBUG"
|
||||
# ADD RSC /l 0xc09 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmswd.lib pngd.lib zlibd.lib jpegd.lib tiffd.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"wxIE.exe" /pdbtype:sept /libpath:"$(WXWIN)\Lib" /libpath:"$(WXWIN)\contrib\Lib"
|
||||
# SUBTRACT BASE LINK32 /pdb:none
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmswud.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrt.lib" /out:"wxIE.exe" /pdbtype:sept /libpath:"$(WXWIN)\Lib" /libpath:"$(WXWIN)\contrib\Lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Unicode Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "wxIE___Win32_Unicode_Release"
|
||||
# PROP BASE Intermediate_Dir "wxIE___Win32_Unicode_Release"
|
||||
# PROP BASE Ignore_Export_Lib 0
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "wxIE___Win32_Unicode_Release"
|
||||
# PROP Intermediate_Dir "wxIE___Win32_Unicode_Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "$(WXWIN)\include" /I "$(WXWIN)\contrib\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "$(WXWIN)\include" /I "$(WXWIN)\contrib\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /YX /FD /c
|
||||
# ADD BASE RSC /l 0xc09 /d "NDEBUG"
|
||||
# ADD RSC /l 0xc09 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wx.lib xpm.lib png.lib zlib.lib jpeg.lib tiff.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"wxIE.exe"
|
||||
# SUBTRACT BASE LINK32 /pdb:none
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmswu.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libci.lib" /nodefaultlib:"msvcrtd.lib" /out:"wxIE.exe" /libpath:"$(WXWIN)\Lib" /libpath:"$(WXWIN)\contrib\Lib"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "wxIE - Win32 Release"
|
||||
# Name "wxIE - Win32 Debug"
|
||||
# Name "wxIE - Win32 Unicode Debug"
|
||||
# Name "wxIE - Win32 Unicode Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IEHtmlWin.cpp
|
||||
|
||||
!IF "$(CFG)" == "wxIE - Win32 Release"
|
||||
|
||||
# SUBTRACT CPP /YX
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Unicode Debug"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Unicode Release"
|
||||
|
||||
# SUBTRACT BASE CPP /YX
|
||||
# SUBTRACT CPP /YX
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxactivex.cpp
|
||||
|
||||
!IF "$(CFG)" == "wxIE - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Unicode Debug"
|
||||
|
||||
# SUBTRACT BASE CPP /YX /Yc /Yu
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "wxIE - Win32 Unicode Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxActiveXFrame.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIE.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIEApp.cpp
|
||||
# ADD CPP /Yc"wx/wxprec.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIEFrm.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\IEHtmlWin.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxactivex.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxActiveXFrame.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIEApp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIEFrm.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\blank.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\bullseye.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\colours.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\cross.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\disable.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\error.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\hand.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\info.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\magnif1.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\noentry.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\pbrush.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\pencil.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\plot_dwn.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\plot_enl.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\plot_shr.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\plot_up.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\plot_zin.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\plot_zot.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\pntleft.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\pntright.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\query.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\question.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\roller.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\size.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\tick.bmp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\tip.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\warning.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wx\msw\watch1.cur
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIE.ico
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\default.doxygen
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\license.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\makefile
|
||||
# PROP Exclude_From_Scan -1
|
||||
# PROP BASE Exclude_From_Build 1
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\makefile.gtk
|
||||
# PROP Exclude_From_Scan -1
|
||||
# PROP BASE Exclude_From_Build 1
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\makefile.mtf
|
||||
# PROP Exclude_From_Scan -1
|
||||
# PROP BASE Exclude_From_Build 1
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\notes.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\readme.txt
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wxIE.xpm
|
||||
# PROP Exclude_From_Scan -1
|
||||
# PROP BASE Exclude_From_Build 1
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
BIN
wxPython/contrib/activex/wxie/wxIE.ico
Normal file
BIN
wxPython/contrib/activex/wxie/wxIE.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
169
wxPython/contrib/activex/wxie/wxIE.rc
Normal file
169
wxPython/contrib/activex/wxie/wxIE.rc
Normal file
@@ -0,0 +1,169 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
//#include "afxres.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
#include <winuser.rh>
|
||||
#include <commctrl.rh>
|
||||
#include <dde.rh>
|
||||
#include <winnt.rh>
|
||||
#include <dlgs.h>
|
||||
#include <winver.h>
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
/*
|
||||
WXDISABLE_BUTTON_BITMAP BITMAP MOVEABLE PURE "wx/msw/disable.bmp"
|
||||
WXBITMAP_STD_COLOURS BITMAP MOVEABLE PURE "wx/msw/colours.bmp"
|
||||
TICK_BMP BITMAP MOVEABLE PURE "wx/msw/tick.bmp"
|
||||
PLOT_ZOT_BMP BITMAP MOVEABLE PURE "wx/msw/plot_zot.bmp"
|
||||
PLOT_ZIN_BMP BITMAP MOVEABLE PURE "wx/msw/plot_zin.bmp"
|
||||
PLOT_UP_BMP BITMAP MOVEABLE PURE "wx/msw/plot_up.bmp"
|
||||
PLOT_SHR_BMP BITMAP MOVEABLE PURE "wx/msw/plot_shr.bmp"
|
||||
PLOT_ENL_BMP BITMAP MOVEABLE PURE "wx/msw/plot_enl.bmp"
|
||||
PLOT_DWN_BMP BITMAP MOVEABLE PURE "wx/msw/plot_dwn.bmp"
|
||||
CROSS_BMP BITMAP MOVEABLE PURE "wx/msw/cross.bmp"
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Cursor
|
||||
//
|
||||
|
||||
/*
|
||||
WXCURSOR_WATCH CURSOR DISCARDABLE "wx\\msw\\watch1.cur"
|
||||
WXCURSOR_SIZING CURSOR DISCARDABLE "wx/msw/size.cur"
|
||||
WXCURSOR_ROLLER CURSOR DISCARDABLE "wx/msw/roller.cur"
|
||||
WXCURSOR_QARROW CURSOR DISCARDABLE "wx/msw/query.cur"
|
||||
WXCURSOR_PRIGHT CURSOR DISCARDABLE "wx/msw/pntright.cur"
|
||||
WXCURSOR_PLEFT CURSOR DISCARDABLE "wx/msw/pntleft.cur"
|
||||
WXCURSOR_PENCIL CURSOR DISCARDABLE "wx/msw/pencil.cur"
|
||||
WXCURSOR_PBRUSH CURSOR DISCARDABLE "wx/msw/pbrush.cur"
|
||||
WXCURSOR_NO_ENTRY CURSOR DISCARDABLE "wx/msw/noentry.cur"
|
||||
WXCURSOR_MAGNIFIER CURSOR DISCARDABLE "wx/msw/magnif1.cur"
|
||||
WXCURSOR_HAND CURSOR DISCARDABLE "wx/msw/hand.cur"
|
||||
WXCURSOR_BULLSEYE CURSOR DISCARDABLE "wx/msw/bullseye.cur"
|
||||
WXCURSOR_BLANK CURSOR DISCARDABLE "wx/msw/blank.cur"
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
WXRESIZEABLEDIALOG DIALOG DISCARDABLE 34, 22, 144, 75
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
|
||||
BEGIN
|
||||
END
|
||||
|
||||
WXNOCAPTIONDIALOG DIALOG DISCARDABLE 34, 22, 144, 75
|
||||
STYLE WS_POPUP
|
||||
BEGIN
|
||||
END
|
||||
|
||||
WXCAPTIONDIALOG DIALOG DISCARDABLE 34, 22, 144, 75
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dummy dialog"
|
||||
BEGIN
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
WXIE ICON DISCARDABLE "wxIE.ico"
|
||||
/*
|
||||
WXICON_WARNING ICON DISCARDABLE "wx\\msw\\warning.ico"
|
||||
WXICON_TIP ICON DISCARDABLE "wx/msw/tip.ico"
|
||||
WXICON_QUESTION ICON DISCARDABLE "wx/msw/question.ico"
|
||||
WXICON_INFO ICON DISCARDABLE "wx/msw/info.ico"
|
||||
WXICON_ERROR ICON DISCARDABLE "wx/msw/error.ico"
|
||||
*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
WXWINDOWMENU MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&Window"
|
||||
BEGIN
|
||||
MENUITEM "&Cascade", 4002
|
||||
MENUITEM "Tile &Horizontally", 4001
|
||||
MENUITEM "Tile &Vertically", 4005
|
||||
MENUITEM "", 65535
|
||||
MENUITEM "&Arrange Icons", 4003
|
||||
MENUITEM "&Next", 4004
|
||||
END
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
44
wxPython/contrib/activex/wxie/wxIE.xpm
Normal file
44
wxPython/contrib/activex/wxie/wxIE.xpm
Normal file
@@ -0,0 +1,44 @@
|
||||
/* XPM */
|
||||
static char *wxIE_xpm[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c Black",
|
||||
". c Blue",
|
||||
"X c #00bf00",
|
||||
"o c Red",
|
||||
"O c Yellow",
|
||||
"+ c Gray100",
|
||||
/* pixels */
|
||||
" ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" oooooo +++++++++++++++++++++++ ",
|
||||
" ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ .... ",
|
||||
" ++++++ ++++++++++++++++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++++++++++++++++ ++++ ",
|
||||
" ++++++ ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
|
||||
" "
|
||||
};
|
99
wxPython/contrib/activex/wxie/wxIEApp.cpp
Normal file
99
wxPython/contrib/activex/wxie/wxIEApp.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
#include "wx/wxprec.h"
|
||||
#include "wxIEApp.h"
|
||||
#include "wxIEFrm.h"
|
||||
#include "resource.h"
|
||||
|
||||
|
||||
|
||||
// Create a new application object: this macro will allow wxWindows to create
|
||||
// the application object during program execution (it's better than using a
|
||||
// static object for many reasons) and also declares the accessor function
|
||||
// wxGetApp() which will return the reference of the right type (i.e. wxIEApp and
|
||||
// not wxApp)
|
||||
IMPLEMENT_APP(wxIEApp)
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// 'Main program' equivalent: the program execution "starts" here
|
||||
bool wxIEApp::OnInit()
|
||||
{
|
||||
// create the main application window
|
||||
wxIEFrame *frame = new wxIEFrame(wxT("IE Test"));
|
||||
|
||||
// and show it (the frames, unlike simple controls, are not shown when
|
||||
// created initially)
|
||||
frame->Show(TRUE);
|
||||
|
||||
// success: wxApp::OnRun() will be called which will enter the main message
|
||||
// loop and the application will run. If we returned FALSE here, the
|
||||
// application would exit immediately.
|
||||
return TRUE;
|
||||
}
|
||||
|
66
wxPython/contrib/activex/wxie/wxIEApp.h
Normal file
66
wxPython/contrib/activex/wxie/wxIEApp.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
// Define a new application type, each program should derive a class from wxApp
|
||||
class wxIEApp : public wxApp
|
||||
{
|
||||
public:
|
||||
// override base class virtuals
|
||||
// ----------------------------
|
||||
|
||||
// this one is called on application startup and is a good place for the app
|
||||
// initialization (doing it here and not in the ctor allows to have an error
|
||||
// return: if OnInit() returns false, the application terminates)
|
||||
virtual bool OnInit();
|
||||
};
|
381
wxPython/contrib/activex/wxie/wxIEFrm.cpp
Normal file
381
wxPython/contrib/activex/wxie/wxIEFrm.cpp
Normal file
@@ -0,0 +1,381 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
// For compilers that support precompilation, includes "wx/wx.h".
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/filedlg.h"
|
||||
#include "wxIEApp.h"
|
||||
#include "wxIEFrm.h"
|
||||
#include "wxActiveXFrame.h"
|
||||
#include <istream>
|
||||
#include <fstream>
|
||||
using namespace std;
|
||||
#include <exdispid.h>
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// resources
|
||||
// ----------------------------------------------------------------------------
|
||||
// the application icon
|
||||
#if defined(__WXGTK__) || defined(__WXMOTIF__)
|
||||
#include "wxIE.xpm"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// IDs for the controls and the menu commands
|
||||
enum
|
||||
{
|
||||
// menu items
|
||||
FILE_QUIT = 1,
|
||||
FILE_OPEN,
|
||||
FILE_BROWSE,
|
||||
FILE_HTML_EDITMODE,
|
||||
FILE_TEST_HTML,
|
||||
FILE_TEST_SELECT,
|
||||
FILE_TEST_HTMLSELECT,
|
||||
FILE_TEST_GETTEXT,
|
||||
FILE_TEST_HTMLGETTEXT,
|
||||
FILE_TEST_HOME,
|
||||
FILE_TEST_ACTIVEX,
|
||||
FILE_ABOUT,
|
||||
|
||||
// controls
|
||||
ID_MSHTML = 501,
|
||||
ID_PROGRESS_GAUGE
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event tables and other macros for wxWindows
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the event tables connect the wxWindows events with the functions (event
|
||||
// handlers) which process them. It can be also done at run-time, but for the
|
||||
// simple menu events like this the static method is much simpler.
|
||||
BEGIN_EVENT_TABLE(wxIEFrame, wxFrame)
|
||||
EVT_SIZE(wxIEFrame::OnSize)
|
||||
EVT_MENU(FILE_QUIT, wxIEFrame::OnQuit)
|
||||
EVT_MENU(FILE_BROWSE, wxIEFrame::OnBrowse)
|
||||
EVT_MENU(FILE_OPEN, wxIEFrame::OnOpen)
|
||||
EVT_MENU(FILE_HTML_EDITMODE, wxIEFrame::OnEditMode)
|
||||
EVT_UPDATE_UI(FILE_HTML_EDITMODE, wxIEFrame::OnEditModeUI)
|
||||
EVT_MENU(FILE_TEST_HTML, wxIEFrame::OnTestHTML)
|
||||
EVT_MENU(FILE_TEST_SELECT, wxIEFrame::OnTestSelect)
|
||||
EVT_MENU(FILE_TEST_HTMLSELECT, wxIEFrame::OnTestHTMLSelect)
|
||||
EVT_MENU(FILE_TEST_GETTEXT, wxIEFrame::OnTestGetText)
|
||||
EVT_MENU(FILE_TEST_HTMLGETTEXT, wxIEFrame::OnTestHTMLGetText)
|
||||
EVT_MENU(FILE_TEST_HOME, wxIEFrame::OnTestHome)
|
||||
EVT_MENU(FILE_TEST_ACTIVEX, wxIEFrame::OnTestActiveX)
|
||||
EVT_MENU(FILE_ABOUT, wxIEFrame::OnAbout)
|
||||
|
||||
// ActiveX Events
|
||||
EVT_ACTIVEX_DISPID(ID_MSHTML, DISPID_STATUSTEXTCHANGE, OnMSHTMLStatusTextChangeX)
|
||||
EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
|
||||
EVT_ACTIVEX(ID_MSHTML, "TitleChange", OnMSHTMLTitleChangeX)
|
||||
EVT_ACTIVEX(ID_MSHTML, "NewWindow2", OnMSHTMLNewWindow2X)
|
||||
EVT_ACTIVEX(ID_MSHTML, "ProgressChange", OnMSHTMLProgressChangeX)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// main frame
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// frame constructor
|
||||
wxIEFrame::wxIEFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
|
||||
{
|
||||
// set the frame icon
|
||||
SetIcon(wxICON(wxIE));
|
||||
|
||||
// create a menu bar
|
||||
wxMenu *menuFile = new wxMenu("", wxMENU_TEAROFF);
|
||||
|
||||
// the "About" item should be in the help menu
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
helpMenu->Append(FILE_ABOUT, "&About...\tCtrl-A", "Show about dialog");
|
||||
|
||||
menuFile->Append(FILE_TEST_HTML, "Test HTML", "Demonstrates LoadString()");
|
||||
menuFile->Append(FILE_OPEN, "Open HTML File", "Demonstrates LoadStream(istream *)");
|
||||
menuFile->Append(FILE_BROWSE, "Browse Web Page", "Demonstrates LoadUrl(url)");
|
||||
menuFile->Append(FILE_HTML_EDITMODE, "Edit Mode", "Demonstrates editing html", true);
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(FILE_TEST_SELECT, "Get Selected Text", "Demonstrates GetStringSelection(false)");
|
||||
menuFile->Append(FILE_TEST_HTMLSELECT, "Get HTML Selected Text", "Demonstrates GetStringSelection(true)");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(FILE_TEST_GETTEXT, "Get Text", "Demonstrates GetText(false)");
|
||||
menuFile->Append(FILE_TEST_HTMLGETTEXT, "Get HTML Text", "Demonstrates GetText(true)");
|
||||
menuFile->Append(FILE_TEST_HOME, "Open Home Page", "Demonstrates GoHome()");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(FILE_TEST_ACTIVEX, "Display a ActiveX control", "Demonstrates the Generic ActiveX Container");
|
||||
menuFile->AppendSeparator();
|
||||
menuFile->Append(FILE_QUIT, "E&xit\tAlt-X", "Quit this program");
|
||||
|
||||
// now append the freshly created menu to the menu bar...
|
||||
wxMenuBar *menuBar = new wxMenuBar();
|
||||
menuBar->Append(menuFile, "&File");
|
||||
menuBar->Append(helpMenu, "&Help");
|
||||
|
||||
// ... and attach this menu bar to the frame
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
// create a status bar just for fun (by default with 1 pane only)
|
||||
wxStatusBar * sb = CreateStatusBar(2);
|
||||
SetStatusText("Ready");
|
||||
|
||||
// progress gauge (belongs to status bar)
|
||||
m_gauge = new wxGauge(sb, ID_PROGRESS_GAUGE, 100);
|
||||
|
||||
// IE Control
|
||||
m_ie = new wxIEHtmlWin(this, ID_MSHTML);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// event handlers
|
||||
|
||||
void wxIEFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
wxFrame::OnSize(event);
|
||||
|
||||
wxStatusBar* sb = GetStatusBar();
|
||||
if (! sb)
|
||||
return;
|
||||
|
||||
wxRect rc;
|
||||
sb->GetFieldRect(1, rc);
|
||||
|
||||
m_gauge->SetSize(rc);
|
||||
};
|
||||
|
||||
void wxIEFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _T("About wxIE...\n"));
|
||||
wxMessageBox(msg, "About wxIE", wxOK | wxICON_INFORMATION, this);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnTestHTML(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString html =
|
||||
"<HTML><BODY><H1>Hello World</H1>Plain Text</body></html>";
|
||||
m_ie->LoadString(html);
|
||||
}
|
||||
|
||||
|
||||
void wxIEFrame::OnTestSelect(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString s = m_ie->GetStringSelection();
|
||||
|
||||
wxMessageBox(s);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnTestHTMLSelect(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString s = m_ie->GetStringSelection(true);
|
||||
|
||||
wxMessageBox(s);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnTestGetText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString s = m_ie->GetText();
|
||||
|
||||
wxMessageBox(s);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnTestHTMLGetText(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString s = m_ie->GetText(true);
|
||||
|
||||
wxMessageBox(s);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnTestHome(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_ie->GoHome();
|
||||
};
|
||||
|
||||
|
||||
void wxIEFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxFileDialog dlg(this, "Chooose a HTML File", "", "", "HTML files (*.html; *.htm)|*.html;*.htm|",wxOPEN);
|
||||
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
wxString fname = dlg.GetPath();
|
||||
|
||||
ifstream *is = new ifstream(fname.mb_str());
|
||||
m_ie->LoadStream(is);
|
||||
};
|
||||
}
|
||||
|
||||
void wxIEFrame::OnEditMode(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
m_ie->SetEditMode(! m_ie->GetEditMode());
|
||||
}
|
||||
|
||||
void wxIEFrame::OnEditModeUI(wxUpdateUIEvent& event)
|
||||
{
|
||||
if (m_ie)
|
||||
event.Check(m_ie->GetEditMode());
|
||||
}
|
||||
|
||||
void wxIEFrame::OnBrowse(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxString url = wxGetTextFromUser("Enter URL:", "Browse", "", this);
|
||||
|
||||
m_ie->LoadUrl(url);
|
||||
}
|
||||
|
||||
void wxIEFrame::OnMSHTMLStatusTextChangeX(wxActiveXEvent& event)
|
||||
{
|
||||
SetStatusText(event["Text"]);
|
||||
};
|
||||
|
||||
|
||||
void wxIEFrame::OnMSHTMLBeforeNavigate2X(wxActiveXEvent& event)
|
||||
{
|
||||
wxString url = event["Url"];
|
||||
if (url == "about:blank")
|
||||
return;
|
||||
|
||||
int rc = wxMessageBox(url, "Allow open url ?", wxYES_NO);
|
||||
|
||||
if (rc != wxYES)
|
||||
event["Cancel"] = true;
|
||||
};
|
||||
|
||||
void wxIEFrame::OnMSHTMLTitleChangeX(wxActiveXEvent& event)
|
||||
{
|
||||
SetTitle(event["Text"]);
|
||||
};
|
||||
|
||||
|
||||
void wxIEFrame::OnMSHTMLNewWindow2X(wxActiveXEvent& event)
|
||||
{
|
||||
int rc = wxMessageBox("New Window requested", "Allow New Window ?", wxYES_NO);
|
||||
|
||||
if (rc != wxYES)
|
||||
event["Cancel"] = true;
|
||||
};
|
||||
|
||||
|
||||
void wxIEFrame::OnMSHTMLProgressChangeX(wxActiveXEvent& event)
|
||||
{
|
||||
if ((long) event["ProgressMax"] != m_gauge->GetRange())
|
||||
m_gauge->SetRange((long) event["ProgressMax"]);
|
||||
|
||||
m_gauge->SetValue((long) event["Progress"]);
|
||||
};
|
||||
|
||||
void wxIEFrame::OnTestActiveX(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
// Some known prog ids
|
||||
//#define PROGID "Shell.Explorer"
|
||||
//#define PROGID CLSID_WebBrowser
|
||||
//#define PROGID CLSID_MozillaBrowser
|
||||
//#define PROGID CLSID_HTMLDocument
|
||||
//#define PROGID "MSCAL.Calendar"
|
||||
//#define PROGID "WordPad.Document"
|
||||
//#define PROGID "SoftwareFX.ChartFX"
|
||||
//#define PROGID "PDF.PdfCtrl"
|
||||
#define PROGID "ShockwaveFlash.ShockwaveFlash"
|
||||
|
||||
wxDialog dlg(this, -1, wxString(wxT("Test ActiveX")));
|
||||
|
||||
wxFlexGridSizer *sz = new wxFlexGridSizer(2);
|
||||
sz->Add(new wxStaticText(&dlg, -1, wxT("Enter a ActiveX ProgId")), 0, wxALL, 5 );
|
||||
|
||||
wxComboBox *cb = new wxComboBox(&dlg, 101, "");
|
||||
cb->Append(wxT("ShockwaveFlash.ShockwaveFlash"));
|
||||
cb->Append(wxT("MSCAL.Calendar"));
|
||||
cb->Append(wxT("Shell.Explorer"));
|
||||
cb->Append(wxT("WordPad.Document.1"));
|
||||
cb->Append(wxT("SoftwareFX.ChartFX.20"));
|
||||
cb->Append(wxT("PDF.PdfCtrl.5"));
|
||||
cb->SetSelection(0);
|
||||
|
||||
sz->Add(cb, 0, wxALL, 5 );
|
||||
|
||||
// next row
|
||||
sz->Add(new wxButton(&dlg, wxID_CANCEL, "Cancel"), 0, wxALIGN_RIGHT|wxALL, 5 );
|
||||
sz->Add(new wxButton(&dlg, wxID_OK, "Ok"), 0, wxALIGN_RIGHT|wxALL, 5 );
|
||||
|
||||
dlg.SetAutoLayout( TRUE );
|
||||
dlg.SetSizer(sz);
|
||||
sz->Fit(&dlg);
|
||||
sz->SetSizeHints(&dlg);
|
||||
|
||||
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
wxString progId = cb->GetValue();
|
||||
wxActiveXFrame *frame = new wxActiveXFrame(this, progId);
|
||||
frame->Show();
|
||||
};
|
||||
}
|
||||
|
95
wxPython/contrib/activex/wxie/wxIEFrm.h
Normal file
95
wxPython/contrib/activex/wxie/wxIEFrm.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
#include "IEHtmlWin.h"
|
||||
#include "wx/gauge.h"
|
||||
|
||||
// Define a new frame type: this is going to be our main frame
|
||||
class wxIEFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
wxIEHtmlWin *m_ie;
|
||||
wxGauge *m_gauge;
|
||||
|
||||
// ctor(s)
|
||||
wxIEFrame(const wxString& title, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize);
|
||||
|
||||
// event handlers (these functions should _not_ be virtual)
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
|
||||
void OnEditMode(wxCommandEvent& event);
|
||||
void OnEditModeUI(wxUpdateUIEvent& event);
|
||||
void OnBrowse(wxCommandEvent& event);
|
||||
void OnOpen(wxCommandEvent& event);
|
||||
void OnTestHTML(wxCommandEvent& event);
|
||||
void OnTestSelect(wxCommandEvent& event);
|
||||
void OnTestHTMLSelect(wxCommandEvent& event);
|
||||
void OnTestGetText(wxCommandEvent& event);
|
||||
void OnTestHTMLGetText(wxCommandEvent& event);
|
||||
void OnTestHome(wxCommandEvent& event);
|
||||
void OnTestActiveX(wxCommandEvent& event);
|
||||
|
||||
private:
|
||||
// any class wishing to process wxWindows events must use this macro
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
void OnMSHTMLStatusTextChangeX(wxActiveXEvent& event);
|
||||
void OnMSHTMLBeforeNavigate2X(wxActiveXEvent& event);
|
||||
void OnMSHTMLTitleChangeX(wxActiveXEvent& event);
|
||||
void OnMSHTMLNewWindow2X(wxActiveXEvent& event);
|
||||
void OnMSHTMLProgressChangeX(wxActiveXEvent& event);
|
||||
};
|
2757
wxPython/contrib/activex/wxie/wxactivex.cpp
Normal file
2757
wxPython/contrib/activex/wxie/wxactivex.cpp
Normal file
File diff suppressed because it is too large
Load Diff
680
wxPython/contrib/activex/wxie/wxactivex.h
Normal file
680
wxPython/contrib/activex/wxie/wxactivex.h
Normal file
@@ -0,0 +1,680 @@
|
||||
/*
|
||||
wxActiveX Library Licence, Version 3
|
||||
====================================
|
||||
|
||||
Copyright (C) 2003 Lindsay Mathieson [, ...]
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this licence document, but changing it is not allowed.
|
||||
|
||||
wxActiveX LIBRARY LICENCE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public Licence as published by
|
||||
the Free Software Foundation; either version 2 of the Licence, or (at
|
||||
your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public Licence for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public Licence
|
||||
along with this software, usually in a file named COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
EXCEPTION NOTICE
|
||||
|
||||
1. As a special exception, the copyright holders of this library give
|
||||
permission for additional uses of the text contained in this release of
|
||||
the library as licenced under the wxActiveX Library Licence, applying
|
||||
either version 3 of the Licence, or (at your option) any later version of
|
||||
the Licence as published by the copyright holders of version 3 of the
|
||||
Licence document.
|
||||
|
||||
2. The exception is that you may use, copy, link, modify and distribute
|
||||
under the user's own terms, binary object code versions of works based
|
||||
on the Library.
|
||||
|
||||
3. If you copy code from files distributed under the terms of the GNU
|
||||
General Public Licence or the GNU Library General Public Licence into a
|
||||
copy of this library, as this licence permits, the exception does not
|
||||
apply to the code that you add in this way. To avoid misleading anyone as
|
||||
to the status of such modified files, you must delete this exception
|
||||
notice from such code and/or adjust the licensing conditions notice
|
||||
accordingly.
|
||||
|
||||
4. If you write modifications of your own for this library, it is your
|
||||
choice whether to permit this exception to apply to your modifications.
|
||||
If you do not wish that, you must delete the exception notice from such
|
||||
code and/or adjust the licensing conditions notice accordingly.
|
||||
*/
|
||||
|
||||
/*! \file wxactivex.h
|
||||
\brief implements wxActiveX window class and OLE tools
|
||||
*/
|
||||
|
||||
#ifndef WX_ACTIVE_X
|
||||
#define WX_ACTIVE_X
|
||||
#pragma warning( disable : 4101 4786)
|
||||
#pragma warning( disable : 4786)
|
||||
|
||||
|
||||
#include <wx/setup.h>
|
||||
#include <wx/wx.h>
|
||||
#include <wx/variant.h>
|
||||
#include <wx/datetime.h>
|
||||
#include <oleidl.h>
|
||||
#include <exdisp.h>
|
||||
#include <docobj.h>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
/// \brief wxActiveX Namespace for stuff I want to keep out of other tools way.
|
||||
namespace NS_wxActiveX
|
||||
{
|
||||
/// STL utilty class.
|
||||
/// specific to wxActiveX, for creating
|
||||
/// case insenstive maps etc
|
||||
struct less_wxStringI
|
||||
{
|
||||
bool operator()(const wxString& x, const wxString& y) const
|
||||
{
|
||||
return x.CmpNoCase(y) < 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
/// Template class for smart interface handling.
|
||||
/// - Automatically dereferences ole interfaces
|
||||
/// - Smart Copy Semantics
|
||||
/// - Can Create Interfaces
|
||||
/// - Can query for other interfaces
|
||||
template <class I> class wxAutoOleInterface
|
||||
{
|
||||
protected:
|
||||
I *m_interface;
|
||||
|
||||
public:
|
||||
/// takes ownership of an existing interface
|
||||
/// Assumed to already have a AddRef() applied
|
||||
explicit wxAutoOleInterface(I *pInterface = NULL) : m_interface(pInterface) {}
|
||||
|
||||
/// queries for an interface
|
||||
wxAutoOleInterface(REFIID riid, IUnknown *pUnk) : m_interface(NULL)
|
||||
{
|
||||
QueryInterface(riid, pUnk);
|
||||
};
|
||||
/// queries for an interface
|
||||
wxAutoOleInterface(REFIID riid, IDispatch *pDispatch) : m_interface(NULL)
|
||||
{
|
||||
QueryInterface(riid, pDispatch);
|
||||
};
|
||||
|
||||
/// Creates an Interface
|
||||
wxAutoOleInterface(REFCLSID clsid, REFIID riid) : m_interface(NULL)
|
||||
{
|
||||
CreateInstance(clsid, riid);
|
||||
};
|
||||
|
||||
/// copy constructor
|
||||
wxAutoOleInterface(const wxAutoOleInterface<I>& ti) : m_interface(NULL)
|
||||
{
|
||||
operator = (ti);
|
||||
}
|
||||
|
||||
/// assignment operator
|
||||
wxAutoOleInterface<I>& operator = (const wxAutoOleInterface<I>& ti)
|
||||
{
|
||||
if (ti.m_interface)
|
||||
ti.m_interface->AddRef();
|
||||
Free();
|
||||
m_interface = ti.m_interface;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// takes ownership of an existing interface
|
||||
/// Assumed to already have a AddRef() applied
|
||||
wxAutoOleInterface<I>& operator = (I *&ti)
|
||||
{
|
||||
Free();
|
||||
m_interface = ti;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// invokes Free()
|
||||
~wxAutoOleInterface()
|
||||
{
|
||||
Free();
|
||||
};
|
||||
|
||||
|
||||
/// Releases interface (i.e decrements refCount)
|
||||
inline void Free()
|
||||
{
|
||||
if (m_interface)
|
||||
m_interface->Release();
|
||||
m_interface = NULL;
|
||||
};
|
||||
|
||||
/// queries for an interface
|
||||
HRESULT QueryInterface(REFIID riid, IUnknown *pUnk)
|
||||
{
|
||||
Free();
|
||||
wxCHECK(pUnk != NULL, -1);
|
||||
return pUnk->QueryInterface(riid, (void **) &m_interface);
|
||||
};
|
||||
|
||||
/// Create a Interface instance
|
||||
HRESULT CreateInstance(REFCLSID clsid, REFIID riid)
|
||||
{
|
||||
Free();
|
||||
return CoCreateInstance(clsid, NULL, CLSCTX_ALL, riid, (void **) &m_interface);
|
||||
};
|
||||
|
||||
|
||||
/// returns the interface pointer
|
||||
inline operator I *() const {return m_interface;}
|
||||
|
||||
/// returns the dereferenced interface pointer
|
||||
inline I* operator ->() {return m_interface;}
|
||||
/// returns a pointer to the interface pointer
|
||||
inline I** GetRef() {return &m_interface;}
|
||||
/// returns true if we have a valid interface pointer
|
||||
inline bool Ok() const {return m_interface != NULL;}
|
||||
};
|
||||
|
||||
|
||||
/// \brief Converts a std HRESULT to its error code.
|
||||
/// Hardcoded, by no means a definitive list.
|
||||
wxString OLEHResultToString(HRESULT hr);
|
||||
/// \brief Returns the string description of a IID.
|
||||
/// Hardcoded, by no means a definitive list.
|
||||
wxString GetIIDName(REFIID riid);
|
||||
|
||||
//#define __WXOLEDEBUG
|
||||
|
||||
|
||||
#ifdef __WXOLEDEBUG
|
||||
#define WXOLE_TRACE(str) {OutputDebugString(str);OutputDebugString("\r\n");}
|
||||
#define WXOLE_TRACEOUT(stuff)\
|
||||
{\
|
||||
wxString os;\
|
||||
os << stuff << "\r\n";\
|
||||
WXOLE_TRACE(os.mb_str());\
|
||||
}
|
||||
|
||||
#define WXOLE_WARN(__hr,msg)\
|
||||
{\
|
||||
if (__hr != S_OK)\
|
||||
{\
|
||||
wxString s = "*** ";\
|
||||
s += msg;\
|
||||
s += " : "+ OLEHResultToString(__hr);\
|
||||
WXOLE_TRACE(s.c_str());\
|
||||
}\
|
||||
}
|
||||
#else
|
||||
#define WXOLE_TRACE(str)
|
||||
#define WXOLE_TRACEOUT(stuff)
|
||||
#define WXOLE_WARN(_proc,msg) {_proc;}
|
||||
#endif
|
||||
|
||||
class wxOleInit
|
||||
{
|
||||
public:
|
||||
static IMalloc *GetIMalloc();
|
||||
|
||||
wxOleInit();
|
||||
~wxOleInit();
|
||||
};
|
||||
|
||||
#define DECLARE_OLE_UNKNOWN(cls)\
|
||||
private:\
|
||||
class TAutoInitInt\
|
||||
{\
|
||||
public:\
|
||||
LONG l;\
|
||||
TAutoInitInt() : l(0) {}\
|
||||
};\
|
||||
TAutoInitInt refCount, lockCount;\
|
||||
wxOleInit oleInit;\
|
||||
static void _GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc);\
|
||||
public:\
|
||||
LONG GetRefCount();\
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, void ** ppvObject);\
|
||||
ULONG STDMETHODCALLTYPE AddRef();\
|
||||
ULONG STDMETHODCALLTYPE Release();\
|
||||
ULONG STDMETHODCALLTYPE AddLock();\
|
||||
ULONG STDMETHODCALLTYPE ReleaseLock()
|
||||
|
||||
#define DEFINE_OLE_TABLE(cls)\
|
||||
LONG cls::GetRefCount() {return refCount.l;}\
|
||||
HRESULT STDMETHODCALLTYPE cls::QueryInterface(REFIID iid, void ** ppvObject)\
|
||||
{\
|
||||
if (! ppvObject)\
|
||||
{\
|
||||
WXOLE_TRACE("*** NULL POINTER ***");\
|
||||
return E_FAIL;\
|
||||
};\
|
||||
const char *desc = NULL;\
|
||||
cls::_GetInterface(this, iid, ppvObject, desc);\
|
||||
if (! *ppvObject)\
|
||||
{\
|
||||
WXOLE_TRACEOUT("<" << GetIIDName(iid).c_str() << "> Not Found");\
|
||||
return E_NOINTERFACE;\
|
||||
};\
|
||||
WXOLE_TRACEOUT("QI : <" << desc <<">");\
|
||||
((IUnknown * )(*ppvObject))->AddRef();\
|
||||
return S_OK;\
|
||||
};\
|
||||
ULONG STDMETHODCALLTYPE cls::AddRef()\
|
||||
{\
|
||||
WXOLE_TRACEOUT(# cls << "::Add ref(" << refCount.l << ")");\
|
||||
InterlockedIncrement(&refCount.l);\
|
||||
return refCount.l;\
|
||||
};\
|
||||
ULONG STDMETHODCALLTYPE cls::Release()\
|
||||
{\
|
||||
if (refCount.l > 0)\
|
||||
{\
|
||||
InterlockedDecrement(&refCount.l);\
|
||||
WXOLE_TRACEOUT(# cls << "::Del ref(" << refCount.l << ")");\
|
||||
if (refCount.l == 0)\
|
||||
{\
|
||||
delete this;\
|
||||
return 0;\
|
||||
};\
|
||||
return refCount.l;\
|
||||
}\
|
||||
else\
|
||||
return 0;\
|
||||
}\
|
||||
ULONG STDMETHODCALLTYPE cls::AddLock()\
|
||||
{\
|
||||
WXOLE_TRACEOUT(# cls << "::Add Lock(" << lockCount.l << ")");\
|
||||
InterlockedIncrement(&lockCount.l);\
|
||||
return lockCount.l;\
|
||||
};\
|
||||
ULONG STDMETHODCALLTYPE cls::ReleaseLock()\
|
||||
{\
|
||||
if (lockCount.l > 0)\
|
||||
{\
|
||||
InterlockedDecrement(&lockCount.l);\
|
||||
WXOLE_TRACEOUT(# cls << "::Del Lock(" << lockCount.l << ")");\
|
||||
return lockCount.l;\
|
||||
}\
|
||||
else\
|
||||
return 0;\
|
||||
}\
|
||||
DEFINE_OLE_BASE(cls)
|
||||
|
||||
#define DEFINE_OLE_BASE(cls)\
|
||||
void cls::_GetInterface(cls *self, REFIID iid, void **_interface, const char *&desc)\
|
||||
{\
|
||||
*_interface = NULL;\
|
||||
desc = NULL;
|
||||
|
||||
#define OLE_INTERFACE(_iid, _type)\
|
||||
if (IsEqualIID(iid, _iid))\
|
||||
{\
|
||||
WXOLE_TRACE("Found Interface <" # _type ">");\
|
||||
*_interface = (IUnknown *) (_type *) self;\
|
||||
desc = # _iid;\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define OLE_IINTERFACE(_face) OLE_INTERFACE(IID_##_face, _face)
|
||||
|
||||
#define OLE_INTERFACE_CUSTOM(func)\
|
||||
if (func(self, iid, _interface, desc))\
|
||||
{\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define END_OLE_TABLE\
|
||||
}
|
||||
|
||||
|
||||
/// Main class for embedding a ActiveX control.
|
||||
/// Use by itself or derive from it
|
||||
/// \note The utility program (wxie) can generate a list of events, methods & properties
|
||||
/// for a control.
|
||||
/// First display the control (File|Display),
|
||||
/// then get the type info (ActiveX|Get Type Info) - these are copied to the clipboard.
|
||||
/// Eventually this will be expanded to autogenerate
|
||||
/// wxWindows source files for a control with all methods etc encapsulated.
|
||||
/// \par Usage:
|
||||
/// construct using a ProgId or class id
|
||||
/// \code new wxActiveX(parent, CLSID_WebBrowser, id, pos, size, style, name)\endcode
|
||||
/// \code new wxActiveX(parent, "ShockwaveFlash.ShockwaveFlash", id, pos, size, style, name)\endcode
|
||||
/// \par Properties
|
||||
/// Properties can be set using \c SetProp() and set/retrieved using \c Prop()
|
||||
/// \code SetProp(name, wxVariant(x)) \endcode or
|
||||
/// \code wxString Prop("<name>") = x\endcode
|
||||
/// \code wxString result = Prop("<name>")\endcode
|
||||
/// \code flash_ctl.Prop("movie") = "file:///movies/test.swf";\endcode
|
||||
/// \code flash_ctl.Prop("Playing") = false;\endcode
|
||||
/// \code wxString current_movie = flash_ctl.Prop("movie");\endcode
|
||||
/// \par Methods
|
||||
/// Methods are invoked with \c CallMethod()
|
||||
/// \code wxVariant result = CallMethod("<name>", args, nargs = -1)\endcode
|
||||
/// \code wxVariant args[] = {0L, "file:///e:/dev/wxie/bug-zap.swf"};
|
||||
/// wxVariant result = X->CallMethod("LoadMovie", args);\endcode
|
||||
/// \par events
|
||||
/// respond to events with the
|
||||
/// \c EVT_ACTIVEX(controlId, eventName, handler) &
|
||||
/// \c EVT_ACTIVEX_DISPID(controlId, eventDispId, handler) macros
|
||||
/// \code
|
||||
/// BEGIN_EVENT_TABLE(wxIEFrame, wxFrame)
|
||||
/// EVT_ACTIVEX_DISPID(ID_MSHTML, DISPID_STATUSTEXTCHANGE, OnMSHTMLStatusTextChangeX)
|
||||
/// EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
|
||||
/// EVT_ACTIVEX(ID_MSHTML, "TitleChange", OnMSHTMLTitleChangeX)
|
||||
/// EVT_ACTIVEX(ID_MSHTML, "NewWindow2", OnMSHTMLNewWindow2X)
|
||||
/// EVT_ACTIVEX(ID_MSHTML, "ProgressChange", OnMSHTMLProgressChangeX)
|
||||
/// END_EVENT_TABLE()\endcode
|
||||
class wxActiveX : public wxWindow {
|
||||
public:
|
||||
/// General parameter and return type infoformation for Events, Properties and Methods.
|
||||
/// refer to ELEMDESC, IDLDESC in MSDN
|
||||
class ParamX
|
||||
{
|
||||
public:
|
||||
USHORT flags;
|
||||
bool isPtr;
|
||||
bool isSafeArray;
|
||||
bool isOptional;
|
||||
VARTYPE vt;
|
||||
wxString name;
|
||||
|
||||
ParamX() : isOptional(false), vt(VT_EMPTY) {}
|
||||
inline bool IsIn() const {return (flags & IDLFLAG_FIN) != 0;}
|
||||
inline bool IsOut() const {return (flags & IDLFLAG_FOUT) != 0;}
|
||||
inline bool IsRetVal() const {return (flags & IDLFLAG_FRETVAL) != 0;}
|
||||
};
|
||||
typedef vector<ParamX> ParamXArray;
|
||||
|
||||
|
||||
/// Type & Parameter info for Events and Methods.
|
||||
/// refer to FUNCDESC in MSDN
|
||||
class FuncX
|
||||
{
|
||||
public:
|
||||
wxString name;
|
||||
MEMBERID memid;
|
||||
bool hasOut;
|
||||
|
||||
ParamX retType;
|
||||
ParamXArray params;
|
||||
};
|
||||
typedef vector<FuncX> FuncXArray;
|
||||
|
||||
|
||||
/// Type info for properties.
|
||||
class PropX
|
||||
{
|
||||
public:
|
||||
wxString name;
|
||||
MEMBERID memid;
|
||||
ParamX type;
|
||||
ParamX arg;
|
||||
bool putByRef;
|
||||
|
||||
PropX() : putByRef (false) {}
|
||||
inline bool CanGet() const {return type.vt != VT_EMPTY;}
|
||||
inline bool CanSet() const {return arg.vt != VT_EMPTY;}
|
||||
};
|
||||
typedef vector<PropX> PropXArray;
|
||||
|
||||
|
||||
/// Create using clsid.
|
||||
wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
/// create using progid.
|
||||
wxActiveX(wxWindow * parent, const wxString& progId, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxActiveX();
|
||||
|
||||
/// Number of events defined for this control.
|
||||
inline int GetEventCount() const {return m_events.size();}
|
||||
/// returns event description by index.
|
||||
/// throws exception for invalid index
|
||||
const FuncX& GetEventDesc(int idx) const;
|
||||
|
||||
/// Number of properties defined for this control.
|
||||
inline int GetPropCount() const {return m_props.size();}
|
||||
/// returns property description by index.
|
||||
/// throws exception for invalid index
|
||||
const PropX& GetPropDesc(int idx) const;
|
||||
/// returns property description by name.
|
||||
/// throws exception for invalid name
|
||||
const PropX& GetPropDesc(const wxString& name) const;
|
||||
|
||||
/// Number of methods defined for this control.
|
||||
inline int GetMethodCount() const {return m_methods.size();}
|
||||
/// returns method description by name.
|
||||
/// throws exception for invalid index
|
||||
const FuncX& GetMethodDesc(int idx) const;
|
||||
/// returns method description by name.
|
||||
/// throws exception for invalid name
|
||||
const FuncX& GetMethodDesc(const wxString& name) const;
|
||||
|
||||
/// Set property VARIANTARG value by MEMBERID.
|
||||
void SetProp(MEMBERID name, VARIANTARG& value);
|
||||
/// Set property using wxVariant by name.
|
||||
void SetProp(const wxString &name, const wxVariant &value);
|
||||
|
||||
class wxPropertySetter
|
||||
{
|
||||
public:
|
||||
wxActiveX *m_ctl;
|
||||
wxString m_propName;
|
||||
|
||||
wxPropertySetter(wxActiveX *ctl, const wxString& propName) :
|
||||
m_ctl(ctl), m_propName(propName) {}
|
||||
|
||||
inline const wxPropertySetter& operator = (wxVariant v) const
|
||||
{
|
||||
m_ctl->SetProp(m_propName, v);
|
||||
return *this;
|
||||
};
|
||||
|
||||
inline operator wxVariant() const {return m_ctl->GetPropAsWxVariant(m_propName);};
|
||||
inline operator wxString() const {return m_ctl->GetPropAsString(m_propName);};
|
||||
inline operator char() const {return m_ctl->GetPropAsChar(m_propName);};
|
||||
inline operator long() const {return m_ctl->GetPropAsLong(m_propName);};
|
||||
inline operator bool() const {return m_ctl->GetPropAsBool(m_propName);};
|
||||
inline operator double() const {return m_ctl->GetPropAsDouble(m_propName);};
|
||||
inline operator wxDateTime() const {return m_ctl->GetPropAsDateTime(m_propName);};
|
||||
inline operator void *() const {return m_ctl->GetPropAsPointer(m_propName);};
|
||||
};
|
||||
|
||||
/// \fn inline wxPropertySetter Prop(wxString name) {return wxPropertySetter(this, name);}
|
||||
/// \param name Property name to read/set
|
||||
/// \return wxPropertySetter, which has overloads for setting/getting the property
|
||||
/// \brief Generic Get/Set Property by name.
|
||||
/// Automatically handles most types
|
||||
/// \par Usage:
|
||||
/// - Prop("\<name\>") = \<value\>
|
||||
/// - var = Prop("\<name\>")
|
||||
/// - e.g:
|
||||
/// - \code flash_ctl.Prop("movie") = "file:///movies/test.swf";\endcode
|
||||
/// - \code flash_ctl.Prop("Playing") = false;\endcode
|
||||
/// - \code wxString current_movie = flash_ctl.Prop("movie");\endcode
|
||||
/// \exception raises exception if \<name\> is invalid
|
||||
/// \note Have to add a few more type conversions yet ...
|
||||
inline wxPropertySetter Prop(wxString name) {return wxPropertySetter(this, name);}
|
||||
|
||||
VARIANT GetPropAsVariant(MEMBERID name);
|
||||
VARIANT GetPropAsVariant(const wxString& name);
|
||||
wxVariant GetPropAsWxVariant(const wxString& name);
|
||||
wxString GetPropAsString(const wxString& name);
|
||||
char GetPropAsChar(const wxString& name);
|
||||
long GetPropAsLong(const wxString& name);
|
||||
bool GetPropAsBool(const wxString& name);
|
||||
double GetPropAsDouble(const wxString& name);
|
||||
wxDateTime GetPropAsDateTime(const wxString& name);
|
||||
void *GetPropAsPointer(const wxString& name);
|
||||
|
||||
// methods
|
||||
// VARIANTARG form is passed straight to Invoke,
|
||||
// so args in *REVERSE* order
|
||||
VARIANT CallMethod(MEMBERID name, VARIANTARG args[], int argc);
|
||||
VARIANT CallMethod(const wxString& name, VARIANTARG args[] = NULL, int argc = -1);
|
||||
// args are in *NORMAL* order
|
||||
// args can be a single wxVariant or an array
|
||||
/// \fn wxVariant CallMethod(wxString name, wxVariant args[], int nargs = -1);
|
||||
/// \param name name of method to call
|
||||
/// \param args array of wxVariant's, defaults to NULL (no args)
|
||||
/// \param nargs number of arguments passed via args. Defaults to actual number of args for the method
|
||||
/// \return wxVariant
|
||||
/// \brief Call a method of the ActiveX control.
|
||||
/// Automatically handles most types
|
||||
/// \par Usage:
|
||||
/// - result = CallMethod("\<name\>", args, nargs)
|
||||
/// - e.g.
|
||||
/// - \code
|
||||
/// wxVariant args[] = {0L, "file:///e:/dev/wxie/bug-zap.swf"};
|
||||
/// wxVariant result = X->CallMethod("LoadMovie", args);\endcode
|
||||
/// \exception raises exception if \<name\> is invalid
|
||||
/// \note Since wxVariant has built in type conversion, most the std types can be passed easily
|
||||
wxVariant CallMethod(const wxString& name, wxVariant args[], int nargs = -1);
|
||||
|
||||
HRESULT ConnectAdvise(REFIID riid, IUnknown *eventSink);
|
||||
|
||||
void OnSize(wxSizeEvent&);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnMouse(wxMouseEvent& event);
|
||||
void OnSetFocus(wxFocusEvent&);
|
||||
void OnKillFocus(wxFocusEvent&);
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
protected:
|
||||
friend class FrameSite;
|
||||
friend class wxActiveXEvents;
|
||||
|
||||
unsigned long m_pdwRegister;
|
||||
|
||||
typedef map<MEMBERID, int> MemberIdMap;
|
||||
typedef map<wxString, int, NS_wxActiveX::less_wxStringI> NameMap;
|
||||
|
||||
typedef wxAutoOleInterface<IConnectionPoint> wxOleConnectionPoint;
|
||||
typedef pair<wxOleConnectionPoint, DWORD> wxOleConnection;
|
||||
typedef vector<wxOleConnection> wxOleConnectionArray;
|
||||
|
||||
wxAutoOleInterface<IDispatch> m_Dispatch;
|
||||
wxAutoOleInterface<IOleClientSite> m_clientSite;
|
||||
wxAutoOleInterface<IUnknown> m_ActiveX;
|
||||
wxAutoOleInterface<IOleObject> m_oleObject;
|
||||
wxAutoOleInterface<IOleInPlaceObject> m_oleInPlaceObject;
|
||||
wxAutoOleInterface<IOleInPlaceActiveObject>
|
||||
|
||||
m_oleInPlaceActiveObject;
|
||||
wxAutoOleInterface<IOleDocumentView> m_docView;
|
||||
wxAutoOleInterface<IViewObject> m_viewObject;
|
||||
HWND m_oleObjectHWND;
|
||||
bool m_bAmbientUserMode;
|
||||
DWORD m_docAdviseCookie;
|
||||
wxOleConnectionArray m_connections;
|
||||
|
||||
void CreateActiveX(REFCLSID clsid);
|
||||
void CreateActiveX(LPOLESTR progId);
|
||||
HRESULT AmbientPropertyChanged(DISPID dispid);
|
||||
|
||||
void GetTypeInfo();
|
||||
void GetTypeInfo(ITypeInfo *ti, bool defInterface, bool defEventSink);
|
||||
|
||||
|
||||
// events
|
||||
FuncXArray m_events;
|
||||
MemberIdMap m_eventMemberIds;
|
||||
|
||||
// properties
|
||||
PropXArray m_props;
|
||||
NameMap m_propNames;
|
||||
|
||||
// Methods
|
||||
FuncXArray m_methods;
|
||||
NameMap m_methodNames;
|
||||
|
||||
virtual bool MSWTranslateMessage(WXMSG* pMsg);
|
||||
long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
DECLARE_CLASS(wxActiveX)
|
||||
};
|
||||
|
||||
// events
|
||||
class wxActiveXEvent : public wxCommandEvent
|
||||
{
|
||||
private:
|
||||
friend class wxActiveXEvents;
|
||||
|
||||
wxVariant m_params;
|
||||
|
||||
public:
|
||||
|
||||
virtual wxEvent *Clone() const { return new wxActiveXEvent(*this); }
|
||||
|
||||
wxString EventName();
|
||||
int ParamCount() const;
|
||||
wxString ParamType(int idx);
|
||||
wxString ParamName(int idx);
|
||||
wxVariant& operator[] (int idx);
|
||||
wxVariant& operator[] (wxString name);
|
||||
|
||||
private:
|
||||
DECLARE_CLASS(wxActiveXEvent)
|
||||
};
|
||||
|
||||
const wxEventType& RegisterActiveXEvent(const wxChar *eventName);
|
||||
const wxEventType& RegisterActiveXEvent(DISPID event);
|
||||
|
||||
typedef void (wxEvtHandler::*wxActiveXEventFunction)(wxActiveXEvent&);
|
||||
|
||||
/// \def EVT_ACTIVEX(id, eventName, fn)
|
||||
/// \brief Event handle for events by name
|
||||
#define EVT_ACTIVEX(id, eventName, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(wxT(eventName)), id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ),
|
||||
/// \def EVT_ACTIVEX_DISPID(id, eventDispId, fn)
|
||||
/// \brief Event handle for events by DISPID (dispath id)
|
||||
#define EVT_ACTIVEX_DISPID(id, eventDispId, fn) DECLARE_EVENT_TABLE_ENTRY(RegisterActiveXEvent(eventDispId), id, -1, (wxObjectEventFunction) (wxEventFunction) (wxActiveXEventFunction) & fn, (wxObject *) NULL ),
|
||||
|
||||
//util
|
||||
bool wxDateTimeToVariant(wxDateTime dt, VARIANTARG& va);
|
||||
bool VariantToWxDateTime(VARIANTARG va, wxDateTime& dt);
|
||||
/// \relates wxActiveX
|
||||
/// \fn bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx);
|
||||
/// \param va VARAIANTARG to convert from
|
||||
/// \param vx Destination wxVariant
|
||||
/// \return success/failure (true/false)
|
||||
/// \brief Convert MSW VARIANTARG to wxVariant.
|
||||
/// Handles basic types, need to add:
|
||||
/// - VT_ARRAY | VT_*
|
||||
/// - better support for VT_UNKNOWN (currently treated as void *)
|
||||
/// - better support for VT_DISPATCH (currently treated as void *)
|
||||
bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx);
|
||||
/// \relates wxActiveX
|
||||
/// \fn bool VariantToMSWVariant(const wxVariant& vx, VARIANTARG& va);
|
||||
/// \param vx wxVariant to convert from
|
||||
/// \param va Destination VARIANTARG
|
||||
/// \return success/failure (true/false)
|
||||
/// \brief Convert wxVariant to MSW VARIANTARG.
|
||||
/// Handles basic types, need to add:
|
||||
/// - VT_ARRAY | VT_*
|
||||
/// - better support for VT_UNKNOWN (currently treated as void *)
|
||||
/// - better support for VT_DISPATCH (currently treated as void *)
|
||||
bool VariantToMSWVariant(const wxVariant& vx, VARIANTARG& va);
|
||||
|
||||
#endif /* _IEHTMLWIN_H_ */
|
2
wxPython/contrib/activex/wxie/zip.bat
Executable file
2
wxPython/contrib/activex/wxie/zip.bat
Executable file
@@ -0,0 +1,2 @@
|
||||
del wxie.zip
|
||||
pkzip -max -add -dir -recurse -excl=CVS\*.* -excl=CVS\*.* -excl=debug\*.* wxie *.*
|
16
wxPython/contrib/animate/_animate_rename.i
Normal file
16
wxPython/contrib/animate/_animate_rename.i
Normal file
@@ -0,0 +1,16 @@
|
||||
// A bunch of %rename directives generated by BuildRenamers in config.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef BUILDING_RENAMERS
|
||||
|
||||
%rename(ANIM_UNSPECIFIED) wxANIM_UNSPECIFIED;
|
||||
%rename(ANIM_DONOTREMOVE) wxANIM_DONOTREMOVE;
|
||||
%rename(ANIM_TOBACKGROUND) wxANIM_TOBACKGROUND;
|
||||
%rename(ANIM_TOPREVIOUS) wxANIM_TOPREVIOUS;
|
||||
%rename(AnimationPlayer) wxAnimationPlayer;
|
||||
%rename(AnimationBase) wxAnimationBase;
|
||||
%rename(GIFAnimation) wxGIFAnimation;
|
||||
%rename(AN_FIT_ANIMATION) wxAN_FIT_ANIMATION;
|
||||
%rename(GIFAnimationCtrl) wxGIFAnimationCtrl;
|
||||
|
||||
#endif
|
326
wxPython/contrib/animate/animate.i
Normal file
326
wxPython/contrib/animate/animate.i
Normal file
@@ -0,0 +1,326 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: animate.i
|
||||
// Purpose: Wrappers for the animation classes in wx/contrib
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 4-April-2005
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2005 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%define DOCSTRING
|
||||
"Simple animation player classes, including `GIFAnimationCtrl` for displaying
|
||||
animated GIF files
|
||||
"
|
||||
%enddef
|
||||
|
||||
%module(package="wx", docstring=DOCSTRING) animate
|
||||
|
||||
|
||||
%{
|
||||
#include "wx/wxPython/wxPython.h"
|
||||
#include "wx/wxPython/pyclasses.h"
|
||||
#include <wx/animate/animate.h>
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%import core.i
|
||||
%pythoncode { import wx }
|
||||
%pythoncode { __docfilter__ = wx._core.__DocFilter(globals()) }
|
||||
|
||||
|
||||
MAKE_CONST_WXSTRING2(AnimationControlNameStr, wxT("animationControl"));
|
||||
MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
|
||||
|
||||
%include _animate_rename.i
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
enum wxAnimationDisposal
|
||||
{
|
||||
wxANIM_UNSPECIFIED = -1,
|
||||
wxANIM_DONOTREMOVE = 0,
|
||||
wxANIM_TOBACKGROUND = 1,
|
||||
wxANIM_TOPREVIOUS = 2
|
||||
} ;
|
||||
|
||||
|
||||
/* wxAnimationPlayer
|
||||
* Create an object of this class, and either pass an wxXXXAnimation object in
|
||||
* the constructor, or call SetAnimation. Then call Play(). The wxAnimation
|
||||
* object is only destroyed in the destructor if destroyAnimation is true in
|
||||
* the constructor.
|
||||
*/
|
||||
|
||||
class wxAnimationPlayer : public wxObject
|
||||
{
|
||||
public:
|
||||
wxAnimationPlayer(wxAnimationBase *animation = NULL,
|
||||
bool destroyAnimation = false);
|
||||
~wxAnimationPlayer();
|
||||
|
||||
|
||||
void SetAnimation(wxAnimationBase* animation, bool destroyAnimation = false);
|
||||
wxAnimationBase* GetAnimation() const;
|
||||
|
||||
void SetDestroyAnimation(bool destroyAnimation);
|
||||
bool GetDestroyAnimation() const;
|
||||
|
||||
void SetCurrentFrame(int currentFrame);
|
||||
int GetCurrentFrame() const;
|
||||
|
||||
void SetWindow(wxWindow* window);
|
||||
wxWindow* GetWindow() const;
|
||||
|
||||
void SetPosition(const wxPoint& pos);
|
||||
wxPoint GetPosition() const;
|
||||
|
||||
void SetLooped(bool looped);
|
||||
bool GetLooped() const;
|
||||
|
||||
bool HasAnimation() const;
|
||||
|
||||
bool IsPlaying() const;
|
||||
|
||||
// Specify whether the GIF's background colour is to be shown,
|
||||
// or whether the window background should show through (the default)
|
||||
void UseBackgroundColour(bool useBackground);
|
||||
bool UsingBackgroundColour() const;
|
||||
|
||||
// Set and use a user-specified background colour (valid for transparent
|
||||
// animations only)
|
||||
void SetCustomBackgroundColour(const wxColour& col,
|
||||
bool useCustomBackgroundColour = true);
|
||||
|
||||
bool UsingCustomBackgroundColour() const;
|
||||
const wxColour& GetCustomBackgroundColour() const;
|
||||
|
||||
// Another refinement - suppose we're drawing the animation in a separate
|
||||
// control or window. We may wish to use the background of the parent
|
||||
// window as the background of our animation. This allows us to specify
|
||||
// whether to grab from the parent or from this window.
|
||||
void UseParentBackground(bool useParent);
|
||||
bool UsingParentBackground() const;
|
||||
|
||||
|
||||
// Play
|
||||
virtual bool Play(wxWindow& window, const wxPoint& pos = wxPoint(0, 0), bool looped = true);
|
||||
|
||||
// Build animation (list of wxImages). If not called before Play
|
||||
// is called, Play will call this automatically.
|
||||
virtual bool Build();
|
||||
|
||||
// Stop the animation
|
||||
virtual void Stop();
|
||||
|
||||
// Draw the current view of the animation into this DC.
|
||||
// Call this from your OnPaint, for example.
|
||||
virtual void Draw(wxDC& dc);
|
||||
|
||||
|
||||
virtual int GetFrameCount() const;
|
||||
%newobject GetFrame;
|
||||
virtual wxImage* GetFrame(int i) const; // Creates a new wxImage
|
||||
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
|
||||
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
|
||||
virtual int GetDelay(int i) const; // Delay for this frame
|
||||
|
||||
virtual wxSize GetLogicalScreenSize() const;
|
||||
virtual bool GetBackgroundColour(wxColour& col) const ;
|
||||
virtual bool GetTransparentColour(wxColour& col) const ;
|
||||
|
||||
|
||||
// Play the frame
|
||||
virtual bool PlayFrame(int frame, wxWindow& window, const wxPoint& pos);
|
||||
%Rename(PlayNextFrame,
|
||||
virtual bool, PlayFrame());
|
||||
|
||||
virtual void DrawFrame(int frame, wxDC& dc, const wxPoint& pos);
|
||||
virtual void DrawBackground(wxDC& dc, const wxPoint& pos, const wxColour& colour);
|
||||
|
||||
// Clear the wxImage cache
|
||||
virtual void ClearCache();
|
||||
|
||||
// Save the pertinent area of the window so we can restore
|
||||
// it if drawing transparently
|
||||
void SaveBackground(const wxRect& rect);
|
||||
|
||||
wxBitmap& GetBackingStore();
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/* wxAnimationBase
|
||||
* Base class for animations.
|
||||
* A wxXXXAnimation only stores the animation, providing accessors to
|
||||
* wxAnimationPlayer. Currently an animation is read-only, but we could
|
||||
* extend the API for adding frames programmatically, and perhaps have a
|
||||
* wxMemoryAnimation class that stores its frames in memory, and is able to
|
||||
* save all files with suitable filenames. You could then use e.g. Ulead GIF
|
||||
* Animator to load the image files into a GIF animation.
|
||||
*/
|
||||
|
||||
class wxAnimationBase : public wxObject
|
||||
{
|
||||
public:
|
||||
//wxAnimationBase() {}; // It's an ABC
|
||||
~wxAnimationBase() {};
|
||||
|
||||
//// Accessors. Should be overridden by each derived class.
|
||||
|
||||
virtual int GetFrameCount() const;
|
||||
%newobject GetFrame;
|
||||
virtual wxImage* GetFrame(int i) const;
|
||||
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
|
||||
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
|
||||
virtual int GetDelay(int i) const; // Delay for this frame
|
||||
|
||||
virtual wxSize GetLogicalScreenSize() const;
|
||||
virtual bool GetBackgroundColour(wxColour& col) const;
|
||||
virtual bool GetTransparentColour(wxColour& col) const;
|
||||
|
||||
// Is the animation OK?
|
||||
virtual bool IsValid() const;
|
||||
|
||||
virtual bool LoadFile(const wxString& filename);
|
||||
};
|
||||
|
||||
|
||||
// TODO: Add a wxPyAnimationBase class
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/* wxGIFAnimation
|
||||
* This will be moved to a separate file in due course.
|
||||
*/
|
||||
class wxGIFAnimation : public wxAnimationBase
|
||||
{
|
||||
public:
|
||||
wxGIFAnimation() ;
|
||||
~wxGIFAnimation() ;
|
||||
|
||||
//// Accessors
|
||||
|
||||
virtual int GetFrameCount() const;
|
||||
%newobject GetFrame;
|
||||
virtual wxImage* GetFrame(int i) const;
|
||||
virtual wxAnimationDisposal GetDisposalMethod(int i) const;
|
||||
virtual wxRect GetFrameRect(int i) const; // Position and size of frame
|
||||
virtual int GetDelay(int i) const; // Delay for this frame
|
||||
|
||||
virtual wxSize GetLogicalScreenSize() const ;
|
||||
virtual bool GetBackgroundColour(wxColour& col) const ;
|
||||
virtual bool GetTransparentColour(wxColour& col) const ;
|
||||
|
||||
virtual bool IsValid() const;
|
||||
|
||||
//// Operations
|
||||
|
||||
virtual bool LoadFile(const wxString& filename);
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* wxAnimationCtrlBase
|
||||
* Abstract base class for format-specific animation controls.
|
||||
* This class implements most of the functionality; all a derived
|
||||
* class has to do is create the appropriate animation class on demand.
|
||||
*/
|
||||
|
||||
// Resize to animation size if this is set
|
||||
enum { wxAN_FIT_ANIMATION };
|
||||
|
||||
|
||||
// class wxAnimationCtrlBase: public wxControl
|
||||
// {
|
||||
// public:
|
||||
// %pythonAppend wxAnimationCtrlBase "self._setOORInfo(self)"
|
||||
// %pythonAppend wxAnimationCtrlBase() ""
|
||||
|
||||
// wxAnimationCtrlBase(wxWindow *parent, wxWindowID id,
|
||||
// const wxString& filename = wxPyEmptyString,
|
||||
// const wxPoint& pos = wxDefaultPosition,
|
||||
// const wxSize& size = wxDefaultSize,
|
||||
// long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
// const wxString& name = wxPyAnimationControlNameStr);
|
||||
// %RenameCtor(PreAnimationCtrlBase, wxAnimationCtrlBase());
|
||||
|
||||
// bool Create(wxWindow *parent, wxWindowID id,
|
||||
// const wxString& filename = wxPyEmptyString,
|
||||
// const wxPoint& pos = wxDefaultPosition,
|
||||
// const wxSize& size = wxDefaultSize,
|
||||
// long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
// const wxString& name = wxPyAnimationControlNameStr);
|
||||
|
||||
// //// Operations
|
||||
// virtual bool LoadFile(const wxString& filename = wxPyEmptyString);
|
||||
// virtual bool Play(bool looped = true) ;
|
||||
// virtual void Stop();
|
||||
// virtual void FitToAnimation();
|
||||
|
||||
// //// Accessors
|
||||
// virtual bool IsPlaying() const;
|
||||
// virtual wxAnimationPlayer& GetPlayer();
|
||||
// virtual wxAnimationBase* GetAnimation();
|
||||
|
||||
// const wxString& GetFilename() const;
|
||||
// void SetFilename(const wxString& filename);
|
||||
|
||||
// };
|
||||
|
||||
|
||||
/*
|
||||
* wxGIFAnimationCtrl
|
||||
* Provides a GIF animation class when required.
|
||||
*/
|
||||
|
||||
MustHaveApp(wxGIFAnimationCtrl);
|
||||
class wxGIFAnimationCtrl: public wxControl //wxAnimationCtrlBase
|
||||
{
|
||||
public:
|
||||
%pythonAppend wxGIFAnimationCtrl "self._setOORInfo(self)"
|
||||
%pythonAppend wxGIFAnimationCtrl() ""
|
||||
|
||||
wxGIFAnimationCtrl(wxWindow *parent, wxWindowID id=-1,
|
||||
const wxString& filename = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
const wxString& name = wxPyAnimationControlNameStr);
|
||||
%RenameCtor(PreGIFAnimationCtrl, wxGIFAnimationCtrl());
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id=-1,
|
||||
const wxString& filename = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
const wxString& name = wxPyAnimationControlNameStr);
|
||||
|
||||
//// Operations
|
||||
virtual bool LoadFile(const wxString& filename = wxPyEmptyString);
|
||||
virtual bool Play(bool looped = true) ;
|
||||
virtual void Stop();
|
||||
virtual void FitToAnimation();
|
||||
|
||||
//// Accessors
|
||||
virtual bool IsPlaying() const;
|
||||
virtual wxAnimationPlayer& GetPlayer();
|
||||
virtual wxAnimationBase* GetAnimation();
|
||||
|
||||
const wxString& GetFilename() const;
|
||||
void SetFilename(const wxString& filename);
|
||||
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
|
446
wxPython/contrib/animate/gtk/animate.py
Normal file
446
wxPython/contrib/animate/gtk/animate.py
Normal file
@@ -0,0 +1,446 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
Simple animation player classes, including `GIFAnimationCtrl` for displaying
|
||||
animated GIF files
|
||||
|
||||
"""
|
||||
|
||||
import _animate
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
import wx
|
||||
__docfilter__ = wx._core.__DocFilter(globals())
|
||||
ANIM_UNSPECIFIED = _animate.ANIM_UNSPECIFIED
|
||||
ANIM_DONOTREMOVE = _animate.ANIM_DONOTREMOVE
|
||||
ANIM_TOBACKGROUND = _animate.ANIM_TOBACKGROUND
|
||||
ANIM_TOPREVIOUS = _animate.ANIM_TOPREVIOUS
|
||||
class AnimationPlayer(_core.Object):
|
||||
"""Proxy of C++ AnimationPlayer class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxAnimationPlayer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, AnimationBase animation=None, bool destroyAnimation=False) -> AnimationPlayer"""
|
||||
newobj = _animate.new_AnimationPlayer(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_animate.delete_AnimationPlayer):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def SetAnimation(*args, **kwargs):
|
||||
"""SetAnimation(self, AnimationBase animation, bool destroyAnimation=False)"""
|
||||
return _animate.AnimationPlayer_SetAnimation(*args, **kwargs)
|
||||
|
||||
def GetAnimation(*args, **kwargs):
|
||||
"""GetAnimation(self) -> AnimationBase"""
|
||||
return _animate.AnimationPlayer_GetAnimation(*args, **kwargs)
|
||||
|
||||
def SetDestroyAnimation(*args, **kwargs):
|
||||
"""SetDestroyAnimation(self, bool destroyAnimation)"""
|
||||
return _animate.AnimationPlayer_SetDestroyAnimation(*args, **kwargs)
|
||||
|
||||
def GetDestroyAnimation(*args, **kwargs):
|
||||
"""GetDestroyAnimation(self) -> bool"""
|
||||
return _animate.AnimationPlayer_GetDestroyAnimation(*args, **kwargs)
|
||||
|
||||
def SetCurrentFrame(*args, **kwargs):
|
||||
"""SetCurrentFrame(self, int currentFrame)"""
|
||||
return _animate.AnimationPlayer_SetCurrentFrame(*args, **kwargs)
|
||||
|
||||
def GetCurrentFrame(*args, **kwargs):
|
||||
"""GetCurrentFrame(self) -> int"""
|
||||
return _animate.AnimationPlayer_GetCurrentFrame(*args, **kwargs)
|
||||
|
||||
def SetWindow(*args, **kwargs):
|
||||
"""SetWindow(self, Window window)"""
|
||||
return _animate.AnimationPlayer_SetWindow(*args, **kwargs)
|
||||
|
||||
def GetWindow(*args, **kwargs):
|
||||
"""GetWindow(self) -> Window"""
|
||||
return _animate.AnimationPlayer_GetWindow(*args, **kwargs)
|
||||
|
||||
def SetPosition(*args, **kwargs):
|
||||
"""SetPosition(self, Point pos)"""
|
||||
return _animate.AnimationPlayer_SetPosition(*args, **kwargs)
|
||||
|
||||
def GetPosition(*args, **kwargs):
|
||||
"""GetPosition(self) -> Point"""
|
||||
return _animate.AnimationPlayer_GetPosition(*args, **kwargs)
|
||||
|
||||
def SetLooped(*args, **kwargs):
|
||||
"""SetLooped(self, bool looped)"""
|
||||
return _animate.AnimationPlayer_SetLooped(*args, **kwargs)
|
||||
|
||||
def GetLooped(*args, **kwargs):
|
||||
"""GetLooped(self) -> bool"""
|
||||
return _animate.AnimationPlayer_GetLooped(*args, **kwargs)
|
||||
|
||||
def HasAnimation(*args, **kwargs):
|
||||
"""HasAnimation(self) -> bool"""
|
||||
return _animate.AnimationPlayer_HasAnimation(*args, **kwargs)
|
||||
|
||||
def IsPlaying(*args, **kwargs):
|
||||
"""IsPlaying(self) -> bool"""
|
||||
return _animate.AnimationPlayer_IsPlaying(*args, **kwargs)
|
||||
|
||||
def UseBackgroundColour(*args, **kwargs):
|
||||
"""UseBackgroundColour(self, bool useBackground)"""
|
||||
return _animate.AnimationPlayer_UseBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UsingBackgroundColour(*args, **kwargs):
|
||||
"""UsingBackgroundColour(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingBackgroundColour(*args, **kwargs)
|
||||
|
||||
def SetCustomBackgroundColour(*args, **kwargs):
|
||||
"""SetCustomBackgroundColour(self, Colour col, bool useCustomBackgroundColour=True)"""
|
||||
return _animate.AnimationPlayer_SetCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UsingCustomBackgroundColour(*args, **kwargs):
|
||||
"""UsingCustomBackgroundColour(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetCustomBackgroundColour(*args, **kwargs):
|
||||
"""GetCustomBackgroundColour(self) -> Colour"""
|
||||
return _animate.AnimationPlayer_GetCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UseParentBackground(*args, **kwargs):
|
||||
"""UseParentBackground(self, bool useParent)"""
|
||||
return _animate.AnimationPlayer_UseParentBackground(*args, **kwargs)
|
||||
|
||||
def UsingParentBackground(*args, **kwargs):
|
||||
"""UsingParentBackground(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingParentBackground(*args, **kwargs)
|
||||
|
||||
def Play(*args, **kwargs):
|
||||
"""Play(self, Window window, Point pos=wxPoint(0, 0), bool looped=True) -> bool"""
|
||||
return _animate.AnimationPlayer_Play(*args, **kwargs)
|
||||
|
||||
def Build(*args, **kwargs):
|
||||
"""Build(self) -> bool"""
|
||||
return _animate.AnimationPlayer_Build(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _animate.AnimationPlayer_Stop(*args, **kwargs)
|
||||
|
||||
def Draw(*args, **kwargs):
|
||||
"""Draw(self, DC dc)"""
|
||||
return _animate.AnimationPlayer_Draw(*args, **kwargs)
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.AnimationPlayer_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.AnimationPlayer_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.AnimationPlayer_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.AnimationPlayer_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.AnimationPlayer_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.AnimationPlayer_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationPlayer_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationPlayer_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def PlayFrame(*args, **kwargs):
|
||||
"""PlayFrame(self, int frame, Window window, Point pos) -> bool"""
|
||||
return _animate.AnimationPlayer_PlayFrame(*args, **kwargs)
|
||||
|
||||
def PlayNextFrame(*args, **kwargs):
|
||||
"""PlayNextFrame(self) -> bool"""
|
||||
return _animate.AnimationPlayer_PlayNextFrame(*args, **kwargs)
|
||||
|
||||
def DrawFrame(*args, **kwargs):
|
||||
"""DrawFrame(self, int frame, DC dc, Point pos)"""
|
||||
return _animate.AnimationPlayer_DrawFrame(*args, **kwargs)
|
||||
|
||||
def DrawBackground(*args, **kwargs):
|
||||
"""DrawBackground(self, DC dc, Point pos, Colour colour)"""
|
||||
return _animate.AnimationPlayer_DrawBackground(*args, **kwargs)
|
||||
|
||||
def ClearCache(*args, **kwargs):
|
||||
"""ClearCache(self)"""
|
||||
return _animate.AnimationPlayer_ClearCache(*args, **kwargs)
|
||||
|
||||
def SaveBackground(*args, **kwargs):
|
||||
"""SaveBackground(self, Rect rect)"""
|
||||
return _animate.AnimationPlayer_SaveBackground(*args, **kwargs)
|
||||
|
||||
def GetBackingStore(*args, **kwargs):
|
||||
"""GetBackingStore(self) -> Bitmap"""
|
||||
return _animate.AnimationPlayer_GetBackingStore(*args, **kwargs)
|
||||
|
||||
|
||||
class AnimationPlayerPtr(AnimationPlayer):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = AnimationPlayer
|
||||
_animate.AnimationPlayer_swigregister(AnimationPlayerPtr)
|
||||
cvar = _animate.cvar
|
||||
AnimationControlNameStr = cvar.AnimationControlNameStr
|
||||
|
||||
class AnimationBase(_core.Object):
|
||||
"""Proxy of C++ AnimationBase class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxAnimationBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __del__(self, destroy=_animate.delete_AnimationBase):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.AnimationBase_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.AnimationBase_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.AnimationBase_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.AnimationBase_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.AnimationBase_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.AnimationBase_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationBase_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationBase_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def IsValid(*args, **kwargs):
|
||||
"""IsValid(self) -> bool"""
|
||||
return _animate.AnimationBase_IsValid(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename) -> bool"""
|
||||
return _animate.AnimationBase_LoadFile(*args, **kwargs)
|
||||
|
||||
|
||||
class AnimationBasePtr(AnimationBase):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = AnimationBase
|
||||
_animate.AnimationBase_swigregister(AnimationBasePtr)
|
||||
|
||||
class GIFAnimation(AnimationBase):
|
||||
"""Proxy of C++ GIFAnimation class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGIFAnimation instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self) -> GIFAnimation"""
|
||||
newobj = _animate.new_GIFAnimation(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_animate.delete_GIFAnimation):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.GIFAnimation_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.GIFAnimation_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.GIFAnimation_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.GIFAnimation_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.GIFAnimation_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.GIFAnimation_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.GIFAnimation_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.GIFAnimation_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def IsValid(*args, **kwargs):
|
||||
"""IsValid(self) -> bool"""
|
||||
return _animate.GIFAnimation_IsValid(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename) -> bool"""
|
||||
return _animate.GIFAnimation_LoadFile(*args, **kwargs)
|
||||
|
||||
|
||||
class GIFAnimationPtr(GIFAnimation):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GIFAnimation
|
||||
_animate.GIFAnimation_swigregister(GIFAnimationPtr)
|
||||
|
||||
AN_FIT_ANIMATION = _animate.AN_FIT_ANIMATION
|
||||
class GIFAnimationCtrl(_core.Control):
|
||||
"""Proxy of C++ GIFAnimationCtrl class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGIFAnimationCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, String filename=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
String name=AnimationControlNameStr) -> GIFAnimationCtrl
|
||||
"""
|
||||
newobj = _animate.new_GIFAnimationCtrl(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def Create(*args, **kwargs):
|
||||
"""
|
||||
Create(self, Window parent, int id=-1, String filename=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
String name=AnimationControlNameStr) -> bool
|
||||
"""
|
||||
return _animate.GIFAnimationCtrl_Create(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename=EmptyString) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_LoadFile(*args, **kwargs)
|
||||
|
||||
def Play(*args, **kwargs):
|
||||
"""Play(self, bool looped=True) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_Play(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _animate.GIFAnimationCtrl_Stop(*args, **kwargs)
|
||||
|
||||
def FitToAnimation(*args, **kwargs):
|
||||
"""FitToAnimation(self)"""
|
||||
return _animate.GIFAnimationCtrl_FitToAnimation(*args, **kwargs)
|
||||
|
||||
def IsPlaying(*args, **kwargs):
|
||||
"""IsPlaying(self) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_IsPlaying(*args, **kwargs)
|
||||
|
||||
def GetPlayer(*args, **kwargs):
|
||||
"""GetPlayer(self) -> AnimationPlayer"""
|
||||
return _animate.GIFAnimationCtrl_GetPlayer(*args, **kwargs)
|
||||
|
||||
def GetAnimation(*args, **kwargs):
|
||||
"""GetAnimation(self) -> AnimationBase"""
|
||||
return _animate.GIFAnimationCtrl_GetAnimation(*args, **kwargs)
|
||||
|
||||
def GetFilename(*args, **kwargs):
|
||||
"""GetFilename(self) -> String"""
|
||||
return _animate.GIFAnimationCtrl_GetFilename(*args, **kwargs)
|
||||
|
||||
def SetFilename(*args, **kwargs):
|
||||
"""SetFilename(self, String filename)"""
|
||||
return _animate.GIFAnimationCtrl_SetFilename(*args, **kwargs)
|
||||
|
||||
|
||||
class GIFAnimationCtrlPtr(GIFAnimationCtrl):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GIFAnimationCtrl
|
||||
_animate.GIFAnimationCtrl_swigregister(GIFAnimationCtrlPtr)
|
||||
|
||||
def PreGIFAnimationCtrl(*args, **kwargs):
|
||||
"""PreGIFAnimationCtrl() -> GIFAnimationCtrl"""
|
||||
val = _animate.new_PreGIFAnimationCtrl(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
|
5025
wxPython/contrib/animate/gtk/animate_wrap.cpp
Normal file
5025
wxPython/contrib/animate/gtk/animate_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
446
wxPython/contrib/animate/mac/animate.py
Normal file
446
wxPython/contrib/animate/mac/animate.py
Normal file
@@ -0,0 +1,446 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
Simple animation player classes, including `GIFAnimationCtrl` for displaying
|
||||
animated GIF files
|
||||
|
||||
"""
|
||||
|
||||
import _animate
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
import wx
|
||||
__docfilter__ = wx._core.__DocFilter(globals())
|
||||
ANIM_UNSPECIFIED = _animate.ANIM_UNSPECIFIED
|
||||
ANIM_DONOTREMOVE = _animate.ANIM_DONOTREMOVE
|
||||
ANIM_TOBACKGROUND = _animate.ANIM_TOBACKGROUND
|
||||
ANIM_TOPREVIOUS = _animate.ANIM_TOPREVIOUS
|
||||
class AnimationPlayer(_core.Object):
|
||||
"""Proxy of C++ AnimationPlayer class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxAnimationPlayer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, AnimationBase animation=None, bool destroyAnimation=False) -> AnimationPlayer"""
|
||||
newobj = _animate.new_AnimationPlayer(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_animate.delete_AnimationPlayer):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def SetAnimation(*args, **kwargs):
|
||||
"""SetAnimation(self, AnimationBase animation, bool destroyAnimation=False)"""
|
||||
return _animate.AnimationPlayer_SetAnimation(*args, **kwargs)
|
||||
|
||||
def GetAnimation(*args, **kwargs):
|
||||
"""GetAnimation(self) -> AnimationBase"""
|
||||
return _animate.AnimationPlayer_GetAnimation(*args, **kwargs)
|
||||
|
||||
def SetDestroyAnimation(*args, **kwargs):
|
||||
"""SetDestroyAnimation(self, bool destroyAnimation)"""
|
||||
return _animate.AnimationPlayer_SetDestroyAnimation(*args, **kwargs)
|
||||
|
||||
def GetDestroyAnimation(*args, **kwargs):
|
||||
"""GetDestroyAnimation(self) -> bool"""
|
||||
return _animate.AnimationPlayer_GetDestroyAnimation(*args, **kwargs)
|
||||
|
||||
def SetCurrentFrame(*args, **kwargs):
|
||||
"""SetCurrentFrame(self, int currentFrame)"""
|
||||
return _animate.AnimationPlayer_SetCurrentFrame(*args, **kwargs)
|
||||
|
||||
def GetCurrentFrame(*args, **kwargs):
|
||||
"""GetCurrentFrame(self) -> int"""
|
||||
return _animate.AnimationPlayer_GetCurrentFrame(*args, **kwargs)
|
||||
|
||||
def SetWindow(*args, **kwargs):
|
||||
"""SetWindow(self, Window window)"""
|
||||
return _animate.AnimationPlayer_SetWindow(*args, **kwargs)
|
||||
|
||||
def GetWindow(*args, **kwargs):
|
||||
"""GetWindow(self) -> Window"""
|
||||
return _animate.AnimationPlayer_GetWindow(*args, **kwargs)
|
||||
|
||||
def SetPosition(*args, **kwargs):
|
||||
"""SetPosition(self, Point pos)"""
|
||||
return _animate.AnimationPlayer_SetPosition(*args, **kwargs)
|
||||
|
||||
def GetPosition(*args, **kwargs):
|
||||
"""GetPosition(self) -> Point"""
|
||||
return _animate.AnimationPlayer_GetPosition(*args, **kwargs)
|
||||
|
||||
def SetLooped(*args, **kwargs):
|
||||
"""SetLooped(self, bool looped)"""
|
||||
return _animate.AnimationPlayer_SetLooped(*args, **kwargs)
|
||||
|
||||
def GetLooped(*args, **kwargs):
|
||||
"""GetLooped(self) -> bool"""
|
||||
return _animate.AnimationPlayer_GetLooped(*args, **kwargs)
|
||||
|
||||
def HasAnimation(*args, **kwargs):
|
||||
"""HasAnimation(self) -> bool"""
|
||||
return _animate.AnimationPlayer_HasAnimation(*args, **kwargs)
|
||||
|
||||
def IsPlaying(*args, **kwargs):
|
||||
"""IsPlaying(self) -> bool"""
|
||||
return _animate.AnimationPlayer_IsPlaying(*args, **kwargs)
|
||||
|
||||
def UseBackgroundColour(*args, **kwargs):
|
||||
"""UseBackgroundColour(self, bool useBackground)"""
|
||||
return _animate.AnimationPlayer_UseBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UsingBackgroundColour(*args, **kwargs):
|
||||
"""UsingBackgroundColour(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingBackgroundColour(*args, **kwargs)
|
||||
|
||||
def SetCustomBackgroundColour(*args, **kwargs):
|
||||
"""SetCustomBackgroundColour(self, Colour col, bool useCustomBackgroundColour=True)"""
|
||||
return _animate.AnimationPlayer_SetCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UsingCustomBackgroundColour(*args, **kwargs):
|
||||
"""UsingCustomBackgroundColour(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetCustomBackgroundColour(*args, **kwargs):
|
||||
"""GetCustomBackgroundColour(self) -> Colour"""
|
||||
return _animate.AnimationPlayer_GetCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UseParentBackground(*args, **kwargs):
|
||||
"""UseParentBackground(self, bool useParent)"""
|
||||
return _animate.AnimationPlayer_UseParentBackground(*args, **kwargs)
|
||||
|
||||
def UsingParentBackground(*args, **kwargs):
|
||||
"""UsingParentBackground(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingParentBackground(*args, **kwargs)
|
||||
|
||||
def Play(*args, **kwargs):
|
||||
"""Play(self, Window window, Point pos=wxPoint(0, 0), bool looped=True) -> bool"""
|
||||
return _animate.AnimationPlayer_Play(*args, **kwargs)
|
||||
|
||||
def Build(*args, **kwargs):
|
||||
"""Build(self) -> bool"""
|
||||
return _animate.AnimationPlayer_Build(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _animate.AnimationPlayer_Stop(*args, **kwargs)
|
||||
|
||||
def Draw(*args, **kwargs):
|
||||
"""Draw(self, DC dc)"""
|
||||
return _animate.AnimationPlayer_Draw(*args, **kwargs)
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.AnimationPlayer_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.AnimationPlayer_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.AnimationPlayer_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.AnimationPlayer_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.AnimationPlayer_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.AnimationPlayer_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationPlayer_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationPlayer_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def PlayFrame(*args, **kwargs):
|
||||
"""PlayFrame(self, int frame, Window window, Point pos) -> bool"""
|
||||
return _animate.AnimationPlayer_PlayFrame(*args, **kwargs)
|
||||
|
||||
def PlayNextFrame(*args, **kwargs):
|
||||
"""PlayNextFrame(self) -> bool"""
|
||||
return _animate.AnimationPlayer_PlayNextFrame(*args, **kwargs)
|
||||
|
||||
def DrawFrame(*args, **kwargs):
|
||||
"""DrawFrame(self, int frame, DC dc, Point pos)"""
|
||||
return _animate.AnimationPlayer_DrawFrame(*args, **kwargs)
|
||||
|
||||
def DrawBackground(*args, **kwargs):
|
||||
"""DrawBackground(self, DC dc, Point pos, Colour colour)"""
|
||||
return _animate.AnimationPlayer_DrawBackground(*args, **kwargs)
|
||||
|
||||
def ClearCache(*args, **kwargs):
|
||||
"""ClearCache(self)"""
|
||||
return _animate.AnimationPlayer_ClearCache(*args, **kwargs)
|
||||
|
||||
def SaveBackground(*args, **kwargs):
|
||||
"""SaveBackground(self, Rect rect)"""
|
||||
return _animate.AnimationPlayer_SaveBackground(*args, **kwargs)
|
||||
|
||||
def GetBackingStore(*args, **kwargs):
|
||||
"""GetBackingStore(self) -> Bitmap"""
|
||||
return _animate.AnimationPlayer_GetBackingStore(*args, **kwargs)
|
||||
|
||||
|
||||
class AnimationPlayerPtr(AnimationPlayer):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = AnimationPlayer
|
||||
_animate.AnimationPlayer_swigregister(AnimationPlayerPtr)
|
||||
cvar = _animate.cvar
|
||||
AnimationControlNameStr = cvar.AnimationControlNameStr
|
||||
|
||||
class AnimationBase(_core.Object):
|
||||
"""Proxy of C++ AnimationBase class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxAnimationBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __del__(self, destroy=_animate.delete_AnimationBase):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.AnimationBase_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.AnimationBase_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.AnimationBase_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.AnimationBase_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.AnimationBase_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.AnimationBase_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationBase_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationBase_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def IsValid(*args, **kwargs):
|
||||
"""IsValid(self) -> bool"""
|
||||
return _animate.AnimationBase_IsValid(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename) -> bool"""
|
||||
return _animate.AnimationBase_LoadFile(*args, **kwargs)
|
||||
|
||||
|
||||
class AnimationBasePtr(AnimationBase):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = AnimationBase
|
||||
_animate.AnimationBase_swigregister(AnimationBasePtr)
|
||||
|
||||
class GIFAnimation(AnimationBase):
|
||||
"""Proxy of C++ GIFAnimation class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGIFAnimation instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self) -> GIFAnimation"""
|
||||
newobj = _animate.new_GIFAnimation(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_animate.delete_GIFAnimation):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.GIFAnimation_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.GIFAnimation_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.GIFAnimation_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.GIFAnimation_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.GIFAnimation_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.GIFAnimation_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.GIFAnimation_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.GIFAnimation_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def IsValid(*args, **kwargs):
|
||||
"""IsValid(self) -> bool"""
|
||||
return _animate.GIFAnimation_IsValid(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename) -> bool"""
|
||||
return _animate.GIFAnimation_LoadFile(*args, **kwargs)
|
||||
|
||||
|
||||
class GIFAnimationPtr(GIFAnimation):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GIFAnimation
|
||||
_animate.GIFAnimation_swigregister(GIFAnimationPtr)
|
||||
|
||||
AN_FIT_ANIMATION = _animate.AN_FIT_ANIMATION
|
||||
class GIFAnimationCtrl(_core.Control):
|
||||
"""Proxy of C++ GIFAnimationCtrl class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGIFAnimationCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, String filename=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
String name=AnimationControlNameStr) -> GIFAnimationCtrl
|
||||
"""
|
||||
newobj = _animate.new_GIFAnimationCtrl(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def Create(*args, **kwargs):
|
||||
"""
|
||||
Create(self, Window parent, int id=-1, String filename=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
String name=AnimationControlNameStr) -> bool
|
||||
"""
|
||||
return _animate.GIFAnimationCtrl_Create(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename=EmptyString) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_LoadFile(*args, **kwargs)
|
||||
|
||||
def Play(*args, **kwargs):
|
||||
"""Play(self, bool looped=True) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_Play(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _animate.GIFAnimationCtrl_Stop(*args, **kwargs)
|
||||
|
||||
def FitToAnimation(*args, **kwargs):
|
||||
"""FitToAnimation(self)"""
|
||||
return _animate.GIFAnimationCtrl_FitToAnimation(*args, **kwargs)
|
||||
|
||||
def IsPlaying(*args, **kwargs):
|
||||
"""IsPlaying(self) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_IsPlaying(*args, **kwargs)
|
||||
|
||||
def GetPlayer(*args, **kwargs):
|
||||
"""GetPlayer(self) -> AnimationPlayer"""
|
||||
return _animate.GIFAnimationCtrl_GetPlayer(*args, **kwargs)
|
||||
|
||||
def GetAnimation(*args, **kwargs):
|
||||
"""GetAnimation(self) -> AnimationBase"""
|
||||
return _animate.GIFAnimationCtrl_GetAnimation(*args, **kwargs)
|
||||
|
||||
def GetFilename(*args, **kwargs):
|
||||
"""GetFilename(self) -> String"""
|
||||
return _animate.GIFAnimationCtrl_GetFilename(*args, **kwargs)
|
||||
|
||||
def SetFilename(*args, **kwargs):
|
||||
"""SetFilename(self, String filename)"""
|
||||
return _animate.GIFAnimationCtrl_SetFilename(*args, **kwargs)
|
||||
|
||||
|
||||
class GIFAnimationCtrlPtr(GIFAnimationCtrl):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GIFAnimationCtrl
|
||||
_animate.GIFAnimationCtrl_swigregister(GIFAnimationCtrlPtr)
|
||||
|
||||
def PreGIFAnimationCtrl(*args, **kwargs):
|
||||
"""PreGIFAnimationCtrl() -> GIFAnimationCtrl"""
|
||||
val = _animate.new_PreGIFAnimationCtrl(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
|
5025
wxPython/contrib/animate/mac/animate_wrap.cpp
Normal file
5025
wxPython/contrib/animate/mac/animate_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
446
wxPython/contrib/animate/msw/animate.py
Normal file
446
wxPython/contrib/animate/msw/animate.py
Normal file
@@ -0,0 +1,446 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
Simple animation player classes, including `GIFAnimationCtrl` for displaying
|
||||
animated GIF files
|
||||
|
||||
"""
|
||||
|
||||
import _animate
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
import wx
|
||||
__docfilter__ = wx._core.__DocFilter(globals())
|
||||
ANIM_UNSPECIFIED = _animate.ANIM_UNSPECIFIED
|
||||
ANIM_DONOTREMOVE = _animate.ANIM_DONOTREMOVE
|
||||
ANIM_TOBACKGROUND = _animate.ANIM_TOBACKGROUND
|
||||
ANIM_TOPREVIOUS = _animate.ANIM_TOPREVIOUS
|
||||
class AnimationPlayer(_core.Object):
|
||||
"""Proxy of C++ AnimationPlayer class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxAnimationPlayer instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, AnimationBase animation=None, bool destroyAnimation=False) -> AnimationPlayer"""
|
||||
newobj = _animate.new_AnimationPlayer(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_animate.delete_AnimationPlayer):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def SetAnimation(*args, **kwargs):
|
||||
"""SetAnimation(self, AnimationBase animation, bool destroyAnimation=False)"""
|
||||
return _animate.AnimationPlayer_SetAnimation(*args, **kwargs)
|
||||
|
||||
def GetAnimation(*args, **kwargs):
|
||||
"""GetAnimation(self) -> AnimationBase"""
|
||||
return _animate.AnimationPlayer_GetAnimation(*args, **kwargs)
|
||||
|
||||
def SetDestroyAnimation(*args, **kwargs):
|
||||
"""SetDestroyAnimation(self, bool destroyAnimation)"""
|
||||
return _animate.AnimationPlayer_SetDestroyAnimation(*args, **kwargs)
|
||||
|
||||
def GetDestroyAnimation(*args, **kwargs):
|
||||
"""GetDestroyAnimation(self) -> bool"""
|
||||
return _animate.AnimationPlayer_GetDestroyAnimation(*args, **kwargs)
|
||||
|
||||
def SetCurrentFrame(*args, **kwargs):
|
||||
"""SetCurrentFrame(self, int currentFrame)"""
|
||||
return _animate.AnimationPlayer_SetCurrentFrame(*args, **kwargs)
|
||||
|
||||
def GetCurrentFrame(*args, **kwargs):
|
||||
"""GetCurrentFrame(self) -> int"""
|
||||
return _animate.AnimationPlayer_GetCurrentFrame(*args, **kwargs)
|
||||
|
||||
def SetWindow(*args, **kwargs):
|
||||
"""SetWindow(self, Window window)"""
|
||||
return _animate.AnimationPlayer_SetWindow(*args, **kwargs)
|
||||
|
||||
def GetWindow(*args, **kwargs):
|
||||
"""GetWindow(self) -> Window"""
|
||||
return _animate.AnimationPlayer_GetWindow(*args, **kwargs)
|
||||
|
||||
def SetPosition(*args, **kwargs):
|
||||
"""SetPosition(self, Point pos)"""
|
||||
return _animate.AnimationPlayer_SetPosition(*args, **kwargs)
|
||||
|
||||
def GetPosition(*args, **kwargs):
|
||||
"""GetPosition(self) -> Point"""
|
||||
return _animate.AnimationPlayer_GetPosition(*args, **kwargs)
|
||||
|
||||
def SetLooped(*args, **kwargs):
|
||||
"""SetLooped(self, bool looped)"""
|
||||
return _animate.AnimationPlayer_SetLooped(*args, **kwargs)
|
||||
|
||||
def GetLooped(*args, **kwargs):
|
||||
"""GetLooped(self) -> bool"""
|
||||
return _animate.AnimationPlayer_GetLooped(*args, **kwargs)
|
||||
|
||||
def HasAnimation(*args, **kwargs):
|
||||
"""HasAnimation(self) -> bool"""
|
||||
return _animate.AnimationPlayer_HasAnimation(*args, **kwargs)
|
||||
|
||||
def IsPlaying(*args, **kwargs):
|
||||
"""IsPlaying(self) -> bool"""
|
||||
return _animate.AnimationPlayer_IsPlaying(*args, **kwargs)
|
||||
|
||||
def UseBackgroundColour(*args, **kwargs):
|
||||
"""UseBackgroundColour(self, bool useBackground)"""
|
||||
return _animate.AnimationPlayer_UseBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UsingBackgroundColour(*args, **kwargs):
|
||||
"""UsingBackgroundColour(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingBackgroundColour(*args, **kwargs)
|
||||
|
||||
def SetCustomBackgroundColour(*args, **kwargs):
|
||||
"""SetCustomBackgroundColour(self, Colour col, bool useCustomBackgroundColour=True)"""
|
||||
return _animate.AnimationPlayer_SetCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UsingCustomBackgroundColour(*args, **kwargs):
|
||||
"""UsingCustomBackgroundColour(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetCustomBackgroundColour(*args, **kwargs):
|
||||
"""GetCustomBackgroundColour(self) -> Colour"""
|
||||
return _animate.AnimationPlayer_GetCustomBackgroundColour(*args, **kwargs)
|
||||
|
||||
def UseParentBackground(*args, **kwargs):
|
||||
"""UseParentBackground(self, bool useParent)"""
|
||||
return _animate.AnimationPlayer_UseParentBackground(*args, **kwargs)
|
||||
|
||||
def UsingParentBackground(*args, **kwargs):
|
||||
"""UsingParentBackground(self) -> bool"""
|
||||
return _animate.AnimationPlayer_UsingParentBackground(*args, **kwargs)
|
||||
|
||||
def Play(*args, **kwargs):
|
||||
"""Play(self, Window window, Point pos=wxPoint(0, 0), bool looped=True) -> bool"""
|
||||
return _animate.AnimationPlayer_Play(*args, **kwargs)
|
||||
|
||||
def Build(*args, **kwargs):
|
||||
"""Build(self) -> bool"""
|
||||
return _animate.AnimationPlayer_Build(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _animate.AnimationPlayer_Stop(*args, **kwargs)
|
||||
|
||||
def Draw(*args, **kwargs):
|
||||
"""Draw(self, DC dc)"""
|
||||
return _animate.AnimationPlayer_Draw(*args, **kwargs)
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.AnimationPlayer_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.AnimationPlayer_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.AnimationPlayer_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.AnimationPlayer_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.AnimationPlayer_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.AnimationPlayer_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationPlayer_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationPlayer_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def PlayFrame(*args, **kwargs):
|
||||
"""PlayFrame(self, int frame, Window window, Point pos) -> bool"""
|
||||
return _animate.AnimationPlayer_PlayFrame(*args, **kwargs)
|
||||
|
||||
def PlayNextFrame(*args, **kwargs):
|
||||
"""PlayNextFrame(self) -> bool"""
|
||||
return _animate.AnimationPlayer_PlayNextFrame(*args, **kwargs)
|
||||
|
||||
def DrawFrame(*args, **kwargs):
|
||||
"""DrawFrame(self, int frame, DC dc, Point pos)"""
|
||||
return _animate.AnimationPlayer_DrawFrame(*args, **kwargs)
|
||||
|
||||
def DrawBackground(*args, **kwargs):
|
||||
"""DrawBackground(self, DC dc, Point pos, Colour colour)"""
|
||||
return _animate.AnimationPlayer_DrawBackground(*args, **kwargs)
|
||||
|
||||
def ClearCache(*args, **kwargs):
|
||||
"""ClearCache(self)"""
|
||||
return _animate.AnimationPlayer_ClearCache(*args, **kwargs)
|
||||
|
||||
def SaveBackground(*args, **kwargs):
|
||||
"""SaveBackground(self, Rect rect)"""
|
||||
return _animate.AnimationPlayer_SaveBackground(*args, **kwargs)
|
||||
|
||||
def GetBackingStore(*args, **kwargs):
|
||||
"""GetBackingStore(self) -> Bitmap"""
|
||||
return _animate.AnimationPlayer_GetBackingStore(*args, **kwargs)
|
||||
|
||||
|
||||
class AnimationPlayerPtr(AnimationPlayer):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = AnimationPlayer
|
||||
_animate.AnimationPlayer_swigregister(AnimationPlayerPtr)
|
||||
cvar = _animate.cvar
|
||||
AnimationControlNameStr = cvar.AnimationControlNameStr
|
||||
|
||||
class AnimationBase(_core.Object):
|
||||
"""Proxy of C++ AnimationBase class"""
|
||||
def __init__(self): raise RuntimeError, "No constructor defined"
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxAnimationBase instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __del__(self, destroy=_animate.delete_AnimationBase):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.AnimationBase_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.AnimationBase_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.AnimationBase_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.AnimationBase_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.AnimationBase_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.AnimationBase_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationBase_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.AnimationBase_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def IsValid(*args, **kwargs):
|
||||
"""IsValid(self) -> bool"""
|
||||
return _animate.AnimationBase_IsValid(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename) -> bool"""
|
||||
return _animate.AnimationBase_LoadFile(*args, **kwargs)
|
||||
|
||||
|
||||
class AnimationBasePtr(AnimationBase):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = AnimationBase
|
||||
_animate.AnimationBase_swigregister(AnimationBasePtr)
|
||||
|
||||
class GIFAnimation(AnimationBase):
|
||||
"""Proxy of C++ GIFAnimation class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGIFAnimation instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self) -> GIFAnimation"""
|
||||
newobj = _animate.new_GIFAnimation(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_animate.delete_GIFAnimation):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def GetFrameCount(*args, **kwargs):
|
||||
"""GetFrameCount(self) -> int"""
|
||||
return _animate.GIFAnimation_GetFrameCount(*args, **kwargs)
|
||||
|
||||
def GetFrame(*args, **kwargs):
|
||||
"""GetFrame(self, int i) -> Image"""
|
||||
return _animate.GIFAnimation_GetFrame(*args, **kwargs)
|
||||
|
||||
def GetDisposalMethod(*args, **kwargs):
|
||||
"""GetDisposalMethod(self, int i) -> int"""
|
||||
return _animate.GIFAnimation_GetDisposalMethod(*args, **kwargs)
|
||||
|
||||
def GetFrameRect(*args, **kwargs):
|
||||
"""GetFrameRect(self, int i) -> Rect"""
|
||||
return _animate.GIFAnimation_GetFrameRect(*args, **kwargs)
|
||||
|
||||
def GetDelay(*args, **kwargs):
|
||||
"""GetDelay(self, int i) -> int"""
|
||||
return _animate.GIFAnimation_GetDelay(*args, **kwargs)
|
||||
|
||||
def GetLogicalScreenSize(*args, **kwargs):
|
||||
"""GetLogicalScreenSize(self) -> Size"""
|
||||
return _animate.GIFAnimation_GetLogicalScreenSize(*args, **kwargs)
|
||||
|
||||
def GetBackgroundColour(*args, **kwargs):
|
||||
"""GetBackgroundColour(self, Colour col) -> bool"""
|
||||
return _animate.GIFAnimation_GetBackgroundColour(*args, **kwargs)
|
||||
|
||||
def GetTransparentColour(*args, **kwargs):
|
||||
"""GetTransparentColour(self, Colour col) -> bool"""
|
||||
return _animate.GIFAnimation_GetTransparentColour(*args, **kwargs)
|
||||
|
||||
def IsValid(*args, **kwargs):
|
||||
"""IsValid(self) -> bool"""
|
||||
return _animate.GIFAnimation_IsValid(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename) -> bool"""
|
||||
return _animate.GIFAnimation_LoadFile(*args, **kwargs)
|
||||
|
||||
|
||||
class GIFAnimationPtr(GIFAnimation):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GIFAnimation
|
||||
_animate.GIFAnimation_swigregister(GIFAnimationPtr)
|
||||
|
||||
AN_FIT_ANIMATION = _animate.AN_FIT_ANIMATION
|
||||
class GIFAnimationCtrl(_core.Control):
|
||||
"""Proxy of C++ GIFAnimationCtrl class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGIFAnimationCtrl instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, String filename=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
String name=AnimationControlNameStr) -> GIFAnimationCtrl
|
||||
"""
|
||||
newobj = _animate.new_GIFAnimationCtrl(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def Create(*args, **kwargs):
|
||||
"""
|
||||
Create(self, Window parent, int id=-1, String filename=EmptyString,
|
||||
Point pos=DefaultPosition, Size size=DefaultSize,
|
||||
long style=wxAN_FIT_ANIMATION|wxNO_BORDER,
|
||||
String name=AnimationControlNameStr) -> bool
|
||||
"""
|
||||
return _animate.GIFAnimationCtrl_Create(*args, **kwargs)
|
||||
|
||||
def LoadFile(*args, **kwargs):
|
||||
"""LoadFile(self, String filename=EmptyString) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_LoadFile(*args, **kwargs)
|
||||
|
||||
def Play(*args, **kwargs):
|
||||
"""Play(self, bool looped=True) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_Play(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self)"""
|
||||
return _animate.GIFAnimationCtrl_Stop(*args, **kwargs)
|
||||
|
||||
def FitToAnimation(*args, **kwargs):
|
||||
"""FitToAnimation(self)"""
|
||||
return _animate.GIFAnimationCtrl_FitToAnimation(*args, **kwargs)
|
||||
|
||||
def IsPlaying(*args, **kwargs):
|
||||
"""IsPlaying(self) -> bool"""
|
||||
return _animate.GIFAnimationCtrl_IsPlaying(*args, **kwargs)
|
||||
|
||||
def GetPlayer(*args, **kwargs):
|
||||
"""GetPlayer(self) -> AnimationPlayer"""
|
||||
return _animate.GIFAnimationCtrl_GetPlayer(*args, **kwargs)
|
||||
|
||||
def GetAnimation(*args, **kwargs):
|
||||
"""GetAnimation(self) -> AnimationBase"""
|
||||
return _animate.GIFAnimationCtrl_GetAnimation(*args, **kwargs)
|
||||
|
||||
def GetFilename(*args, **kwargs):
|
||||
"""GetFilename(self) -> String"""
|
||||
return _animate.GIFAnimationCtrl_GetFilename(*args, **kwargs)
|
||||
|
||||
def SetFilename(*args, **kwargs):
|
||||
"""SetFilename(self, String filename)"""
|
||||
return _animate.GIFAnimationCtrl_SetFilename(*args, **kwargs)
|
||||
|
||||
|
||||
class GIFAnimationCtrlPtr(GIFAnimationCtrl):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GIFAnimationCtrl
|
||||
_animate.GIFAnimationCtrl_swigregister(GIFAnimationCtrlPtr)
|
||||
|
||||
def PreGIFAnimationCtrl(*args, **kwargs):
|
||||
"""PreGIFAnimationCtrl() -> GIFAnimationCtrl"""
|
||||
val = _animate.new_PreGIFAnimationCtrl(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
return val
|
||||
|
||||
|
5025
wxPython/contrib/animate/msw/animate_wrap.cpp
Normal file
5025
wxPython/contrib/animate/msw/animate_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
123
wxPython/contrib/dllwidget/dllwidget.cpp
Normal file
123
wxPython/contrib/dllwidget/dllwidget.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dllwidget.cpp
|
||||
// Purpose: Dynamically loadable C++ widget for wxPython
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2001/12/03
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/sizer.h"
|
||||
|
||||
#include "dllwidget.h"
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDllWidget, wxPanel)
|
||||
|
||||
wxDllWidget::wxDllWidget(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& dllName, const wxString& className,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
long style)
|
||||
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
className + wxT("_container")),
|
||||
m_widget(NULL), m_lib(NULL), m_controlAdded(false)
|
||||
{
|
||||
SetBackgroundColour(wxColour(255, 0, 255));
|
||||
if ( !!className )
|
||||
LoadWidget(dllName, className, style);
|
||||
}
|
||||
|
||||
wxDllWidget::~wxDllWidget()
|
||||
{
|
||||
UnloadWidget();
|
||||
}
|
||||
|
||||
void wxDllWidget::AddChild(wxWindowBase *child)
|
||||
{
|
||||
wxASSERT_MSG( !m_controlAdded, wxT("Couldn't load two widgets into one container!") );
|
||||
|
||||
wxPanel::AddChild(child);
|
||||
|
||||
m_controlAdded = true;
|
||||
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add((wxWindow*)child, 1, wxEXPAND);
|
||||
SetSizer(sizer);
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
wxString wxDllWidget::GetDllExt()
|
||||
{
|
||||
return wxDllLoader::GetDllExt();
|
||||
}
|
||||
|
||||
|
||||
typedef WXDLLEXPORT bool (*DLL_WidgetFactory_t)(const wxString& className,
|
||||
wxWindow *parent,
|
||||
long style,
|
||||
wxWindow **classInst,
|
||||
wxSendCommandFunc *cmdFunc);
|
||||
|
||||
bool wxDllWidget::LoadWidget(const wxString& dll, const wxString& className,
|
||||
long style)
|
||||
{
|
||||
UnloadWidget();
|
||||
|
||||
// Load the dynamic library
|
||||
m_lib = new wxDynamicLibrary(dll);
|
||||
if ( !m_lib->IsLoaded() )
|
||||
{
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
DLL_WidgetFactory_t factory;
|
||||
factory = (DLL_WidgetFactory_t) m_lib->GetSymbol(wxT("DLL_WidgetFactory"));
|
||||
if ( factory == NULL)
|
||||
{
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !factory(className, this, style, &m_widget, &m_cmdFunc) )
|
||||
{
|
||||
delete m_widget;
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
m_widget = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDllWidget::UnloadWidget()
|
||||
{
|
||||
if ( m_widget )
|
||||
{
|
||||
DestroyChildren();
|
||||
m_widget = NULL;
|
||||
delete m_lib;
|
||||
m_lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int wxDllWidget::SendCommand(int cmd, const wxString& param)
|
||||
{
|
||||
wxASSERT_MSG( m_widget && m_cmdFunc, wxT("Sending command to not loaded widget!"));
|
||||
|
||||
return m_cmdFunc(m_widget, cmd, param);
|
||||
}
|
139
wxPython/contrib/dllwidget/dllwidget.h
Normal file
139
wxPython/contrib/dllwidget/dllwidget.h
Normal file
@@ -0,0 +1,139 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dllwidget.h
|
||||
// Purpose: Dynamically loadable C++ widget for wxPython
|
||||
// Author: Vaclav Slavik
|
||||
// Created: 2001/12/03
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 Vaclav Slavik
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DLLWIDGET_H__
|
||||
#define __DLLWIDGET_H__
|
||||
|
||||
#include "wx/panel.h"
|
||||
|
||||
/*
|
||||
|
||||
wxDllWidget can be used to embed a wxWindow implemented in C++ in your
|
||||
wxPython application without the need to write a SWIG interface. Widget's code
|
||||
is stored in shared library or DLL that exports DLL_WidgetFactory symbol
|
||||
and loaded at runtime. All you have to do is to pass the name of DLL and the class
|
||||
to create to wxDllWidget's ctor.
|
||||
|
||||
Runtime-loadable widget must have HandleCommand method (see the example) that is
|
||||
used to communicate with Python app. You call wxDllWidget.SendCommand(cmd,param) from
|
||||
Python and it in turn calls HandleCommand of the loaded widget.
|
||||
|
||||
You must use DECLARE_DLL_WIDGET, BEGIN_WIDGET_LIBRARY, END_WIDGET_LIBRARY and
|
||||
REGISTER_WIDGET macros in your C++ module in order to provide all the meat
|
||||
wxDllWidget needs.
|
||||
|
||||
Example of use:
|
||||
|
||||
#define CMD_MAKEWHITE 1
|
||||
|
||||
class MyWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
MyWindow(wxWindow *parent, long style)
|
||||
: wxWindow(parent, wxID_ANY) {}
|
||||
|
||||
int HandleCommand(int cmd, const wxString& param)
|
||||
{
|
||||
if (cmd == CMD_MAKEWHITE)
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyWindow)
|
||||
|
||||
class MyCanvasWindow : public wxScrolledWindow
|
||||
{
|
||||
...
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyCanvasWindow)
|
||||
|
||||
BEGIN_WIDGET_LIBRARY()
|
||||
REGISTER_WIDGET(MyWindow)
|
||||
REGISTER_WIDGET(MyCanvasWindow)
|
||||
END_WIDGET_LIBRARY()
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class WXDLLEXPORT wxDynamicLibrary;
|
||||
|
||||
typedef int (*wxSendCommandFunc)(wxWindow *wnd, int cmd, const wxString& param);
|
||||
|
||||
class wxDllWidget : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxDllWidget(wxWindow *parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& dllName = wxEmptyString,
|
||||
const wxString& className = wxEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
virtual ~wxDllWidget();
|
||||
|
||||
bool Ok() { return m_widget != NULL; }
|
||||
|
||||
virtual int SendCommand(int cmd, const wxString& param = wxEmptyString);
|
||||
virtual wxWindow* GetWidgetWindow() { return m_widget; }
|
||||
|
||||
virtual void AddChild(wxWindowBase *child);
|
||||
|
||||
static wxString GetDllExt();
|
||||
|
||||
|
||||
protected:
|
||||
bool LoadWidget(const wxString& dll, const wxString& className, long style);
|
||||
void UnloadWidget();
|
||||
|
||||
protected:
|
||||
wxWindow* m_widget;
|
||||
wxSendCommandFunc m_cmdFunc;
|
||||
wxDynamicLibrary* m_lib;
|
||||
bool m_controlAdded;
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_CLASS(wxDllWidget)
|
||||
};
|
||||
|
||||
|
||||
#define DECLARE_DLL_WIDGET(widget) \
|
||||
static int SendCommandTo##widget(wxWindow *wnd, int cmd, const wxString& param) \
|
||||
{ \
|
||||
return wxStaticCast(wnd, widget)->HandleCommand(cmd, param); \
|
||||
}
|
||||
|
||||
|
||||
#define BEGIN_WIDGET_LIBRARY() \
|
||||
extern "C" WXEXPORT bool DLL_WidgetFactory( \
|
||||
const wxString& className, \
|
||||
wxWindow *parent, \
|
||||
long style, \
|
||||
wxWindow **classInst, \
|
||||
wxSendCommandFunc *cmdFunc) \
|
||||
{ \
|
||||
wxClassInfo::CleanUpClasses(); \
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
|
||||
#define REGISTER_WIDGET(widget) \
|
||||
if ( className == wxT(#widget) ) \
|
||||
{ \
|
||||
*classInst = new widget(parent, style); \
|
||||
*cmdFunc = SendCommandTo##widget; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
|
||||
#define END_WIDGET_LIBRARY() \
|
||||
return false; \
|
||||
}
|
||||
|
||||
#endif // __DLLWIDGET_H__
|
6
wxPython/contrib/dllwidget/dllwidget.py
Normal file
6
wxPython/contrib/dllwidget/dllwidget.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# The SWIG module is named dllwidget_ to avoid name clashes, so
|
||||
# this stub just imports everything in it so the friendly module
|
||||
# name can be used elsewhere.
|
||||
|
||||
from dllwidget_ import *
|
||||
|
467
wxPython/contrib/dllwidget/dllwidget_.cpp
Normal file
467
wxPython/contrib/dllwidget/dllwidget_.cpp
Normal file
@@ -0,0 +1,467 @@
|
||||
/*
|
||||
* FILE : contrib/dllwidget/dllwidget_.cpp
|
||||
*
|
||||
* This file was automatically generated by :
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
* Version 1.1 (Build 883)
|
||||
*
|
||||
* Portions Copyright (c) 1995-1998
|
||||
* The University of Utah and The Regents of the University of California.
|
||||
* Permission is granted to distribute this file in any manner provided
|
||||
* this notice remains intact.
|
||||
*
|
||||
* Do not make changes to this file--changes will be lost!
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#define SWIGCODE
|
||||
/* Implementation : PYTHON */
|
||||
|
||||
#define SWIGPYTHON
|
||||
#include "Python.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
/* Definitions for Windows/Unix exporting */
|
||||
#if defined(__WIN32__)
|
||||
# if defined(_MSC_VER)
|
||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||
# else
|
||||
# if defined(__BORLANDC__)
|
||||
# define SWIGEXPORT(a) a _export
|
||||
# else
|
||||
# define SWIGEXPORT(a) a
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
# define SWIGEXPORT(a) a
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void SWIG_MakePtr(char *, void *, char *);
|
||||
extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *));
|
||||
extern char *SWIG_GetPtr(char *, void **, char *);
|
||||
extern char *SWIG_GetPtrObj(PyObject *, void **, char *);
|
||||
extern void SWIG_addvarlink(PyObject *, char *, PyObject *(*)(void), int (*)(PyObject *));
|
||||
extern PyObject *SWIG_newvarlink(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#define SWIG_init initdllwidget_c
|
||||
|
||||
#define SWIG_name "dllwidget_c"
|
||||
|
||||
#include "wxPython.h"
|
||||
#include "dllwidget.h"
|
||||
|
||||
|
||||
static PyObject* t_output_helper(PyObject* target, PyObject* o) {
|
||||
PyObject* o2;
|
||||
PyObject* o3;
|
||||
|
||||
if (!target) {
|
||||
target = o;
|
||||
} else if (target == Py_None) {
|
||||
Py_DECREF(Py_None);
|
||||
target = o;
|
||||
} else {
|
||||
if (!PyTuple_Check(target)) {
|
||||
o2 = target;
|
||||
target = PyTuple_New(1);
|
||||
PyTuple_SetItem(target, 0, o2);
|
||||
}
|
||||
o3 = PyTuple_New(1);
|
||||
PyTuple_SetItem(o3, 0, o);
|
||||
|
||||
o2 = target;
|
||||
target = PySequence_Concat(o2, o3);
|
||||
Py_DECREF(o2);
|
||||
Py_DECREF(o3);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
static void *SwigwxDllWidgetTowxPanel(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxPanel *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxPanel *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDllWidgetTowxWindow(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxWindow *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxWindow *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDllWidgetTowxEvtHandler(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxEvtHandler *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxEvtHandler *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
static void *SwigwxDllWidgetTowxObject(void *ptr) {
|
||||
wxDllWidget *src;
|
||||
wxObject *dest;
|
||||
src = (wxDllWidget *) ptr;
|
||||
dest = (wxObject *) src;
|
||||
return (void *) dest;
|
||||
}
|
||||
|
||||
#define new_wxDllWidget(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6) (new wxDllWidget(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5,_swigarg6))
|
||||
static PyObject *_wrap_new_wxDllWidget(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxDllWidget * _result;
|
||||
wxWindow * _arg0;
|
||||
wxWindowID _arg1 = (wxWindowID ) -1;
|
||||
wxString * _arg2 = (wxString *) &wxPyEmptyString;
|
||||
wxString * _arg3 = (wxString *) &wxPyEmptyString;
|
||||
wxPoint * _arg4 = (wxPoint *) &wxDefaultPosition;
|
||||
wxSize * _arg5 = (wxSize *) &wxDefaultSize;
|
||||
long _arg6 = (long ) 0;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
PyObject * _obj3 = 0;
|
||||
wxPoint temp;
|
||||
PyObject * _obj4 = 0;
|
||||
wxSize temp0;
|
||||
PyObject * _obj5 = 0;
|
||||
char *_kwnames[] = { "parent","id","dllName","className","pos","size","style", NULL };
|
||||
char _ptemp[128];
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|iOOOOl:new_wxDllWidget",_kwnames,&_argo0,&_arg1,&_obj2,&_obj3,&_obj4,&_obj5,&_arg6))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxWindow_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of new_wxDllWidget. Expected _wxWindow_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = wxString_in_helper(_obj2);
|
||||
if (_arg2 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj3)
|
||||
{
|
||||
_arg3 = wxString_in_helper(_obj3);
|
||||
if (_arg3 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
if (_obj4)
|
||||
{
|
||||
_arg4 = &temp;
|
||||
if (! wxPoint_helper(_obj4, &_arg4))
|
||||
return NULL;
|
||||
}
|
||||
if (_obj5)
|
||||
{
|
||||
_arg5 = &temp0;
|
||||
if (! wxSize_helper(_obj5, &_arg5))
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxDllWidget *)new_wxDllWidget(_arg0,_arg1,*_arg2,*_arg3,*_arg4,*_arg5,_arg6);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} if (_result) {
|
||||
SWIG_MakePtr(_ptemp, (char *) _result,"_wxDllWidget_p");
|
||||
_resultobj = Py_BuildValue("s",_ptemp);
|
||||
} else {
|
||||
Py_INCREF(Py_None);
|
||||
_resultobj = Py_None;
|
||||
}
|
||||
{
|
||||
if (_obj2)
|
||||
delete _arg2;
|
||||
}
|
||||
{
|
||||
if (_obj3)
|
||||
delete _arg3;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDllWidget_Ok(_swigobj) (_swigobj->Ok())
|
||||
static PyObject *_wrap_wxDllWidget_Ok(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
bool _result;
|
||||
wxDllWidget * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDllWidget_Ok",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_Ok. Expected _wxDllWidget_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (bool )wxDllWidget_Ok(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDllWidget_SendCommand(_swigobj,_swigarg0,_swigarg1) (_swigobj->SendCommand(_swigarg0,_swigarg1))
|
||||
static PyObject *_wrap_wxDllWidget_SendCommand(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
int _result;
|
||||
wxDllWidget * _arg0;
|
||||
int _arg1;
|
||||
wxString * _arg2 = (wxString *) &wxPyEmptyString;
|
||||
PyObject * _argo0 = 0;
|
||||
PyObject * _obj2 = 0;
|
||||
char *_kwnames[] = { "self","cmd","param", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oi|O:wxDllWidget_SendCommand",_kwnames,&_argo0,&_arg1,&_obj2))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_SendCommand. Expected _wxDllWidget_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (_obj2)
|
||||
{
|
||||
_arg2 = wxString_in_helper(_obj2);
|
||||
if (_arg2 == NULL)
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (int )wxDllWidget_SendCommand(_arg0,_arg1,*_arg2);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
} _resultobj = Py_BuildValue("i",_result);
|
||||
{
|
||||
if (_obj2)
|
||||
delete _arg2;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
#define wxDllWidget_GetWidgetWindow(_swigobj) (_swigobj->GetWidgetWindow())
|
||||
static PyObject *_wrap_wxDllWidget_GetWidgetWindow(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxWindow * _result;
|
||||
wxDllWidget * _arg0;
|
||||
PyObject * _argo0 = 0;
|
||||
char *_kwnames[] = { "self", NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxDllWidget_GetWidgetWindow",_kwnames,&_argo0))
|
||||
return NULL;
|
||||
if (_argo0) {
|
||||
if (_argo0 == Py_None) { _arg0 = NULL; }
|
||||
else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDllWidget_p")) {
|
||||
PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDllWidget_GetWidgetWindow. Expected _wxDllWidget_p.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = (wxWindow *)wxDllWidget_GetWidgetWindow(_arg0);
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{ _resultobj = wxPyMake_wxObject(_result); }
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyObject *_wrap_wxDllWidget_GetDllExt(PyObject *self, PyObject *args, PyObject *kwargs) {
|
||||
PyObject * _resultobj;
|
||||
wxString * _result;
|
||||
char *_kwnames[] = { NULL };
|
||||
|
||||
self = self;
|
||||
if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxDllWidget_GetDllExt",_kwnames))
|
||||
return NULL;
|
||||
{
|
||||
PyThreadState* __tstate = wxPyBeginAllowThreads();
|
||||
_result = new wxString (wxDllWidget::GetDllExt());
|
||||
|
||||
wxPyEndAllowThreads(__tstate);
|
||||
if (PyErr_Occurred()) return NULL;
|
||||
}{
|
||||
#if wxUSE_UNICODE
|
||||
_resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len());
|
||||
#else
|
||||
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
|
||||
#endif
|
||||
}
|
||||
{
|
||||
delete _result;
|
||||
}
|
||||
return _resultobj;
|
||||
}
|
||||
|
||||
static PyMethodDef dllwidget_cMethods[] = {
|
||||
{ "wxDllWidget_GetDllExt", (PyCFunction) _wrap_wxDllWidget_GetDllExt, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDllWidget_GetWidgetWindow", (PyCFunction) _wrap_wxDllWidget_GetWidgetWindow, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDllWidget_SendCommand", (PyCFunction) _wrap_wxDllWidget_SendCommand, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "wxDllWidget_Ok", (PyCFunction) _wrap_wxDllWidget_Ok, METH_VARARGS | METH_KEYWORDS },
|
||||
{ "new_wxDllWidget", (PyCFunction) _wrap_new_wxDllWidget, METH_VARARGS | METH_KEYWORDS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* This table is used by the pointer type-checker
|
||||
*/
|
||||
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
|
||||
{ "_signed_long","_long",0},
|
||||
{ "_wxPrintQuality","_wxCoord",0},
|
||||
{ "_wxPrintQuality","_int",0},
|
||||
{ "_wxPrintQuality","_signed_int",0},
|
||||
{ "_wxPrintQuality","_unsigned_int",0},
|
||||
{ "_wxPrintQuality","_wxWindowID",0},
|
||||
{ "_wxPrintQuality","_uint",0},
|
||||
{ "_wxPrintQuality","_EBool",0},
|
||||
{ "_wxPrintQuality","_size_t",0},
|
||||
{ "_wxPrintQuality","_time_t",0},
|
||||
{ "_byte","_unsigned_char",0},
|
||||
{ "_long","_unsigned_long",0},
|
||||
{ "_long","_signed_long",0},
|
||||
{ "_size_t","_wxCoord",0},
|
||||
{ "_size_t","_wxPrintQuality",0},
|
||||
{ "_size_t","_time_t",0},
|
||||
{ "_size_t","_unsigned_int",0},
|
||||
{ "_size_t","_int",0},
|
||||
{ "_size_t","_wxWindowID",0},
|
||||
{ "_size_t","_uint",0},
|
||||
{ "_wxPanel","_wxDllWidget",SwigwxDllWidgetTowxPanel},
|
||||
{ "_uint","_wxCoord",0},
|
||||
{ "_uint","_wxPrintQuality",0},
|
||||
{ "_uint","_time_t",0},
|
||||
{ "_uint","_size_t",0},
|
||||
{ "_uint","_unsigned_int",0},
|
||||
{ "_uint","_int",0},
|
||||
{ "_uint","_wxWindowID",0},
|
||||
{ "_wxChar","_char",0},
|
||||
{ "_char","_wxChar",0},
|
||||
{ "_struct_wxNativeFontInfo","_wxNativeFontInfo",0},
|
||||
{ "_EBool","_wxCoord",0},
|
||||
{ "_EBool","_wxPrintQuality",0},
|
||||
{ "_EBool","_signed_int",0},
|
||||
{ "_EBool","_int",0},
|
||||
{ "_EBool","_wxWindowID",0},
|
||||
{ "_unsigned_long","_long",0},
|
||||
{ "_wxNativeFontInfo","_struct_wxNativeFontInfo",0},
|
||||
{ "_signed_int","_wxCoord",0},
|
||||
{ "_signed_int","_wxPrintQuality",0},
|
||||
{ "_signed_int","_EBool",0},
|
||||
{ "_signed_int","_wxWindowID",0},
|
||||
{ "_signed_int","_int",0},
|
||||
{ "_WXTYPE","_wxDateTime_t",0},
|
||||
{ "_WXTYPE","_short",0},
|
||||
{ "_WXTYPE","_signed_short",0},
|
||||
{ "_WXTYPE","_unsigned_short",0},
|
||||
{ "_unsigned_short","_wxDateTime_t",0},
|
||||
{ "_unsigned_short","_WXTYPE",0},
|
||||
{ "_unsigned_short","_short",0},
|
||||
{ "_wxObject","_wxDllWidget",SwigwxDllWidgetTowxObject},
|
||||
{ "_signed_short","_WXTYPE",0},
|
||||
{ "_signed_short","_short",0},
|
||||
{ "_unsigned_char","_byte",0},
|
||||
{ "_unsigned_int","_wxCoord",0},
|
||||
{ "_unsigned_int","_wxPrintQuality",0},
|
||||
{ "_unsigned_int","_time_t",0},
|
||||
{ "_unsigned_int","_size_t",0},
|
||||
{ "_unsigned_int","_uint",0},
|
||||
{ "_unsigned_int","_wxWindowID",0},
|
||||
{ "_unsigned_int","_int",0},
|
||||
{ "_short","_wxDateTime_t",0},
|
||||
{ "_short","_WXTYPE",0},
|
||||
{ "_short","_unsigned_short",0},
|
||||
{ "_short","_signed_short",0},
|
||||
{ "_wxWindowID","_wxCoord",0},
|
||||
{ "_wxWindowID","_wxPrintQuality",0},
|
||||
{ "_wxWindowID","_time_t",0},
|
||||
{ "_wxWindowID","_size_t",0},
|
||||
{ "_wxWindowID","_EBool",0},
|
||||
{ "_wxWindowID","_uint",0},
|
||||
{ "_wxWindowID","_int",0},
|
||||
{ "_wxWindowID","_signed_int",0},
|
||||
{ "_wxWindowID","_unsigned_int",0},
|
||||
{ "_int","_wxCoord",0},
|
||||
{ "_int","_wxPrintQuality",0},
|
||||
{ "_int","_time_t",0},
|
||||
{ "_int","_size_t",0},
|
||||
{ "_int","_EBool",0},
|
||||
{ "_int","_uint",0},
|
||||
{ "_int","_wxWindowID",0},
|
||||
{ "_int","_unsigned_int",0},
|
||||
{ "_int","_signed_int",0},
|
||||
{ "_wxDateTime_t","_unsigned_short",0},
|
||||
{ "_wxDateTime_t","_short",0},
|
||||
{ "_wxDateTime_t","_WXTYPE",0},
|
||||
{ "_time_t","_wxCoord",0},
|
||||
{ "_time_t","_wxPrintQuality",0},
|
||||
{ "_time_t","_unsigned_int",0},
|
||||
{ "_time_t","_int",0},
|
||||
{ "_time_t","_wxWindowID",0},
|
||||
{ "_time_t","_uint",0},
|
||||
{ "_time_t","_size_t",0},
|
||||
{ "_wxCoord","_int",0},
|
||||
{ "_wxCoord","_signed_int",0},
|
||||
{ "_wxCoord","_unsigned_int",0},
|
||||
{ "_wxCoord","_wxWindowID",0},
|
||||
{ "_wxCoord","_uint",0},
|
||||
{ "_wxCoord","_EBool",0},
|
||||
{ "_wxCoord","_size_t",0},
|
||||
{ "_wxCoord","_time_t",0},
|
||||
{ "_wxCoord","_wxPrintQuality",0},
|
||||
{ "_wxEvtHandler","_wxDllWidget",SwigwxDllWidgetTowxEvtHandler},
|
||||
{ "_wxWindow","_wxDllWidget",SwigwxDllWidgetTowxWindow},
|
||||
{0,0,0}};
|
||||
|
||||
static PyObject *SWIG_globals;
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
SWIGEXPORT(void) initdllwidget_c() {
|
||||
PyObject *m, *d;
|
||||
SWIG_globals = SWIG_newvarlink();
|
||||
m = Py_InitModule("dllwidget_c", dllwidget_cMethods);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
|
||||
wxClassInfo::CleanUpClasses();
|
||||
wxClassInfo::InitializeClasses();
|
||||
|
||||
{
|
||||
int i;
|
||||
for (i = 0; _swig_mapping[i].n1; i++)
|
||||
SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
|
||||
}
|
||||
}
|
115
wxPython/contrib/dllwidget/dllwidget_.i
Normal file
115
wxPython/contrib/dllwidget/dllwidget_.i
Normal file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: dllwidget_.i
|
||||
// Purpose: Load wx widgets from external DLLs
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 04-Dec-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
%module dllwidget_
|
||||
|
||||
|
||||
%{
|
||||
#include "wxPython.h"
|
||||
#include "dllwidget.h"
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%include typemaps.i
|
||||
%include my_typemaps.i
|
||||
|
||||
%extern wx.i
|
||||
%extern windows.i
|
||||
%extern _defs.i
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
%{
|
||||
// Put some wx default wxChar* values into wxStrings.
|
||||
static const wxString wxPyEmptyString(wxT(""));
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
|
||||
wxDllWidget can be used to embed a wxWindow implemented in C++ in your
|
||||
wxPython application without the need to write a SWIG interface. Widget's code
|
||||
is stored in shared library or DLL that exports DLL_WidgetFactory symbol
|
||||
and loaded at runtime. All you have to do is to pass the name of DLL and the class
|
||||
to create to wxDllWidget's ctor.
|
||||
|
||||
Runtime-loadable widget must have HandleCommand method (see the example) that is
|
||||
used to communicate with Python app. You call wxDllWidget.SendCommand(cmd,param) from
|
||||
Python and it in turn calls HandleCommand of the loaded widget.
|
||||
|
||||
You must use DECLARE_DLL_WIDGET, BEGIN_WIDGET_LIBRARY, END_WIDGET_LIBRARY and
|
||||
REGISTER_WIDGET macros in your C++ module in order to provide all the meat
|
||||
wxDllWidget needs.
|
||||
|
||||
Example of use:
|
||||
|
||||
#define CMD_MAKEWHITE 1
|
||||
|
||||
class MyWindow : public wxWindow
|
||||
{
|
||||
public:
|
||||
MyWindow(wxWindow *parent, long style)
|
||||
: wxWindow(parent, -1) {}
|
||||
|
||||
int HandleCommand(int cmd, const wxString& param)
|
||||
{
|
||||
if (cmd == CMD_MAKEWHITE)
|
||||
SetBackgroundColour(*wxWHITE);
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyWindow)
|
||||
|
||||
class MyCanvasWindow : public wxScrolledWindow
|
||||
{
|
||||
...
|
||||
};
|
||||
DECLARE_DLL_WIDGET(MyCanvasWindow)
|
||||
|
||||
BEGIN_WIDGET_LIBRARY()
|
||||
REGISTER_WIDGET(MyWindow)
|
||||
REGISTER_WIDGET(MyCanvasWindow)
|
||||
END_WIDGET_LIBRARY()
|
||||
|
||||
*/
|
||||
|
||||
class wxDllWidget : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxDllWidget(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxString& dllName = wxPyEmptyString,
|
||||
const wxString& className = wxPyEmptyString,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
|
||||
|
||||
bool Ok();
|
||||
|
||||
int SendCommand(int cmd, const wxString& param = wxPyEmptyString);
|
||||
wxWindow* GetWidgetWindow();
|
||||
|
||||
static wxString GetDllExt();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
%}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
78
wxPython/contrib/dllwidget/dllwidget_.py
Normal file
78
wxPython/contrib/dllwidget/dllwidget_.py
Normal file
@@ -0,0 +1,78 @@
|
||||
# This file was created automatically by SWIG.
|
||||
import dllwidget_c
|
||||
|
||||
from misc import *
|
||||
|
||||
from misc2 import *
|
||||
|
||||
from windows import *
|
||||
|
||||
from gdi import *
|
||||
|
||||
from fonts import *
|
||||
|
||||
from clip_dnd import *
|
||||
|
||||
from events import *
|
||||
|
||||
from streams import *
|
||||
|
||||
from utils import *
|
||||
|
||||
from mdi import *
|
||||
|
||||
from frames import *
|
||||
|
||||
from stattool import *
|
||||
|
||||
from controls import *
|
||||
|
||||
from controls2 import *
|
||||
|
||||
from windows2 import *
|
||||
|
||||
from cmndlgs import *
|
||||
|
||||
from windows3 import *
|
||||
|
||||
from image import *
|
||||
|
||||
from printfw import *
|
||||
|
||||
from sizers import *
|
||||
|
||||
from filesys import *
|
||||
class wxDllWidgetPtr(wxPanelPtr):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
def Ok(self, *_args, **_kwargs):
|
||||
val = dllwidget_c.wxDllWidget_Ok(self, *_args, **_kwargs)
|
||||
return val
|
||||
def SendCommand(self, *_args, **_kwargs):
|
||||
val = dllwidget_c.wxDllWidget_SendCommand(self, *_args, **_kwargs)
|
||||
return val
|
||||
def GetWidgetWindow(self, *_args, **_kwargs):
|
||||
val = dllwidget_c.wxDllWidget_GetWidgetWindow(self, *_args, **_kwargs)
|
||||
return val
|
||||
def __repr__(self):
|
||||
return "<%s.%s instance; proxy of C++ wxDllWidget instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this)
|
||||
class wxDllWidget(wxDllWidgetPtr):
|
||||
def __init__(self,*_args,**_kwargs):
|
||||
self.this = dllwidget_c.new_wxDllWidget(*_args,**_kwargs)
|
||||
self.thisown = 1
|
||||
self._setOORInfo(self)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
wxDllWidget_GetDllExt = dllwidget_c.wxDllWidget_GetDllExt
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
1
wxPython/contrib/gizmos/.cvsignore
Normal file
1
wxPython/contrib/gizmos/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
contrib
|
41
wxPython/contrib/gizmos/_gizmos_rename.i
Normal file
41
wxPython/contrib/gizmos/_gizmos_rename.i
Normal file
@@ -0,0 +1,41 @@
|
||||
// A bunch of %rename directives generated by BuildRenamers in config.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef BUILDING_RENAMERS
|
||||
|
||||
%rename(DS_MANAGE_SCROLLBARS) wxDS_MANAGE_SCROLLBARS;
|
||||
%rename(DS_DRAG_CORNER) wxDS_DRAG_CORNER;
|
||||
%rename(DynamicSashSplitEvent) wxDynamicSashSplitEvent;
|
||||
%rename(DynamicSashUnifyEvent) wxDynamicSashUnifyEvent;
|
||||
%rename(DynamicSashWindow) wxDynamicSashWindow;
|
||||
%rename(EL_ALLOW_NEW) wxEL_ALLOW_NEW;
|
||||
%rename(EL_ALLOW_EDIT) wxEL_ALLOW_EDIT;
|
||||
%rename(EL_ALLOW_DELETE) wxEL_ALLOW_DELETE;
|
||||
%rename(EditableListBox) wxEditableListBox;
|
||||
%rename(RemotelyScrolledTreeCtrl) wxRemotelyScrolledTreeCtrl;
|
||||
%rename(ThinSplitterWindow) wxThinSplitterWindow;
|
||||
%rename(SplitterScrolledWindow) wxSplitterScrolledWindow;
|
||||
%rename(LED_ALIGN_LEFT) wxLED_ALIGN_LEFT;
|
||||
%rename(LED_ALIGN_RIGHT) wxLED_ALIGN_RIGHT;
|
||||
%rename(LED_ALIGN_CENTER) wxLED_ALIGN_CENTER;
|
||||
%rename(LED_ALIGN_MASK) wxLED_ALIGN_MASK;
|
||||
%rename(LED_DRAW_FADED) wxLED_DRAW_FADED;
|
||||
%rename(LEDNumberCtrl) wxLEDNumberCtrl;
|
||||
%rename(TL_ALIGN_LEFT) wxTL_ALIGN_LEFT;
|
||||
%rename(TL_ALIGN_RIGHT) wxTL_ALIGN_RIGHT;
|
||||
%rename(TL_ALIGN_CENTER) wxTL_ALIGN_CENTER;
|
||||
%rename(TREE_HITTEST_ONITEMCOLUMN) wxTREE_HITTEST_ONITEMCOLUMN;
|
||||
%rename(TL_SEARCH_VISIBLE) wxTL_SEARCH_VISIBLE;
|
||||
%rename(TL_SEARCH_LEVEL) wxTL_SEARCH_LEVEL;
|
||||
%rename(TL_SEARCH_FULL) wxTL_SEARCH_FULL;
|
||||
%rename(TL_SEARCH_PARTIAL) wxTL_SEARCH_PARTIAL;
|
||||
%rename(TL_SEARCH_NOCASE) wxTL_SEARCH_NOCASE;
|
||||
%rename(TR_DONT_ADJUST_MAC) wxTR_DONT_ADJUST_MAC;
|
||||
%rename(TreeListColumnInfo) wxTreeListColumnInfo;
|
||||
%rename(SCALE_HORIZONTAL) wxSCALE_HORIZONTAL;
|
||||
%rename(SCALE_VERTICAL) wxSCALE_VERTICAL;
|
||||
%rename(SCALE_UNIFORM) wxSCALE_UNIFORM;
|
||||
%rename(SCALE_CUSTOM) wxSCALE_CUSTOM;
|
||||
%rename(StaticPicture) wxStaticPicture;
|
||||
|
||||
#endif
|
3
wxPython/contrib/gizmos/_gizmos_reverse.txt
Normal file
3
wxPython/contrib/gizmos/_gizmos_reverse.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# Other names that need to be reverse-renamed for the old namespace
|
||||
|
||||
EVT*
|
1027
wxPython/contrib/gizmos/gizmos.i
Normal file
1027
wxPython/contrib/gizmos/gizmos.i
Normal file
File diff suppressed because it is too large
Load Diff
1016
wxPython/contrib/gizmos/gtk/gizmos.py
Normal file
1016
wxPython/contrib/gizmos/gtk/gizmos.py
Normal file
File diff suppressed because it is too large
Load Diff
10918
wxPython/contrib/gizmos/gtk/gizmos_wrap.cpp
Normal file
10918
wxPython/contrib/gizmos/gtk/gizmos_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
1016
wxPython/contrib/gizmos/mac/gizmos.py
Normal file
1016
wxPython/contrib/gizmos/mac/gizmos.py
Normal file
File diff suppressed because it is too large
Load Diff
10918
wxPython/contrib/gizmos/mac/gizmos_wrap.cpp
Normal file
10918
wxPython/contrib/gizmos/mac/gizmos_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
1016
wxPython/contrib/gizmos/msw/gizmos.py
Normal file
1016
wxPython/contrib/gizmos/msw/gizmos.py
Normal file
File diff suppressed because it is too large
Load Diff
10918
wxPython/contrib/gizmos/msw/gizmos_wrap.cpp
Normal file
10918
wxPython/contrib/gizmos/msw/gizmos_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
556
wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h
Normal file
556
wxPython/contrib/gizmos/wxCode/include/wx/treelistctrl.h
Normal file
@@ -0,0 +1,556 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: treelistctrl.h
|
||||
// Purpose: wxTreeListCtrl class
|
||||
// Author: Robert Roebling
|
||||
// Modified by: Alberto Griggio, 2002
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Robert Roebling, Julian Smart, Alberto Griggio,
|
||||
// Vadim Zeitlin, Otto Wyss
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifndef TREELISTCTRL_H
|
||||
#define TREELISTCTRL_H
|
||||
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/control.h>
|
||||
#include <wx/pen.h>
|
||||
#include <wx/listctrl.h> // for wxListEvent
|
||||
|
||||
#ifdef GIZMOISDLL
|
||||
#define GIZMODLLEXPORT WXDLLEXPORT
|
||||
#else
|
||||
#define GIZMODLLEXPORT
|
||||
#endif
|
||||
|
||||
|
||||
class GIZMODLLEXPORT wxTreeListItem;
|
||||
class GIZMODLLEXPORT wxTreeListHeaderWindow;
|
||||
class GIZMODLLEXPORT wxTreeListMainWindow;
|
||||
|
||||
|
||||
// Using this typedef removes an ambiguity when calling Remove()
|
||||
#ifdef __WXMSW__
|
||||
#if !wxCHECK_VERSION(2, 5, 0)
|
||||
typedef long wxTreeItemIdValue;
|
||||
#else
|
||||
typedef void *wxTreeItemIdValue;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define wxTR_DONT_ADJUST_MAC 0x0100 // Don't adjust the style for the Mac
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxTreeListColumnAttrs
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
enum wxTreeListColumnAlign {
|
||||
wxTL_ALIGN_LEFT,
|
||||
wxTL_ALIGN_RIGHT,
|
||||
wxTL_ALIGN_CENTER
|
||||
};
|
||||
|
||||
|
||||
class GIZMODLLEXPORT wxTreeListColumnInfo: public wxObject {
|
||||
public:
|
||||
enum { DEFAULT_COL_WIDTH = 100 };
|
||||
|
||||
wxTreeListColumnInfo(const wxString &text = wxT(""),
|
||||
int image = -1,
|
||||
size_t width = DEFAULT_COL_WIDTH,
|
||||
bool shown = true,
|
||||
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT)
|
||||
{
|
||||
m_image = image;
|
||||
m_selected_image = -1;
|
||||
m_text = text;
|
||||
m_width = width;
|
||||
m_shown = shown;
|
||||
m_alignment = alignment;
|
||||
}
|
||||
|
||||
wxTreeListColumnInfo(const wxTreeListColumnInfo& other)
|
||||
{
|
||||
m_image = other.m_image;
|
||||
m_selected_image = other.m_selected_image;
|
||||
m_text = other.m_text;
|
||||
m_width = other.m_width;
|
||||
m_shown = other.m_shown;
|
||||
m_alignment = other.m_alignment;
|
||||
}
|
||||
|
||||
~wxTreeListColumnInfo() {}
|
||||
|
||||
// getters
|
||||
bool GetShown() const { return m_shown; }
|
||||
wxTreeListColumnAlign GetAlignment() const { return m_alignment; }
|
||||
wxString GetText() const { return m_text; }
|
||||
int GetImage() const { return m_image; }
|
||||
int GetSelectedImage() const { return m_selected_image; }
|
||||
size_t GetWidth() const { return m_width; }
|
||||
|
||||
// setters
|
||||
wxTreeListColumnInfo& SetShown(bool shown)
|
||||
{ m_shown = shown; return *this; }
|
||||
|
||||
wxTreeListColumnInfo& SetAlignment(wxTreeListColumnAlign alignment)
|
||||
{ m_alignment = alignment; return *this; }
|
||||
|
||||
wxTreeListColumnInfo& SetText(const wxString& text)
|
||||
{ m_text = text; return *this; }
|
||||
|
||||
wxTreeListColumnInfo& SetImage(int image)
|
||||
{ m_image = image; return *this; }
|
||||
|
||||
wxTreeListColumnInfo& SetSelectedImage(int image)
|
||||
{ m_selected_image = image; return *this; }
|
||||
|
||||
wxTreeListColumnInfo& SetWidth(size_t with)
|
||||
{ m_width = with; return *this; }
|
||||
|
||||
private:
|
||||
bool m_shown;
|
||||
wxTreeListColumnAlign m_alignment;
|
||||
wxString m_text;
|
||||
int m_image;
|
||||
int m_selected_image;
|
||||
size_t m_width;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxTreeListCtrl - the multicolumn tree control
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// flags for FindItem
|
||||
const int wxTL_SEARCH_VISIBLE = 0x0000;
|
||||
const int wxTL_SEARCH_LEVEL = 0x0001;
|
||||
const int wxTL_SEARCH_FULL = 0x0002;
|
||||
const int wxTL_SEARCH_PARTIAL = 0x0010;
|
||||
const int wxTL_SEARCH_NOCASE = 0x0020;
|
||||
|
||||
// additional flag for HitTest
|
||||
const int wxTREE_HITTEST_ONITEMCOLUMN = 0x2000;
|
||||
extern GIZMODLLEXPORT const wxChar* wxTreeListCtrlNameStr;
|
||||
|
||||
|
||||
class GIZMODLLEXPORT wxTreeListCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
// creation
|
||||
// --------
|
||||
wxTreeListCtrl()
|
||||
: m_header_win(0), m_main_win(0), m_headerHeight(0)
|
||||
{}
|
||||
|
||||
wxTreeListCtrl(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_DEFAULT_STYLE,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString& name = wxTreeListCtrlNameStr )
|
||||
: m_header_win(0), m_main_win(0), m_headerHeight(0)
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
virtual ~wxTreeListCtrl() {}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTR_DEFAULT_STYLE,
|
||||
const wxValidator &validator = wxDefaultValidator,
|
||||
const wxString& name = wxTreeListCtrlNameStr );
|
||||
|
||||
void Refresh(bool erase=TRUE, const wxRect* rect=NULL);
|
||||
void SetFocus();
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// get the total number of items in the control
|
||||
size_t GetCount() const;
|
||||
|
||||
// indent is the number of pixels the children are indented relative to
|
||||
// the parents position. SetIndent() also redraws the control
|
||||
// immediately.
|
||||
unsigned int GetIndent() const;
|
||||
void SetIndent(unsigned int indent);
|
||||
|
||||
// line spacing is the space above and below the text on each line
|
||||
unsigned int GetLineSpacing() const;
|
||||
void SetLineSpacing(unsigned int spacing);
|
||||
|
||||
// image list: these functions allow to associate an image list with
|
||||
// the control and retrieve it. Note that when assigned with
|
||||
// SetImageList, the control does _not_ delete
|
||||
// the associated image list when it's deleted in order to allow image
|
||||
// lists to be shared between different controls. If you use
|
||||
// AssignImageList, the control _does_ delete the image list.
|
||||
//
|
||||
// The normal image list is for the icons which correspond to the
|
||||
// normal tree item state (whether it is selected or not).
|
||||
// Additionally, the application might choose to show a state icon
|
||||
// which corresponds to an app-defined item state (for example,
|
||||
// checked/unchecked) which are taken from the state image list.
|
||||
wxImageList *GetImageList() const;
|
||||
wxImageList *GetStateImageList() const;
|
||||
wxImageList *GetButtonsImageList() const;
|
||||
|
||||
void SetImageList(wxImageList *imageList);
|
||||
void SetStateImageList(wxImageList *imageList);
|
||||
void SetButtonsImageList(wxImageList *imageList);
|
||||
void AssignImageList(wxImageList *imageList);
|
||||
void AssignStateImageList(wxImageList *imageList);
|
||||
void AssignButtonsImageList(wxImageList *imageList);
|
||||
|
||||
|
||||
// Functions to work with tree list ctrl columns
|
||||
|
||||
// adds a column
|
||||
void AddColumn(const wxString& text)
|
||||
{ AddColumn(wxTreeListColumnInfo(text)); }
|
||||
void AddColumn(const wxString& text,
|
||||
size_t width,
|
||||
wxTreeListColumnAlign alignment = wxTL_ALIGN_LEFT)
|
||||
{ AddColumn(wxTreeListColumnInfo(text,
|
||||
-1,
|
||||
width,
|
||||
true,
|
||||
alignment)); }
|
||||
void AddColumn(const wxTreeListColumnInfo& col);
|
||||
|
||||
// inserts a column before the given one
|
||||
void InsertColumn(size_t before, const wxString& text)
|
||||
{ InsertColumn(before, wxTreeListColumnInfo(text)); }
|
||||
void InsertColumn(size_t before, const wxTreeListColumnInfo& col);
|
||||
|
||||
// deletes the given column - does not delete the corresponding column
|
||||
// of each item
|
||||
void RemoveColumn(size_t column);
|
||||
|
||||
// returns the number of columns in the ctrl
|
||||
size_t GetColumnCount() const;
|
||||
|
||||
void SetColumnWidth(size_t column, size_t width);
|
||||
int GetColumnWidth(size_t column) const;
|
||||
|
||||
// tells which column is the "main" one, i.e. the "threaded" one
|
||||
void SetMainColumn(size_t column);
|
||||
size_t GetMainColumn() const;
|
||||
|
||||
void SetColumnText(size_t column, const wxString& text);
|
||||
wxString GetColumnText(size_t column) const;
|
||||
|
||||
void SetColumn(size_t column, const wxTreeListColumnInfo& info);
|
||||
wxTreeListColumnInfo& GetColumn(size_t column);
|
||||
const wxTreeListColumnInfo& GetColumn(size_t column) const;
|
||||
|
||||
// other column-related methods
|
||||
void SetColumnAlignment(size_t column, wxTreeListColumnAlign align);
|
||||
wxTreeListColumnAlign GetColumnAlignment(size_t column) const;
|
||||
|
||||
void SetColumnImage(size_t column, int image);
|
||||
int GetColumnImage(size_t column) const;
|
||||
|
||||
void ShowColumn(size_t column, bool shown);
|
||||
bool IsColumnShown(size_t column) const;
|
||||
|
||||
// Functions to work with tree list ctrl items.
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// retrieve item's label (of the main column)
|
||||
wxString GetItemText(const wxTreeItemId& item) const
|
||||
{ return GetItemText(item, GetMainColumn()); }
|
||||
// retrieves item's label of the given column
|
||||
wxString GetItemText(const wxTreeItemId& item, size_t column) const;
|
||||
|
||||
// get one of the images associated with the item (normal by default)
|
||||
int GetItemImage(const wxTreeItemId& item,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal) const
|
||||
{ return GetItemImage(item, GetMainColumn(), which); }
|
||||
int GetItemImage(const wxTreeItemId& item, size_t column,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
|
||||
|
||||
// get the data associated with the item
|
||||
wxTreeItemData *GetItemData(const wxTreeItemId& item) const;
|
||||
|
||||
bool GetItemBold(const wxTreeItemId& item) const;
|
||||
wxColour GetItemTextColour(const wxTreeItemId& item) const;
|
||||
wxColour GetItemBackgroundColour(const wxTreeItemId& item) const;
|
||||
wxFont GetItemFont(const wxTreeItemId& item) const;
|
||||
|
||||
// modifiers
|
||||
// ---------
|
||||
|
||||
// set item's label
|
||||
void SetItemText(const wxTreeItemId& item, const wxString& text)
|
||||
{ SetItemText(item, GetMainColumn(), text); }
|
||||
void SetItemText(const wxTreeItemId& item, size_t column,
|
||||
const wxString& text);
|
||||
|
||||
// get one of the images associated with the item (normal by default)
|
||||
void SetItemImage(const wxTreeItemId& item, int image,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal)
|
||||
{ SetItemImage(item, GetMainColumn(), image, which); }
|
||||
// the which parameter is ignored for all columns but the main one
|
||||
void SetItemImage(const wxTreeItemId& item, size_t column, int image,
|
||||
wxTreeItemIcon which = wxTreeItemIcon_Normal);
|
||||
|
||||
// associate some data with the item
|
||||
void SetItemData(const wxTreeItemId& item, wxTreeItemData *data);
|
||||
|
||||
// force appearance of [+] button near the item. This is useful to
|
||||
// allow the user to expand the items which don't have any children now
|
||||
// - but instead add them only when needed, thus minimizing memory
|
||||
// usage and loading time.
|
||||
void SetItemHasChildren(const wxTreeItemId& item, bool has = TRUE);
|
||||
|
||||
// the item will be shown in bold
|
||||
void SetItemBold(const wxTreeItemId& item, bool bold = TRUE);
|
||||
|
||||
// set the item's text colour
|
||||
void SetItemTextColour(const wxTreeItemId& item, const wxColour& colour);
|
||||
|
||||
// set the item's background colour
|
||||
void SetItemBackgroundColour(const wxTreeItemId& item, const wxColour& colour);
|
||||
|
||||
// set the item's font (should be of the same height for all items)
|
||||
void SetItemFont(const wxTreeItemId& item, const wxFont& font);
|
||||
|
||||
// set the window font
|
||||
virtual bool SetFont( const wxFont &font );
|
||||
|
||||
// set the styles.
|
||||
void SetWindowStyle(const long styles);
|
||||
long GetWindowStyle() const;
|
||||
long GetWindowStyleFlag() const { return GetWindowStyle(); }
|
||||
|
||||
// item status inquiries
|
||||
// ---------------------
|
||||
|
||||
// is the item visible (it might be outside the view or not expanded)?
|
||||
bool IsVisible(const wxTreeItemId& item) const;
|
||||
// does the item has any children?
|
||||
bool HasChildren(const wxTreeItemId& item) const
|
||||
{ return ItemHasChildren(item); }
|
||||
bool ItemHasChildren(const wxTreeItemId& item) const;
|
||||
// is the item expanded (only makes sense if HasChildren())?
|
||||
bool IsExpanded(const wxTreeItemId& item) const;
|
||||
// is this item currently selected (the same as has focus)?
|
||||
bool IsSelected(const wxTreeItemId& item) const;
|
||||
// is item text in bold font?
|
||||
bool IsBold(const wxTreeItemId& item) const;
|
||||
// does the layout include space for a button?
|
||||
|
||||
// number of children
|
||||
// ------------------
|
||||
|
||||
// if 'recursively' is FALSE, only immediate children count, otherwise
|
||||
// the returned number is the number of all items in this branch
|
||||
size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE);
|
||||
|
||||
// navigation
|
||||
// ----------
|
||||
|
||||
// wxTreeItemId.IsOk() will return FALSE if there is no such item
|
||||
|
||||
// get the root tree item
|
||||
wxTreeItemId GetRootItem() const;
|
||||
|
||||
// get the item currently selected (may return NULL if no selection)
|
||||
wxTreeItemId GetSelection() const;
|
||||
|
||||
// get the items currently selected, return the number of such item
|
||||
size_t GetSelections(wxArrayTreeItemIds&) const;
|
||||
|
||||
// get the parent of this item (may return NULL if root)
|
||||
wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
|
||||
|
||||
// for this enumeration function you must pass in a "cookie" parameter
|
||||
// which is opaque for the application but is necessary for the library
|
||||
// to make these functions reentrant (i.e. allow more than one
|
||||
// enumeration on one and the same object simultaneously). Of course,
|
||||
// the "cookie" passed to GetFirstChild() and GetNextChild() should be
|
||||
// the same!
|
||||
|
||||
// get the first child of this item
|
||||
#if !wxCHECK_VERSION(2, 5, 0)
|
||||
wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& cookie) const;
|
||||
#else
|
||||
wxTreeItemId GetFirstChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
#endif
|
||||
// get the next child
|
||||
#if !wxCHECK_VERSION(2, 5, 0)
|
||||
wxTreeItemId GetNextChild(const wxTreeItemId& item, long& cookie) const;
|
||||
#else
|
||||
wxTreeItemId GetNextChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
#endif
|
||||
// get the prev child
|
||||
#if !wxCHECK_VERSION(2, 5, 0)
|
||||
wxTreeItemId GetPrevChild(const wxTreeItemId& item, long& cookie) const;
|
||||
#else
|
||||
wxTreeItemId GetPrevChild(const wxTreeItemId& item, wxTreeItemIdValue& cookie) const;
|
||||
#endif
|
||||
// get the last child of this item - this method doesn't use cookies
|
||||
wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
|
||||
|
||||
// get the next sibling of this item
|
||||
wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
|
||||
// get the previous sibling
|
||||
wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
|
||||
|
||||
// get first visible item
|
||||
wxTreeItemId GetFirstVisibleItem() const;
|
||||
// get the next visible item: item must be visible itself!
|
||||
// see IsVisible() and wxTreeCtrl::GetFirstVisibleItem()
|
||||
wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
|
||||
// get the previous visible item: item must be visible itself!
|
||||
wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
|
||||
|
||||
// Only for internal use right now, but should probably be public
|
||||
wxTreeItemId GetNext(const wxTreeItemId& item) const;
|
||||
|
||||
// operations
|
||||
// ----------
|
||||
|
||||
// add the root node to the tree
|
||||
wxTreeItemId AddRoot(const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item in as the first child of the parent
|
||||
wxTreeItemId PrependItem(const wxTreeItemId& parent,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item after a given one
|
||||
wxTreeItemId InsertItem(const wxTreeItemId& parent,
|
||||
const wxTreeItemId& idPrevious,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item before the one with the given index
|
||||
wxTreeItemId InsertItem(const wxTreeItemId& parent,
|
||||
size_t index,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// insert a new item in as the last child of the parent
|
||||
wxTreeItemId AppendItem(const wxTreeItemId& parent,
|
||||
const wxString& text,
|
||||
int image = -1, int selectedImage = -1,
|
||||
wxTreeItemData *data = NULL);
|
||||
|
||||
// delete this item and associated data if any
|
||||
void Delete(const wxTreeItemId& item);
|
||||
// delete all children (but don't delete the item itself)
|
||||
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
|
||||
void DeleteChildren(const wxTreeItemId& item);
|
||||
// delete all items from the tree
|
||||
// NB: this won't send wxEVT_COMMAND_TREE_ITEM_DELETED events
|
||||
void DeleteAllItems();
|
||||
|
||||
// expand this item
|
||||
void Expand(const wxTreeItemId& item);
|
||||
// expand this item and all subitems recursively
|
||||
void ExpandAll(const wxTreeItemId& item);
|
||||
// collapse the item without removing its children
|
||||
void Collapse(const wxTreeItemId& item);
|
||||
// collapse the item and remove all children
|
||||
void CollapseAndReset(const wxTreeItemId& item);
|
||||
// toggles the current state
|
||||
void Toggle(const wxTreeItemId& item);
|
||||
|
||||
// remove the selection from currently selected item (if any)
|
||||
void Unselect();
|
||||
void UnselectAll();
|
||||
// select this item
|
||||
void SelectItem(const wxTreeItemId& item, bool unselect_others=TRUE,
|
||||
bool extended_select=FALSE);
|
||||
void SelectAll(bool extended_select=FALSE);
|
||||
// make sure this item is visible (expanding the parent item and/or
|
||||
// scrolling to this item if necessary)
|
||||
void EnsureVisible(const wxTreeItemId& item);
|
||||
// scroll to this item (but don't expand its parent)
|
||||
void ScrollTo(const wxTreeItemId& item);
|
||||
//void AdjustMyScrollbars();
|
||||
|
||||
// The first function is more portable (because easier to implement
|
||||
// on other platforms), but the second one returns some extra info.
|
||||
wxTreeItemId HitTest(const wxPoint& point)
|
||||
{ int dummy; return HitTest(point, dummy); }
|
||||
wxTreeItemId HitTest(const wxPoint& point, int& flags)
|
||||
{ int col; return HitTest(point, flags, col); }
|
||||
wxTreeItemId HitTest(const wxPoint& point, int& flags, int& column);
|
||||
|
||||
// get the bounding rectangle of the item (or of its label only)
|
||||
bool GetBoundingRect(const wxTreeItemId& item,
|
||||
wxRect& rect,
|
||||
bool textOnly = FALSE) const;
|
||||
|
||||
// Start editing the item label: this (temporarily) replaces the item
|
||||
// with a one line edit control. The item will be selected if it hadn't
|
||||
// been before.
|
||||
void EditLabel( const wxTreeItemId& item ) { Edit( item ); }
|
||||
void Edit( const wxTreeItemId& item );
|
||||
|
||||
// sorting
|
||||
// this function is called to compare 2 items and should return -1, 0
|
||||
// or +1 if the first item is less than, equal to or greater than the
|
||||
// second one. The base class version performs alphabetic comparaison
|
||||
// of item labels (GetText)
|
||||
virtual int OnCompareItems(const wxTreeItemId& item1,
|
||||
const wxTreeItemId& item2);
|
||||
// sort the children of this item using OnCompareItems
|
||||
//
|
||||
// NB: this function is not reentrant and not MT-safe (FIXME)!
|
||||
void SortChildren(const wxTreeItemId& item);
|
||||
|
||||
// searching
|
||||
wxTreeItemId FindItem (const wxTreeItemId& item, const wxString& str, int flags = 0);
|
||||
|
||||
// overridden base class virtuals
|
||||
virtual bool SetBackgroundColour(const wxColour& colour);
|
||||
virtual bool SetForegroundColour(const wxColour& colour);
|
||||
|
||||
|
||||
wxTreeListHeaderWindow* GetHeaderWindow() const
|
||||
{ return m_header_win; }
|
||||
|
||||
wxTreeListMainWindow* GetMainWindow() const
|
||||
{ return m_main_win; }
|
||||
|
||||
virtual wxSize DoGetBestSize() const;
|
||||
|
||||
protected:
|
||||
// header window, responsible for column visualization and manipulation
|
||||
wxTreeListHeaderWindow* m_header_win;
|
||||
// main window, the "true" tree ctrl
|
||||
wxTreeListMainWindow* m_main_win;
|
||||
|
||||
// // the common part of all ctors
|
||||
// void Init();
|
||||
|
||||
void OnGetToolTip( wxTreeEvent &event );
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void CalculateAndSetHeaderHeight();
|
||||
void DoHeaderLayout();
|
||||
|
||||
private:
|
||||
size_t fill_column;
|
||||
size_t m_headerHeight;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_DYNAMIC_CLASS(wxTreeListCtrl)
|
||||
};
|
||||
|
||||
#endif // TREELISTCTRL_H
|
||||
|
5118
wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp
Normal file
5118
wxPython/contrib/gizmos/wxCode/src/treelistctrl.cpp
Normal file
File diff suppressed because it is too large
Load Diff
14
wxPython/contrib/glcanvas/.cvsignore
Normal file
14
wxPython/contrib/glcanvas/.cvsignore
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
*.exp
|
||||
*.lib
|
||||
*.obj
|
||||
*.pch
|
||||
Makefile
|
||||
Makefile.pre
|
||||
Setup
|
||||
build.local
|
||||
config.c
|
||||
glcanvas.h
|
||||
glcanvasc.ilk
|
||||
glcanvasc.pyd
|
||||
sedscript
|
9
wxPython/contrib/glcanvas/_glcanvas_rename.i
Normal file
9
wxPython/contrib/glcanvas/_glcanvas_rename.i
Normal file
@@ -0,0 +1,9 @@
|
||||
// A bunch of %rename directives generated by BuildRenamers in config.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef BUILDING_RENAMERS
|
||||
|
||||
%rename(GLContext) wxGLContext;
|
||||
%rename(GLCanvas) wxGLCanvas;
|
||||
|
||||
#endif
|
171
wxPython/contrib/glcanvas/glcanvas.i
Normal file
171
wxPython/contrib/glcanvas/glcanvas.i
Normal file
@@ -0,0 +1,171 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: glcanvas.i
|
||||
// Purpose: SWIG definitions for the OpenGL wxWindows classes
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 15-Mar-1999
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
%define DOCSTRING
|
||||
"`GLCanvas` provides an OpenGL Context on a `wx.Window`."
|
||||
%enddef
|
||||
|
||||
%module(package="wx", docstring=DOCSTRING) glcanvas
|
||||
|
||||
%{
|
||||
#include "wx/wxPython/wxPython.h"
|
||||
#include "wx/wxPython/pyclasses.h"
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%import core.i
|
||||
%pythoncode { wx = _core }
|
||||
%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
|
||||
|
||||
|
||||
MAKE_CONST_WXSTRING2(GLCanvasNameStr, wxT("GLCanvas"));
|
||||
MAKE_CONST_WXSTRING_NOSWIG(EmptyString);
|
||||
|
||||
|
||||
%include _glcanvas_rename.i
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxPalette;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
MustHaveApp(wxGLContext);
|
||||
|
||||
class wxGLContext : public wxObject {
|
||||
public:
|
||||
#ifndef __WXMAC__
|
||||
wxGLContext(bool isRGB, wxGLCanvas *win,
|
||||
const wxPalette& palette = wxNullPalette,
|
||||
const wxGLContext* other = NULL);
|
||||
#else
|
||||
%extend {
|
||||
wxGLContext(bool isRGB, wxGLCanvas *win,
|
||||
const wxPalette& palette = wxNullPalette,
|
||||
const wxGLContext* other = NULL) {
|
||||
AGLPixelFormat fmt; // TODO: How should this be initialized?
|
||||
return new wxGLContext(fmt, win, palette, other);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
~wxGLContext();
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const wxString& colour);
|
||||
void SwapBuffers();
|
||||
|
||||
#ifdef __WXGTK__
|
||||
void SetupPixelFormat();
|
||||
void SetupPalette(const wxPalette& palette);
|
||||
wxPalette CreateDefaultPalette();
|
||||
wxPalette* GetPalette();
|
||||
#endif
|
||||
|
||||
wxWindow* GetWindow();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
WX_GL_RGBA, // use true color palette
|
||||
WX_GL_BUFFER_SIZE, // bits for buffer if not WX_GL_RGBA
|
||||
WX_GL_LEVEL, // 0 for main buffer, >0 for overlay, <0 for underlay
|
||||
WX_GL_DOUBLEBUFFER, // use doublebuffer
|
||||
WX_GL_STEREO, // use stereoscopic display
|
||||
WX_GL_AUX_BUFFERS, // number of auxiliary buffers
|
||||
WX_GL_MIN_RED, // use red buffer with most bits (> MIN_RED bits)
|
||||
WX_GL_MIN_GREEN, // use green buffer with most bits (> MIN_GREEN bits)
|
||||
WX_GL_MIN_BLUE, // use blue buffer with most bits (> MIN_BLUE bits)
|
||||
WX_GL_MIN_ALPHA, // use blue buffer with most bits (> MIN_ALPHA bits)
|
||||
WX_GL_DEPTH_SIZE, // bits for Z-buffer (0,16,32)
|
||||
WX_GL_STENCIL_SIZE, // bits for stencil buffer
|
||||
WX_GL_MIN_ACCUM_RED, // use red accum buffer with most bits (> MIN_ACCUM_RED bits)
|
||||
WX_GL_MIN_ACCUM_GREEN, // use green buffer with most bits (> MIN_ACCUM_GREEN bits)
|
||||
WX_GL_MIN_ACCUM_BLUE, // use blue buffer with most bits (> MIN_ACCUM_BLUE bits)
|
||||
WX_GL_MIN_ACCUM_ALPHA // use blue buffer with most bits (> MIN_ACCUM_ALPHA bits)
|
||||
};
|
||||
|
||||
|
||||
%typemap(in) int *attribList (int *temp) {
|
||||
int i;
|
||||
if (PySequence_Check($input)) {
|
||||
int size = PyObject_Length($input);
|
||||
temp = new int[size+1]; // (int*)malloc((size + 1) * sizeof(int));
|
||||
for (i = 0; i < size; i++) {
|
||||
temp[i] = PyInt_AsLong(PySequence_GetItem($input, i));
|
||||
}
|
||||
temp[size] = 0;
|
||||
$1 = temp;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(freearg) int *attribList
|
||||
{
|
||||
delete [] $1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MustHaveApp(wxGLCanvas);
|
||||
|
||||
class wxGLCanvas : public wxWindow {
|
||||
public:
|
||||
%pythonAppend wxGLCanvas "self._setOORInfo(self)"
|
||||
wxGLCanvas(wxWindow *parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize, long style = 0,
|
||||
const wxString& name = wxPyGLCanvasNameStr,
|
||||
int *attribList = NULL,
|
||||
const wxPalette& palette = wxNullPalette);
|
||||
|
||||
%pythonAppend wxGLCanvas "val._setOORInfo(val)"
|
||||
%RenameCtor(GLCanvasWithContext,
|
||||
wxGLCanvas( wxWindow *parent,
|
||||
const wxGLContext *shared = NULL,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPyGLCanvasNameStr,
|
||||
int *attribList = NULL,
|
||||
const wxPalette& palette = wxNullPalette ));
|
||||
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const wxString& colour);
|
||||
void SwapBuffers();
|
||||
|
||||
wxGLContext* GetContext();
|
||||
|
||||
#ifdef __WXMSW__
|
||||
void SetupPixelFormat(int *attribList = NULL);
|
||||
void SetupPalette(const wxPalette& palette);
|
||||
wxPalette CreateDefaultPalette();
|
||||
wxPalette* GetPalette();
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%init %{
|
||||
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
2
wxPython/contrib/glcanvas/gtk/.cvsignore
Normal file
2
wxPython/contrib/glcanvas/gtk/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
*~
|
||||
_glcanvas.cpp
|
183
wxPython/contrib/glcanvas/gtk/glcanvas.py
Normal file
183
wxPython/contrib/glcanvas/gtk/glcanvas.py
Normal file
@@ -0,0 +1,183 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
`GLCanvas` provides an OpenGL Context on a `wx.Window`.
|
||||
"""
|
||||
|
||||
import _glcanvas
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
class GLContext(_core.Object):
|
||||
"""Proxy of C++ GLContext class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGLContext instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, bool isRGB, GLCanvas win, wxPalette palette=wxNullPalette,
|
||||
GLContext other=None) -> GLContext
|
||||
"""
|
||||
newobj = _glcanvas.new_GLContext(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_glcanvas.delete_GLContext):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def SetCurrent(*args, **kwargs):
|
||||
"""SetCurrent(self)"""
|
||||
return _glcanvas.GLContext_SetCurrent(*args, **kwargs)
|
||||
|
||||
def SetColour(*args, **kwargs):
|
||||
"""SetColour(self, String colour)"""
|
||||
return _glcanvas.GLContext_SetColour(*args, **kwargs)
|
||||
|
||||
def SwapBuffers(*args, **kwargs):
|
||||
"""SwapBuffers(self)"""
|
||||
return _glcanvas.GLContext_SwapBuffers(*args, **kwargs)
|
||||
|
||||
def SetupPixelFormat(*args, **kwargs):
|
||||
"""SetupPixelFormat(self)"""
|
||||
return _glcanvas.GLContext_SetupPixelFormat(*args, **kwargs)
|
||||
|
||||
def SetupPalette(*args, **kwargs):
|
||||
"""SetupPalette(self, wxPalette palette)"""
|
||||
return _glcanvas.GLContext_SetupPalette(*args, **kwargs)
|
||||
|
||||
def CreateDefaultPalette(*args, **kwargs):
|
||||
"""CreateDefaultPalette(self) -> wxPalette"""
|
||||
return _glcanvas.GLContext_CreateDefaultPalette(*args, **kwargs)
|
||||
|
||||
def GetPalette(*args, **kwargs):
|
||||
"""GetPalette(self) -> wxPalette"""
|
||||
return _glcanvas.GLContext_GetPalette(*args, **kwargs)
|
||||
|
||||
def GetWindow(*args, **kwargs):
|
||||
"""GetWindow(self) -> Window"""
|
||||
return _glcanvas.GLContext_GetWindow(*args, **kwargs)
|
||||
|
||||
|
||||
class GLContextPtr(GLContext):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GLContext
|
||||
_glcanvas.GLContext_swigregister(GLContextPtr)
|
||||
cvar = _glcanvas.cvar
|
||||
GLCanvasNameStr = cvar.GLCanvasNameStr
|
||||
|
||||
WX_GL_RGBA = _glcanvas.WX_GL_RGBA
|
||||
WX_GL_BUFFER_SIZE = _glcanvas.WX_GL_BUFFER_SIZE
|
||||
WX_GL_LEVEL = _glcanvas.WX_GL_LEVEL
|
||||
WX_GL_DOUBLEBUFFER = _glcanvas.WX_GL_DOUBLEBUFFER
|
||||
WX_GL_STEREO = _glcanvas.WX_GL_STEREO
|
||||
WX_GL_AUX_BUFFERS = _glcanvas.WX_GL_AUX_BUFFERS
|
||||
WX_GL_MIN_RED = _glcanvas.WX_GL_MIN_RED
|
||||
WX_GL_MIN_GREEN = _glcanvas.WX_GL_MIN_GREEN
|
||||
WX_GL_MIN_BLUE = _glcanvas.WX_GL_MIN_BLUE
|
||||
WX_GL_MIN_ALPHA = _glcanvas.WX_GL_MIN_ALPHA
|
||||
WX_GL_DEPTH_SIZE = _glcanvas.WX_GL_DEPTH_SIZE
|
||||
WX_GL_STENCIL_SIZE = _glcanvas.WX_GL_STENCIL_SIZE
|
||||
WX_GL_MIN_ACCUM_RED = _glcanvas.WX_GL_MIN_ACCUM_RED
|
||||
WX_GL_MIN_ACCUM_GREEN = _glcanvas.WX_GL_MIN_ACCUM_GREEN
|
||||
WX_GL_MIN_ACCUM_BLUE = _glcanvas.WX_GL_MIN_ACCUM_BLUE
|
||||
WX_GL_MIN_ACCUM_ALPHA = _glcanvas.WX_GL_MIN_ACCUM_ALPHA
|
||||
class GLCanvas(_core.Window):
|
||||
"""Proxy of C++ GLCanvas class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGLCanvas instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize, long style=0, String name=GLCanvasNameStr,
|
||||
int attribList=None, wxPalette palette=wxNullPalette) -> GLCanvas
|
||||
"""
|
||||
newobj = _glcanvas.new_GLCanvas(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def SetCurrent(*args, **kwargs):
|
||||
"""SetCurrent(self)"""
|
||||
return _glcanvas.GLCanvas_SetCurrent(*args, **kwargs)
|
||||
|
||||
def SetColour(*args, **kwargs):
|
||||
"""SetColour(self, String colour)"""
|
||||
return _glcanvas.GLCanvas_SetColour(*args, **kwargs)
|
||||
|
||||
def SwapBuffers(*args, **kwargs):
|
||||
"""SwapBuffers(self)"""
|
||||
return _glcanvas.GLCanvas_SwapBuffers(*args, **kwargs)
|
||||
|
||||
def GetContext(*args, **kwargs):
|
||||
"""GetContext(self) -> GLContext"""
|
||||
return _glcanvas.GLCanvas_GetContext(*args, **kwargs)
|
||||
|
||||
|
||||
class GLCanvasPtr(GLCanvas):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GLCanvas
|
||||
_glcanvas.GLCanvas_swigregister(GLCanvasPtr)
|
||||
|
||||
def GLCanvasWithContext(*args, **kwargs):
|
||||
"""
|
||||
GLCanvasWithContext(Window parent, GLContext shared=None, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize,
|
||||
long style=0, String name=GLCanvasNameStr,
|
||||
int attribList=None, wxPalette palette=wxNullPalette) -> GLCanvas
|
||||
"""
|
||||
val = _glcanvas.new_GLCanvasWithContext(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
2988
wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp
Normal file
2988
wxPython/contrib/glcanvas/gtk/glcanvas_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
167
wxPython/contrib/glcanvas/mac/glcanvas.py
Normal file
167
wxPython/contrib/glcanvas/mac/glcanvas.py
Normal file
@@ -0,0 +1,167 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
`GLCanvas` provides an OpenGL Context on a `wx.Window`.
|
||||
"""
|
||||
|
||||
import _glcanvas
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
class GLContext(_core.Object):
|
||||
"""Proxy of C++ GLContext class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGLContext instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, bool isRGB, GLCanvas win, wxPalette palette=wxNullPalette,
|
||||
GLContext other=None) -> GLContext
|
||||
"""
|
||||
newobj = _glcanvas.new_GLContext(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_glcanvas.delete_GLContext):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def SetCurrent(*args, **kwargs):
|
||||
"""SetCurrent(self)"""
|
||||
return _glcanvas.GLContext_SetCurrent(*args, **kwargs)
|
||||
|
||||
def SetColour(*args, **kwargs):
|
||||
"""SetColour(self, String colour)"""
|
||||
return _glcanvas.GLContext_SetColour(*args, **kwargs)
|
||||
|
||||
def SwapBuffers(*args, **kwargs):
|
||||
"""SwapBuffers(self)"""
|
||||
return _glcanvas.GLContext_SwapBuffers(*args, **kwargs)
|
||||
|
||||
def GetWindow(*args, **kwargs):
|
||||
"""GetWindow(self) -> Window"""
|
||||
return _glcanvas.GLContext_GetWindow(*args, **kwargs)
|
||||
|
||||
|
||||
class GLContextPtr(GLContext):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GLContext
|
||||
_glcanvas.GLContext_swigregister(GLContextPtr)
|
||||
cvar = _glcanvas.cvar
|
||||
GLCanvasNameStr = cvar.GLCanvasNameStr
|
||||
|
||||
WX_GL_RGBA = _glcanvas.WX_GL_RGBA
|
||||
WX_GL_BUFFER_SIZE = _glcanvas.WX_GL_BUFFER_SIZE
|
||||
WX_GL_LEVEL = _glcanvas.WX_GL_LEVEL
|
||||
WX_GL_DOUBLEBUFFER = _glcanvas.WX_GL_DOUBLEBUFFER
|
||||
WX_GL_STEREO = _glcanvas.WX_GL_STEREO
|
||||
WX_GL_AUX_BUFFERS = _glcanvas.WX_GL_AUX_BUFFERS
|
||||
WX_GL_MIN_RED = _glcanvas.WX_GL_MIN_RED
|
||||
WX_GL_MIN_GREEN = _glcanvas.WX_GL_MIN_GREEN
|
||||
WX_GL_MIN_BLUE = _glcanvas.WX_GL_MIN_BLUE
|
||||
WX_GL_MIN_ALPHA = _glcanvas.WX_GL_MIN_ALPHA
|
||||
WX_GL_DEPTH_SIZE = _glcanvas.WX_GL_DEPTH_SIZE
|
||||
WX_GL_STENCIL_SIZE = _glcanvas.WX_GL_STENCIL_SIZE
|
||||
WX_GL_MIN_ACCUM_RED = _glcanvas.WX_GL_MIN_ACCUM_RED
|
||||
WX_GL_MIN_ACCUM_GREEN = _glcanvas.WX_GL_MIN_ACCUM_GREEN
|
||||
WX_GL_MIN_ACCUM_BLUE = _glcanvas.WX_GL_MIN_ACCUM_BLUE
|
||||
WX_GL_MIN_ACCUM_ALPHA = _glcanvas.WX_GL_MIN_ACCUM_ALPHA
|
||||
class GLCanvas(_core.Window):
|
||||
"""Proxy of C++ GLCanvas class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGLCanvas instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize, long style=0, String name=GLCanvasNameStr,
|
||||
int attribList=None, wxPalette palette=wxNullPalette) -> GLCanvas
|
||||
"""
|
||||
newobj = _glcanvas.new_GLCanvas(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def SetCurrent(*args, **kwargs):
|
||||
"""SetCurrent(self)"""
|
||||
return _glcanvas.GLCanvas_SetCurrent(*args, **kwargs)
|
||||
|
||||
def SetColour(*args, **kwargs):
|
||||
"""SetColour(self, String colour)"""
|
||||
return _glcanvas.GLCanvas_SetColour(*args, **kwargs)
|
||||
|
||||
def SwapBuffers(*args, **kwargs):
|
||||
"""SwapBuffers(self)"""
|
||||
return _glcanvas.GLCanvas_SwapBuffers(*args, **kwargs)
|
||||
|
||||
def GetContext(*args, **kwargs):
|
||||
"""GetContext(self) -> GLContext"""
|
||||
return _glcanvas.GLCanvas_GetContext(*args, **kwargs)
|
||||
|
||||
|
||||
class GLCanvasPtr(GLCanvas):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GLCanvas
|
||||
_glcanvas.GLCanvas_swigregister(GLCanvasPtr)
|
||||
|
||||
def GLCanvasWithContext(*args, **kwargs):
|
||||
"""
|
||||
GLCanvasWithContext(Window parent, GLContext shared=None, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize,
|
||||
long style=0, String name=GLCanvasNameStr,
|
||||
int attribList=None, wxPalette palette=wxNullPalette) -> GLCanvas
|
||||
"""
|
||||
val = _glcanvas.new_GLCanvasWithContext(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
2872
wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp
Normal file
2872
wxPython/contrib/glcanvas/mac/glcanvas_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
1
wxPython/contrib/glcanvas/msw/.cvsignore
Normal file
1
wxPython/contrib/glcanvas/msw/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
*~
|
183
wxPython/contrib/glcanvas/msw/glcanvas.py
Normal file
183
wxPython/contrib/glcanvas/msw/glcanvas.py
Normal file
@@ -0,0 +1,183 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
"""
|
||||
`GLCanvas` provides an OpenGL Context on a `wx.Window`.
|
||||
"""
|
||||
|
||||
import _glcanvas
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
class GLContext(_core.Object):
|
||||
"""Proxy of C++ GLContext class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGLContext instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, bool isRGB, GLCanvas win, wxPalette palette=wxNullPalette,
|
||||
GLContext other=None) -> GLContext
|
||||
"""
|
||||
newobj = _glcanvas.new_GLContext(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def __del__(self, destroy=_glcanvas.delete_GLContext):
|
||||
"""__del__(self)"""
|
||||
try:
|
||||
if self.thisown: destroy(self)
|
||||
except: pass
|
||||
|
||||
def SetCurrent(*args, **kwargs):
|
||||
"""SetCurrent(self)"""
|
||||
return _glcanvas.GLContext_SetCurrent(*args, **kwargs)
|
||||
|
||||
def SetColour(*args, **kwargs):
|
||||
"""SetColour(self, String colour)"""
|
||||
return _glcanvas.GLContext_SetColour(*args, **kwargs)
|
||||
|
||||
def SwapBuffers(*args, **kwargs):
|
||||
"""SwapBuffers(self)"""
|
||||
return _glcanvas.GLContext_SwapBuffers(*args, **kwargs)
|
||||
|
||||
def GetWindow(*args, **kwargs):
|
||||
"""GetWindow(self) -> Window"""
|
||||
return _glcanvas.GLContext_GetWindow(*args, **kwargs)
|
||||
|
||||
|
||||
class GLContextPtr(GLContext):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GLContext
|
||||
_glcanvas.GLContext_swigregister(GLContextPtr)
|
||||
cvar = _glcanvas.cvar
|
||||
GLCanvasNameStr = cvar.GLCanvasNameStr
|
||||
|
||||
WX_GL_RGBA = _glcanvas.WX_GL_RGBA
|
||||
WX_GL_BUFFER_SIZE = _glcanvas.WX_GL_BUFFER_SIZE
|
||||
WX_GL_LEVEL = _glcanvas.WX_GL_LEVEL
|
||||
WX_GL_DOUBLEBUFFER = _glcanvas.WX_GL_DOUBLEBUFFER
|
||||
WX_GL_STEREO = _glcanvas.WX_GL_STEREO
|
||||
WX_GL_AUX_BUFFERS = _glcanvas.WX_GL_AUX_BUFFERS
|
||||
WX_GL_MIN_RED = _glcanvas.WX_GL_MIN_RED
|
||||
WX_GL_MIN_GREEN = _glcanvas.WX_GL_MIN_GREEN
|
||||
WX_GL_MIN_BLUE = _glcanvas.WX_GL_MIN_BLUE
|
||||
WX_GL_MIN_ALPHA = _glcanvas.WX_GL_MIN_ALPHA
|
||||
WX_GL_DEPTH_SIZE = _glcanvas.WX_GL_DEPTH_SIZE
|
||||
WX_GL_STENCIL_SIZE = _glcanvas.WX_GL_STENCIL_SIZE
|
||||
WX_GL_MIN_ACCUM_RED = _glcanvas.WX_GL_MIN_ACCUM_RED
|
||||
WX_GL_MIN_ACCUM_GREEN = _glcanvas.WX_GL_MIN_ACCUM_GREEN
|
||||
WX_GL_MIN_ACCUM_BLUE = _glcanvas.WX_GL_MIN_ACCUM_BLUE
|
||||
WX_GL_MIN_ACCUM_ALPHA = _glcanvas.WX_GL_MIN_ACCUM_ALPHA
|
||||
class GLCanvas(_core.Window):
|
||||
"""Proxy of C++ GLCanvas class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxGLCanvas instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize, long style=0, String name=GLCanvasNameStr,
|
||||
int attribList=None, wxPalette palette=wxNullPalette) -> GLCanvas
|
||||
"""
|
||||
newobj = _glcanvas.new_GLCanvas(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def SetCurrent(*args, **kwargs):
|
||||
"""SetCurrent(self)"""
|
||||
return _glcanvas.GLCanvas_SetCurrent(*args, **kwargs)
|
||||
|
||||
def SetColour(*args, **kwargs):
|
||||
"""SetColour(self, String colour)"""
|
||||
return _glcanvas.GLCanvas_SetColour(*args, **kwargs)
|
||||
|
||||
def SwapBuffers(*args, **kwargs):
|
||||
"""SwapBuffers(self)"""
|
||||
return _glcanvas.GLCanvas_SwapBuffers(*args, **kwargs)
|
||||
|
||||
def GetContext(*args, **kwargs):
|
||||
"""GetContext(self) -> GLContext"""
|
||||
return _glcanvas.GLCanvas_GetContext(*args, **kwargs)
|
||||
|
||||
def SetupPixelFormat(*args, **kwargs):
|
||||
"""SetupPixelFormat(self, int attribList=None)"""
|
||||
return _glcanvas.GLCanvas_SetupPixelFormat(*args, **kwargs)
|
||||
|
||||
def SetupPalette(*args, **kwargs):
|
||||
"""SetupPalette(self, wxPalette palette)"""
|
||||
return _glcanvas.GLCanvas_SetupPalette(*args, **kwargs)
|
||||
|
||||
def CreateDefaultPalette(*args, **kwargs):
|
||||
"""CreateDefaultPalette(self) -> wxPalette"""
|
||||
return _glcanvas.GLCanvas_CreateDefaultPalette(*args, **kwargs)
|
||||
|
||||
def GetPalette(*args, **kwargs):
|
||||
"""GetPalette(self) -> wxPalette"""
|
||||
return _glcanvas.GLCanvas_GetPalette(*args, **kwargs)
|
||||
|
||||
|
||||
class GLCanvasPtr(GLCanvas):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = GLCanvas
|
||||
_glcanvas.GLCanvas_swigregister(GLCanvasPtr)
|
||||
|
||||
def GLCanvasWithContext(*args, **kwargs):
|
||||
"""
|
||||
GLCanvasWithContext(Window parent, GLContext shared=None, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize,
|
||||
long style=0, String name=GLCanvasNameStr,
|
||||
int attribList=None, wxPalette palette=wxNullPalette) -> GLCanvas
|
||||
"""
|
||||
val = _glcanvas.new_GLCanvasWithContext(*args, **kwargs)
|
||||
val.thisown = 1
|
||||
val._setOORInfo(val)
|
||||
return val
|
||||
|
||||
|
3011
wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp
Normal file
3011
wxPython/contrib/glcanvas/msw/glcanvas_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
1
wxPython/contrib/iewin/.cvsignore
Normal file
1
wxPython/contrib/iewin/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
orig
|
585
wxPython/contrib/iewin/IEHtmlWin.cpp
Normal file
585
wxPython/contrib/iewin/IEHtmlWin.cpp
Normal file
@@ -0,0 +1,585 @@
|
||||
#include "IEHtmlWin.h"
|
||||
#include <wx/strconv.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <oleidl.h>
|
||||
#include <winerror.h>
|
||||
#include <exdispid.h>
|
||||
#include <exdisp.h>
|
||||
#include <olectl.h>
|
||||
#include <Mshtml.h>
|
||||
#include <sstream>
|
||||
using namespace std;
|
||||
|
||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2)
|
||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_NEWWINDOW2)
|
||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE)
|
||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE)
|
||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE)
|
||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_MSHTML_TITLECHANGE)
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMSHTMLEvent, wxNotifyEvent)
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
BEGIN_EVENT_TABLE(wxIEHtmlWin, wxActiveX)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
class FS_DWebBrowserEvents2 : public IDispatch
|
||||
{
|
||||
private:
|
||||
DECLARE_OLE_UNKNOWN(FS_DWebBrowserEvents2);
|
||||
|
||||
|
||||
wxIEHtmlWin *m_iewin;
|
||||
|
||||
public:
|
||||
FS_DWebBrowserEvents2(wxIEHtmlWin *iewin) : m_iewin(iewin) {}
|
||||
virtual ~FS_DWebBrowserEvents2()
|
||||
{
|
||||
}
|
||||
|
||||
//IDispatch
|
||||
STDMETHODIMP GetIDsOfNames(REFIID r, OLECHAR** o, unsigned int i, LCID l, DISPID* d)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
};
|
||||
|
||||
STDMETHODIMP GetTypeInfo(unsigned int i, LCID l, ITypeInfo** t)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
};
|
||||
|
||||
STDMETHODIMP GetTypeInfoCount(unsigned int* i)
|
||||
{
|
||||
return E_NOTIMPL;
|
||||
};
|
||||
|
||||
void Post(WXTYPE etype, wxString text, long l1 = 0, long l2 = 0)
|
||||
{
|
||||
if (! m_iewin || ! m_iewin->GetParent())
|
||||
return;
|
||||
|
||||
wxMSHTMLEvent event;
|
||||
event.SetId(m_iewin->GetId());
|
||||
event.SetEventType(etype);
|
||||
event.m_text1 = text;
|
||||
event.m_long1 = l1;
|
||||
event.m_long2 = l2;
|
||||
|
||||
m_iewin->GetParent()->AddPendingEvent(event);
|
||||
};
|
||||
|
||||
bool Process(WXTYPE etype, wxString text = wxEmptyString, long l1 = 0, long l2 = 0)
|
||||
{
|
||||
if (! m_iewin || ! m_iewin->GetParent())
|
||||
return true;
|
||||
|
||||
wxMSHTMLEvent event;
|
||||
event.SetId(m_iewin->GetId());
|
||||
event.SetEventType(etype);
|
||||
event.m_text1 = text;
|
||||
event.m_long1 = l1;
|
||||
event.m_long2 = l2;
|
||||
|
||||
m_iewin->GetParent()->ProcessEvent(event);
|
||||
|
||||
return event.IsAllowed();
|
||||
};
|
||||
|
||||
wxString GetStrArg(VARIANT& v)
|
||||
{
|
||||
VARTYPE vt = v.vt & ~VT_BYREF;
|
||||
|
||||
if (vt == VT_VARIANT)
|
||||
return GetStrArg(*v.pvarVal);
|
||||
else if (vt == VT_BSTR)
|
||||
{
|
||||
if (v.vt & VT_BYREF)
|
||||
return (v.pbstrVal ? *v.pbstrVal : L"");
|
||||
else
|
||||
return v.bstrVal;
|
||||
}
|
||||
else
|
||||
return wxEmptyString;
|
||||
};
|
||||
|
||||
#define STR_ARG(arg) GetStrArg(pDispParams->rgvarg[arg])
|
||||
|
||||
#define LONG_ARG(arg)\
|
||||
(pDispParams->rgvarg[arg].lVal)
|
||||
|
||||
|
||||
STDMETHODIMP Invoke(DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||
WORD wFlags, DISPPARAMS * pDispParams,
|
||||
VARIANT * pVarResult, EXCEPINFO * pExcepInfo,
|
||||
unsigned int * puArgErr)
|
||||
{
|
||||
if (wFlags & DISPATCH_PROPERTYGET)
|
||||
return E_NOTIMPL;
|
||||
|
||||
switch (dispIdMember)
|
||||
{
|
||||
case DISPID_BEFORENAVIGATE2:
|
||||
if (Process(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, STR_ARG(5)))
|
||||
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
||||
else
|
||||
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
||||
break;
|
||||
|
||||
case DISPID_NEWWINDOW2:
|
||||
if (Process(wxEVT_COMMAND_MSHTML_NEWWINDOW2))
|
||||
*pDispParams->rgvarg->pboolVal = VARIANT_FALSE;
|
||||
else
|
||||
*pDispParams->rgvarg->pboolVal = VARIANT_TRUE;
|
||||
break;
|
||||
|
||||
case DISPID_PROGRESSCHANGE:
|
||||
Post(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, wxEmptyString, LONG_ARG(1), LONG_ARG(0));
|
||||
break;
|
||||
|
||||
case DISPID_DOCUMENTCOMPLETE:
|
||||
Post(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, STR_ARG(0));
|
||||
break;
|
||||
|
||||
case DISPID_STATUSTEXTCHANGE:
|
||||
Post(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, STR_ARG(0));
|
||||
break;
|
||||
|
||||
case DISPID_TITLECHANGE:
|
||||
Post(wxEVT_COMMAND_MSHTML_TITLECHANGE, STR_ARG(0));
|
||||
break;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#undef STR_ARG
|
||||
|
||||
DEFINE_OLE_TABLE(FS_DWebBrowserEvents2)
|
||||
OLE_IINTERFACE(IUnknown)
|
||||
OLE_INTERFACE(DIID_DWebBrowserEvents2, DWebBrowserEvents2)
|
||||
END_OLE_TABLE;
|
||||
|
||||
|
||||
static const CLSID CLSID_MozillaBrowser =
|
||||
{ 0x1339B54C, 0x3453, 0x11D2,
|
||||
{ 0x93, 0xB9, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00 } };
|
||||
|
||||
|
||||
//#define PROGID "Shell.Explorer"
|
||||
#define PROGID CLSID_WebBrowser
|
||||
//#define PROGID CLSID_MozillaBrowser
|
||||
//#define PROGID CLSID_HTMLDocument
|
||||
//#define PROGID "MSCAL.Calendar"
|
||||
//#define PROGID "WordPad.Document.1"
|
||||
//#define PROGID "SoftwareFX.ChartFX.20"
|
||||
|
||||
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name) :
|
||||
wxActiveX(parent, PROGID, id, pos, size, style, name)
|
||||
{
|
||||
SetupBrowser();
|
||||
}
|
||||
|
||||
|
||||
wxIEHtmlWin::~wxIEHtmlWin()
|
||||
{
|
||||
}
|
||||
|
||||
void wxIEHtmlWin::SetupBrowser()
|
||||
{
|
||||
HRESULT hret;
|
||||
|
||||
// Get IWebBrowser2 Interface
|
||||
hret = m_webBrowser.QueryInterface(IID_IWebBrowser2, m_ActiveX);
|
||||
assert(SUCCEEDED(hret));
|
||||
|
||||
// Web Browser Events
|
||||
FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(this);
|
||||
hret = ConnectAdvise(DIID_DWebBrowserEvents2, events);
|
||||
if (! SUCCEEDED(hret))
|
||||
delete events;
|
||||
|
||||
// web browser setup
|
||||
m_webBrowser->put_MenuBar(VARIANT_FALSE);
|
||||
m_webBrowser->put_AddressBar(VARIANT_FALSE);
|
||||
m_webBrowser->put_StatusBar(VARIANT_FALSE);
|
||||
m_webBrowser->put_ToolBar(VARIANT_FALSE);
|
||||
|
||||
m_webBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
|
||||
m_webBrowser->put_RegisterAsDropTarget(VARIANT_TRUE);
|
||||
|
||||
m_webBrowser->Navigate( L"about:blank", NULL, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
|
||||
void wxIEHtmlWin::SetEditMode(bool seton)
|
||||
{
|
||||
m_bAmbientUserMode = ! seton;
|
||||
AmbientPropertyChanged(DISPID_AMBIENT_USERMODE);
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::GetEditMode()
|
||||
{
|
||||
return ! m_bAmbientUserMode;
|
||||
};
|
||||
|
||||
|
||||
void wxIEHtmlWin::SetCharset(wxString charset)
|
||||
{
|
||||
// HTML Document ?
|
||||
IDispatch *pDisp = NULL;
|
||||
HRESULT hret = m_webBrowser->get_Document(&pDisp);
|
||||
wxAutoOleInterface<IDispatch> disp(pDisp);
|
||||
|
||||
if (disp.Ok())
|
||||
{
|
||||
wxAutoOleInterface<IHTMLDocument2> doc(IID_IHTMLDocument2, disp);
|
||||
if (doc.Ok())
|
||||
doc->put_charset((BSTR) (const wchar_t *) charset.wc_str(wxConvUTF8));
|
||||
//doc->put_charset((BSTR) wxConvUTF8.cMB2WC(charset).data());
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
class IStreamAdaptorBase : public IStream
|
||||
{
|
||||
private:
|
||||
DECLARE_OLE_UNKNOWN(IStreamAdaptorBase);
|
||||
|
||||
public:
|
||||
IStreamAdaptorBase() {}
|
||||
virtual ~IStreamAdaptorBase() {}
|
||||
|
||||
// ISequentialStream
|
||||
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead) = 0;
|
||||
HRESULT STDMETHODCALLTYPE Write(const void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbWritten) {return E_NOTIMPL;}
|
||||
|
||||
// IStream
|
||||
HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER __RPC_FAR *plibNewPosition) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE CopyTo(IStream __RPC_FAR *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER __RPC_FAR *pcbRead, ULARGE_INTEGER __RPC_FAR *pcbWritten) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Commit(DWORD grfCommitFlags) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Revert(void) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Stat(STATSTG __RPC_FAR *pstatstg, DWORD grfStatFlag) {return E_NOTIMPL;}
|
||||
HRESULT STDMETHODCALLTYPE Clone(IStream __RPC_FAR *__RPC_FAR *ppstm) {return E_NOTIMPL;}
|
||||
};
|
||||
|
||||
DEFINE_OLE_TABLE(IStreamAdaptorBase)
|
||||
OLE_IINTERFACE(IUnknown)
|
||||
OLE_IINTERFACE(ISequentialStream)
|
||||
OLE_IINTERFACE(IStream)
|
||||
END_OLE_TABLE;
|
||||
|
||||
class IStreamAdaptor : public IStreamAdaptorBase
|
||||
{
|
||||
private:
|
||||
istream *m_is;
|
||||
|
||||
public:
|
||||
|
||||
IStreamAdaptor(istream *is) : IStreamAdaptorBase(), m_is(is)
|
||||
{
|
||||
wxASSERT(m_is != NULL);
|
||||
}
|
||||
~IStreamAdaptor()
|
||||
{
|
||||
delete m_is;
|
||||
}
|
||||
|
||||
// ISequentialStream
|
||||
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead)
|
||||
{
|
||||
m_is->read((char *) pv, cb);
|
||||
if (pcbRead)
|
||||
*pcbRead = m_is->gcount();
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
};
|
||||
|
||||
class IwxStreamAdaptor : public IStreamAdaptorBase
|
||||
{
|
||||
private:
|
||||
wxInputStream *m_is;
|
||||
|
||||
public:
|
||||
|
||||
IwxStreamAdaptor(wxInputStream *is) : IStreamAdaptorBase(), m_is(is)
|
||||
{
|
||||
wxASSERT(m_is != NULL);
|
||||
}
|
||||
~IwxStreamAdaptor()
|
||||
{
|
||||
delete m_is;
|
||||
}
|
||||
|
||||
// ISequentialStream
|
||||
HRESULT STDMETHODCALLTYPE Read(void __RPC_FAR *pv, ULONG cb, ULONG __RPC_FAR *pcbRead)
|
||||
{
|
||||
m_is->Read((char *) pv, cb);
|
||||
if (pcbRead)
|
||||
*pcbRead = m_is->LastRead();
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
};
|
||||
|
||||
void wxIEHtmlWin::LoadUrl(const wxString& url)
|
||||
{
|
||||
VARIANTARG navFlag, targetFrame, postData, headers;
|
||||
navFlag.vt = VT_EMPTY;
|
||||
navFlag.vt = VT_I2;
|
||||
navFlag.iVal = navNoReadFromCache;
|
||||
targetFrame.vt = VT_EMPTY;
|
||||
postData.vt = VT_EMPTY;
|
||||
headers.vt = VT_EMPTY;
|
||||
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->Navigate((BSTR) (const wchar_t *) url.wc_str(wxConvUTF8),
|
||||
&navFlag, &targetFrame, &postData, &headers);
|
||||
};
|
||||
|
||||
class wxOwnedMemInputStream : public wxMemoryInputStream
|
||||
{
|
||||
public:
|
||||
char *m_data;
|
||||
|
||||
wxOwnedMemInputStream(char *data, size_t len) :
|
||||
wxMemoryInputStream(data, len), m_data(data)
|
||||
{}
|
||||
~wxOwnedMemInputStream()
|
||||
{
|
||||
free(m_data);
|
||||
}
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadString(wxString html)
|
||||
{
|
||||
char *data = NULL;
|
||||
size_t len = html.length();
|
||||
#ifdef UNICODE
|
||||
len *= 2;
|
||||
#endif
|
||||
data = (char *) malloc(len);
|
||||
memcpy(data, html.c_str(), len);
|
||||
return LoadStream(new wxOwnedMemInputStream(data, len));
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(IStreamAdaptorBase *pstrm)
|
||||
{
|
||||
wxAutoOleInterface<IStream> strm(pstrm);
|
||||
|
||||
// Document Interface
|
||||
IDispatch *pDisp = NULL;
|
||||
HRESULT hret = m_webBrowser->get_Document(&pDisp);
|
||||
if (! pDisp)
|
||||
return false;
|
||||
wxAutoOleInterface<IDispatch> disp(pDisp);
|
||||
|
||||
|
||||
// get IPersistStreamInit
|
||||
wxAutoOleInterface<IPersistStreamInit>
|
||||
pPersistStreamInit(IID_IPersistStreamInit, disp);
|
||||
|
||||
if (pPersistStreamInit.Ok())
|
||||
{
|
||||
HRESULT hr = pPersistStreamInit->InitNew();
|
||||
if (SUCCEEDED(hr))
|
||||
hr = pPersistStreamInit->Load(strm);
|
||||
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(istream *is)
|
||||
{
|
||||
// wrap reference around stream
|
||||
IStreamAdaptor *pstrm = new IStreamAdaptor(is);
|
||||
pstrm->AddRef();
|
||||
|
||||
return LoadStream(pstrm);
|
||||
};
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(wxInputStream *is)
|
||||
{
|
||||
// wrap reference around stream
|
||||
IwxStreamAdaptor *pstrm = new IwxStreamAdaptor(is);
|
||||
pstrm->AddRef();
|
||||
|
||||
return LoadStream(pstrm);
|
||||
};
|
||||
|
||||
|
||||
bool wxIEHtmlWin::GoBack()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoBack();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::GoForward()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoForward();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::GoHome()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoHome();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::GoSearch()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->GoSearch();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::Refresh(wxIEHtmlRefreshLevel level)
|
||||
{
|
||||
VARIANTARG levelArg;
|
||||
HRESULT hret = 0;
|
||||
|
||||
levelArg.vt = VT_I2;
|
||||
levelArg.iVal = level;
|
||||
hret = m_webBrowser->Refresh2(&levelArg);
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
bool wxIEHtmlWin::Stop()
|
||||
{
|
||||
HRESULT hret = 0;
|
||||
hret = m_webBrowser->Stop();
|
||||
return hret == S_OK;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static wxAutoOleInterface<IHTMLSelectionObject> GetSelObject(IOleObject *oleObject)
|
||||
{
|
||||
// Query for IWebBrowser interface
|
||||
wxAutoOleInterface<IWebBrowser2> wb(IID_IWebBrowser2, oleObject);
|
||||
if (! wb.Ok())
|
||||
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||
|
||||
IDispatch *iDisp = NULL;
|
||||
HRESULT hr = wb->get_Document(&iDisp);
|
||||
if (hr != S_OK)
|
||||
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||
|
||||
// Query for Document Interface
|
||||
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
|
||||
iDisp->Release();
|
||||
|
||||
if (! hd.Ok())
|
||||
return wxAutoOleInterface<IHTMLSelectionObject>();
|
||||
|
||||
IHTMLSelectionObject *_so = NULL;
|
||||
hr = hd->get_selection(&_so);
|
||||
|
||||
// take ownership of selection object
|
||||
wxAutoOleInterface<IHTMLSelectionObject> so(_so);
|
||||
|
||||
return so;
|
||||
};
|
||||
|
||||
static wxAutoOleInterface<IHTMLTxtRange> GetSelRange(IOleObject *oleObject)
|
||||
{
|
||||
wxAutoOleInterface<IHTMLTxtRange> tr;
|
||||
|
||||
wxAutoOleInterface<IHTMLSelectionObject> so(GetSelObject(oleObject));
|
||||
if (! so)
|
||||
return tr;
|
||||
|
||||
IDispatch *iDisp = NULL;
|
||||
HRESULT hr = so->createRange(&iDisp);
|
||||
if (hr != S_OK)
|
||||
return tr;
|
||||
|
||||
// Query for IHTMLTxtRange interface
|
||||
tr.QueryInterface(IID_IHTMLTxtRange, iDisp);
|
||||
iDisp->Release();
|
||||
return tr;
|
||||
};
|
||||
|
||||
|
||||
wxString wxIEHtmlWin::GetStringSelection(bool asHTML)
|
||||
{
|
||||
wxAutoOleInterface<IHTMLTxtRange> tr(GetSelRange(m_oleObject));
|
||||
if (! tr)
|
||||
return wxEmptyString;
|
||||
|
||||
BSTR text = NULL;
|
||||
HRESULT hr = E_FAIL;
|
||||
|
||||
if (asHTML)
|
||||
hr = tr->get_htmlText(&text);
|
||||
else
|
||||
hr = tr->get_text(&text);
|
||||
if (hr != S_OK)
|
||||
return wxEmptyString;
|
||||
|
||||
wxString s = text;
|
||||
SysFreeString(text);
|
||||
|
||||
return s;
|
||||
};
|
||||
|
||||
wxString wxIEHtmlWin::GetText(bool asHTML)
|
||||
{
|
||||
if (! m_webBrowser.Ok())
|
||||
return wxEmptyString;
|
||||
|
||||
// get document dispatch interface
|
||||
IDispatch *iDisp = NULL;
|
||||
HRESULT hr = m_webBrowser->get_Document(&iDisp);
|
||||
if (hr != S_OK)
|
||||
return wxEmptyString;
|
||||
|
||||
// Query for Document Interface
|
||||
wxAutoOleInterface<IHTMLDocument2> hd(IID_IHTMLDocument2, iDisp);
|
||||
iDisp->Release();
|
||||
|
||||
if (! hd.Ok())
|
||||
return wxEmptyString;
|
||||
|
||||
// get body element
|
||||
IHTMLElement *_body = NULL;
|
||||
hd->get_body(&_body);
|
||||
if (! _body)
|
||||
return wxEmptyString;
|
||||
wxAutoOleInterface<IHTMLElement> body(_body);
|
||||
|
||||
// get inner text
|
||||
BSTR text = NULL;
|
||||
hr = E_FAIL;
|
||||
|
||||
if (asHTML)
|
||||
hr = body->get_innerHTML(&text);
|
||||
else
|
||||
hr = body->get_innerText(&text);
|
||||
if (hr != S_OK)
|
||||
return wxEmptyString;
|
||||
|
||||
wxString s = text;
|
||||
SysFreeString(text);
|
||||
|
||||
return s;
|
||||
};
|
104
wxPython/contrib/iewin/IEHtmlWin.h
Normal file
104
wxPython/contrib/iewin/IEHtmlWin.h
Normal file
@@ -0,0 +1,104 @@
|
||||
#ifndef _IEHTMLWIN_H_
|
||||
#define _IEHTMLWIN_H_
|
||||
#pragma warning( disable : 4101 4786)
|
||||
#pragma warning( disable : 4786)
|
||||
|
||||
|
||||
#include <wx/setup.h>
|
||||
#include <wx/wx.h>
|
||||
#include <exdisp.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include "wxactivex.h"
|
||||
|
||||
class wxMSHTMLEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
wxMSHTMLEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
|
||||
: wxNotifyEvent(commandType, id)
|
||||
{}
|
||||
|
||||
wxString GetText1() { return m_text1; }
|
||||
long GetLong1() { return m_long1; }
|
||||
long GetLong2() { return m_long2; }
|
||||
|
||||
|
||||
wxString m_text1;
|
||||
long m_long1, m_long2;
|
||||
|
||||
virtual wxEvent *Clone() const { return new wxMSHTMLEvent(*this); }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxMSHTMLEvent)
|
||||
|
||||
};
|
||||
|
||||
BEGIN_DECLARE_EVENT_TYPES()
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, 0)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_NEWWINDOW2, 0)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, 0)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, 0)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, 0)
|
||||
DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MSHTML_TITLECHANGE, 0)
|
||||
END_DECLARE_EVENT_TYPES()
|
||||
|
||||
typedef void (wxEvtHandler::*wxMSHTMLEventFunction)(wxMSHTMLEvent&);
|
||||
|
||||
#define EVT_MSHTML_BEFORENAVIGATE2(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMSHTMLEventFunction, & fn ), NULL ),
|
||||
#define EVT_MSHTML_NEWWINDOW2(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_NEWWINDOW2, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMSHTMLEventFunction, & fn ), NULL ),
|
||||
#define EVT_MSHTML_DOCUMENTCOMPLETE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMSHTMLEventFunction, & fn ), NULL ),
|
||||
#define EVT_MSHTML_PROGRESSCHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMSHTMLEventFunction, & fn ), NULL ),
|
||||
#define EVT_MSHTML_STATUSTEXTCHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMSHTMLEventFunction, & fn ), NULL ),
|
||||
#define EVT_MSHTML_TITLECHANGE(id, fn) DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_MSHTML_TITLECHANGE, id, -1, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMSHTMLEventFunction, & fn ), NULL ),
|
||||
|
||||
|
||||
enum wxIEHtmlRefreshLevel
|
||||
{
|
||||
wxIEHTML_REFRESH_NORMAL = 0,
|
||||
wxIEHTML_REFRESH_IFEXPIRED = 1,
|
||||
wxIEHTML_REFRESH_CONTINUE = 2,
|
||||
wxIEHTML_REFRESH_COMPLETELY = 3
|
||||
};
|
||||
|
||||
class IStreamAdaptorBase;
|
||||
|
||||
class wxIEHtmlWin : public wxActiveX
|
||||
{
|
||||
|
||||
public:
|
||||
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPanelNameStr);
|
||||
virtual ~wxIEHtmlWin();
|
||||
|
||||
void LoadUrl(const wxString&);
|
||||
bool LoadString(wxString html);
|
||||
bool LoadStream(istream *strm);
|
||||
bool LoadStream(wxInputStream *is);
|
||||
|
||||
void SetCharset(wxString charset);
|
||||
void SetEditMode(bool seton);
|
||||
bool GetEditMode();
|
||||
wxString GetStringSelection(bool asHTML = false);
|
||||
wxString GetText(bool asHTML = false);
|
||||
|
||||
bool GoBack();
|
||||
bool GoForward();
|
||||
bool GoHome();
|
||||
bool GoSearch();
|
||||
bool Refresh(wxIEHtmlRefreshLevel level);
|
||||
bool Stop();
|
||||
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
protected:
|
||||
void SetupBrowser();
|
||||
bool LoadStream(IStreamAdaptorBase *pstrm);
|
||||
|
||||
wxAutoOleInterface<IWebBrowser2> m_webBrowser;
|
||||
};
|
||||
|
||||
#endif /* _IEHTMLWIN_H_ */
|
13
wxPython/contrib/iewin/_iewin_rename.i
Normal file
13
wxPython/contrib/iewin/_iewin_rename.i
Normal file
@@ -0,0 +1,13 @@
|
||||
// A bunch of %rename directives generated by BuildRenamers in config.py
|
||||
// in order to remove the wx prefix from all global scope names.
|
||||
|
||||
#ifndef BUILDING_RENAMERS
|
||||
|
||||
%rename(MSHTMLEvent) wxMSHTMLEvent;
|
||||
%rename(IEHTML_REFRESH_NORMAL) wxIEHTML_REFRESH_NORMAL;
|
||||
%rename(IEHTML_REFRESH_IFEXPIRED) wxIEHTML_REFRESH_IFEXPIRED;
|
||||
%rename(IEHTML_REFRESH_CONTINUE) wxIEHTML_REFRESH_CONTINUE;
|
||||
%rename(IEHTML_REFRESH_COMPLETELY) wxIEHTML_REFRESH_COMPLETELY;
|
||||
%rename(IEHtmlWin) wxIEHtmlWin;
|
||||
|
||||
#endif
|
2
wxPython/contrib/iewin/_iewin_reverse.txt
Normal file
2
wxPython/contrib/iewin/_iewin_reverse.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
EVT*
|
4
wxPython/contrib/iewin/_iewinextras.py
Normal file
4
wxPython/contrib/iewin/_iewinextras.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# Stuff these names into the wx namespace so wxPyConstructObject can find them
|
||||
|
||||
wx.wxMSHTMLEventPtr = wxMSHTMLEventPtr
|
||||
wx.wxIEHtmlWinPtr = wxIEHtmlWinPtr
|
118
wxPython/contrib/iewin/iewin.i
Normal file
118
wxPython/contrib/iewin/iewin.i
Normal file
@@ -0,0 +1,118 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: iewin.i
|
||||
// Purpose: Internet Explorer in a wxWindow
|
||||
//
|
||||
// Author: Robin Dunn
|
||||
//
|
||||
// Created: 20-Apr-2001
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2001 by Total Control Software
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
%module(package="wx") iewin
|
||||
|
||||
%{
|
||||
#include "wx/wxPython/wxPython.h"
|
||||
#include "wx/wxPython/pyclasses.h"
|
||||
#include "wx/wxPython/pyistream.h"
|
||||
|
||||
#include "IEHtmlWin.h"
|
||||
%}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
%import core.i
|
||||
%pythoncode { wx = _core }
|
||||
%pythoncode { __docfilter__ = wx.__DocFilter(globals()) }
|
||||
%pythoncode {
|
||||
import warnings
|
||||
warnings.warn("This module is deprecated. Please use the wx.lib.iewin module instead.",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
}
|
||||
|
||||
MAKE_CONST_WXSTRING_NOSWIG(PanelNameStr);
|
||||
|
||||
%include _iewin_rename.i
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
class wxMSHTMLEvent : public wxNotifyEvent
|
||||
{
|
||||
public:
|
||||
wxMSHTMLEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||
wxString GetText1();
|
||||
long GetLong1();
|
||||
long GetLong2();
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2,
|
||||
wxEVT_COMMAND_MSHTML_NEWWINDOW2,
|
||||
wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE,
|
||||
wxEVT_COMMAND_MSHTML_PROGRESSCHANGE,
|
||||
wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE,
|
||||
wxEVT_COMMAND_MSHTML_TITLECHANGE,
|
||||
};
|
||||
|
||||
|
||||
%pythoncode {
|
||||
EVT_MSHTML_BEFORENAVIGATE2 = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, 1)
|
||||
EVT_MSHTML_NEWWINDOW2 = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_NEWWINDOW2, 1)
|
||||
EVT_MSHTML_DOCUMENTCOMPLETE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, 1)
|
||||
EVT_MSHTML_PROGRESSCHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, 1)
|
||||
EVT_MSHTML_STATUSTEXTCHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, 1)
|
||||
EVT_MSHTML_TITLECHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_TITLECHANGE, 1)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
enum wxIEHtmlRefreshLevel {
|
||||
wxIEHTML_REFRESH_NORMAL = 0,
|
||||
wxIEHTML_REFRESH_IFEXPIRED = 1,
|
||||
wxIEHTML_REFRESH_CONTINUE = 2,
|
||||
wxIEHTML_REFRESH_COMPLETELY = 3
|
||||
};
|
||||
|
||||
|
||||
MustHaveApp(wxIEHtmlWin);
|
||||
|
||||
class wxIEHtmlWin : public wxWindow /* wxActiveX */
|
||||
{
|
||||
public:
|
||||
%pythonAppend wxIEHtmlWin "self._setOORInfo(self)"
|
||||
|
||||
wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxPyPanelNameStr);
|
||||
|
||||
void LoadUrl(const wxString&);
|
||||
bool LoadString(wxString html);
|
||||
bool LoadStream(wxInputStream *is);
|
||||
|
||||
%pythoncode { Navigate = LoadUrl }
|
||||
|
||||
void SetCharset(wxString charset);
|
||||
void SetEditMode(bool seton);
|
||||
bool GetEditMode();
|
||||
wxString GetStringSelection(bool asHTML = false);
|
||||
wxString GetText(bool asHTML = false);
|
||||
|
||||
bool GoBack();
|
||||
bool GoForward();
|
||||
bool GoHome();
|
||||
bool GoSearch();
|
||||
%Rename(RefreshPage, bool, Refresh(wxIEHtmlRefreshLevel level));
|
||||
bool Stop();
|
||||
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
181
wxPython/contrib/iewin/iewin.py
Normal file
181
wxPython/contrib/iewin/iewin.py
Normal file
@@ -0,0 +1,181 @@
|
||||
# This file was created automatically by SWIG.
|
||||
# Don't modify this file, modify the SWIG interface instead.
|
||||
|
||||
import _iewin
|
||||
|
||||
def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
|
||||
if (name == "this"):
|
||||
if isinstance(value, class_type):
|
||||
self.__dict__[name] = value.this
|
||||
if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
|
||||
del value.thisown
|
||||
return
|
||||
method = class_type.__swig_setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
if (not static) or hasattr(self,name) or (name == "thisown"):
|
||||
self.__dict__[name] = value
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
|
||||
def _swig_setattr(self,class_type,name,value):
|
||||
return _swig_setattr_nondynamic(self,class_type,name,value,0)
|
||||
|
||||
def _swig_getattr(self,class_type,name):
|
||||
method = class_type.__swig_getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
|
||||
import types
|
||||
try:
|
||||
_object = types.ObjectType
|
||||
_newclass = 1
|
||||
except AttributeError:
|
||||
class _object : pass
|
||||
_newclass = 0
|
||||
del types
|
||||
|
||||
|
||||
def _swig_setattr_nondynamic_method(set):
|
||||
def set_attr(self,name,value):
|
||||
if hasattr(self,name) or (name in ("this", "thisown")):
|
||||
set(self,name,value)
|
||||
else:
|
||||
raise AttributeError("You cannot add attributes to %s" % self)
|
||||
return set_attr
|
||||
|
||||
|
||||
import _core
|
||||
wx = _core
|
||||
__docfilter__ = wx.__DocFilter(globals())
|
||||
import warnings
|
||||
warnings.warn("This module is deprecated. Please use the wx.lib.iewin module instead.",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
|
||||
class MSHTMLEvent(_core.NotifyEvent):
|
||||
"""Proxy of C++ MSHTMLEvent class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxMSHTMLEvent instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""__init__(self, wxEventType commandType=wxEVT_NULL, int id=0) -> MSHTMLEvent"""
|
||||
newobj = _iewin.new_MSHTMLEvent(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
def GetText1(*args, **kwargs):
|
||||
"""GetText1(self) -> String"""
|
||||
return _iewin.MSHTMLEvent_GetText1(*args, **kwargs)
|
||||
|
||||
def GetLong1(*args, **kwargs):
|
||||
"""GetLong1(self) -> long"""
|
||||
return _iewin.MSHTMLEvent_GetLong1(*args, **kwargs)
|
||||
|
||||
def GetLong2(*args, **kwargs):
|
||||
"""GetLong2(self) -> long"""
|
||||
return _iewin.MSHTMLEvent_GetLong2(*args, **kwargs)
|
||||
|
||||
|
||||
class MSHTMLEventPtr(MSHTMLEvent):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = MSHTMLEvent
|
||||
_iewin.MSHTMLEvent_swigregister(MSHTMLEventPtr)
|
||||
|
||||
wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2 = _iewin.wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2
|
||||
wxEVT_COMMAND_MSHTML_NEWWINDOW2 = _iewin.wxEVT_COMMAND_MSHTML_NEWWINDOW2
|
||||
wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE = _iewin.wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE
|
||||
wxEVT_COMMAND_MSHTML_PROGRESSCHANGE = _iewin.wxEVT_COMMAND_MSHTML_PROGRESSCHANGE
|
||||
wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE = _iewin.wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE
|
||||
wxEVT_COMMAND_MSHTML_TITLECHANGE = _iewin.wxEVT_COMMAND_MSHTML_TITLECHANGE
|
||||
EVT_MSHTML_BEFORENAVIGATE2 = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_BEFORENAVIGATE2, 1)
|
||||
EVT_MSHTML_NEWWINDOW2 = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_NEWWINDOW2, 1)
|
||||
EVT_MSHTML_DOCUMENTCOMPLETE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_DOCUMENTCOMPLETE, 1)
|
||||
EVT_MSHTML_PROGRESSCHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_PROGRESSCHANGE, 1)
|
||||
EVT_MSHTML_STATUSTEXTCHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_STATUSTEXTCHANGE, 1)
|
||||
EVT_MSHTML_TITLECHANGE = wx.PyEventBinder(wxEVT_COMMAND_MSHTML_TITLECHANGE, 1)
|
||||
|
||||
IEHTML_REFRESH_NORMAL = _iewin.IEHTML_REFRESH_NORMAL
|
||||
IEHTML_REFRESH_IFEXPIRED = _iewin.IEHTML_REFRESH_IFEXPIRED
|
||||
IEHTML_REFRESH_CONTINUE = _iewin.IEHTML_REFRESH_CONTINUE
|
||||
IEHTML_REFRESH_COMPLETELY = _iewin.IEHTML_REFRESH_COMPLETELY
|
||||
class IEHtmlWin(_core.Window):
|
||||
"""Proxy of C++ IEHtmlWin class"""
|
||||
def __repr__(self):
|
||||
return "<%s.%s; proxy of C++ wxIEHtmlWin instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
|
||||
Size size=DefaultSize, long style=0, String name=PanelNameStr) -> IEHtmlWin
|
||||
"""
|
||||
newobj = _iewin.new_IEHtmlWin(*args, **kwargs)
|
||||
self.this = newobj.this
|
||||
self.thisown = 1
|
||||
del newobj.thisown
|
||||
self._setOORInfo(self)
|
||||
|
||||
def LoadUrl(*args, **kwargs):
|
||||
"""LoadUrl(self, String ??)"""
|
||||
return _iewin.IEHtmlWin_LoadUrl(*args, **kwargs)
|
||||
|
||||
def LoadString(*args, **kwargs):
|
||||
"""LoadString(self, String html) -> bool"""
|
||||
return _iewin.IEHtmlWin_LoadString(*args, **kwargs)
|
||||
|
||||
def LoadStream(*args, **kwargs):
|
||||
"""LoadStream(self, InputStream is) -> bool"""
|
||||
return _iewin.IEHtmlWin_LoadStream(*args, **kwargs)
|
||||
|
||||
Navigate = LoadUrl
|
||||
def SetCharset(*args, **kwargs):
|
||||
"""SetCharset(self, String charset)"""
|
||||
return _iewin.IEHtmlWin_SetCharset(*args, **kwargs)
|
||||
|
||||
def SetEditMode(*args, **kwargs):
|
||||
"""SetEditMode(self, bool seton)"""
|
||||
return _iewin.IEHtmlWin_SetEditMode(*args, **kwargs)
|
||||
|
||||
def GetEditMode(*args, **kwargs):
|
||||
"""GetEditMode(self) -> bool"""
|
||||
return _iewin.IEHtmlWin_GetEditMode(*args, **kwargs)
|
||||
|
||||
def GetStringSelection(*args, **kwargs):
|
||||
"""GetStringSelection(self, bool asHTML=False) -> String"""
|
||||
return _iewin.IEHtmlWin_GetStringSelection(*args, **kwargs)
|
||||
|
||||
def GetText(*args, **kwargs):
|
||||
"""GetText(self, bool asHTML=False) -> String"""
|
||||
return _iewin.IEHtmlWin_GetText(*args, **kwargs)
|
||||
|
||||
def GoBack(*args, **kwargs):
|
||||
"""GoBack(self) -> bool"""
|
||||
return _iewin.IEHtmlWin_GoBack(*args, **kwargs)
|
||||
|
||||
def GoForward(*args, **kwargs):
|
||||
"""GoForward(self) -> bool"""
|
||||
return _iewin.IEHtmlWin_GoForward(*args, **kwargs)
|
||||
|
||||
def GoHome(*args, **kwargs):
|
||||
"""GoHome(self) -> bool"""
|
||||
return _iewin.IEHtmlWin_GoHome(*args, **kwargs)
|
||||
|
||||
def GoSearch(*args, **kwargs):
|
||||
"""GoSearch(self) -> bool"""
|
||||
return _iewin.IEHtmlWin_GoSearch(*args, **kwargs)
|
||||
|
||||
def RefreshPage(*args, **kwargs):
|
||||
"""RefreshPage(self, int level) -> bool"""
|
||||
return _iewin.IEHtmlWin_RefreshPage(*args, **kwargs)
|
||||
|
||||
def Stop(*args, **kwargs):
|
||||
"""Stop(self) -> bool"""
|
||||
return _iewin.IEHtmlWin_Stop(*args, **kwargs)
|
||||
|
||||
|
||||
class IEHtmlWinPtr(IEHtmlWin):
|
||||
def __init__(self, this):
|
||||
self.this = this
|
||||
if not hasattr(self,"thisown"): self.thisown = 0
|
||||
self.__class__ = IEHtmlWin
|
||||
_iewin.IEHtmlWin_swigregister(IEHtmlWinPtr)
|
||||
|
||||
|
3118
wxPython/contrib/iewin/iewin_wrap.cpp
Normal file
3118
wxPython/contrib/iewin/iewin_wrap.cpp
Normal file
File diff suppressed because one or more lines are too long
158
wxPython/contrib/iewin/readme.txt
Normal file
158
wxPython/contrib/iewin/readme.txt
Normal file
@@ -0,0 +1,158 @@
|
||||
Lindsay Mathieson
|
||||
Email : <lmathieson@optusnet.com.au>
|
||||
|
||||
This is prelimanary stuff - the controls need extra methods and events etc,
|
||||
feel free to email with suggestions &/or patches.
|
||||
|
||||
Tested with wxWindows 2.3.2.
|
||||
Built with MS Visual C++ 6.0 & DevStudio
|
||||
Minor use of templates and STL
|
||||
|
||||
-----------------------------------------------------------
|
||||
This sample illustrates using wxActiveX and wxIEHtmlWin too:
|
||||
1. Host an arbitrary ActiveX control
|
||||
2. Specifically host the MSHTML Control
|
||||
|
||||
|
||||
wxActiveX:
|
||||
==========
|
||||
wxActiveX is used to host and siplay any activeX control, all the wxWindows developer
|
||||
needs to know is either the ProgID or CLSID of the control in question.
|
||||
|
||||
Derived From:
|
||||
- wxWindow
|
||||
|
||||
Include Files:
|
||||
- wxactivex.h
|
||||
|
||||
Source Files:
|
||||
- wxactivex.cpp
|
||||
|
||||
Event Handling:
|
||||
---------------
|
||||
- EVT_ACTIVEX(id, eventName, handler) (handler = void OnActiveX(wxActiveXEvent& event))
|
||||
class wxActiveXEvent : public wxNotifyEvent
|
||||
int ParamCount() const;
|
||||
wxVariant operator[] (int idx) const; // parameter by index
|
||||
wxVariant& operator[] (int idx);
|
||||
wxVariant operator[] (wxString name) const; // named parameters
|
||||
wxVariant& operator[] (wxString name);
|
||||
|
||||
|
||||
Members:
|
||||
--------
|
||||
wxActiveX::wxActiveX(wxWindow * parent, REFCLSID clsid, wxWindowID id = -1);
|
||||
- Creates a activeX control identified by clsid
|
||||
e.g
|
||||
wxFrame *frame = new wxFrame(this, -1, "test");
|
||||
wxActiveX *X = new wxActiveX(frame, CLSID_WebBrowser);
|
||||
|
||||
wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id = -1);
|
||||
- Creates a activeX control identified by progId
|
||||
e.g.
|
||||
wxFrame *frame = new wxFrame(this, -1, "test");
|
||||
wxActiveX *X = new wxActiveX(frame, "MSCAL.Calendar");
|
||||
|
||||
|
||||
wxActiveX::~wxActiveX();
|
||||
- Destroys the control
|
||||
- disconnects all connection points
|
||||
|
||||
HRESULT wxActiveX::ConnectAdvise(REFIID riid, IUnknown *eventSink);
|
||||
- Connects a event sink. Connections are automaticlly diconnected in the destructor
|
||||
e.g.
|
||||
FS_DWebBrowserEvents2 *events = new FS_DWebBrowserEvents2(iecontrol);
|
||||
hret = iecontrol->ConnectAdvise(DIID_DWebBrowserEvents2, events);
|
||||
if (! SUCCEEDED(hret))
|
||||
delete events;
|
||||
|
||||
|
||||
Sample Events:
|
||||
--------------
|
||||
EVT_ACTIVEX(ID_MSHTML, "BeforeNavigate2", OnMSHTMLBeforeNavigate2X)
|
||||
|
||||
void wxIEFrame::OnMSHTMLBeforeNavigate2X(wxActiveXEvent& event)
|
||||
{
|
||||
wxString url = event["Url"];
|
||||
|
||||
int rc = wxMessageBox(url, "Allow open url ?", wxYES_NO);
|
||||
|
||||
if (rc != wxYES)
|
||||
event["Cancel"] = true;
|
||||
};
|
||||
|
||||
|
||||
wxIEHtmlWin:
|
||||
============
|
||||
wxIEHtmlWin is a specialisation of the wxActiveX control for hosting the MSHTML control.
|
||||
|
||||
Derived From:
|
||||
- wxActiveX
|
||||
- wxWindow
|
||||
|
||||
Event Handling:
|
||||
---------------
|
||||
- class wxMSHTMLEvent
|
||||
|
||||
- EVT_MSHTML_BEFORENAVIGATE2
|
||||
* url = event.m_text1
|
||||
* event.Veto() to cancel
|
||||
Generated before an attempt to browse a new url
|
||||
|
||||
- EVT_MSHTML_NEWWINDOW2
|
||||
* event.Veto() to cancel
|
||||
Generated when the control is asked create a new window (e.g a popup)
|
||||
|
||||
- EVT_MSHTML_DOCUMENTCOMPLETE
|
||||
* url = event.m_text1
|
||||
Generated after the document has finished loading
|
||||
|
||||
- EVT_MSHTML_PROGRESSCHANGE
|
||||
* event.m_long1 = progress so far
|
||||
* event.m_long2 = max range of progress
|
||||
|
||||
- EVT_MSHTML_STATUSTEXTCHANGE
|
||||
* status = event.m_text1
|
||||
|
||||
- EVT_MSHTML_TITLECHANGE
|
||||
* title = event.m_text1
|
||||
|
||||
Members:
|
||||
--------
|
||||
wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id = -1);
|
||||
- Constructs and initialises the MSHTML control
|
||||
- LoadUrl("about:blank") is called
|
||||
|
||||
wxIEHtmlWin::~wxIEHtmlWin();
|
||||
- destroys the control
|
||||
|
||||
void wxIEHtmlWin::LoadUrl(const wxString&);
|
||||
- Attempts to browse to the url, the control uses its internal (MS)
|
||||
network streams
|
||||
|
||||
bool wxIEHtmlWin::LoadString(wxString html);
|
||||
- Load the passed HTML string
|
||||
|
||||
bool wxIEHtmlWin::LoadStream(istream *strm);
|
||||
- load the passed HTML stream. The control takes ownership of
|
||||
the pointer, deleting when finished.
|
||||
|
||||
void wxIEHtmlWin::SetCharset(wxString charset);
|
||||
- Sets the charset of the loaded document
|
||||
|
||||
void wxIEHtmlWin::SetEditMode(bool seton);
|
||||
- Sets edit mode.
|
||||
NOTE: This does work, but is bare bones - we need more events exposed before
|
||||
this is usable as an HTML editor.
|
||||
|
||||
bool wxIEHtmlWin::GetEditMode();
|
||||
- Returns the edit mode setting
|
||||
|
||||
wxString wxIEHtmlWin::GetStringSelection(bool asHTML = false);
|
||||
- Returns the currently selected text (plain or HTML text)
|
||||
|
||||
wxString GetText(bool asHTML = false);
|
||||
- Returns the body text (plain or HTML text)
|
||||
|
||||
Lindsay Mathieson
|
||||
Email : <lmathieson@optusnet.com.au>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user