summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/printwizard/cropframe.h
blob: f3c9f132db5e03af54255ca7529f3b3ef60bb27d (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/***************************************************************************
                          cropframe.h  -  description
                             -------------------
    begin                : Mon Sep 30 2002
    copyright            : (C) 2002 by Todd Shoemaker
    email                : jtshoe11@yahoo.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef CROPFRAME_H
#define CROPFRAME_H

// TQt includes.

#include <tqwidget.h>
#include <tqpixmap.h>

// Local includes.

#include "tphoto.h"

namespace KIPIPrintWizardPlugin
{

class CropFrame : public TQWidget
{
  Q_OBJECT
  

  public:
    CropFrame(TQWidget *parent, const char *name);
    ~CropFrame();
    void init(TPhoto *photo, int width, int height, bool autoRotate, bool paint = true);
    void setColor(TQColor);
    TQColor color();

  private:
    TPhoto *m_photo;
    bool m_mouseDown;
    TQPixmap *m_pixmap;
    int m_pixmapX;
    int m_pixmapY;

    TQColor m_color;

    TQRect m_cropRegion;


    TQRect _screenToPhotoRect(TQRect r);
    TQRect _photoToScreenRect(TQRect r);
  
  protected:
    void paintEvent (TQPaintEvent *);
    void mousePressEvent(TQMouseEvent *);
    void mouseReleaseEvent(TQMouseEvent *);
    void mouseMoveEvent(TQMouseEvent *);
    void keyPressEvent(TQKeyEvent *);
};

}  // NameSpace KIPIPrintWizardPlugin

#endif // CROPFRAME_H