Beispiel #1
0
int iupBaseSetActiveAttrib(Ihandle* ih, const char* value)
{
  if (iupStrBoolean(value))
  {
    if (iBaseNativeParentIsActive(ih))
      iupdrvSetActive(ih, 1);
  }
  else
    iupdrvSetActive(ih, 0);
  return 0;
}
Beispiel #2
0
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;
}
Beispiel #3
0
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;
}
Beispiel #4
0
static void iDialogSetModal(Ihandle* ih_popup)
{
  Ihandle *ih;
  iupAttribSetStr(ih_popup, "MODAL", "YES");

  /* disable all visible dialogs, and mark popup level */
  for (ih = iupDlgListFirst(); ih; ih = iupDlgListNext())
  {
    if (ih != ih_popup && 
        ih->handle &&
        iupdrvDialogIsVisible(ih) && 
        ih->data->popup_level == 0)
    {
      iupdrvSetActive(ih, 0);
      ih->data->popup_level = dlg_popup_level;
    }
  }

  dlg_popup_level++;
}
Beispiel #5
0
void iupDialogLeaveModal(int popup_level)
{
  Ihandle *ih;

  assert(popup_level == dlg_popup_level);

  /* must enable all visible dialogs at the marked popup level */
  for (ih = iupDlgListFirst(); ih; ih = iupDlgListNext())
  {
    if (ih->handle)
    {
      if (ih->data->popup_level == dlg_popup_level - 1)
      {
        iupdrvSetActive(ih, 1);
        ih->data->popup_level = 0;
      }
    }
  }

  dlg_popup_level--;
}
Beispiel #6
0
void iupDialogEnterModal(Ihandle* ih_popup, int popup_level)
{
  Ihandle *ih;

  assert(popup_level == dlg_popup_level);

  /* disable all visible dialogs, and mark popup level */
  for (ih = iupDlgListFirst(); ih; ih = iupDlgListNext())
  {
    if (ih != ih_popup &&
      ih->handle &&
      iupdrvDialogIsVisible(ih) &&
      ih->data->popup_level == 0)
    {
      iupdrvSetActive(ih, 0);
      ih->data->popup_level = dlg_popup_level;
    }
  }

  dlg_popup_level++;
}
Beispiel #7
0
static void iDialogUnSetModal(Ihandle* ih_popup)
{
  Ihandle *ih;
  if (!iupAttribGetInt(ih_popup, "MODAL"))
    return;

  iupAttribSetStr(ih_popup, "MODAL", NULL);

  /* must enable all visible dialogs at the marked popup level */
  for (ih = iupDlgListFirst(); ih; ih = iupDlgListNext())
  {
    if (ih->handle)
    {
      if (ih->data->popup_level == dlg_popup_level-1)
      {
        iupdrvSetActive(ih, 1);
        ih->data->popup_level = 0;
      }
    }
  }

  dlg_popup_level--;
}
Beispiel #8
0
static int iDialogSetNActiveAttrib(Ihandle* ih, const char* value)
{
  iupdrvSetActive(ih, iupStrBoolean(value));
  return 0;
}