GnuCash c935c2f+
Loading...
Searching...
No Matches
dialog-options.hpp
1/********************************************************************\
2 * dialog-options.hpp -- GNOME option handling *
3 * Copyright (C) 1998-2000 Linas Vepstas *
4 * Copyright (c) 2006 David Hampton <hampton@employees.org> *
5 * Copyright (c) 2011 Robert Fewell *
6 * Copyright 2019-2021 John Ralls <jralls@ceridwen.us> *
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\********************************************************************/
30#ifndef GNC_DIALOG_OPTIONS_HPP_
31#define GNC_DIALOG_OPTIONS_HPP_
32
33#include <vector>
34
35#include "gnc-option-uitype.hpp"
36#include <gnc-option-ui.hpp>
37#include <gnc-optiondb.hpp>
38#include <gtk/gtk.h>
39
41
42typedef void (* GncOptionsDialogCallback)(GncOptionsDialog*, void* data);
43
45{
46 GtkWidget * m_window;
47 GtkWidget * m_notebook;
48 GtkWidget * m_page_list_view;
49 GtkWidget * m_page_list;
50 GtkButton * m_help_button;
51 GtkButton * m_cancel_button;
52 GtkButton * m_apply_button;
53 GtkButton * m_ok_button;
54
55 GncOptionsDialogCallback m_apply_cb;
56 gpointer m_apply_cb_data;
57
58 GncOptionsDialogCallback m_help_cb;
59 gpointer m_help_cb_data;
60
61 GncOptionsDialogCallback m_close_cb;
62 gpointer m_close_cb_data;
63
64 /* Hold onto this for a complete reset */
65 GncOptionDB* m_option_db;
66
67 /* Hold on to this to unregister the right class */
68 const char* m_component_class;
69
70 /* widget being destroyed */
71 bool m_destroying{false};
72
73public:
74 GncOptionsDialog(const char* title, GtkWindow* parent) :
75 GncOptionsDialog(false, title, nullptr, parent) {}
76 GncOptionsDialog(bool modal, const char* title, const char* component_class,
77 GtkWindow* parent);
78 GncOptionsDialog(const GncOptionsDialog&) = default;
81
82 GtkWidget* get_widget() const noexcept { return m_window; }
83 GtkWidget* get_page_list() const noexcept { return m_page_list; }
84 GtkWidget* get_page_list_view() const noexcept { return m_page_list_view; }
85 GtkWidget* get_notebook() const noexcept { return m_notebook; }
86 GncOptionDB* get_option_db() noexcept { return m_option_db; }
87 inline void build_contents(GncOptionDB* odb){
88 build_contents(odb, true); }
89 void build_contents(GncOptionDB* odb, bool show_dialog);
90 void set_sensitive(bool sensitive) noexcept;
91 void changed() noexcept;
92 void set_apply_cb(GncOptionsDialogCallback, void* cb_data) noexcept;
93 void call_apply_cb() noexcept;
94 void set_help_cb(GncOptionsDialogCallback, void* cb_data) noexcept;
95 void call_help_cb() noexcept;
96 void set_close_cb(GncOptionsDialogCallback, void* cb_data) noexcept;
97 void call_close_cb() noexcept;
98 void set_book_help_cb() noexcept;
99 void call_book_help_cb() noexcept;
100 void set_style_sheet_help_cb() noexcept;
101 void call_style_sheet_help_cb() noexcept;
102};
103
113
114#endif // GNC_DIALOG_OPTIONS_HPP_
Holds all of the options for a book, report, or stylesheet, organized by GncOptionSections.
OptionUITypes.
The primary C++ interface to options for books, reports, and stylesheets.
void gnc_options_dialog_set_new_book_option_values(GncOptionDB *odb)
Set the initial values of new book options to values specified in user preferences.