Debian Codegraph @

examples/others/dnd/dndwindow.h

raw
1 /* gtkmm example Copyright (C) 2002 gtkmm development team
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, see <https://www.gnu.org/licenses/>.
15 */
16
17 #ifndef GTKMM_EXAMPLE_DNDWINDOW_H
18 #define GTKMM_EXAMPLE_DNDWINDOW_H
19
20 #include <gtkmm.h>
21 #include <list>
22
23 class DnDWindow : public Gtk::Window
24 {
25 public:
26 DnDWindow();
27 virtual ~DnDWindow();
28
29 protected:
30 void create_popup();
31
32 //Signal handlers and callback functions:
33 bool on_label_drop_drop(const Glib::ValueBase& value, double x, double y);
34
35 void on_label_popup_enter(double x, double y);
36 void on_label_popup_leave();
37
38 Gdk::DragAction on_button_popup_enter(double x, double y);
39 void on_button_popup_leave();
40 bool on_button_popup_drop(const Glib::ValueBase& value, double x, double y);
41
42 Gdk::DragAction on_image_drag_enter(const Glib::RefPtr<Gdk::Drop>& drop, double x, double y);
43 void on_image_drag_leave(const Glib::RefPtr<Gdk::Drop>& drop);
44 bool on_image_drop(const Glib::RefPtr<Gdk::Drop>& drop, double x, double y);
45
46 void on_label_drag_drag_end(const Glib::RefPtr<Gdk::Drag>& drag, bool delete_data);
47
48 bool on_popdown_timeout();
49 bool on_popup_timeout();
50
51 static Gdk::DragAction action_make_unique(Gdk::DragAction actions, bool print);
52
53 //Member widgets:
54 Gtk::Grid m_Grid;
55 Gtk::Label m_Label_Drop;
56 Gtk::Image m_Image;
57 Gtk::Label m_Label_Drag;
58 Gtk::Label m_Label_Popup;
59
60 Glib::RefPtr<Gdk::Pixbuf> m_drag_icon;
61 Glib::RefPtr<Gdk::Pixbuf> m_trashcan_open;
62 Glib::RefPtr<Gdk::Pixbuf> m_trashcan_closed;
63
64 bool m_have_drag = false;
65
66 Gtk::Window m_PopupWindow; //This is a candidate for being a separate class.
67 bool m_popped_up = false;
68 bool m_in_popup = false;
69 sigc::connection m_popdown_timer;
70 sigc::connection m_popup_timer;
71
72 //Targets:
73 std::vector<Glib::ustring> m_listTargets;
74 std::vector<Glib::ustring> m_listTargetsNoRoot;
75 };
76
77 #endif // GTKMM_EXAMPLE_DNDWINDOW_H