1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- 2 3 caja-view.h: Interface for caja views 4 5 Copyright (C) 2004 Red Hat Inc. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License as 9 published by the Free Software Foundation; either version 2 of the 10 License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU General Public 18 License along with this program; if not, write to the 19 Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 20 Boston, MA 02110-1301, USA. 21 22 Author: Alexander Larsson <alexl@redhat.com> 23 */ 24 25 #ifndef CAJA_VIEW_H 26 #define CAJA_VIEW_H 27 28 #include <glib-object.h> 29 #include <gtk/gtk.h> 30 31 /* For CajaZoomLevel */ 32 #include "caja-icon-info.h" 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 #define CAJA_TYPE_VIEW (caja_view_get_type ()) 39 #define CAJA_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_VIEW, CajaView)) 40 #define CAJA_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_VIEW)) 41 #define CAJA_VIEW_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_VIEW, CajaViewIface)) 42 43 44 typedef struct _CajaView CajaView; /* dummy typedef */ 45 typedef struct _CajaViewIface CajaViewIface; 46 47 struct _CajaViewIface 48 { 49 GTypeInterface g_iface; 50 51 /* Signals: */ 52 53 /* emitted when the view-specific title as returned by get_title changes */ 54 void (* title_changed) (CajaView *view); 55 56 void (* zoom_level_changed) (CajaView *view); 57 58 /* VTable: */ 59 60 /* Get the id string for this view. Its a constant string, not memory managed */ 61 const char * (* get_view_id) (CajaView *view); 62 63 /* Get the widget for this view, can be the same object or a different 64 object owned by the view. Doesn't ref the widget. */ 65 GtkWidget * (* get_widget) (CajaView *view); 66 67 /* Called to tell the view to start loading a location, or to reload it. 68 The view responds with a load_underway as soon as it starts loading, 69 and a load_complete when the location is completely read. */ 70 void (* load_location) (CajaView *view, 71 const char *location_uri); 72 73 /* Called to tell the view to stop loading the location its currently loading */ 74 void (* stop_loading) (CajaView *view); 75 76 /* Returns the number of selected items in the view */ 77 int (* get_selection_count) (CajaView *view); 78 79 /* Returns a list of uris for th selected items in the view, caller frees it */ 80 GList * (* get_selection) (CajaView *view); 81 82 /* This is called when the window wants to change the selection in the view */ 83 void (* set_selection) (CajaView *view, 84 GList *list); 85 86 /* Inverts the selection in the view */ 87 void (* invert_selection) (CajaView *view); 88 89 /* Return the uri of the first visible file */ 90 char * (* get_first_visible_file) (CajaView *view); 91 /* Scroll the view so that the file specified by the uri is at the top 92 of the view */ 93 void (* scroll_to_file) (CajaView *view, 94 const char *uri); 95 96 /* This function can supply a special window title, if you don't want one 97 have this function return NULL, or just don't supply a function */ 98 char * (* get_title) (CajaView *view); 99 100 101 /* Zoom support */ 102 gboolean (* supports_zooming) (CajaView *view); 103 void (* bump_zoom_level) (CajaView *view, 104 int zoom_increment); 105 void (* zoom_to_level) (CajaView *view, 106 CajaZoomLevel level); 107 CajaZoomLevel (* get_zoom_level) (CajaView *view); 108 void (* restore_default_zoom_level) (CajaView *view); 109 gboolean (* can_zoom_in) (CajaView *view); 110 gboolean (* can_zoom_out) (CajaView *view); 111 112 void (* grab_focus) (CajaView *view); 113 void (* update_menus) (CajaView *view); 114 115 /* Request popup of context menu referring to the open location. 116 * This is triggered in spatial windows by right-clicking the location button, 117 * in navigational windows by right-clicking the "Location:" label in the 118 * navigation bar or any of the buttons in the pathbar. 119 * The location parameter specifies the location this popup should be displayed for. 120 * If it is NULL, the currently displayed location should be used. 121 * The view may display the popup synchronously, asynchronously 122 * or not react to the popup request at all. */ 123 void (* pop_up_location_context_menu) (CajaView *view, 124 GdkEventButton *event, 125 const char *location); 126 127 void (* drop_proxy_received_uris) (CajaView *view, 128 GList *uris, 129 const char *target_location, 130 GdkDragAction action); 131 void (* drop_proxy_received_netscape_url) (CajaView *view, 132 const char *source_url, 133 const char *target_location, 134 GdkDragAction action); 135 void (* set_is_active) (CajaView *view, 136 gboolean is_active); 137 138 /* Padding for future expansion */ 139 void (*_reserved1) (void); 140 void (*_reserved2) (void); 141 void (*_reserved3) (void); 142 void (*_reserved4) (void); 143 void (*_reserved5) (void); 144 void (*_reserved6) (void); 145 void (*_reserved7) (void); 146 }; 147 148 GType caja_view_get_type (void); 149 150 const char * caja_view_get_view_id (CajaView *view); 151 GtkWidget * caja_view_get_widget (CajaView *view); 152 void caja_view_load_location (CajaView *view, 153 const char *location_uri); 154 void caja_view_stop_loading (CajaView *view); 155 int caja_view_get_selection_count (CajaView *view); 156 GList * caja_view_get_selection (CajaView *view); 157 void caja_view_set_selection (CajaView *view, 158 GList *list); 159 void caja_view_invert_selection (CajaView *view); 160 char * caja_view_get_first_visible_file (CajaView *view); 161 void caja_view_scroll_to_file (CajaView *view, 162 const char *uri); 163 char * caja_view_get_title (CajaView *view); 164 gboolean caja_view_supports_zooming (CajaView *view); 165 void caja_view_bump_zoom_level (CajaView *view, 166 int zoom_increment); 167 void caja_view_zoom_to_level (CajaView *view, 168 CajaZoomLevel level); 169 void caja_view_restore_default_zoom_level (CajaView *view); 170 gboolean caja_view_can_zoom_in (CajaView *view); 171 gboolean caja_view_can_zoom_out (CajaView *view); 172 CajaZoomLevel caja_view_get_zoom_level (CajaView *view); 173 void caja_view_pop_up_location_context_menu (CajaView *view, 174 GdkEventButton *event, 175 const char *location); 176 void caja_view_grab_focus (CajaView *view); 177 void caja_view_update_menus (CajaView *view); 178 void caja_view_drop_proxy_received_uris (CajaView *view, 179 GList *uris, 180 const char *target_location, 181 GdkDragAction action); 182 void caja_view_drop_proxy_received_netscape_url (CajaView *view, 183 const char *source_url, 184 const char *target_location, 185 GdkDragAction action); 186 void caja_view_set_is_active (CajaView *view, 187 gboolean is_active); 188 189 #ifdef __cplusplus 190 } 191 #endif 192 193 #endif /* CAJA_VIEW_H */ 194