| 1 | /* |
| 2 | * Copyright 2020-2024 Andrey Kutejko <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * For more details see the file COPYING. |
| 18 | */ |
| 19 | |
| 20 | use crate::config::DATA_DIRECTORY; |
| 21 | use gtk::gdk; |
| 22 | use std::path::Path; |
| 23 | |
| 24 | pub fn make_cursors() -> Vec<gdk::Cursor> { |
| 25 | vec![ |
| 26 | make_cursor("cursor-up-left.png", 3, 3), |
| 27 | make_cursor("cursor-up.png", 10, 3), |
| 28 | make_cursor("cursor-up-right.png", 17, 3), |
| 29 | make_cursor("cursor-left.png", 3, 10), |
| 30 | make_cursor("cursor-hold.png", 10, 10), |
| 31 | make_cursor("cursor-right.png", 17, 10), |
| 32 | make_cursor("cursor-down-left.png", 3, 17), |
| 33 | make_cursor("cursor-down.png", 10, 17), |
| 34 | make_cursor("cursor-down-right.png", 17, 17), |
| 35 | ] |
| 36 | } |
| 37 | |
| 38 | fn make_cursor(filename: &str, hsx: i32, hsy: i32) -> gdk::Cursor { |
| 39 | let path = Path::new(DATA_DIRECTORY).join("cursors").join(filename); |
| 40 | let texture = gdk::Texture::from_filename(path).unwrap(); |
| 41 | gdk::Cursor::from_texture(&texture, hsx, hsy, None) |
| 42 | } |