Esempio n. 1
0
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;
}
Esempio n. 2
0
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;
}