Skip to content

Commit f5ff7c2

Browse files
committedAug 9, 2012
Add python bindings for composerhtml
1 parent f7ef19e commit f5ff7c2

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed
 

‎python/core/core.sip

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,14 @@
1414
%Include qgsaddremoveitemcommand.sip
1515
%Include qgsapplication.sip
1616
%Include qgscomposerattributetable.sip
17+
%Include qgscomposerframe.sip
18+
%Include qgscomposerhtml.sip
1719
%Include qgscomposeritem.sip
1820
%Include qgscomposeritemcommand.sip
1921
%Include qgscomposerlabel.sip
2022
%Include qgscomposerlegend.sip
2123
%Include qgscomposermap.sip
24+
%Include qgscomposermultiframe.sip
2225
%Include qgscomposerpicture.sip
2326
%Include qgscomposerscalebar.sip
2427
%Include qgscomposershape.sip

‎python/core/qgscomposerframe.sip

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
class QgsComposerFrame: QgsComposerItem
3+
{
4+
%TypeHeaderCode
5+
#include "qgscomposerframe.h"
6+
%End
7+
8+
public:
9+
QgsComposerFrame( QgsComposition* c, QgsComposerMultiFrame* mf, qreal x, qreal y, qreal width, qreal height );
10+
~QgsComposerFrame();
11+
12+
/**Sets the part of this frame (relative to the total multiframe extent in mm)*/
13+
void setContentSection( const QRectF& section );
14+
15+
void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
16+
17+
void beginItemCommand( const QString& text );
18+
void endItemCommand();
19+
20+
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
21+
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
22+
23+
int type() const;
24+
25+
QgsComposerMultiFrame* multiFrame();
26+
};

‎python/core/qgscomposerhtml.sip

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
class QgsComposerHtml: QgsComposerMultiFrame
2+
{
3+
%TypeHeaderCode
4+
#include "qgscomposerhtml.h"
5+
%End
6+
7+
public:
8+
QgsComposerHtml( QgsComposition* c, bool createUndoCommands );
9+
QgsComposerHtml();
10+
~QgsComposerHtml();
11+
12+
void setUrl( const QUrl& url );
13+
const QUrl& url() const;
14+
15+
QSizeF totalSize() const;
16+
void render( QPainter* p, const QRectF& renderExtent );
17+
18+
bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const;
19+
bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );
20+
21+
void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true );
22+
};

‎python/core/qgscomposermultiframe.sip

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
class QgsComposerMultiFrame: QObject
3+
{
4+
%TypeHeaderCode
5+
#include "qgscomposermultiframe.h"
6+
%End
7+
public:
8+
9+
enum ResizeMode
10+
{
11+
UseExistingFrames = 0,
12+
ExtendToNextPage //duplicates last frame to next page to fit the total size
13+
};
14+
15+
QgsComposerMultiFrame( QgsComposition* c, bool createUndoCommands );
16+
virtual ~QgsComposerMultiFrame();
17+
virtual QSizeF totalSize() const = 0;
18+
virtual void render( QPainter* p, const QRectF& renderExtent ) = 0;
19+
20+
virtual void addFrame( QgsComposerFrame* frame, bool recalcFrameSizes = true ) = 0;
21+
22+
void removeFrame( int i );
23+
24+
void update();
25+
26+
void setResizeMode( ResizeMode mode );
27+
ResizeMode resizeMode() const;
28+
29+
virtual bool writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames = false ) const = 0;
30+
bool _writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames = false ) const;
31+
32+
virtual bool readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false ) = 0;
33+
bool _readXML( const QDomElement& itemElem, const QDomDocument& doc, bool ignoreFrames = false );
34+
35+
QgsComposition* composition();
36+
37+
bool createUndoCommands() const;
38+
void setCreateUndoCommands( bool enabled );
39+
40+
/**Removes and deletes all frames from mComposition*/
41+
void deleteFrames();
42+
43+
int nFrames() const;
44+
};

0 commit comments

Comments
 (0)
Please sign in to comment.