1 /* ide-buffer-change-monitor.h 2 * 3 * Copyright 2015-2019 Christian Hergert <christian@hergert.me> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * SPDX-License-Identifier: GPL-3.0-or-later 19 */ 20 21 #pragma once 22 23 #if !defined (IDE_CODE_INSIDE) && !defined (IDE_CODE_COMPILATION) 24 # error "Only <libide-code.h> can be included directly." 25 #endif 26 27 #include <gtk/gtk.h> 28 #include <libide-core.h> 29 30 #include "ide-code-types.h" 31 32 G_BEGIN_DECLS 33 34 #define IDE_TYPE_BUFFER_CHANGE_MONITOR (ide_buffer_change_monitor_get_type()) 35 36 IDE_AVAILABLE_IN_3_32 37 G_DECLARE_DERIVABLE_TYPE (IdeBufferChangeMonitor, ide_buffer_change_monitor, IDE, BUFFER_CHANGE_MONITOR, IdeObject) 38 39 typedef enum 40 { 41 IDE_BUFFER_LINE_CHANGE_NONE = 0, 42 IDE_BUFFER_LINE_CHANGE_ADDED = 1 << 0, 43 IDE_BUFFER_LINE_CHANGE_CHANGED = 1 << 1, 44 IDE_BUFFER_LINE_CHANGE_DELETED = 1 << 2, 45 IDE_BUFFER_LINE_CHANGE_PREVIOUS_DELETED = 1 << 3, 46 } IdeBufferLineChange; 47 48 typedef void (*IdeBufferChangeMonitorForeachFunc) (guint line, 49 IdeBufferLineChange change, 50 gpointer user_data); 51 52 struct _IdeBufferChangeMonitorClass 53 { 54 IdeObjectClass parent_class; 55 56 void (*load) (IdeBufferChangeMonitor *self, 57 IdeBuffer *buffer); 58 IdeBufferLineChange (*get_change) (IdeBufferChangeMonitor *self, 59 guint line); 60 void (*reload) (IdeBufferChangeMonitor *self); 61 void (*foreach_change) (IdeBufferChangeMonitor *self, 62 guint line_begin, 63 guint line_end, 64 IdeBufferChangeMonitorForeachFunc callback, 65 gpointer user_data); 66 67 /*< private >*/ 68 gpointer _reserved[8]; 69 }; 70 71 IDE_AVAILABLE_IN_3_32 72 IdeBuffer *ide_buffer_change_monitor_get_buffer (IdeBufferChangeMonitor *self); 73 IDE_AVAILABLE_IN_3_32 74 void ide_buffer_change_monitor_emit_changed (IdeBufferChangeMonitor *self); 75 IDE_AVAILABLE_IN_3_32 76 void ide_buffer_change_monitor_foreach_change (IdeBufferChangeMonitor *self, 77 guint line_begin, 78 guint line_end, 79 IdeBufferChangeMonitorForeachFunc callback, 80 gpointer user_data); 81 IDE_AVAILABLE_IN_3_32 82 IdeBufferLineChange ide_buffer_change_monitor_get_change (IdeBufferChangeMonitor *self, 83 guint line); 84 IDE_AVAILABLE_IN_3_32 85 void ide_buffer_change_monitor_reload (IdeBufferChangeMonitor *self); 86 87 G_END_DECLS 88