GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-option-ui.hpp
1/********************************************************************\
2 * gnc-option-ui.hpp -- UI association for GncOption *
3 * Copyright (C) 2019 John Ralls <jralls@ceridwen.us> *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation; either version 2 of *
8 * the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License*
16 * along with this program; if not, contact: *
17 * *
18 * Free Software Foundation Voice: +1-617-542-5942 *
19 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
20 * Boston, MA 02110-1301, USA gnu@gnu.org *
21 * *
22\********************************************************************/
23
24#ifndef GNC_OPTION_UI_HPP_
25#define GNC_OPTION_UI_HPP_
26
27#include <memory>
28#include "gnc-option-uitype.hpp"
29
30class GncOption;
31class GncOptionUIItem;
32using GncOptionUIItemPtr = std::unique_ptr<GncOptionUIItem>;
33
47{
48public:
49 GncOptionUIItem(GncOptionUIType type) : m_type{type} {}
50 virtual ~GncOptionUIItem() = default;
51 GncOptionUIType get_ui_type() const noexcept { return m_type; }
52 virtual void set_dirty(bool status) noexcept { m_dirty = status; }
53 virtual bool get_dirty() const noexcept { return m_dirty; }
54 virtual void set_selectable(bool selectable) const noexcept = 0;
55 virtual void clear_ui_item() = 0;
56 virtual void set_ui_item_from_option(GncOption& option) noexcept = 0;
57 virtual void set_option_from_ui_item(GncOption& option) noexcept = 0;
58private:
59 GncOptionUIType m_type;
60 bool m_dirty = false;
61};
62
63#endif //GNC_OPTION_UI_HPP__
Holds a pointer to the UI item which will control the option and an enum representing the type of the...
Represents the public interface for an option.
OptionUITypes.
GncOptionUIType
Used by GncOptionClassifier to indicate to dialog-options what control should be displayed for the op...