@ -929,6 +929,17 @@ wrap_unique_ptr(GncOptionDBPtr, GncOptionDB);
return g n c _ r e l a t i v e _ d a t e _ t o _ t i m e 64 ( s c m _ r e l a t i v e _ d a t e _ g e t _ p e r i o d ( date ) ) ;
}
void g n c _ r e g i s t e r _ c o m p l e x _ b o o l e a n _ o p t i o n ( G n c O p t i o n D B P t r &, const char*,
c o n s t char * , c o n s t char * ,
c o n s t char * , b o o l , S C M ) ;
void g n c _ r e g i s t e r _ m u l t i c h o i c e _ c a l l b a c k _ o p t i o n ( G n c O p t i o n D B P t r &, const char*,
c o n s t char * , c o n s t char * ,
c o n s t char * , c o n s t char * ,
G n c M u l t i c h o i c e O p t i o n C h o i c e s &&,
S C M ) ;
% } //%header
% i g n o r e G n c O p t i o n M u l t i c h o i c e K e y T y p e ;
@ -1531,8 +1542,67 @@ inline SCM return_scm_value(ValueType value)
return S C M _ B O O L _ F ;
} , s w i g _ g e t _ o p t i o n ( $ self ) ) ;
}
} ;
% i n l i n e % {
/* *
* Create a new c o m p l e x b o o l e a n option and r e g i s t e r i t in t h e o p t i o n s database .
*
* @ param d b A G n c O p t i o n D B * for c a l l i n g from C . C a l l e r r e t a i n s o w n e r s h i p .
* @ param section T h e database section for t h e option .
* @ param name T h e option name .
* @ param d o c _ s t r i n g A d e s c r i p t i o n of t h e option . T h i s w i l l b e u s e d in tooltips and s h o u l d b e m a r k e d for t r a n s l a t i o n .
* @ param value T h e initial and default value for t h e option .
* @ param w i d g e t _ c h a n g e d _ c b A S c h e m e c a l l b a c k to run from t h e U I I t e m ' s "changed" s i g n a l .
* /
void g n c _ r e g i s t e r _ c o m p l e x _ b o o l e a n _ o p t i o n ( G n c O p t i o n D B P t r & db,
c o n s t char * section , c o n s t char * name ,
c o n s t char * key ,
c o n s t char * d o c _ s t r i n g ,
b o o l value , S C M w i d g e t _ c h a n g e d _ c b )
{
G n c O p t i o n option { s e c t i o n , n a m e , k e y , d o c _ s t r i n g , v a l u e ,
G n c O p t i o n U I T y p e : : B O O L E A N } ;
option . s e t _ w i d g e t _ c h a n g e d ( w i d g e t _ c h a n g e d _ c b ) ;
d b - > r e g i s t e r _ o p t i o n ( section , s t d : : m o v e ( option ) ) ;
}
/* *
* Create a new m u l t i c h o i c e option and r e g i s t e r i t in t h e o p t i o n s database .
*
* @ param d b A G n c O p t i o n D B * for c a l l i n g from C . C a l l e r r e t a i n s o w n e r s h i p .
* @ param section T h e database section for t h e option .
* @ param name T h e option name .
* @ param d o c _ s t r i n g A d e s c r i p t i o n of t h e option . T h i s w i l l b e u s e d in tooltips and s h o u l d b e m a r k e d for t r a n s l a t i o n .
* @ param value T h e set of p o s s i b l e values for t h e option . O n l y o n e c a n b e selected . N o t e t h a t t h e value w i l l b e m o v e d from t h e parameter and using t h e parameter a f t e r t h i s call w i l l r e s u l t in u n d e f i n e d b e h a v i o r .
* @ param w i d g e t _ c h a n g e d _ c b A S c h e m e c a l l b a c k to run from t h e U I I t e m ' s "changed" s i g n a l .
* /
void
g n c _ r e g i s t e r _ m u l t i c h o i c e _ c a l l b a c k _ o p t i o n ( G n c O p t i o n D B P t r & db,
c o n s t char * section ,
c o n s t char * name , c o n s t char * key ,
c o n s t char * d o c _ s t r i n g ,
c o n s t char * d e f a u l t _ v a l ,
G n c M u l t i c h o i c e O p t i o n C h o i c e s && choices,
S C M w i d g e t _ c h a n g e d _ c b )
{
s t d : : string d e f v a l { d e f a u l t _ v a l } ;
a u t o f o u n d { s t d : : f i n d _ i f ( c h o i c e s . b e g i n ( ) , c h o i c e s . e n d ( ) ,
[ &defval](auto& choice)->bool {
return d e f v a l = = s t d : : get < 0 > ( c h o i c e ) ;
} ) } ;
if ( f o u n d = = c h o i c e s . end ( ) )
d e f v a l = ( c h o i c e s . empty ( ) ? s t d : : string { " N o n e " } :
s t d : : get < 0 > ( c h o i c e s . at ( 0 ) ) ) ;
G n c O p t i o n option { G n c O p t i o n M u l t i c h o i c e V a l u e { s e c t i o n , n a m e , k e y , d o c _ s t r i n g ,
d e f v a l . c _ s t r ( ) , s t d : : m o v e ( c h o i c e s ) } } ;
option . s e t _ w i d g e t _ c h a n g e d ( w i d g e t _ c h a n g e d _ c b ) ;
d b - > r e g i s t e r _ o p t i o n ( section , s t d : : m o v e ( option ) ) ;
}
% }
% e x t e n d G n c O p t i o n D B {
% t e m p l a t e ( s e t _ o p t i o n _ s t r i n g ) s e t _ o p t i o n < s t d : : string > ;
% t e m p l a t e ( s e t _ o p t i o n _ i n t ) s e t _ o p t i o n < int > ;