GnuCash  5.6-150-g038405b370+
Static Public Member Functions
GncOptionUIFactory Class Reference

Factory class that keeps track of which GncOptionValueType needs which WidgetCreateFunc and calls the appropriate one when required. More...

#include <gnc-option-gtk-ui.hpp>

Static Public Member Functions

static void set_func (GncOptionUIType type, WidgetCreateFunc func)
 Register a WidgetCreateFunc. More...
 
static void create (GncOption &option, GtkGrid *page, int row)
 Create a widget. More...
 

Detailed Description

Factory class that keeps track of which GncOptionValueType needs which WidgetCreateFunc and calls the appropriate one when required.

Definition at line 51 of file gnc-option-gtk-ui.hpp.

Member Function Documentation

◆ create()

void GncOptionUIFactory::create ( GncOption option,
GtkGrid *  page,
int  row 
)
static

Create a widget.

Parameters
optionThe option for which to create the widget
pageThe Option dialog page in which to insert the widget
rowThe row in which to insert the widget
Returns
pointer to the created widget.

Definition at line 64 of file gnc-option-gtk-ui.cpp.

65 {
66  if (!s_initialized)
67  {
68  gnc_options_ui_factory_initialize();
69  s_initialized = true;
70  }
71  auto type{option.get_ui_type()};
72  auto func{s_registry[static_cast<size_t>(type)]};
73  if (func)
74  func(option, page, row);
75  else
76  PERR("No function registered for type %d", static_cast<int>(type));
77 }
#define PERR(format, args...)
Log a serious error.
Definition: qoflog.h:244

◆ set_func()

void GncOptionUIFactory::set_func ( GncOptionUIType  type,
WidgetCreateFunc  func 
)
static

Register a WidgetCreateFunc.

Parameters
typeThe UI type
funcThe function to register

Definition at line 58 of file gnc-option-gtk-ui.cpp.

59 {
60  s_registry[static_cast<size_t>(type)] = func;
61 }

The documentation for this class was generated from the following files: