]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/dnd.h
Changed event type ids to constants instead of enum, for extensibility.
[wxWidgets.git] / include / wx / gtk1 / dnd.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: dnd.h
3 // Purpose: declaration of the wxDropTarget class
4 // Author: Robert Roebling
5 // RCS-ID:
6 // Copyright: (c) 1998 Vadim Zeitlin, Robert Roebling
7 // Licence: wxWindows license
8 ///////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __GTKDNDH__
12 #define __GTKDNDH__
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/cursor.h"
22
23 //-------------------------------------------------------------------------
24 // classes
25 //-------------------------------------------------------------------------
26
27 class wxWindow;
28
29 class wxDropTarget;
30 class wxTextDropTarget;
31 class wxDragSource;
32 class wxTextDragSource;
33
34 //-------------------------------------------------------------------------
35 // wxDropTarget
36 //-------------------------------------------------------------------------
37
38 class wxDropTarget: public wxObject
39 {
40 public:
41
42 wxDropTarget();
43 ~wxDropTarget();
44 virtual void OnEnter() { }
45 virtual void OnLeave() { }
46 virtual bool OnDrop( long x, long y, const void *pData ) = 0;
47
48 public:
49
50 void Drop( GdkEvent *event, int x, int y );
51 virtual void RegisterWidget( GtkWidget *widget ) = 0;
52 void UnregisterWidget( GtkWidget *widget );
53 };
54
55 //-------------------------------------------------------------------------
56 // wxTextDropTarget
57 //-------------------------------------------------------------------------
58
59 class wxTextDropTarget: public wxDropTarget
60 {
61 public:
62
63 wxTextDropTarget() {};
64 virtual bool OnDrop( long x, long y, const void *pData );
65 virtual bool OnDropText( long x, long y, const char *psz );
66 virtual void RegisterWidget( GtkWidget *widget );
67 };
68
69 //-------------------------------------------------------------------------
70 // wxDragSource
71 //-------------------------------------------------------------------------
72
73 class wxDragSource: public wxObject
74 {
75 public:
76
77 wxDragSource( wxWindow *win );
78 ~wxDragSource(void);
79 void SetData( char *data, long size );
80 void Start( int x, int y );
81
82 public:
83
84 void ConnectWindow(void);
85 void UnconnectWindow(void);
86 virtual void RegisterWindow(void) = 0;
87 void UnregisterWindow(void);
88
89 GtkWidget *m_widget;
90 wxWindow *m_window;
91 char *m_data;
92 long m_size;
93 wxCursor m_defaultCursor;
94 wxCursor m_goaheadCursor;
95 };
96
97 //-------------------------------------------------------------------------
98 // wxTextDragSource
99 //-------------------------------------------------------------------------
100
101 class wxTextDragSource: public wxDragSource
102 {
103 public:
104
105 wxTextDragSource( wxWindow *win ) : wxDragSource(win) {};
106 void SetTextData( const wxString &text );
107 void RegisterWindow(void);
108
109 private:
110
111 wxString m_tmp;
112 };
113
114 #endif
115 //__GTKDNDH__
116