From 0bcd620a6249c1c0c50af55673ec894d2aee25bc Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 27 Nov 2015 23:23:54 -0500 Subject: [PATCH] Started a change which will allow a parent of the standard dialogs to be specified. --- test/main.c | 2 +- test/page5.c | 14 +++++++++----- test/test.h | 2 +- ui.h | 8 ++++---- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/test/main.c b/test/main.c index 96d77052..42534181 100644 --- a/test/main.c +++ b/test/main.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) page4 = makePage4(); uiTabAppend(mainTab, "Page 4", uiControl(page4)); - page5 = makePage5(); + page5 = makePage5(w); uiTabAppend(mainTab, "Page 5", uiControl(page5)); page6 = makePage6(); diff --git a/test/page5.c b/test/page5.c index dd5446da..9bc1105a 100644 --- a/test/page5.c +++ b/test/page5.c @@ -1,11 +1,13 @@ // 22 may 2015 #include "test.h" +static uiWindow *parent; + static void openFile(uiButton *b, void *data) { char *fn; - fn = uiOpenFile(); + fn = uiOpenFile(parent); if (fn == NULL) uiLabelSetText(uiLabel(data), "(cancelled)"); else { @@ -18,7 +20,7 @@ static void saveFile(uiButton *b, void *data) { char *fn; - fn = uiSaveFile(); + fn = uiSaveFile(parent); if (fn == NULL) uiLabelSetText(uiLabel(data), "(cancelled)"); else { @@ -35,7 +37,7 @@ static void msgBox(uiButton *b, void *data) t = uiEntryText(title); d = uiEntryText(description); - uiMsgBox(t, d); + uiMsgBox(parent, t, d); uiFreeText(d); uiFreeText(t); } @@ -46,18 +48,20 @@ static void msgBoxError(uiButton *b, void *data) t = uiEntryText(title); d = uiEntryText(description); - uiMsgBoxError(t, d); + uiMsgBoxError(parent, t, d); uiFreeText(d); uiFreeText(t); } -uiBox *makePage5(void) +uiBox *makePage5(uiWindow *pw) { uiBox *page5; uiBox *hbox; uiButton *button; uiLabel *label; + parent = pw; + page5 = newVerticalBox(); #define D(n, f) \ diff --git a/test/test.h b/test/test.h index 28d5b588..78bab9e3 100644 --- a/test/test.h +++ b/test/test.h @@ -45,7 +45,7 @@ extern uiBox *makePage3(void); extern uiBox *makePage4(void); // page5.c -extern uiBox *makePage5(void); +extern uiBox *makePage5(uiWindow *); // page6.c extern uiBox *makePage6(void); diff --git a/ui.h b/ui.h index 9e240fe4..33532dcf 100644 --- a/ui.h +++ b/ui.h @@ -245,10 +245,10 @@ _UI_EXTERN void uiMenuItemOnClicked(uiMenuItem *m, void (*f)(uiMenuItem *sender, _UI_EXTERN int uiMenuItemChecked(uiMenuItem *m); _UI_EXTERN void uiMenuItemSetChecked(uiMenuItem *m, int checked); -_UI_EXTERN char *uiOpenFile(void); -_UI_EXTERN char *uiSaveFile(void); -_UI_EXTERN void uiMsgBox(const char *title, const char *description); -_UI_EXTERN void uiMsgBoxError(const char *title, const char *description); +_UI_EXTERN char *uiOpenFile(uiWindow *parent); +_UI_EXTERN char *uiSaveFile(uiWindow *parent); +_UI_EXTERN void uiMsgBox(uiWindow *parent, const char *title, const char *description); +_UI_EXTERN void uiMsgBoxError(uiWindow *parent, const char *title, const char *description); typedef struct uiArea uiArea; typedef struct uiAreaHandler uiAreaHandler;