summaryrefslogtreecommitdiffstats
path: root/src/select-context.h
blob: bcea8537a74325b5041da1bbebfe938e539dd40d (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
#ifndef __SP_SELECT_CONTEXT_H__
#define __SP_SELECT_CONTEXT_H__

/*
 * Select tool
 *
 * Authors:
 *   Lauris Kaplinski <lauris@kaplinski.com>
 *
 * Copyright (C) 1999-2002 authors
 *
 * Released under GNU GPL, read the file 'COPYING' for more information
 */

#include "event-context.h"
#include <gtk/gtk.h>

#define SP_SELECT_CONTEXT(obj) (dynamic_cast<SPSelectContext*>((SPEventContext*)obj))
#define SP_IS_SELECT_CONTEXT(obj) (dynamic_cast<const SPSelectContext*>((const SPEventContext*)obj) != NULL)

struct SPCanvasItem;

namespace Inkscape {
  class MessageContext;
  class SelTrans;
  class SelectionDescriber;
}

class SPSelectContext : public SPEventContext {
public:
	SPSelectContext();
	virtual ~SPSelectContext();

	guint dragging : 1;
	guint moved : 1;
	bool button_press_shift;
	bool button_press_ctrl;
	bool button_press_alt;

	GList *cycling_items;
	GList *cycling_items_cmp;
	GList *cycling_items_selected_before;
	GList *cycling_cur_item;
	bool cycling_wrap;

	SPItem *item;
	SPCanvasItem *grabbed;
	Inkscape::SelTrans *_seltrans;
	Inkscape::SelectionDescriber *_describer;

	static const std::string prefsPath;

	virtual void setup();
	virtual void set(const Inkscape::Preferences::Entry& val);
	virtual bool root_handler(GdkEvent* event);
	virtual bool item_handler(SPItem* item, GdkEvent* event);

	virtual const std::string& getPrefsPath();

private:
	bool sp_select_context_abort();
	void sp_select_context_cycle_through_items(Inkscape::Selection *selection, GdkEventScroll *scroll_event, bool shift_pressed);
};

#endif