1 /**
2  * @file   gui-tabmanager.h
3  * @brief
4  *
5  * Copyright (C) 2009 Gummi Developers
6  * All Rights reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person
9  * obtaining a copy of this software and associated documentation
10  * files (the "Software"), to deal in the Software without
11  * restriction, including without limitation the rights to use,
12  * copy, modify, merge, publish, distribute, sublicense, and/or sell
13  * copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following
15  * conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  */
29 
30 #ifndef __GUMMI_GUI_TABMANAGER_H__
31 #define __GUMMI_GUI_TABMANAGER_H__
32 
33 #include <glib.h>
34 #include <gtk/gtk.h>
35 
36 #include "editor.h"
37 #include "gui-preview.h"
38 
39 #define g_tabnotebook gui->tabmanagergui->notebook
40 
41 #define GU_TAB_PAGE(x) ((GuTabPage*)x)
42 typedef struct _GuTabPage GuTabPage;
43 
44 struct _GuTabPage {
45     GtkWidget* scrollw;
46     GtkWidget* editorbox;
47 
48     GtkWidget* infobar;
49     GtkWidget* barlabel;
50     gint infosignal;
51 
52     GtkWidget* labelbox;
53     GtkLabel* label;
54     gint position;
55     GtkButton* button;
56     unsigned unsavednr;
57     gboolean bold;
58 };
59 
60 
61 #define GU_TAB_CONTEXT(x) ((GuTabContext*)x)
62 typedef struct _GuTabContext GuTabContext;
63 
64 struct _GuTabContext {
65     GuEditor* editor;
66     GuTabPage* page;
67 
68     enum GuPreviewFitModes fit_mode;
69     gint zoom_mode;
70 
71     gdouble scroll_x;
72     gdouble scroll_y;
73 };
74 
75 #define GU_TABMANAGER_GUI(x) ((GuTabmanagerGui*)x)
76 typedef struct _GuTabmanagerGui GuTabmanagerGui;
77 
78 struct _GuTabmanagerGui {
79     GtkNotebook* notebook;
80     int unsavednr;
81 
82 };
83 
84 GuTabmanagerGui* tabmanagergui_init (GtkBuilder* builder);
85 int tabmanagergui_create_page (GuTabContext* tc, GuEditor* editor);
86 void tabmanagergui_create_label (GuTabPage* tp, gchar* labeltext);
87 void tabmanagergui_create_infobar (GuTabPage* tp);
88 
89 gchar* tabmanagergui_get_labeltext (GuTabPage* tp);
90 gint tabmanagergui_replace_page (GuTabContext* tc, GuEditor* newec);
91 void tabmanagergui_set_current_page (gint position);
92 gint tabmanagergui_get_current_page (void);
93 gint tabmanagergui_get_n_pages (void);
94 void tabmanagergui_update_label (GuTabPage* tp, const gchar* text);
95 void tablabel_set_bold_text (GuTabPage* tp);
96 
97 
98 #endif /* __GUMMI_GUI_TABMANAGER_H__ */
99