summaryrefslogtreecommitdiffstats
path: root/k9author/k9canvasselection.h
blob: 35d01796f9b9a27e46c75e6d1a459233497d4469 (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
71
72
//
// C++ Interface: k9canvasselection
//
// Description: 
//
//
// Author: Jean-Michel PETIT <[email protected]>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef K9CANVASSELECTION_H
#define K9CANVASSELECTION_H

#include "k9menueditor.h"
#include <tqcanvas.h>
/**
	@author Jean-Michel PETIT <[email protected]>
*/

class k9CanvasSelection;
class k9CanvasSelectionRedim : public TQCanvasRectangle {
public:
    enum ePosition  { RedimTopLeft=2002,RedimTopMiddle=2003,RedimTopRight=2004,RedimMiddleLeft=2005,RedimBottomLeft=2006,RedimBottomMiddle=2007,RedimBottomRight=2008,RedimMiddleRight=2009} ;
    k9CanvasSelectionRedim (ePosition _position,int _x,int _y,int _w,int _h,TQCanvas *canvas,k9CanvasSelection *selection);
    void updateSelection();
    virtual int rtti() const {
        return m_position;
    }
    virtual void moveBy(double _x,double _y);
private:
    k9CanvasSelection *m_selection;
    ePosition m_position;
    double m_offsetX,m_offsetY;
};


class k9CanvasSelection : public TQObject
{
Q_OBJECT
  TQ_OBJECT
public:
    k9CanvasSelection(k9MenuEditor *_editor);

    ~k9CanvasSelection();
    void setPosition (TQPoint _p);
    void release();
    void hide();
    void hideRedim();
    void showRedim();
    void show();
    void setSize(int _w,int _h);
    TQRect getRect();
    void moveBy(int _x,int _y);
    int getWidth();
    void setWidth(int _w);
    int getHeight();
    void setHeight(int _h);
    int getLeft();
    int getTop();
    void update();
    void scale(int _x,int _y, int _w,int _h);
    void drawSelection();
    bool canScale(int _w, int _h);

private:
    k9MenuEditor *m_editor;
    TQCanvasRectangle *m_rect;
    k9CanvasSelectionRedim *m_lt,*m_mt,*m_rt,*m_lm,*m_rm,*m_lb,*m_mb,*m_rb;
};

#endif