File: CloningAssistant.h

package info (click to toggle)
gentle 1.9+cvs20100605+dfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,224 kB
  • ctags: 6,214
  • sloc: cpp: 41,569; ansic: 3,978; sh: 1,420; makefile: 243
file content (120 lines) | stat: -rw-r--r-- 2,963 bytes parent folder | download | duplicates (6)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#ifndef __CLONING_ASSISTANT_H_
#define __CLONING_ASSISTANT_H_

#include "main.h"

#include "ChildBase.h"

class TVector ;

enum {
	DDR_NONE = 0 ,
	DDR_AS_SEQUENCE = 1 ,
	DDR_AS_ITEM = 2 ,
} ;

enum {
	DDR_HIGHLIGHT_NONE = 0 ,
	DDR_HIGHLIGHT_AS ,
	DDR_HIGHLIGHT_LEFT ,
	DDR_HIGHLIGHT_RIGHT
} ;

class TCloningAssistant ;
class TVector ;
class TVectorItem ;
class TCloningAssistantPanel ;

class TDDR_Timer : public wxTimer
	{
	public :
	virtual void Notify() ;
	TCloningAssistantPanel *cap ;
	int move_back , max ;
	} ;

class TDDR ;
typedef vector <TDDR*> VDDR ;

class TDDR // Drag'n'Drop Rect
	{
	public :
	TDDR ( int _type = DDR_NONE ) ;
	~TDDR () ;
	void resizeForText ( wxDC &dc ) ;
	void draw ( wxDC &dc , wxPoint off = wxPoint ( 0 , 0 ) ) ;
	TDDR *findItem ( wxPoint p , wxPoint ori = wxPoint ( 0 , 0 ) , TDDR *match = NULL ) ;
	wxPoint getRealOffset () ;
	void clear_children () ;
	void do_highlight ( wxPoint p ) ;
	void duplicate_from ( TDDR *b ) ;
	void insert_new_child ( TDDR *i , TDDR *t , bool before ) ;
	
	wxRect r ;
	int draggable ;
	VDDR children ;
	TDDR *parent , *original ;
	wxPen pen ;
	wxBrush brush ;
	wxString title ;
	int type ;
	bool dragging ;
	TVector *vector ;
	TVectorItem *item ;
	int highlight ;
	static wxPen ThickRedPen ;
	} ;

class TCloningAssistantPanel : public wxScrolledWindow
	{
	public :
	TCloningAssistantPanel ( TCloningAssistant *_ca , wxWindow *parent ) ;

    virtual void Refresh (bool eraseBackground = true, const wxRect* rect = NULL) ;
    virtual void OnDraw(wxDC& pdc) ;
    virtual void OnPaint(wxPaintEvent& event) ; ///< Paint event handler
    virtual void OnEvent(wxMouseEvent& event) ; ///< Mouse event handler
    virtual void OnSize (wxSizeEvent& event) ;
    	
    void arrange () ;
    
	private :
	friend class TDDR_Timer ;
	void do_drop ( TDDR *source , TDDR *target ) ;
		
	TDDR_Timer timer ;
	TCloningAssistant *ca ;
	TDDR *dragging , *highlight ;
	wxPoint drag_diff , last_dragged_point ;

    DECLARE_EVENT_TABLE()
	} ;

/**	\brief The cloning assistant module
*/
class TCloningAssistant : public ChildBase
    {
    public :
	TCloningAssistant(wxWindow *parent, const wxString& title) ; ///< Constructor
    virtual ~TCloningAssistant () ; ///< Destructor
    virtual wxString getName () ; ///< Returns the module name
    virtual void EnforceRefesh () ; ///< Refreshes the module display

    virtual void initme () ;
    virtual void Refresh (bool eraseBackground = true, const wxRect* rect = NULL) ;
    virtual void OnPaint(wxPaintEvent& event) ; ///< Paint event handler
    virtual void OnDraw(wxDC& pdc) ;
    
    private :
	friend class TCloningAssistantPanel ;
	
	TDDR *new_from_vector ( TVector *v , int drag = DDR_NONE ) ;
	
	vector <TVector*> vectors ;
	TDDR *base , *vlist , *tlist ;
	TCloningAssistantPanel *panel ;

    DECLARE_EVENT_TABLE()
	} ;

#endif