void iupDialogUpdatePosition(Ihandle* ih) { int x = iupAttribGetInt(ih, "_IUPDLG_X"); int y = iupAttribGetInt(ih, "_IUPDLG_Y"); iupdrvDialogUpdateSize(ih); iupDialogAdjustPos(ih, &x, &y); iupdrvDialogSetPosition(ih, x, y); }
int iupDialogShowXY(Ihandle* ih, int x, int y) { int was_visible; /* Calling IupShow for a visible dialog shown with IupPopup does nothing. */ if (iupAttribGetBoolean(ih, "MODAL")) /* already a popup */ return IUP_NOERROR; if (ih->data->popup_level != 0) { /* was disabled by a Popup, re-enable it */ iupdrvSetActive(ih, 1); ih->data->popup_level = 0; /* Now it is at the current popup level */ } /* save visible state before iupdrvDialogSetPlacement */ /* because it can also show the window when changing placement. */ was_visible = iupdrvDialogIsVisible(ih); /* Update the position and placement */ if (!iupdrvDialogSetPlacement(ih)) { iDialogAdjustPos(ih, &x, &y); iupdrvDialogSetPosition(ih, x, y); } if (was_visible) /* already visible */ { /* only re-show to raise the window */ iupdrvDialogSetVisible(ih, 1); /* flush, then process show_cb and startfocus */ iDialogAfterShow(ih); return IUP_NOERROR; } ih->data->first_show = 1; /* actually show the window */ /* test if placement turn the dialog visible */ if (!iupdrvDialogIsVisible(ih)) iupdrvDialogSetVisible(ih, 1); /* increment visible count */ iupDlgListVisibleInc(); /* flush, then process show_cb and startfocus */ iDialogAfterShow(ih); return IUP_NOERROR; }
void iupDialogUpdatePosition(Ihandle* ih) { /* This funtion is used only by pre-defined popup native dialogs */ int x = iupAttribGetInt(ih, "_IUPDLG_X"); int y = iupAttribGetInt(ih, "_IUPDLG_Y"); iupdrvDialogGetSize(ih, NULL, &(ih->currentwidth), &(ih->currentheight)); /* handle always as visible for the first time */ ih->data->first_show = 0; iDialogAdjustPos(ih, &x, &y); iupdrvDialogSetPosition(ih, x, y); }
int iupDialogPopup(Ihandle* ih, int x, int y) { int ret = iupClassObjectDlgPopup(ih, x, y); if (ret != IUP_INVALID) /* IUP_INVALID means it is not implemented */ return ret; ih->data->show_state = IUP_SHOW; /* Update only the position */ iupDialogAdjustPos(ih, &x, &y); iupdrvDialogSetPosition(ih, x, y); if (iupdrvDialogIsVisible(ih)) /* already visible */ { /* only re-show to raise the window */ iupdrvDialogSetVisible(ih, 1); iDialogCallShowCb(ih); return IUP_NOERROR; } if (iupAttribGetInt(ih, "MODAL")) /* already a popup */ return IUP_NOERROR; iDialogSetModal(ih); /* actually show the window */ iupdrvDialogSetVisible(ih, 1); /* increment visible count */ iupDlgListVisibleInc(); iDialogCallShowCb(ih); /* interrupt processing here */ IupMainLoop(); /* if window is still valid (IupDestroy not called), hide the dialog if still visible. */ if (iupObjectCheck(ih)) { iDialogUnSetModal(ih); IupHide(ih); } return IUP_NOERROR; }
int iupDialogShowXY(Ihandle* ih, int x, int y) { int was_visible; if (iupAttribGetInt(ih, "MODAL")) /* already a popup */ return IUP_NOERROR; if (ih->data->popup_level != 0) { /* was disabled by a Popup, re-enable it */ iupdrvSetActive(ih, 1); ih->data->popup_level = 0; /* Now it is at the current popup level */ } /* save visible state before iupdrvDialogSetPlacement */ /* because it can also show the window when changing placement. */ was_visible = iupdrvDialogIsVisible(ih); /* Update the position and placement */ if (!iupdrvDialogSetPlacement(ih, x, y)) { iupDialogAdjustPos(ih, &x, &y); iupdrvDialogSetPosition(ih, x, y); } if (was_visible) /* already visible */ { /* only re-show to raise the window */ iupdrvDialogSetVisible(ih, 1); iDialogCallShowCb(ih); return IUP_NOERROR; } /* actually show the window */ /* test if placement turn the dialog visible */ if (!iupdrvDialogIsVisible(ih)) iupdrvDialogSetVisible(ih, 1); /* increment visible count */ iupDlgListVisibleInc(); iDialogCallShowCb(ih); return IUP_NOERROR; }
int iupDialogPopup(Ihandle* ih, int x, int y) { int was_visible; int ret = iupClassObjectDlgPopup(ih, x, y); if (ret != IUP_INVALID) /* IUP_INVALID means it is not implemented */ return ret; ih->data->show_state = IUP_SHOW; /* save visible state before iupdrvDialogSetPlacement */ /* because it can also show the window when changing placement. */ was_visible = iupdrvDialogIsVisible(ih); /* Update the position and placement */ if (!iupdrvDialogSetPlacement(ih)) { iDialogAdjustPos(ih, &x, &y); iupdrvDialogSetPosition(ih, x, y); } if (was_visible) /* already visible */ { /* only re-show to raise the window */ iupdrvDialogSetVisible(ih, 1); /* flush, then process show_cb and startfocus */ iDialogAfterShow(ih); return IUP_NOERROR; } if (iupAttribGetBoolean(ih, "MODAL")) /* already a popup */ return IUP_NOERROR; iDialogSetModal(ih); ih->data->first_show = 1; /* actually show the window */ /* test if placement turn the dialog visible */ if (!iupdrvDialogIsVisible(ih)) iupdrvDialogSetVisible(ih, 1); /* increment visible count */ iupDlgListVisibleInc(); /* flush, then process show_cb and startfocus */ iDialogAfterShow(ih); /* interrupt processing here */ IupMainLoop(); /* if window is still valid (IupDestroy not called), hide the dialog if still visible. */ if (iupObjectCheck(ih)) { iDialogUnSetModal(ih); IupHide(ih); } return IUP_NOERROR; }