1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ 2 /* 3 * anjuta-shell.h 4 * Copyright (C) Naba Kumar <naba@gnome.org> 5 * 6 * This program 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 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program 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. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 #ifndef _ANJUTA_SHELL_H 21 #define _ANJUTA_SHELL_H 22 23 #include <glib-object.h> 24 #include <gtk/gtk.h> 25 26 #include <libanjuta/anjuta-shell.h> 27 #include <libanjuta/anjuta-status.h> 28 #include <libanjuta/anjuta-ui.h> 29 #include <libanjuta/anjuta-preferences.h> 30 #include <libanjuta/anjuta-plugin-manager.h> 31 #include <libanjuta/anjuta-profile-manager.h> 32 #include <libanjuta/anjuta-session.h> 33 #include <libanjuta/anjuta-save-prompt.h> 34 35 G_BEGIN_DECLS 36 37 #define ANJUTA_TYPE_SHELL (anjuta_shell_get_type ()) 38 #define ANJUTA_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ANJUTA_TYPE_SHELL, AnjutaShell)) 39 #define ANJUTA_IS_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ANJUTA_TYPE_SHELL)) 40 #define ANJUTA_SHELL_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ANJUTA_TYPE_SHELL, AnjutaShellIface)) 41 42 #define ANJUTA_SHELL_ERROR anjuta_shell_error_quark() 43 44 typedef struct _AnjutaShell AnjutaShell; 45 typedef struct _AnjutaShellIface AnjutaShellIface; 46 47 /** 48 * AnjutaShellError: 49 * @ANJUTA_SHELL_ERROR_DOESNT_EXIST: 50 */ 51 typedef enum 52 { 53 ANJUTA_SHELL_ERROR_DOESNT_EXIST, 54 } AnjutaShellError; 55 56 typedef enum 57 { 58 ANJUTA_SHELL_PLACEMENT_NONE = 0, 59 ANJUTA_SHELL_PLACEMENT_TOP, 60 ANJUTA_SHELL_PLACEMENT_BOTTOM, 61 ANJUTA_SHELL_PLACEMENT_RIGHT, 62 ANJUTA_SHELL_PLACEMENT_LEFT, 63 ANJUTA_SHELL_PLACEMENT_CENTER, 64 ANJUTA_SHELL_PLACEMENT_FLOATING 65 } AnjutaShellPlacement; 66 67 struct _AnjutaShellIface { 68 GTypeInterface g_iface; 69 70 /* Signals */ 71 void (*value_added) (AnjutaShell *shell, char *name, GValue *value); 72 void (*value_removed) (AnjutaShell *shell, char *name); 73 void (*save_session) (AnjutaShell *shell, AnjutaSessionPhase phase, 74 AnjutaSession *session); 75 void (*load_session) (AnjutaShell *shell, AnjutaSessionPhase phase, 76 AnjutaSession *session); 77 void (*save_prompt) (AnjutaShell *shell, AnjutaSavePrompt *save_prompt); 78 79 /* Virtual Table */ 80 AnjutaStatus* (*get_status) (AnjutaShell *shell, GError **error); 81 AnjutaUI* (*get_ui) (AnjutaShell *shell, GError **error); 82 AnjutaPreferences* (*get_preferences) (AnjutaShell *shell, GError **error); 83 AnjutaPluginManager* (*get_plugin_manager) (AnjutaShell *shell, 84 GError **error); 85 AnjutaProfileManager* (*get_profile_manager) (AnjutaShell *shell, 86 GError **error); 87 88 void (*add_widget_full) (AnjutaShell *shell, 89 GtkWidget *widget, 90 const char *name, 91 const char *title, 92 const char *stock_id, 93 AnjutaShellPlacement placement, 94 gboolean locked, 95 GError **error); 96 void (*add_widget_custom) (AnjutaShell *shell, 97 GtkWidget *widget, 98 const char *name, 99 const char *title, 100 const char *stock_id, 101 GtkWidget *label, 102 AnjutaShellPlacement placement, 103 GError **error); 104 105 void (*remove_widget) (AnjutaShell *shell, 106 GtkWidget *widget, 107 GError **error); 108 void (*present_widget) (AnjutaShell *shell, 109 GtkWidget *widget, 110 GError **error); 111 112 void (*iconify_dockable_widget) (AnjutaShell *shell, 113 GtkWidget *widget, 114 GError **error); 115 void (*hide_dockable_widget) (AnjutaShell *shell, 116 GtkWidget *widget, 117 GError **error); 118 void (*show_dockable_widget) (AnjutaShell *shell, 119 GtkWidget *widget, 120 GError **error); 121 void (*maximize_widget) (AnjutaShell *shell, 122 const char *widget_name, 123 GError **error); 124 void (*unmaximize) (AnjutaShell *shell, 125 GError **error); 126 void (*add_value) (AnjutaShell *shell, 127 const char *name, 128 const GValue *value, 129 GError **error); 130 void (*get_value) (AnjutaShell *shell, 131 const char *name, 132 GValue *value, 133 GError **error); 134 void (*remove_value) (AnjutaShell *shell, 135 const char *name, 136 GError **error); 137 void (*saving_push) (AnjutaShell* shell); 138 void (*saving_pop) (AnjutaShell* shell); 139 GObject* (*get_object) (AnjutaShell *shell, 140 const char *iface_name, 141 GError **error); 142 AnjutaShell * (*create_window) (AnjutaShell *shell, 143 GError **error); 144 }; 145 146 GQuark anjuta_shell_error_quark (void); 147 GType anjuta_shell_get_type (void); 148 149 AnjutaStatus* anjuta_shell_get_status (AnjutaShell *shell, GError **error); 150 151 AnjutaUI* anjuta_shell_get_ui (AnjutaShell *shell, GError **error); 152 153 AnjutaPreferences* anjuta_shell_get_preferences (AnjutaShell *shell, 154 GError **error); 155 156 AnjutaPluginManager* anjuta_shell_get_plugin_manager (AnjutaShell *shell, 157 GError **error); 158 159 AnjutaProfileManager* anjuta_shell_get_profile_manager (AnjutaShell *shell, 160 GError **error); 161 162 void anjuta_shell_freeze (AnjutaShell *shell, GError **error); 163 void anjuta_shell_thaw (AnjutaShell *shell, GError **error); 164 165 void anjuta_shell_add_widget (AnjutaShell *shell, 166 GtkWidget *widget, 167 const char *name, 168 const char *title, 169 const char *stock_id, 170 AnjutaShellPlacement placement, 171 GError **error); 172 173 void anjuta_shell_add_widget_custom (AnjutaShell *shell, 174 GtkWidget *widget, 175 const char *name, 176 const char *title, 177 const char *stock_id, 178 GtkWidget *label, 179 AnjutaShellPlacement placement, 180 GError **error); 181 182 void anjuta_shell_add_widget_full (AnjutaShell *shell, 183 GtkWidget *widget, 184 const char *name, 185 const char *title, 186 const char *stock_id, 187 AnjutaShellPlacement placement, 188 gboolean locked, 189 GError **error); 190 191 void anjuta_shell_remove_widget (AnjutaShell *shell, 192 GtkWidget *widget, 193 GError **error); 194 void anjuta_shell_present_widget (AnjutaShell *shell, 195 GtkWidget *widget, 196 GError **error); 197 void anjuta_shell_iconify_dockable_widget (AnjutaShell *shell, 198 GtkWidget *widget, 199 GError **error); 200 void anjuta_shell_hide_dockable_widget (AnjutaShell *shell, 201 GtkWidget *widget, 202 GError **error); 203 void anjuta_shell_show_dockable_widget (AnjutaShell *shell, 204 GtkWidget *widget, 205 GError **error); 206 void anjuta_shell_maximize_widget (AnjutaShell *shell, 207 const char *widget_name, 208 GError **error); 209 void anjuta_shell_unmaximize (AnjutaShell *shell, 210 GError **error); 211 AnjutaShell* anjuta_shell_create_window (AnjutaShell* shell, 212 GError **error); 213 void anjuta_shell_add_value (AnjutaShell *shell, 214 const char *name, 215 const GValue *value, 216 GError **error); 217 void anjuta_shell_add_valist (AnjutaShell *shell, 218 const char *first_name, 219 GType first_type, 220 va_list var_args); 221 void anjuta_shell_add (AnjutaShell *shell, 222 const char *first_name, 223 GType first_type, 224 ...); 225 void anjuta_shell_get_value (AnjutaShell *shell, 226 const char *name, 227 GValue *value, 228 GError **error); 229 void anjuta_shell_get_valist (AnjutaShell *shell, 230 const char *first_name, 231 GType first_type, 232 va_list var_args); 233 void anjuta_shell_get (AnjutaShell *shell, 234 const char *first_name, 235 GType first_type, 236 ...); 237 void anjuta_shell_remove_value (AnjutaShell *shell, 238 const char *name, 239 GError **error); 240 241 GObject *anjuta_shell_get_object (AnjutaShell *shell, 242 const gchar *iface_name, 243 GError **error); 244 void anjuta_shell_session_save (AnjutaShell *shell, 245 const gchar *session_directory, 246 GError **error); 247 void anjuta_shell_session_load (AnjutaShell *shell, 248 const gchar *session_directory, 249 GError **error); 250 void anjuta_shell_save_prompt (AnjutaShell *shell, 251 AnjutaSavePrompt *prompt, 252 GError **error); 253 void anjuta_shell_saving_push (AnjutaShell* shell); 254 void anjuta_shell_saving_pop (AnjutaShell* shell); 255 256 257 /** 258 * anjuta_shell_get_interface: 259 * @shell: A #AnjutaShell object 260 * @iface_type: The interface type implemented by the object to be found 261 * @error: Error propagation object. 262 * 263 * Equivalent to anjuta_shell_get_object(), but additionally typecasts returned 264 * object to the interface type. It also takes interface type directly. A 265 * usage of this function is: 266 * <programlisting> 267 * IAnjutaDocumentManager *docman = 268 * anjuta_shell_get_interface (shell, IAnjutaDocumentManager, error); 269 * </programlisting> 270 */ 271 #define anjuta_shell_get_interface(shell, iface_type, error) \ 272 ((iface_type*) anjuta_shell_get_object((shell), #iface_type, (error))) 273 274 G_END_DECLS 275 276 #endif 277