示例#1
0
static int gtkDialogSetFullScreenAttrib(Ihandle* ih, const char* value)
{                       
  if (iupStrBoolean(value))
  {
    if (!iupAttribGet(ih, "_IUPGTK_FS_STYLE"))
    {
      /* save the previous decoration attributes */
      /* during fullscreen these attributes can be consulted by the application */
      iupAttribStoreStr(ih, "_IUPGTK_FS_MAXBOX", iupAttribGet(ih, "MAXBOX"));
      iupAttribStoreStr(ih, "_IUPGTK_FS_MINBOX", iupAttribGet(ih, "MINBOX"));
      iupAttribStoreStr(ih, "_IUPGTK_FS_MENUBOX",iupAttribGet(ih, "MENUBOX"));
      iupAttribStoreStr(ih, "_IUPGTK_FS_RESIZE", iupAttribGet(ih, "RESIZE"));
      iupAttribStoreStr(ih, "_IUPGTK_FS_BORDER", iupAttribGet(ih, "BORDER"));
      iupAttribStoreStr(ih, "_IUPGTK_FS_TITLE",  IupGetAttribute(ih, "TITLE"));  /* must use IupGetAttribute to check from the native implementation */

      /* remove the decorations attributes */
      iupAttribSetStr(ih, "MAXBOX", "NO");
      iupAttribSetStr(ih, "MINBOX", "NO");
      iupAttribSetStr(ih, "MENUBOX", "NO");
      IupSetAttribute(ih, "TITLE", NULL); iupAttribSetStr(ih, "TITLE", NULL); /* remove from the hash table if we are during IupMap */
      iupAttribSetStr(ih, "RESIZE", "NO");
      iupAttribSetStr(ih, "BORDER", "NO");

      if (iupdrvIsVisible(ih))
        gtk_window_fullscreen((GtkWindow*)ih->handle);

      iupAttribSetStr(ih, "_IUPGTK_FS_STYLE", "YES");
    }
  }
  else
  {
    char* fs_style = iupAttribGet(ih, "_IUPGTK_FS_STYLE");
    if (fs_style)
    {
      iupAttribSetStr(ih, "_IUPGTK_FS_STYLE", NULL);

      /* restore the decorations attributes */
      iupAttribStoreStr(ih, "MAXBOX", iupAttribGet(ih, "_IUPGTK_FS_MAXBOX"));
      iupAttribStoreStr(ih, "MINBOX", iupAttribGet(ih, "_IUPGTK_FS_MINBOX"));
      iupAttribStoreStr(ih, "MENUBOX",iupAttribGet(ih, "_IUPGTK_FS_MENUBOX"));
      IupSetAttribute(ih, "TITLE",  iupAttribGet(ih, "_IUPGTK_FS_TITLE"));   /* must use IupSetAttribute to update the native implementation */
      iupAttribStoreStr(ih, "RESIZE", iupAttribGet(ih, "_IUPGTK_FS_RESIZE"));
      iupAttribStoreStr(ih, "BORDER", iupAttribGet(ih, "_IUPGTK_FS_BORDER"));

      if (iupdrvIsVisible(ih))
        gtk_window_unfullscreen((GtkWindow*)ih->handle);

      /* remove auxiliar attributes */
      iupAttribSetStr(ih, "_IUPGTK_FS_MAXBOX", NULL);
      iupAttribSetStr(ih, "_IUPGTK_FS_MINBOX", NULL);
      iupAttribSetStr(ih, "_IUPGTK_FS_MENUBOX",NULL);
      iupAttribSetStr(ih, "_IUPGTK_FS_RESIZE", NULL);
      iupAttribSetStr(ih, "_IUPGTK_FS_BORDER", NULL);
      iupAttribSetStr(ih, "_IUPGTK_FS_TITLE",  NULL);
    }
  }
  return 1;
}
示例#2
0
char* iupBaseGetVisibleAttrib(Ihandle* ih)
{
  if (iupdrvIsVisible(ih))
    return "YES";
  else
    return "NO";
}
示例#3
0
int iupdrvBaseSetZorderAttrib(Ihandle* ih, const char* value)
{
  if (iupdrvIsVisible(ih))
  {
    if (iupStrEqualNoCase(value, "TOP"))
      XRaiseWindow(iupmot_display, XtWindow(ih->handle));
    else
      XLowerWindow(iupmot_display, XtWindow(ih->handle));
  }

  return 0;
}
示例#4
0
int iupdrvBaseSetZorderAttrib(Ihandle* ih, const char* value)
{
  if (iupdrvIsVisible(ih))
  {
    Widget widget = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");
    if (iupStrEqualNoCase(value, "TOP"))
      XRaiseWindow(iupmot_display, XtWindow(widget));
    else
      XLowerWindow(iupmot_display, XtWindow(widget));
  }

  return 0;
}
示例#5
0
int iupdrvBaseSetZorderAttrib(Ihandle* ih, const char* value)
{
  if (iupdrvIsVisible(ih))
  {
    GdkWindow* window = ih->handle->window;
    if (iupStrEqualNoCase(value, "TOP"))
      gdk_window_raise(window);
    else
      gdk_window_lower(window);
  }

  return 0;
}
示例#6
0
static void gtkCanvasLayoutUpdateMethod(Ihandle *ih)
{
  iupdrvBaseLayoutUpdateMethod(ih);

  /* Force GdkWindow size update when not visible,
     so when mapped before show GDK returns the correct value. */
  if (!iupdrvIsVisible(ih))
  {
    GdkWindow* window = iupgtkGetWindow(ih->handle);
    gdk_window_resize(window, ih->currentwidth, ih->currentheight);
  }

  gtkCanvasUpdateChildLayout(ih);
}
示例#7
0
void iupdrvDialogSetVisible(Ihandle* ih, int visible)
{
  if (visible)
  {
    XtMapWidget(ih->handle);
    XRaiseWindow(iupmot_display, XtWindow(ih->handle));
    while (!iupdrvDialogIsVisible(ih)); /* waits until window get mapped */
  }
  else
  {
    /* if iupdrvIsVisible reports hidden, then it should be minimized */ 
    if (!iupdrvIsVisible(ih))  /* can NOT hide a minimized window, so map it first. */
    {
      XtMapWidget(ih->handle);
      XRaiseWindow(iupmot_display, XtWindow(ih->handle));
      while (!iupdrvDialogIsVisible(ih)); /* waits until window get mapped */
    }

    XtUnmapWidget(ih->handle);
    while (iupdrvDialogIsVisible(ih)); /* waits until window gets unmapped */
  }
}
示例#8
0
static void gtkCanvasLayoutUpdateMethod(Ihandle *ih)
{
  GdkWindow* window = iupgtkGetWindow(ih->handle);

  iupdrvBaseLayoutUpdateMethod(ih);

  /* Force GdkWindow size update when not visible,
     so when mapped before show the function gdk_drawable_get_size returns the correct value. */
  if (!iupdrvIsVisible(ih))
    gdk_window_resize(window, ih->currentwidth, ih->currentheight);

  if (iupAttribGetStr(ih, "_IUP_GTK_FIRST_RESIZE"))
  {
    /* GTK is nor calling gtkCanvasConfigureEvent on the first resize */
    IFnii cb = (IFnii)IupGetCallback(ih,"RESIZE_CB");
    iupAttribSetStr(ih, "_IUP_GTK_FIRST_RESIZE", NULL);
    if (cb)
    {
      int sb_w = 0, sb_h = 0;

      if (ih->data->sb)
      {
        int sb_size = iupdrvGetScrollbarSize();
        if (ih->data->sb & IUP_SB_HORIZ)
          sb_h += sb_size;  /* sb horizontal affects vertical size */
        if (ih->data->sb & IUP_SB_VERT)
          sb_w += sb_size;  /* sb vertical affects horizontal size */
      }

      if (iupAttribGetBoolean(ih, "BORDER"))
      {
        sb_w += 4;
        sb_h += 4;
      }

      cb(ih, ih->currentwidth-sb_w, ih->currentheight-sb_h);
    }
  }
}
示例#9
0
int iupdrvDialogIsVisible(Ihandle* ih)
{
  return iupdrvIsVisible(ih);
}
示例#10
0
void iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu)
{
#ifdef HILDON
  /* In Hildon, borders have fixed dimensions, but are drawn as part
     of the client area! */
  if (border)
    *border = (iupAttribGetBoolean(ih, "HILDONWINDOW") && !iupAttribGetBoolean(ih, "FULLSCREEN")) ? 12 : 0;
  if (caption)
    *caption = 0;
  if (menu)
    *menu = 0;
#else
  static int native_border = 0;
  static int native_caption = 0;

  int has_titlebar = iupAttribGetBoolean(ih, "RESIZE")  || /* GTK and Motif only */
                     iupAttribGetBoolean(ih, "MAXBOX")  ||
                     iupAttribGetBoolean(ih, "MINBOX")  ||
                     iupAttribGetBoolean(ih, "MENUBOX") || 
                     IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */

  int has_border = has_titlebar ||
                   iupAttribGetBoolean(ih, "RESIZE") ||
                   iupAttribGetBoolean(ih, "BORDER");

  *menu = gtkDialogGetMenuSize(ih);

  if (ih->handle && iupdrvIsVisible(ih))
  {
    int win_border, win_caption;
    gtkDialogGetWindowDecor(ih, &win_border, &win_caption);

#ifdef WIN32
    if (*menu)
      win_caption -= *menu;
#endif

    *border = 0;
    if (has_border)
      *border = win_border;

    *caption = 0;
    if (has_titlebar)
      *caption = win_caption;

    if (!native_border && *border)
      native_border = win_border;

    if (!native_caption && *caption)
      native_caption = win_caption;
  }

  /* I could not set the size of the window including the decorations when the dialog is hidden */
  /* So we have to estimate the size of borders and caption when the dialog is hidden           */

  *border = 0;
  if (has_border)
  {
    if (native_border)
      *border = native_border;
    else
      *border = 5;
  }

  *caption = 0;
  if (has_titlebar)
  {
    if (native_caption)
      *caption = native_caption;
    else
      *caption = 20;
  }
#endif
}
示例#11
0
char* iupBaseGetVisibleAttrib(Ihandle* ih)
{
  return iupStrReturnBoolean (iupdrvIsVisible(ih)); 
}
示例#12
0
int iupdrvDialogIsVisible(Ihandle* ih)
{
  return iupdrvIsVisible(ih) || ih->data->show_state == IUP_MINIMIZE;
}
示例#13
0
void iupdrvDialogGetDecoration(Ihandle* ih, int *border, int *caption, int *menu)
{
#ifdef HILDON
  /* In Hildon, borders have fixed dimensions, but are drawn as part
     of the client area! */
  if (border)
    *border = (iupAttribGetInt(ih, "HILDONWINDOW") && !iupAttribGetInt(ih, "FULLSCREEN")) ? 12 : 0;
  if (caption)
    *caption = 0;
  if (menu)
    *menu = 0;
#else
  static int native_border = 0;
  static int native_caption = 0;

  int has_caption = iupAttribGetInt(ih, "MAXBOX")  ||
                    iupAttribGetInt(ih, "MINBOX")  ||
                    iupAttribGetInt(ih, "MENUBOX") || 
                    IupGetAttribute(ih, "TITLE"); /* must use IupGetAttribute to check from the native implementation */

  int has_border = has_caption ||
                   iupAttribGetInt(ih, "RESIZE") ||
                   iupAttribGetInt(ih, "BORDER");

  *menu = gtkDialogGetMenuSize(ih);

  if (ih->handle && iupdrvIsVisible(ih))
  {
    int win_border, win_caption;
    /* TODO: maybe we can use gdk_window_get_frame_extents to get a better decoration size 
    GdkRectangle rect;
    gdk_window_get_frame_extents(gtk_widget_get_window(ih->handle), &rect);  */

    if (iupdrvGetWindowDecor(iupgtkGetNativeWindowHandle(ih), &win_border, &win_caption))
    {
#ifdef WIN32
      if (*menu)
        win_caption -= *menu;
#endif

      *border = 0;
      if (has_border)
        *border = win_border;

      *caption = 0;
      if (has_caption)
        *caption = win_caption;

      if (!native_border && *border)
        native_border = win_border;

      if (!native_caption && *caption)
        native_caption = win_caption;
    }
  }

  /* I could not set the size of the window including the decorations when the dialog is hidden */
  /* So we have to estimate the size of borders and caption when the dialog is hidden           */

  *border = 0;
  if (has_border)
  {
    if (native_border)
      *border = native_border;
    else
      *border = 5;
  }

  *caption = 0;
  if (has_caption)
  {
    if (native_caption)
      *caption = native_caption;
    else
      *caption = 20;
  }
#endif
}