1 /* 2 * views.h 3 * 4 * Copyright 2012 Dimitar Toshkov Zhekov <dimitar.zhekov@gmail.com> 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, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef VIEWS_H 21 22 typedef enum _ViewIndex 23 { 24 VIEW_TERMINAL, 25 VIEW_THREADS, 26 VIEW_BREAKS, 27 VIEW_STACK, 28 VIEW_LOCALS, 29 VIEW_WATCHES, 30 VIEW_MEMORY, 31 VIEW_CONSOLE, 32 VIEW_INSPECT, 33 VIEW_REGISTERS, 34 VIEW_TOOLTIP, 35 VIEW_POPMENU, 36 VIEW_COUNT 37 } ViewIndex; 38 39 void view_dirty(ViewIndex index); 40 void views_context_dirty(DebugState state, gboolean frame_only); 41 #define views_data_dirty(state) views_context_dirty((state), FALSE) 42 void views_clear(void); 43 void views_update(DebugState state); 44 gboolean view_stack_update(void); 45 #define view_frame_update() (g_strcmp0(frame_id, "0") && view_stack_update()) 46 void view_local_update(void); 47 48 void on_view_changed(GtkNotebook *notebook, gpointer page, gint page_num, gpointer gdata); 49 typedef void (*ViewSeeker)(gboolean focus); 50 gboolean on_view_key_press(GtkWidget *widget, GdkEventKey *event, ViewSeeker seeker); 51 gboolean on_view_button_1_press(GtkWidget *widget, GdkEventButton *event, ViewSeeker seeker); 52 gboolean on_view_query_base_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, 53 GtkTooltip *tooltip, GtkTreeViewColumn *base_name_column); 54 gboolean on_view_editable_map(GtkWidget *widget, gchar *replace); 55 56 enum 57 { 58 COLUMN_ID, 59 COLUMN_FILE, /* locale */ 60 COLUMN_LINE /* 1-based */ 61 }; 62 63 typedef struct _TreeCell 64 { 65 const char *name; 66 GCallback callback; 67 } TreeCell; 68 69 GtkTreeView *view_create(const char *name, ScpTreeStore **store, GtkTreeSelection **selection); 70 GtkTreeView *view_connect(const char *name, ScpTreeStore **store, GtkTreeSelection **selection, 71 const TreeCell *cell_info, const char *window, GObject **display_cell); 72 /* note: 2 references to column */ 73 #define view_set_sort_func(store, column, compare) \ 74 scp_tree_store_set_sort_func((store), (column), (GtkTreeIterCompareFunc) (compare), \ 75 GINT_TO_POINTER(column), NULL) 76 void view_set_line_data_func(const char *column, const char *cell, gint column_id); 77 void view_display_edited(ScpTreeStore *store, gboolean condition, const gchar *path_str, 78 const char *format, gchar *new_text); 79 80 void view_column_set_visible(const char *name, gboolean visible); 81 void view_seek_selected(GtkTreeSelection *selection, gboolean focus, SeekerType seeker); 82 void view_command_line(const gchar *text, const gchar *title, const gchar *seek, 83 gboolean seek_after); 84 void views_update_state(DebugState state); 85 86 void views_init(void); 87 void views_finalize(void); 88 89 #define VIEWS_H 1 90 #endif 91