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();
79 dlg->dbPreferences=db;
90 assert(dlg->refCount);
92 if (dlg->refCount>1) {
106 GWEN_Widget_Tree_free(dlg->widgets);
108 free(dlg->i18nDomain);
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);
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;
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;
void GWEN_Dialog_SetWidgetColumns(GWEN_DIALOG *dlg, const char *name, int i)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY
const char *GWENHYWFAR_CB(* GWEN_DIALOG_GETCHARPROPERTY_FN)(GWEN_DIALOG *dlg, GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultValue)
struct GWEN_DB_NODE GWEN_DB_NODE
#define GWEN_INHERIT_FINI(t, element)
#define GWEN_XML_FLAGS_DEFAULT
void GWEN_DB_Group_free(GWEN_DB_NODE *n)
GWEN_DIALOG * GWEN_Dialog_List_Next(const GWEN_DIALOG *element)
#define GWEN_DIR_SEPARATOR_S
const char * GWEN_XMLNode_GetProperty(const GWEN_XMLNODE *n, const char *name, const char *defaultValue)
GWEN_XMLNODE * GWEN_XMLNode_FindNextTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
static void GWEN_Dialog_DumpWidget(const GWEN_WIDGET *w, FILE *f, unsigned int indent)
GWEN_WIDGET_TREE * GWEN_Dialog_GetWidgets(const GWEN_DIALOG *dlg)
GWEN_DIALOG_SETINTPROPERTY_FN GWEN_Dialog_SetSetIntPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_SETINTPROPERTY_FN fn)
GWEN_DIALOG * GWEN_Dialog_List_First(const GWEN_DIALOG_LIST *l)
#define GWEN_FREE_OBJECT(varname)
int GWEN_Dialog_RemoveWidget(GWEN_DIALOG *dlg, const char *name)
int GWEN_Gui_WriteDialogPrefs(const char *groupName, GWEN_DB_NODE *db)
GWENHYWFAR_API int GWEN_XML_ReadFile(GWEN_XMLNODE *n, const char *filepath, uint32_t flags)
void GWEN_Dialog_AddWidgetFlags(GWEN_DIALOG *dlg, const char *name, uint32_t fl)
#define DBG_WARN(dbg_logger, format, args...)
const char * GWEN_Dialog_TranslateString(const GWEN_DIALOG *dlg, const char *s)
GWEN_DIALOG_SIGNALHANDLER GWEN_Dialog_SetSignalHandler(GWEN_DIALOG *dlg, GWEN_DIALOG_SIGNALHANDLER fn)
GWEN_DB_NODE * GWEN_Dialog_GetPreferences(const GWEN_DIALOG *dlg)
GWEN_XMLNODE * GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data)
uint32_t GWEN_Dialog_GetWidgetFlags(const GWEN_DIALOG *dlg, const char *name)
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
struct GWEN_DIALOG GWEN_DIALOG
GWEN_STRINGLISTENTRY * GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl)
void GWEN_Buffer_Reset(GWEN_BUFFER *bf)
const char * GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se)
int GWEN_Dialog__ReadXmlWidget(GWEN_DIALOG *dlg, GWEN_WIDGET *wparent, GWEN_XMLNODE *node)
const char * GWEN_Dialog_GetId(const GWEN_DIALOG *dlg)
void GWEN_Dialog_List_Add(GWEN_DIALOG *element, GWEN_DIALOG_LIST *list)
void GWEN_Dialog_SetWidgetText(GWEN_DIALOG *dlg, const char *name, const char *t)
GWEN_WIDGET * GWEN_Dialog_FindWidgetByName(const GWEN_DIALOG *dlg, const char *name)
int GWENHYWFAR_CB(* GWEN_DIALOG_GETINTPROPERTY_FN)(GWEN_DIALOG *dlg, GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int defaultValue)
void GWEN_StringList_free(GWEN_STRINGLIST *sl)
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
GWEN_WIDGET * GWEN_Dialog_FindWidgetByImplData(const GWEN_DIALOG *dlg, int index, const void *ptr)
void GWEN_Dialog_SetWidgetRows(GWEN_DIALOG *dlg, const char *name, int i)
#define GWEN_NEW_OBJECT(typ, varname)
int GWEN_StringList_AppendString(GWEN_STRINGLIST *sl, const char *s, int take, int checkDouble)
int GWEN_Dialog_GetIntProperty(GWEN_DIALOG *dlg, const char *name, GWEN_DIALOG_PROPERTY prop, int index, int defaultProperty)
int GWEN_Dialog_EmitSignalToAll(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
void GWEN_Dialog_SetI18nDomain(GWEN_DIALOG *dlg, const char *s)
void GWEN_Dialog_SetWidgetFlags(GWEN_DIALOG *dlg, const char *name, uint32_t fl)
GWEN_STRINGLIST * GWEN_Dialog_GetMediaPaths(const GWEN_DIALOG *dlg)
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST
int GWENHYWFAR_CB(* GWEN_DIALOG_SIGNALHANDLER)(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
void GWEN_Dialog_SetGuiId(GWEN_DIALOG *dlg, uint32_t guiid)
void GWEN_Dialog_List_free(GWEN_DIALOG_LIST *l)
#define GWEN_INHERIT_INIT(t, element)
GWEN_STRINGLIST * GWEN_PathManager_GetPaths(const char *destLib, const char *pathName)
GWEN_DIALOG_SETCHARPROPERTY_FN GWEN_Dialog_SetSetCharPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_SETCHARPROPERTY_FN fn)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
void GWEN_XMLNode_free(GWEN_XMLNODE *n)
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
GWEN_LIST2_FUNCTIONS(TYPEMAKER2_TYPE, Typemaker2_Type)
void GWEN_Dialog_Dump(const GWEN_DIALOG *dlg, FILE *f, unsigned int indent)
GWEN_DIALOG_LIST * GWEN_Dialog_List_new()
const char * GWEN_Dialog_GetI18nDomain(const GWEN_DIALOG *dlg)
int GWEN_Dialog_EmitSignal(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender)
#define DBG_ERROR(dbg_logger, format, args...)
const char * GWEN_Dialog_GetCharProperty(GWEN_DIALOG *dlg, const char *name, GWEN_DIALOG_PROPERTY prop, int index, const char *defaultProperty)
int GWEN_Gui_ReadDialogPrefs(const char *groupName, const char *altName, GWEN_DB_NODE **pDb)
int GWEN_Dialog_SetIntProperty(GWEN_DIALOG *dlg, const char *name, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
int GWEN_Dialog_ReadXml(GWEN_DIALOG *dlg, GWEN_XMLNODE *node)
GWEN_DIALOG * GWEN_Dialog_new(const char *dialogId)
GWEN_STRINGLISTENTRY * GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se)
int GWEN_Dialog_SetCharProperty(GWEN_DIALOG *dlg, const char *name, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
#define GWEN_ERROR_NOT_FOUND
const char * GWEN_I18N_Translate(const char *txtdom, const char *text)
void GWEN_Dialog_AddMediaPath(GWEN_DIALOG *dlg, const char *s)
int GWEN_Dialog_GetWidgetRows(const GWEN_DIALOG *dlg, const char *name)
const char * GWEN_Dialog_GetWidgetText(const GWEN_DIALOG *dlg, const char *name)
#define DBG_INFO(dbg_logger, format, args...)
void GWEN_Dialog_SubWidgetFlags(GWEN_DIALOG *dlg, const char *name, uint32_t fl)
GWEN_DIALOG * GWEN_Dialog_GetParentDialog(const GWEN_DIALOG *dlg)
int GWEN_Dialog_GetWidgetColumns(const GWEN_DIALOG *dlg, const char *name)
#define GWEN_LIST_INIT(t, element)
int GWEN_Dialog_AddSubDialog(GWEN_DIALOG *dlg, const char *parentName, GWEN_DIALOG *subdlg)
int GWENHYWFAR_CB(* GWEN_DIALOG_SETCHARPROPERTY_FN)(GWEN_DIALOG *dlg, GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, const char *value, int doSignal)
#define GWEN_XML_FLAGS_HANDLE_HEADERS
void GWEN_Dialog_AddMediaPathsFromPathManager(GWEN_DIALOG *dlg, const char *destlib, const char *pathName, const char *relPath)
GWEN_DB_NODE * GWEN_DB_Group_new(const char *name)
void GWEN_Dialog_free(GWEN_DIALOG *dlg)
int GWEN_Dialog_ReadXmlFile(GWEN_DIALOG *dlg, const char *fname)
uint32_t GWEN_Dialog_GetGuiId(const GWEN_DIALOG *dlg)
#define GWEN_LIST_FUNCTIONS(t, pr)
GWEN_DIALOG_GETINTPROPERTY_FN GWEN_Dialog_SetGetIntPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_GETINTPROPERTY_FN fn)
GWEN_STRINGLIST * GWEN_StringList_new(void)
GWEN_DIALOG_GETCHARPROPERTY_FN GWEN_Dialog_SetGetCharPropertyFn(GWEN_DIALOG *dlg, GWEN_DIALOG_GETCHARPROPERTY_FN fn)
#define GWEN_LIST_FINI(t, element)
#define GWEN_INHERIT_FUNCTIONS(t)
struct GWEN__XMLNODE GWEN_XMLNODE
int GWENHYWFAR_CB(* GWEN_DIALOG_SETINTPROPERTY_FN)(GWEN_DIALOG *dlg, GWEN_WIDGET *w, GWEN_DIALOG_PROPERTY prop, int index, int value, int doSignal)
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
#define GWEN_ERROR_NOT_IMPLEMENTED