1 /*
2  * gedit-multi-notebook.h
3  * This file is part of gedit
4  *
5  * Copyright (C) 2010 - Ignacio Casal Quinteiro
6  *
7  * gedit is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * gedit 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
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with gedit; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA  02110-1301  USA
21  */
22 
23 
24 #ifndef GEDIT_MULTI_NOTEBOOK_H
25 #define GEDIT_MULTI_NOTEBOOK_H
26 
27 #include <gtk/gtk.h>
28 
29 #include "gedit-tab.h"
30 #include "gedit-notebook.h"
31 
32 G_BEGIN_DECLS
33 
34 #define GEDIT_TYPE_MULTI_NOTEBOOK		(gedit_multi_notebook_get_type ())
35 #define GEDIT_MULTI_NOTEBOOK(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_MULTI_NOTEBOOK, GeditMultiNotebook))
36 #define GEDIT_MULTI_NOTEBOOK_CONST(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_MULTI_NOTEBOOK, GeditMultiNotebook const))
37 #define GEDIT_MULTI_NOTEBOOK_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_MULTI_NOTEBOOK, GeditMultiNotebookClass))
38 #define GEDIT_IS_MULTI_NOTEBOOK(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_MULTI_NOTEBOOK))
39 #define GEDIT_IS_MULTI_NOTEBOOK_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_MULTI_NOTEBOOK))
40 #define GEDIT_MULTI_NOTEBOOK_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_MULTI_NOTEBOOK, GeditMultiNotebookClass))
41 
42 typedef struct _GeditMultiNotebook		GeditMultiNotebook;
43 typedef struct _GeditMultiNotebookClass		GeditMultiNotebookClass;
44 typedef struct _GeditMultiNotebookPrivate	GeditMultiNotebookPrivate;
45 
46 struct _GeditMultiNotebook
47 {
48 	GtkGrid parent;
49 
50 	GeditMultiNotebookPrivate *priv;
51 };
52 
53 struct _GeditMultiNotebookClass
54 {
55 	GtkGridClass parent_class;
56 
57 	/* Signals */
58 	void	(* notebook_added)		(GeditMultiNotebook *mnb,
59 						 GeditNotebook      *notebook);
60 	void	(* notebook_removed)		(GeditMultiNotebook *mnb,
61 						 GeditNotebook      *notebook);
62 	void	(* tab_added)			(GeditMultiNotebook *mnb,
63 						 GeditNotebook      *notebook,
64 						 GeditTab           *tab);
65 	void	(* tab_removed)			(GeditMultiNotebook *mnb,
66 						 GeditNotebook      *notebook,
67 						 GeditTab           *tab);
68 	void	(* switch_tab)			(GeditMultiNotebook *mnb,
69 						 GeditNotebook      *old_notebook,
70 						 GeditTab           *old_tab,
71 						 GeditNotebook      *new_notebook,
72 						 GeditTab           *new_tab);
73 	void	(* tab_close_request)		(GeditMultiNotebook *mnb,
74 						 GeditNotebook      *notebook,
75 						 GeditTab           *tab);
76 	GtkNotebook *	(* create_window)	(GeditMultiNotebook *mnb,
77 						 GeditNotebook      *notebook,
78 						 GtkWidget          *page,
79 						 gint                x,
80 						 gint                y);
81 	void	(* page_reordered)		(GeditMultiNotebook *mnb);
82 	void	(* show_popup_menu)		(GeditMultiNotebook *mnb,
83 						 GdkEvent           *event,
84 						 GeditTab           *tab);
85 };
86 
87 GType			 gedit_multi_notebook_get_type			(void) G_GNUC_CONST;
88 
89 GeditMultiNotebook	*gedit_multi_notebook_new			(void);
90 
91 GeditNotebook		*gedit_multi_notebook_get_active_notebook	(GeditMultiNotebook *mnb);
92 
93 gint			 gedit_multi_notebook_get_n_notebooks		(GeditMultiNotebook *mnb);
94 
95 GeditNotebook		*gedit_multi_notebook_get_nth_notebook		(GeditMultiNotebook *mnb,
96 									 gint                notebook_num);
97 
98 GeditNotebook		*gedit_multi_notebook_get_notebook_for_tab	(GeditMultiNotebook *mnb,
99 									 GeditTab           *tab);
100 
101 gint			 gedit_multi_notebook_get_notebook_num		(GeditMultiNotebook *mnb,
102 									 GeditNotebook      *notebook);
103 
104 gint			 gedit_multi_notebook_get_n_tabs		(GeditMultiNotebook *mnb);
105 
106 gint			 gedit_multi_notebook_get_page_num		(GeditMultiNotebook *mnb,
107 									 GeditTab           *tab);
108 
109 GeditTab		*gedit_multi_notebook_get_active_tab		(GeditMultiNotebook *mnb);
110 void			 gedit_multi_notebook_set_active_tab		(GeditMultiNotebook *mnb,
111 									 GeditTab           *tab);
112 
113 void			 gedit_multi_notebook_set_current_page		(GeditMultiNotebook *mnb,
114 									 gint                page_num);
115 
116 GList			*gedit_multi_notebook_get_all_tabs		(GeditMultiNotebook *mnb);
117 
118 void			 gedit_multi_notebook_close_tabs		(GeditMultiNotebook *mnb,
119 									 const GList        *tabs);
120 
121 void			 gedit_multi_notebook_close_all_tabs		(GeditMultiNotebook *mnb);
122 
123 void			 gedit_multi_notebook_add_new_notebook		(GeditMultiNotebook *mnb);
124 
125 void			 gedit_multi_notebook_add_new_notebook_with_tab (GeditMultiNotebook *mnb,
126 									 GeditTab           *tab);
127 
128 void			 gedit_multi_notebook_remove_active_notebook	(GeditMultiNotebook *mnb);
129 
130 void			 gedit_multi_notebook_previous_notebook		(GeditMultiNotebook *mnb);
131 void			 gedit_multi_notebook_next_notebook		(GeditMultiNotebook *mnb);
132 
133 void			 gedit_multi_notebook_foreach_notebook		(GeditMultiNotebook *mnb,
134 									 GtkCallback         callback,
135 									 gpointer            callback_data);
136 
137 void			 gedit_multi_notebook_foreach_tab		(GeditMultiNotebook *mnb,
138 									 GtkCallback         callback,
139 									 gpointer            callback_data);
140 
141 void			_gedit_multi_notebook_set_show_tabs		(GeditMultiNotebook *mnb,
142 									 gboolean            show);
143 
144 G_END_DECLS
145 
146 #endif /* GEDIT_MULTI_NOTEBOOK_H */
147 
148 /* ex:set ts=8 noet: */
149