2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
19 #include <cursormanager.h>
23 CursorManager cursorManager
;
25 void CursorManager::init (Glib::RefPtr
<Gdk::Window
> mainWin
) {
27 cResizeWidth
= new Gdk::Cursor (Gdk::SB_H_DOUBLE_ARROW
);
28 cResizeHeight
= new Gdk::Cursor (Gdk::SB_V_DOUBLE_ARROW
);
29 cResizeDiag
= new Gdk::Cursor (Gdk::BOTTOM_RIGHT_CORNER
);
30 cCropMove
= new Gdk::Cursor (Gdk::FLEUR
);
31 cCropMoving
= new Gdk::Cursor (Gdk::HAND2
);
32 cCropSelection
= new Gdk::Cursor (Gdk::CROSSHAIR
);
34 cNormal
= new Gdk::Cursor (Gdk::LAST_CURSOR
);
36 cNormal
= new Gdk::Cursor (Gdk::ARROW
);
38 cHand
= new Gdk::Cursor (cNormal
->get_display(), Gdk::Pixbuf::create_from_file(GET_DATA_PATH(argv0
)+"/images/openhand22.png"), 10, 10);
39 cClosedHand
= new Gdk::Cursor (cNormal
->get_display(), Gdk::Pixbuf::create_from_file(GET_DATA_PATH(argv0
)+"/images/closedhand22.png"), 10, 10);
40 cWB
= new Gdk::Cursor (cNormal
->get_display(), Gdk::Pixbuf::create_from_file(GET_DATA_PATH(argv0
)+"/images/wbpicker16.png"), 1, 12);
45 void CursorManager::setCursor (Glib::RefPtr
<Gdk::Window
> window
, CursorShape shape
) {
48 window
->set_cursor (*cNormal
);
49 else if (shape
==CSOpenHand
)
50 window
->set_cursor (*cHand
);
51 else if (shape
==CSClosedHand
)
52 window
->set_cursor (*cClosedHand
);
53 else if (shape
==CSMove
)
54 window
->set_cursor (*cCropMove
);
55 else if (shape
==CSResizeWidth
)
56 window
->set_cursor (*cResizeWidth
);
57 else if (shape
==CSResizeHeight
)
58 window
->set_cursor (*cResizeHeight
);
59 else if (shape
==CSResizeDiagonal
)
60 window
->set_cursor (*cResizeDiag
);
61 else if (shape
==CSSpotWB
)
62 window
->set_cursor (*cWB
);
63 else if (shape
==CSCropSelect
)
64 window
->set_cursor (*cCropSelection
);
65 else if (shape
==CSStraighten
)
66 window
->set_cursor (*cCropSelection
);