The Gnome Chemistry Utils
0.14.0
Main Page
Namespaces
Classes
Files
File List
File Members
libs
gcp
tool.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
/*
4
* GChemPaint library
5
* tool.h
6
*
7
* Copyright (C) 2001-2011 Jean Bréfort <jean.brefort@normalesup.org>
8
*
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 3 of the
12
* License, or (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22
* USA
23
*/
24
25
#ifndef GCHEMPAINT_TOOL_H
26
#define GCHEMPAINT_TOOL_H
27
28
#include <
gcu/macros.h
>
29
#include <gtk/gtk.h>
30
#include <libxml/tree.h>
31
#include <vector>
32
#include <set>
33
#include <string>
34
35
namespace
gcu {
36
class
Dialog;
37
class
Object;
38
class
UIManager;
39
}
40
41
namespace
gccv {
42
class
Item;
43
}
44
46
namespace
gcp {
47
48
class
Application;
49
class
View;
50
class
WidgetData;
51
class
Operation;
52
56
class
Tool
57
{
58
public
:
65
Tool
(
gcp::Application
*App, std::string Id);
69
virtual
~Tool
();
70
87
bool
OnClicked
(
View
* pView,
gcu::Object
* pObject,
double
x,
double
y,
unsigned
int
state);
88
97
void
OnDrag
(
double
x,
double
y,
unsigned
int
state);
108
void
OnMotion
(
View
* pView,
gcu::Object
* pObject,
double
x,
double
y,
unsigned
int
state);
116
void
OnLeaveNotify
(
View
* pView,
unsigned
int
state);
125
void
OnRelease
(
double
x,
double
y,
unsigned
int
state);
139
bool
OnRightButtonClicked
(
View
* pView,
gcu::Object
* pObject,
double
x,
double
y,
gcu::UIManager
*UIManager);
147
bool
Activate
(
bool
bState);
151
std::string&
GetName
() {
return
name;}
160
virtual
bool
OnRightButtonClicked
(
gcu::UIManager
*UIManager);
166
virtual
void
Activate
();
173
virtual
bool
Deactivate
();
181
void
OnKeyPressed
(
unsigned
int
code) {
m_nState
|= code;
OnChangeState
();}
189
void
OnKeyReleased
(
unsigned
int
code) {
if
(
m_nState
& code)
m_nState
-= code;
OnChangeState
();}
196
virtual
bool
OnKeyPress
(GdkEventKey *event);
203
virtual
bool
OnKeyRelease
(GdkEventKey *event);
213
virtual
bool
NotifyViewChange
();
218
virtual
bool
DeleteSelection
();
223
virtual
bool
CopySelection
(GtkClipboard *clipboard);
228
virtual
bool
CutSelection
(GtkClipboard *clipboard);
233
virtual
bool
PasteSelection
(GtkClipboard *clipboard);
238
virtual
void
AddSelection
(
WidgetData
* data);
243
virtual
bool
OnReceive
(GtkClipboard *clipboard, GtkSelectionData *data,
int
type);
249
virtual
bool
OnUndo
();
255
virtual
bool
OnRedo
();
261
virtual
void
PushNode
(xmlNodePtr node);
267
virtual
GtkWidget *
GetPropertyPage
();
275
virtual
char
const
*
GetHelpTag
() {
return
""
;}
280
Application
*
GetApplication
() {
return
m_pApp
;}
285
virtual
void
OnConfigChanged
() {}
286
287
protected
:
297
virtual
bool
OnClicked
();
304
virtual
void
OnDrag
();
311
virtual
void
OnMotion
();
318
virtual
void
OnLeaveNotify
();
325
virtual
void
OnRelease
();
330
virtual
void
OnChangeState
();
331
332
protected
:
336
double
m_x0
;
340
double
m_y0
;
345
double
m_x1
;
350
double
m_y1
;
354
double
m_x
;
358
double
m_y
;
362
gcu::Object
*
m_pObject
;
366
gcu::Object
*
m_pObjectGroup
;
370
View
*
m_pView
;
374
WidgetData
*
m_pData
;
378
GtkWidget *
m_pWidget
;
382
gccv::Item
*
m_Item
;
386
double
m_dZoomFactor
;
391
bool
m_bChanged
;
395
unsigned
int
m_nState
;
399
gcp::Application
*
m_pApp
;
403
std::set<std::string>
ModifiedObjects
;
408
bool
m_bAllowed
;
409
410
private
:
411
double
lastx, lasty;
412
std::string name;
413
bool
m_bPressed;
414
421
GCU_PROT_PROP
(
bool
, OwnStatus)
422
};
423
424
}
// namespace gcp
425
426
#endif // GCHEMPAINT_TOOL_H
Generated on Tue Jan 1 2013 22:29:23 for The Gnome Chemistry Utils by
1.8.1.2