Ejemplo n.º 1
0
static char* gtkDialogGetClientOffsetAttrib(Ihandle *ih)
{
  char* str = iupStrGetMemory(20);
  /* remove the menu because it is placed inside the client area */
  sprintf(str, "0x%d", -gtkDialogGetMenuSize(ih));
  return str;
}
Ejemplo n.º 2
0
/* replace the common dialog SetChildrenPosition method because of 
   the menu that it is inside the dialog. */
static void gtkDialogSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  int menu_h = gtkDialogGetMenuSize(ih);
  (void)x;
  (void)y;

  /* Child coordinates are relative to client left-top corner. */
  iupBaseSetPosition(ih->firstchild, 0, menu_h);
}
Ejemplo n.º 3
0
static char* gtkDialogGetClientSizeAttrib(Ihandle *ih)
{
  int width, height;
  gtk_window_get_size((GtkWindow*)ih->handle, &width, &height);

  /* remove the menu because it is placed inside the client area */
  height -= gtkDialogGetMenuSize(ih);

  return iupStrReturnIntInt(width, height, 'x');
}
Ejemplo n.º 4
0
static char* gtkDialogGetClientSizeAttrib(Ihandle *ih)
{
  char* str = iupStrGetMemory(20);
 
  int width, height;
  gtk_window_get_size((GtkWindow*)ih->handle, &width, &height);
  height -= gtkDialogGetMenuSize(ih);

  sprintf(str, "%dx%d", width, height);
  return str;
}
Ejemplo n.º 5
0
static char* gtkDialogGetClientSizeAttrib(Ihandle *ih)
{
  char* str = iupStrGetMemory(20);
 
  int width, height;
  gtk_window_get_size((GtkWindow*)ih->handle, &width, &height);

  /* remove the menu because it is placed inside the client area */
  height -= gtkDialogGetMenuSize(ih);

  sprintf(str, "%dx%d", width, height);
  return str;
}
Ejemplo n.º 6
0
/* replace the common dialog SetPosition method because of 
   the menu that it is inside the dialog. */
static void gtkDialogSetPositionMethod(Ihandle* ih, int x, int y)
{
  /* x and y are always 0 for the dialog. */
  ih->x = x;
  ih->y = y;

  if (ih->firstchild)
  {
    int menu = gtkDialogGetMenuSize(ih);

    /* Child coordinates are relative to client left-top corner. */
    iupClassObjectSetPosition(ih->firstchild, 0, menu);
  }
}
Ejemplo n.º 7
0
/* replace the common dialog SetChildrenPosition method because of 
   the menu that it is inside the dialog. */
static void gtkDialogSetChildrenPositionMethod(Ihandle* ih, int x, int y)
{
  if (ih->firstchild)
  {
    char* offset = iupAttribGet(ih, "CHILDOFFSET");

    /* Native container, position is reset */
    x = 0;
    y = 0;

    if (offset) iupStrToIntInt(offset, &x, &y, 'x');

    y += gtkDialogGetMenuSize(ih);

    /* Child coordinates are relative to client left-top corner. */
    if (ih->firstchild)
      iupBaseSetPosition(ih->firstchild, x, y);
  }
}
Ejemplo n.º 8
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
}
Ejemplo n.º 9
0
static char* gtkDialogGetClientOffsetAttrib(Ihandle *ih)
{
  /* remove the menu because it is placed inside the client area */
  return iupStrReturnIntInt(0, -gtkDialogGetMenuSize(ih), 'x');
}
Ejemplo n.º 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 = (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
}