GnuCash  4.14+
gnc-plugin-page.h
Go to the documentation of this file.
1 /*
2  * gnc-plugin-page.h -- A page, which can be added to the
3  * GnuCash main window.
4  *
5  * Copyright (C) 2003 Jan Arne Petersen <jpetersen@uni-bonn.de>
6  * Copyright (C) 2003,2005 David Hampton <hampton@employees.org>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, contact:
20  *
21  * Free Software Foundation Voice: +1-617-542-5942
22  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
23  * Boston, MA 02110-1301, USA gnu@gnu.org
24  */
25 
36 #ifndef __GNC_PLUGIN_PAGE_H
37 #define __GNC_PLUGIN_PAGE_H
38 
39 #include <glib.h>
40 #include "qof.h"
41 
42 G_BEGIN_DECLS
43 
44 #define GNC_PREF_SUMMARYBAR_POSITION_TOP "summarybar-position-top"
45 #define GNC_PREF_SUMMARYBAR_POSITION_BOTTOM "summarybar-position-bottom"
46 
47 /* type macros */
48 #define GNC_TYPE_PLUGIN_PAGE (gnc_plugin_page_get_type ())
49 #define GNC_PLUGIN_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNC_TYPE_PLUGIN_PAGE, GncPluginPage))
50 #define GNC_PLUGIN_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GNC_TYPE_PLUGIN_PAGE, GncPluginPageClass))
51 #define GNC_IS_PLUGIN_PAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNC_TYPE_PLUGIN_PAGE))
52 #define GNC_IS_PLUGIN_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GNC_TYPE_PLUGIN_PAGE))
53 #define GNC_PLUGIN_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNC_PLUGIN_PAGE, GncPluginPageClass))
54 
55 /* typedefs & structures */
56 
58 typedef struct GncPluginPage
59 {
60  GObject gobject;
62  GtkWidget *window;
67  GtkWidget *notebook_page;
71  GtkWidget *summarybar;
77 
78 
80 typedef struct
81 {
82  GObjectClass gobject;
83 
86  const gchar *tab_icon;
88  const gchar *plugin_name;
89 
90  /* Signals */
91  void (* inserted) (GncPluginPage *plugin_page);
92  void (* removed) (GncPluginPage *plugin_page);
93  void (* selected) (GncPluginPage *plugin_page);
94  void (* unselected) (GncPluginPage *plugin_page);
95 
96  /* Virtual Table */
97 
107  GtkWidget *(* create_widget) (GncPluginPage *plugin_page);
108 
114  void (* destroy_widget) (GncPluginPage *plugin_page);
115 
126  void (* save_page) (GncPluginPage *page, GKeyFile *file,
127  const gchar *group);
128 
146  GncPluginPage * (* recreate_page) (GtkWidget *window, GKeyFile *file,
147  const gchar *group);
148 
158  void (* window_changed) (GncPluginPage *plugin_page, GtkWidget *window);
159 
165  void (* focus_page) (GncPluginPage *plugin_page, gboolean on_current_page);
166 
173  gboolean (* focus_page_function) (GncPluginPage *plugin_page);
174 
181  void (* page_name_changed) (GncPluginPage *plugin_page,
182  const gchar *name);
183 
192  void (* update_edit_menu_actions) (GncPluginPage *plugin_page, gboolean hide);
193 
203  gboolean (* finish_pending) (GncPluginPage *plugin_page);
205 
206 
211 GType gnc_plugin_page_get_type (void);
212 
213 
225 GtkWidget *gnc_plugin_page_create_widget (GncPluginPage *plugin_page);
226 
227 
236 
237 
244 void gnc_plugin_page_show_summarybar (GncPluginPage *page, gboolean visible);
245 
246 
260  GKeyFile *key_file,
261  const gchar *group_name);
262 
263 
277 GncPluginPage *gnc_plugin_page_recreate_page (GtkWidget *window,
278  const gchar *page_type,
279  GKeyFile *key_file,
280  const gchar *group_name);
281 
282 
292  GtkUIManager *merge);
293 
294 
304  GtkUIManager *merge);
305 
306 
315 const gchar *gnc_plugin_page_get_plugin_name (GncPluginPage *plugin_page);
316 
317 
324 void gnc_plugin_page_add_book (GncPluginPage *page, QofBook *book);
325 
326 
338 gboolean gnc_plugin_page_has_book (GncPluginPage *page, QofBook *book);
339 
340 
348 
349 
357 GtkWidget *gnc_plugin_page_get_window (GncPluginPage *page);
358 
359 
368 const gchar *gnc_plugin_page_get_page_name (GncPluginPage *page);
369 
370 
378 void gnc_plugin_page_set_page_name (GncPluginPage *page, const char *name);
379 
380 
391 
392 
400 void gnc_plugin_page_set_page_long_name (GncPluginPage *page, const char *name);
401 
402 
411 const gchar *gnc_plugin_page_get_page_color (GncPluginPage *page);
412 
413 
422 void gnc_plugin_page_set_page_color (GncPluginPage *page, const char *color);
423 
424 
433 void gnc_plugin_page_inserted_cb (GncPluginPage *page, gpointer user_data);
434 
435 
441 
442 
450 const gchar *gnc_plugin_page_get_uri (GncPluginPage *page);
451 
452 
459 void gnc_plugin_page_set_uri (GncPluginPage *page, const char *name);
460 
461 
470 
471 
479  const char *name);
480 
481 
489 
490 
501  gboolean use_new);
502 
503 
512 
513 
525  const char *ui_filename);
526 
527 
533 GtkUIManager *gnc_plugin_page_get_ui_merge (GncPluginPage *page);
534 
535 
543 GtkActionGroup *gnc_plugin_page_get_action_group (GncPluginPage *page);
544 
545 
558 GtkActionGroup * gnc_plugin_page_create_action_group (GncPluginPage *page,
559  const gchar *group_name);
560 
570 GtkAction *gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name);
571 
572 /* Signals */
573 void gnc_plugin_page_inserted (GncPluginPage *plugin_page);
574 void gnc_plugin_page_removed (GncPluginPage *plugin_page);
575 void gnc_plugin_page_selected (GncPluginPage *plugin_page);
576 void gnc_plugin_page_unselected (GncPluginPage *plugin_page);
577 
585 gboolean gnc_plugin_page_finish_pending (GncPluginPage *plugin_page);
586 
587 G_END_DECLS
588 
589 #endif /* __GNC_PLUGIN_PAGE_H */
590 
GncPluginPage * gnc_plugin_page_recreate_page(GtkWidget *window, const gchar *page_type, GKeyFile *key_file, const gchar *page_group)
This function looks up a specific plugin type by name, and then calls a plugin specific function to c...
GtkWidget * gnc_plugin_page_get_window(GncPluginPage *page)
Retrieve a pointer to the GncMainWindow (GtkWindow) containing this page.
gboolean gnc_plugin_page_has_books(GncPluginPage *page)
Query a page to see if it has a reference to any book.
gboolean gnc_plugin_page_get_use_new_window(GncPluginPage *page)
Retrieve the "use new window" setting associated with this page.
const gchar * tab_icon
The relative name of the icon that should be shown on the tab for this page.
gboolean gnc_plugin_page_finish_pending(GncPluginPage *page)
Tell a page to finish any outstanding activities.
GType gnc_plugin_page_get_type(void)
Get the type of a content plugin.
void gnc_plugin_page_destroy_widget(GncPluginPage *plugin_page)
Destroy the display widget that corresponds to this plugin.
The instance data structure for a content plugin.
void gnc_plugin_page_set_statusbar_text(GncPluginPage *page, const char *name)
Set the statusbar text associated with this page.
const gchar * gnc_plugin_page_get_page_long_name(GncPluginPage *page)
Retrieve the long name of this page.
void gnc_plugin_page_set_uri(GncPluginPage *page, const char *name)
Set the Uniform Resource Identifier for this page.
void gnc_plugin_page_set_ui_description(GncPluginPage *page, const char *ui_filename)
Set an alternate UI for the specified page.
const gchar * gnc_plugin_page_get_page_name(GncPluginPage *page)
Retrieve the name of this page.
GtkWidget * window
The window that contains the display widget for this plugin.
const gchar * gnc_plugin_page_get_page_color(GncPluginPage *page)
Retrieve the color of this page.
void gnc_plugin_page_unmerge_actions(GncPluginPage *page, GtkUIManager *ui_merge)
Remove the actions for a content page from the specified window.
void gnc_plugin_page_set_page_long_name(GncPluginPage *page, const char *name)
Set the long name of this page.
const gchar * gnc_plugin_page_get_ui_description(GncPluginPage *page)
Retrieve the name of the XML UI file associated with this page.
GtkActionGroup * gnc_plugin_page_get_action_group(GncPluginPage *page)
Retrieve the GtkActionGroup object associated with this page.
GObject gobject
The parent object data.
The class data structure for a content plugin.
const gchar * gnc_plugin_page_get_uri(GncPluginPage *page)
Retrieve the Uniform Resource Identifier for this page.
void gnc_plugin_page_set_use_new_window(GncPluginPage *page, gboolean use_new)
Set the "use new window" setting associated with this page.
void gnc_plugin_page_disconnect_page_changed(GncPluginPage *page)
Disconnect the page_changed_id signal callback.
gboolean gnc_plugin_page_has_book(GncPluginPage *page, QofBook *book)
Query a page to see if it has a reference to a given book.
const gchar * plugin_name
The textual name of this plugin.
const gchar * gnc_plugin_page_get_statusbar_text(GncPluginPage *page)
Retrieve the statusbar text associated with this page.
void gnc_plugin_page_save_page(GncPluginPage *page, GKeyFile *key_file, const gchar *group_name)
Call the plugin specific function that will save the state of a content page to a disk...
GtkAction * gnc_plugin_page_get_action(GncPluginPage *page, const gchar *name)
Retrieve a GtkAction object associated with this page.
void gnc_plugin_page_set_page_color(GncPluginPage *page, const char *color)
Set the color of this page.
void gnc_plugin_page_merge_actions(GncPluginPage *page, GtkUIManager *ui_merge)
Add the actions for a content page to the specified window.
void gnc_plugin_page_inserted_cb(GncPluginPage *page, gpointer user_data)
Set up the page_changed callback for when the current page is changed.
void gnc_plugin_page_set_page_name(GncPluginPage *page, const char *name)
Set the name of this page.
void gnc_plugin_page_add_book(GncPluginPage *page, QofBook *book)
Add a book reference to the specified page.
GtkActionGroup * gnc_plugin_page_create_action_group(GncPluginPage *page, const gchar *group_name)
Create the GtkActionGroup object associated with this page.
GtkUIManager * gnc_plugin_page_get_ui_merge(GncPluginPage *page)
Retrieve the GtkUIManager object associated with this page.
GtkWidget * notebook_page
The display widget for this plugin.
void gnc_plugin_page_show_summarybar(GncPluginPage *page, gboolean visible)
Show/hide the summarybar associated with this page.
GtkWidget * summarybar
The summary bar widget (if any) that is associated with this plugin.
GtkWidget * gnc_plugin_page_create_widget(GncPluginPage *plugin_page)
Create the display widget that corresponds to this plugin.
const gchar * gnc_plugin_page_get_plugin_name(GncPluginPage *plugin_page)
Retrieve the textual name of a plugin.