30 #define DISABLE_DEBUGLOG
37 #include <gwenhywfar/text.h>
38 #include <gwenhywfar/pathmanager.h>
39 #include <gwenhywfar/debug.h>
40 #include <gwenhywfar/i18n.h>
63 if (dialogId && *dialogId)
64 dlg->dialogId=strdup(dialogId);
66 dlg->i18nDomain=strdup(PACKAGE);
68 dlg->widgets=GWEN_Widget_Tree_new();
70 dlg->subDialogs=GWEN_Dialog_List_new();
79 dlg->dbPreferences=db;
90 assert(dlg->refCount);
92 if (dlg->refCount>1) {
106 GWEN_Widget_Tree_free(dlg->widgets);
108 free(dlg->i18nDomain);
110 GWEN_Dialog_List_free(dlg->subDialogs);
124 assert(dlg->refCount);
126 return dlg->parentDialog;
133 assert(dlg->refCount);
135 return dlg->dialogId;
142 assert(dlg->refCount);
151 assert(dlg->refCount);
160 assert(dlg->refCount);
162 free(dlg->i18nDomain);
163 if (s) dlg->i18nDomain=strdup(s);
164 else dlg->i18nDomain=strdup(PACKAGE);
171 assert(dlg->refCount);
173 return dlg->i18nDomain;
180 assert(dlg->refCount);
189 assert(dlg->refCount);
198 const char *pathName,
199 const char *relPath) {
236 assert(dlg->refCount);
238 return dlg->mediaPaths;
248 assert(dlg->refCount);
250 oh=dlg->signalHandler;
251 dlg->signalHandler=fn;
260 const char *sender) {
262 assert(dlg->refCount);
264 if (dlg->signalHandler)
265 return (dlg->signalHandler)(dlg, t, sender);
268 (dlg->dialogId)?(dlg->dialogId):
"-unnamed-");
277 const char *sender) {
282 assert(dlg->refCount);
284 subdlg=GWEN_Dialog_List_First(dlg->subDialogs);
290 subdlg=GWEN_Dialog_List_Next(subdlg);
293 if (dlg->signalHandler) {
294 rv=(dlg->signalHandler)(dlg, t, sender);
306 const char *parentName,
316 subRoot=GWEN_Widget_Tree_GetFirst(subdlg->widgets);
318 while( (cw=GWEN_Widget_Tree_GetFirstChild(subRoot)) ) {
319 if (subdlg->firstSubWidget==
NULL)
320 subdlg->firstSubWidget=cw;
321 GWEN_Widget_Tree_Del(cw);
322 GWEN_Widget_Tree_AddChild(wparent, cw);
327 subdlg->parentWidget=wparent;
330 subdlg->parentDialog=dlg;
332 GWEN_Dialog_List_Add(subdlg, dlg->subDialogs);
360 GWEN_Widget_Tree_AddChild(wparent, w);
362 GWEN_Widget_Tree_Add(dlg->widgets, w);
385 assert(dlg->refCount);
387 assert(dlg->widgets);
388 GWEN_Widget_Tree_Clear(dlg->widgets);
397 GWEN_Widget_Tree_free(dlg->widgets);
446 assert(dlg->refCount);
447 assert(dlg->widgets);
450 if (dlg->parentWidget)
453 w=GWEN_Widget_Tree_GetFirst(dlg->widgets);
455 if (dlg->firstSubWidget)
456 w=dlg->firstSubWidget;
458 w=GWEN_Widget_Tree_GetFirst(dlg->widgets);
460 if (name==
NULL || *name==0)
469 if (s && *s && strcasecmp(s, name)==0)
471 w=GWEN_Widget_Tree_GetBelow(w);
483 assert(dlg->refCount);
484 assert(dlg->widgets);
486 if (dlg->parentWidget)
489 w=GWEN_Widget_Tree_GetFirst(dlg->widgets);
494 w=GWEN_Widget_Tree_GetBelow(w);
504 assert(dlg->refCount);
505 assert(dlg->widgets);
517 assert(dlg->refCount);
519 oh=dlg->setIntPropertyFn;
520 dlg->setIntPropertyFn=fn;
531 assert(dlg->refCount);
533 oh=dlg->getIntPropertyFn;
534 dlg->getIntPropertyFn=fn;
545 assert(dlg->refCount);
547 oh=dlg->setCharPropertyFn;
548 dlg->setCharPropertyFn=fn;
559 assert(dlg->refCount);
561 oh=dlg->getCharPropertyFn;
562 dlg->getCharPropertyFn=fn;
580 assert(dlg->refCount);
584 if (dlg->setIntPropertyFn)
585 return dlg->setIntPropertyFn(dlg, w, prop, index, value, doSignal);
586 else if (dlg->parentDialog && dlg->parentDialog->setIntPropertyFn)
587 return dlg->parentDialog->setIntPropertyFn(dlg->parentDialog, w, prop, index, value, doSignal);
604 int defaultProperty) {
608 assert(dlg->refCount);
612 if (dlg->getIntPropertyFn)
613 return dlg->getIntPropertyFn(dlg, w, prop, index, defaultProperty);
614 else if (dlg->parentDialog && dlg->parentDialog->getIntPropertyFn)
615 return dlg->parentDialog->getIntPropertyFn(dlg->parentDialog, w, prop, index, defaultProperty);
619 return defaultProperty;
623 return defaultProperty;
637 assert(dlg->refCount);
641 if (dlg->setCharPropertyFn)
642 return dlg->setCharPropertyFn(dlg, w, prop, index, value, doSignal);
643 else if (dlg->parentDialog && dlg->parentDialog->setCharPropertyFn)
644 return dlg->parentDialog->setCharPropertyFn(dlg->parentDialog, w, prop, index, value, doSignal);
661 const char *defaultProperty) {
665 assert(dlg->refCount);
669 if (dlg->getCharPropertyFn)
670 return dlg->getCharPropertyFn(dlg, w, prop, index, defaultProperty);
671 else if (dlg->parentDialog && dlg->parentDialog->getCharPropertyFn)
672 return dlg->parentDialog->getCharPropertyFn(dlg->parentDialog, w, prop, index, defaultProperty);
676 return defaultProperty;
680 return defaultProperty;
690 GWEN_Widget_Tree_Del(w);
820 const char *dname=
NULL;
824 for (i=0; i<indent; i++)
831 fprintf(f,
"Widget %s: %d [%s]\n", s?s:
"unnamed",
GWEN_Widget_GetType(w), dname?dname:
"no dialog");
832 c=GWEN_Widget_Tree_GetFirstChild(w);
835 c=GWEN_Widget_Tree_GetNext(c);
844 w=GWEN_Widget_Tree_GetFirst(dlg->widgets);
855 assert(dlg->refCount);
857 return dlg->dbPreferences;