Skip to content

Commit

Permalink
Add python bindings for composerhtml
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Aug 9, 2012
1 parent f7ef19e commit f5ff7c2
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python/core/core.sip
Expand Up @@ -14,11 +14,14 @@
%Include qgsaddremoveitemcommand.sip
%Include qgsapplication.sip
%Include qgscomposerattributetable.sip
%Include qgscomposerframe.sip
%Include qgscomposerhtml.sip
%Include qgscomposeritem.sip
%Include qgscomposeritemcommand.sip
%Include qgscomposerlabel.sip
%Include qgscomposerlegend.sip
%Include qgscomposermap.sip
%Include qgscomposermultiframe.sip
%Include qgscomposerpicture.sip
%Include qgscomposerscalebar.sip
%Include qgscomposershape.sip
Expand Down
26 changes: 26 additions & 0 deletions python/core/qgscomposerframe.sip
@@ -0,0 +1,26 @@

class QgsComposerFrame: QgsComposerItem
{
%TypeHeaderCode
#include "qgscomposerframe.h"
%End

public:
QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height );
~QgsComposerFrame();

/**Sets the part of this frame (relative to the total multiframe extent in mm)*/
void setContentSection( const QRectF& section );

void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );

void beginItemCommand( const QString& text );
void endItemCommand();

bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );

int type() const;

QgsComposerMultiFrame* multiFrame();
};
22 changes: 22 additions & 0 deletions python/core/qgscomposerhtml.sip
@@ -0,0 +1,22 @@
class QgsComposerHtml: QgsComposerMultiFrame
{
%TypeHeaderCode
#include "qgscomposerhtml.h"
%End

public:
QgsComposerHtml( QgsComposition* c, bool createUndoCommands );
QgsComposerHtml();
~QgsComposerHtml();

void setUrl( const QUrl& url );
const QUrl& url() const;

QSizeF totalSize() const;
void render( QPainter* p, const QRectF& renderExtent );

bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const;
bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );

void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true );
};
44 changes: 44 additions & 0 deletions python/core/qgscomposermultiframe.sip
@@ -0,0 +1,44 @@

class QgsComposerMultiFrame: QObject
{
%TypeHeaderCode
#include "qgscomposermultiframe.h"
%End
public:

enum ResizeMode
{
UseExistingFrames = 0,
ExtendToNextPage //duplicates last frame to next page to fit the total size
};

QgsComposerMultiFrame( QgsComposition* c, bool createUndoCommands );
virtual ~QgsComposerMultiFrame();
virtual QSizeF totalSize() const = 0;
virtual void render( QPainter* p, const QRectF& renderExtent ) = 0;

virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0;

void removeFrame( int i );

void update();

void setResizeMode( ResizeMode mode );
ResizeMode resizeMode() const;

virtual bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const = 0;
bool _writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames = false ) const;

virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ) = 0;
bool _readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );

QgsComposition* composition();

bool createUndoCommands() const;
void setCreateUndoCommands( bool enabled );

/**Removes and deletes all frames from mComposition*/
void deleteFrames();

int nFrames() const;
};

0 comments on commit f5ff7c2

Please sign in to comment.