Пример #1
0
void iupDialogHide(Ihandle* ih)
{
  /* hidden at the system and marked hidden in IUP */
  if (!iupdrvDialogIsVisible(ih) && ih->data->show_state == IUP_HIDE) 
    return;

  /* marked hidden in IUP */
  ih->data->show_state = IUP_HIDE;

  /* if called IupHide for a Popup window */
  if (iupAttribGetInt(ih, "MODAL"))
  {
    iDialogUnSetModal(ih);
    IupExitLoop();
  }

  /* actually hide the window */
  iupdrvDialogSetVisible(ih, 0);

  /* decrement visible count */
  iupDlgListVisibleDec();

  if (iupDlgListVisibleCount() <= 0)
  {
    /* if this is the last window visible, 
       exit message loop except when LOCKLOOP==YES */
    if (!iupStrBoolean(IupGetGlobal("LOCKLOOP")))
      IupExitLoop();
  }

  iDialogCallShowCb(ih);
}
Пример #2
0
void iupDialogHide(Ihandle* ih)
{
  /* hidden at the system and marked hidden in IUP */
  if (!iupdrvDialogIsVisible(ih) && ih->data->show_state == IUP_HIDE) 
    return;

  /* marked hidden in IUP */
  ih->data->show_state = IUP_HIDE;

  /* if called IupHide for a Popup window */
  if (iupAttribGetBoolean(ih, "MODAL"))
  {
    iDialogUnSetModal(ih);
    IupExitLoop();
  }

  ih->data->ignore_resize = 1;

  /* actually hide the window */
  iupdrvDialogSetVisible(ih, 0);

  ih->data->ignore_resize = 0;

  /* decrement visible count */
  iupDlgListVisibleDec();
    
  /* process flush and process show_cb */
  iDialogAfterHide(ih);

  iDialogListCheckLastVisible();
}
Пример #3
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;
}
Пример #4
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;
}