Started a change which will allow a parent of the standard dialogs to be specified.

This commit is contained in:
Pietro Gagliardi 2015-11-27 23:23:54 -05:00
parent 7646e8303d
commit 0bcd620a62
4 changed files with 15 additions and 11 deletions

View File

@ -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();

View File

@ -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) \

View File

@ -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);

8
ui.h
View File

@ -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;