summaryrefslogtreecommitdiffstats
path: root/languages/cpp/app_templates/kofficepart/kopart_view.cpp
blob: 601413efbdd3176589dbc66012b472294adfd672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

/* This template is based off of the KOffice example written by Torben Weis <[email protected]
   It was converted to a KDevelop template by Ian Reinhart Geiser <[email protected]>
*/
#include "%{APPNAMELC}_view.h"
#include "%{APPNAMELC}_factory.h"
#include "%{APPNAMELC}_part.h"

#include <tqpainter.h>
#include <tqiconset.h>
#include <tdeaction.h>
#include <kstdaction.h>
#include <tdelocale.h>
#include <kdebug.h>

%{APPNAME}View::%{APPNAME}View( %{APPNAME}Part* part, TQWidget* parent, const char* name )
    : KoView( part, parent, name )
{
    setInstance( %{APPNAME}Factory::global() );
    setXMLFile( "%{APPNAMELC}.rc" );
    KStdAction::cut(this, TQT_SLOT( cut() ), actionCollection(), "cut" );
    // Note: Prefer KStdAction::* to any custom action if possible.
    //m_cut = new TDEAction( i18n("&Cut"), "edit-cut", 0, this, TQT_SLOT( cut() ),
    //                   actionCollection(), "cut");
}

void %{APPNAME}View::paintEvent( TQPaintEvent* ev )
{
    TQPainter painter;
    painter.begin( this );

    /// @todo Scaling

    // Let the document do the drawing
    koDocument()->paintEverything( painter, ev->rect(), FALSE, this );

    painter.end();
}

void %{APPNAME}View::updateReadWrite( bool /*readwrite*/ )
{
#ifdef __GNUC__
#warning TODO
#endif
}

void %{APPNAME}View::cut()
{
    kdDebug(31000) << "%{APPNAME}View::cut(): CUT called" << endl;
}

#include "%{APPNAMELC}_view.moc"