1 /* 2 * pluma-window.h 3 * This file is part of pluma 4 * 5 * Copyright (C) 2005 - Paolo Maggi 6 * Copyright (C) 2012-2021 MATE Developers 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANWINDOWILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24 /* 25 * Modified by the pluma Team, 2005. See the AUTHORS file for a 26 * list of people on the pluma Team. 27 * See the ChangeLog files for a list of changes. 28 * 29 * $Id$ 30 */ 31 32 #ifndef __PLUMA_WINDOW_H__ 33 #define __PLUMA_WINDOW_H__ 34 35 #include <gio/gio.h> 36 #include <gtk/gtk.h> 37 38 #include <pluma/pluma-tab.h> 39 #include <pluma/pluma-panel.h> 40 #include <pluma/pluma-message-bus.h> 41 42 G_BEGIN_DECLS 43 44 typedef enum 45 { 46 PLUMA_WINDOW_STATE_NORMAL = 0, 47 PLUMA_WINDOW_STATE_SAVING = 1 << 1, 48 PLUMA_WINDOW_STATE_PRINTING = 1 << 2, 49 PLUMA_WINDOW_STATE_LOADING = 1 << 3, 50 PLUMA_WINDOW_STATE_ERROR = 1 << 4, 51 PLUMA_WINDOW_STATE_SAVING_SESSION = 1 << 5 52 } PlumaWindowState; 53 54 /* 55 * Type checking and casting macros 56 */ 57 #define PLUMA_TYPE_WINDOW (pluma_window_get_type()) 58 #define PLUMA_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_WINDOW, PlumaWindow)) 59 #define PLUMA_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_WINDOW, PlumaWindowClass)) 60 #define PLUMA_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_WINDOW)) 61 #define PLUMA_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_WINDOW)) 62 #define PLUMA_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_WINDOW, PlumaWindowClass)) 63 64 /* Private structure type */ 65 typedef struct _PlumaWindowPrivate PlumaWindowPrivate; 66 67 /* 68 * Main object structure 69 */ 70 typedef struct _PlumaWindow PlumaWindow; 71 72 struct _PlumaWindow 73 { 74 GtkWindow window; 75 76 /*< private > */ 77 PlumaWindowPrivate *priv; 78 }; 79 80 /* 81 * Class definition 82 */ 83 typedef struct _PlumaWindowClass PlumaWindowClass; 84 85 struct _PlumaWindowClass 86 { 87 GtkWindowClass parent_class; 88 89 /* Signals */ 90 void (* tab_added) (PlumaWindow *window, 91 PlumaTab *tab); 92 void (* tab_removed) (PlumaWindow *window, 93 PlumaTab *tab); 94 void (* tabs_reordered) (PlumaWindow *window); 95 void (* active_tab_changed) (PlumaWindow *window, 96 PlumaTab *tab); 97 void (* active_tab_state_changed) 98 (PlumaWindow *window); 99 }; 100 101 /* 102 * Public methods 103 */ 104 GType pluma_window_get_type (void) G_GNUC_CONST; 105 106 PlumaTab *pluma_window_create_tab (PlumaWindow *window, 107 gboolean jump_to); 108 109 PlumaTab *pluma_window_create_tab_from_uri (PlumaWindow *window, 110 const gchar *uri, 111 const PlumaEncoding *encoding, 112 gint line_pos, 113 gboolean create, 114 gboolean jump_to); 115 116 void pluma_window_close_tab (PlumaWindow *window, 117 PlumaTab *tab); 118 119 void pluma_window_close_all_tabs (PlumaWindow *window); 120 121 void pluma_window_close_tabs (PlumaWindow *window, 122 const GList *tabs); 123 124 PlumaTab *pluma_window_get_active_tab (PlumaWindow *window); 125 126 void pluma_window_set_active_tab (PlumaWindow *window, 127 PlumaTab *tab); 128 129 /* Helper functions */ 130 PlumaView *pluma_window_get_active_view (PlumaWindow *window); 131 PlumaDocument *pluma_window_get_active_document (PlumaWindow *window); 132 133 /* Returns a newly allocated list with all the documents in the window */ 134 GList *pluma_window_get_documents (PlumaWindow *window); 135 136 /* Returns a newly allocated list with all the documents that need to be 137 saved before closing the window */ 138 GList *pluma_window_get_unsaved_documents (PlumaWindow *window); 139 140 /* Returns a newly allocated list with all the views in the window */ 141 GList *pluma_window_get_views (PlumaWindow *window); 142 143 GtkWindowGroup *pluma_window_get_group (PlumaWindow *window); 144 145 PlumaPanel *pluma_window_get_side_panel (PlumaWindow *window); 146 147 PlumaPanel *pluma_window_get_bottom_panel (PlumaWindow *window); 148 149 GtkWidget *pluma_window_get_statusbar (PlumaWindow *window); 150 151 GtkUIManager *pluma_window_get_ui_manager (PlumaWindow *window); 152 153 PlumaWindowState pluma_window_get_state (PlumaWindow *window); 154 155 PlumaTab *pluma_window_get_tab_from_location (PlumaWindow *window, 156 GFile *location); 157 158 /* Message bus */ 159 PlumaMessageBus *pluma_window_get_message_bus (PlumaWindow *window); 160 161 /* 162 * Non exported functions 163 */ 164 GtkWidget *_pluma_window_get_notebook (PlumaWindow *window); 165 166 PlumaWindow *_pluma_window_move_tab_to_new_window (PlumaWindow *window, 167 PlumaTab *tab); 168 gboolean _pluma_window_is_removing_tabs (PlumaWindow *window); 169 170 GFile *_pluma_window_get_default_location (PlumaWindow *window); 171 172 void _pluma_window_set_default_location (PlumaWindow *window, 173 GFile *location); 174 175 void _pluma_window_set_saving_session_state (PlumaWindow *window, 176 gboolean saving_session); 177 178 void _pluma_window_fullscreen (PlumaWindow *window); 179 180 void _pluma_window_unfullscreen (PlumaWindow *window); 181 182 gboolean _pluma_window_is_fullscreen (PlumaWindow *window); 183 184 /* these are in pluma-window because of screen safety */ 185 void _pluma_recent_add (PlumaWindow *window, 186 const gchar *uri, 187 const gchar *mime); 188 void _pluma_recent_remove (PlumaWindow *window, 189 const gchar *uri); 190 191 void _pluma_window_get_default_size (gint *width, 192 gint *height); 193 194 G_END_DECLS 195 196 #endif /* __PLUMA_WINDOW_H__ */ 197