Beispiel #1
0
char* iupListGetPaddingAttrib(Ihandle* ih)
{
  if (ih->data->has_editbox)
    return iupStrReturnIntInt(ih->data->horiz_padding, ih->data->vert_padding, 'x');
  else
    return NULL;
}
Beispiel #2
0
static char* motTextGetSelectionAttrib(Ihandle* ih)
{
  XmTextPosition start = 0, end = 0;

  if (!XmTextGetSelectionPosition(ih->handle, &start, &end) || start==end)
    return NULL;

  if (ih->data->is_multiline)
  {
    int start_col, start_lin, end_col, end_lin;

    char *value = XmTextGetString(ih->handle);
    motTextGetLinColFromPosition(value, start, &start_lin, &start_col);
    motTextGetLinColFromPosition(value, end,   &end_lin,   &end_col);
    XtFree(value);

    return iupStrReturnStrf("%d,%d:%d,%d", start_lin, start_col, end_lin, end_col);
  }
  else
  {
    start++; /* IUP starts at 1 */
    end++;
    return iupStrReturnIntInt((int)start, (int)end, ':');
  }
}
Beispiel #3
0
static char* iBaseGetScreenPositionAttrib(Ihandle *ih)
{
  int x = 0, y = 0;
  iupdrvClientToScreen(ih, &x, &y);
  iupdrvAddScreenOffset(&x, &y, -1);
  return iupStrReturnIntInt(x, y, ',');
}
Beispiel #4
0
static char* iSboxGetClientSizeAttrib(Ihandle* ih)
{
  int width = ih->currentwidth - iSboxGetXborder(ih);
  int height = ih->currentheight - iSboxGetYborder(ih);
  if (width < 0) width = 0;
  if (height < 0) height = 0;
  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #5
0
static char* motTextGetSelectionPosAttrib(Ihandle* ih)
{
  XmTextPosition start = 0, end = 0;

  if (!XmTextGetSelectionPosition(ih->handle, &start, &end) || start==end)
    return NULL;

  return iupStrReturnIntInt((int)start, (int)end, ':');
}
Beispiel #6
0
static char* iSpinboxGetClientSizeAttrib(Ihandle* ih)
{
  int width = ih->currentwidth;
  int height = ih->currentheight;
  width -= ih->firstchild->currentwidth;
  if (width < 0) width = 0;
  if (height < 0) height = 0;
  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #7
0
char* iupLabelGetPaddingAttrib(Ihandle* ih)
{
  /* this method can be called before map */
  int type = iupLabelGetTypeBeforeMap(ih);
  if (type != IUP_LABEL_SEP_HORIZ && type != IUP_LABEL_SEP_VERT)
    return iupStrReturnIntInt(ih->data->horiz_padding, ih->data->vert_padding, 'x');
  else
    return NULL;
}
Beispiel #8
0
static char* iScintillaGetCaretAttrib(Ihandle* ih)
{
  int col, lin, pos;

  pos = iupScintillaSendMessage(ih, SCI_GETCURRENTPOS, 0, 0);
  iupScintillaConvertPosToLinCol(ih, pos, &lin, &col);

  return iupStrReturnIntInt(lin, col, ',');
}
static char* motCanvasGetDrawSizeAttrib(Ihandle *ih)
{
  Dimension width, height;
  XtVaGetValues(ih->handle, XmNwidth,  &width,
                            XmNheight, &height, 
                            NULL);

  return iupStrReturnIntInt((int)width, (int)height, 'x');
}
Beispiel #10
0
static char* iBoxGetClientSizeAttrib(Ihandle* ih)
{
  int width = ih->currentwidth;
  int height = ih->currentheight;
  width -= 2*ih->data->margin_horiz;
  height -= 2*ih->data->margin_vert;
  if (width < 0) width = 0;
  if (height < 0) height = 0;
  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #11
0
static char* iScintillaGetSelectionPosAttrib(Ihandle* ih)
{
  int start = iupScintillaSendMessage(ih, SCI_GETSELECTIONSTART, 0, 0);
  int end   = iupScintillaSendMessage(ih, SCI_GETSELECTIONEND, 0, 0);

  if (start == end)
    return NULL;

  return iupStrReturnIntInt(start, end, ':');
}
static char* iGLCanvasBoxGetClientOffsetAttrib(Ihandle* ih)
{
  int dx = 0, dy = 0;
  if (iupAttribGetBoolean(ih, "BORDER"))
  {
    dx = 1;
    dy = 1;
  }
  return iupStrReturnIntInt(dx, dy, 'x');
}
Beispiel #13
0
char* iupBaseGetCharSizeAttrib(Ihandle* ih)
{
  int charwidth, charheight;

  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  if (charwidth == 0 || charheight == 0)
    return NULL;

  return iupStrReturnIntInt(charwidth, charheight, 'x');
}
Beispiel #14
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');
}
Beispiel #15
0
static char* iGLExpanderGetClipMinAttrib(Ihandle* ih)
{
  int dx = 0, dy = 0;
  int bar_size = iGLExpanderGetBarSize(ih);

  if (ih->data->position == IEXPANDER_LEFT)
    dx += bar_size;
  else if (ih->data->position == IEXPANDER_TOP)
    dy += bar_size;

  return iupStrReturnIntInt(dx, dy, 'x');
}
Beispiel #16
0
static char* iTabsGetClientSizeAttrib(Ihandle* ih)
{
  int width, height, decorwidth, decorheight;
  width = ih->currentwidth;
  height = ih->currentheight;
  iTabsGetDecorSize(ih, &decorwidth, &decorheight);
  width -= decorwidth;
  height -= decorheight;
  if (width < 0) width = 0;
  if (height < 0) height = 0;
  return iupStrReturnIntInt(width, height,'x');
}
static char* iDetachBoxGetClientSizeAttrib(Ihandle* ih)
{
  int width = ih->currentwidth;
  int height = ih->currentheight;

  if (ih->data->orientation == IDBOX_VERT)
    width -= ih->data->barsize;
  else
    height -= ih->data->barsize;

  if (width < 0) width = 0;
  if (height < 0) height = 0;
  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #18
0
static char* iGLExpanderGetClientSizeAttrib(Ihandle* ih)
{
  int width = ih->currentwidth;
  int height = ih->currentheight;
  int bar_size = iGLExpanderGetBarSize(ih);

  if (ih->data->position == IEXPANDER_LEFT || ih->data->position == IEXPANDER_RIGHT)
    width -= bar_size;
  else
    height -= bar_size;

  if (width < 0) width = 0;
  if (height < 0) height = 0;
  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #19
0
static char* motListGetSelectionPosAttrib(Ihandle* ih)
{
  XmTextPosition start = 0, end = 0;
  Widget cbedit;
  if (!ih->data->has_editbox)
    return NULL;

  XtVaGetValues(ih->handle, XmNtextField, &cbedit, NULL);
  if (!XmTextFieldGetSelectionPosition(cbedit, &start, &end) || start==end)
    return NULL;

  /* end is inside the selection, in IUP is outside */
  end++;

  return iupStrReturnIntInt((int)start, (int)end, ':');
}
Beispiel #20
0
static char* motTextGetCaretAttrib(Ihandle* ih)
{
  XmTextPosition pos = XmTextGetInsertionPosition(ih->handle);

  if (ih->data->is_multiline)
  {
    int col, lin;

    char *value = XmTextGetString(ih->handle);
    motTextGetLinColFromPosition(value, pos, &lin, &col);
    XtFree(value);

    return iupStrReturnIntInt(lin, col, ',');
  }
  else
  {
    pos++; /* IUP starts at 1 */
    return iupStrReturnInt((int)pos);
  }
}
Beispiel #21
0
char* iupBaseGetRasterSizeAttrib(Ihandle* ih)
{
  int width, height;

  if (ih->handle)
  {
    width = ih->currentwidth;
    height = ih->currentheight;
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  if (!width && !height)
    return NULL;

  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #22
0
static char* iDialogGetRasterSizeAttrib(Ihandle* ih)
{
  int width, height;

  if (ih->handle)
  {
    /* ih->currentwidth and/or ih->currentheight could have been reset in SetRasterSize */
    iupdrvDialogGetSize(ih, NULL, &width, &height);
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  if (!width && !height)
    return NULL;

  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #23
0
char* iupBaseGetSizeAttrib(Ihandle* ih)
{
  int charwidth, charheight, width, height;

  if (ih->handle)
  {
    width = ih->currentwidth;
    height = ih->currentheight;
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  if (charwidth == 0 || charheight == 0)
    return NULL;  /* if font failed get from the hash table */

  return iupStrReturnIntInt(iupRASTER2WIDTH(width, charwidth), iupRASTER2HEIGHT(height, charheight), 'x');
}
Beispiel #24
0
static char* iDialogGetSizeAttrib(Ihandle* ih)
{
  int charwidth, charheight, width, height;

  if (ih->handle)
  {
    /* ih->currentwidth and/or ih->currentheight could have been reset in SetSize */
    iupdrvDialogGetSize(ih, NULL, &width, &height);
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  iupdrvFontGetCharSize(ih, &charwidth, &charheight);
  if (charwidth == 0 || charheight == 0)
    return NULL;  /* if font failed get from the hash table */

  return iupStrReturnIntInt(iupRASTER2WIDTH(width, charwidth), iupRASTER2HEIGHT(height, charheight), 'x');
}
Beispiel #25
0
static char* iGridBoxGetClientSizeAttrib(Ihandle* ih)
{
  int width, height;

  if (ih->handle)
  {
    width = ih->currentwidth;
    height = ih->currentheight;
  }
  else
  {
    width = ih->userwidth;
    height = ih->userheight;
  }

  if (!width && !height)
    return NULL;

  width -= 2*ih->data->margin_x;
  height -= 2*ih->data->margin_y;

  return iupStrReturnIntInt(width, height, 'x');
}
Beispiel #26
0
static char* iBaseGetPositionAttrib(Ihandle* ih)
{
  return iupStrReturnIntInt(ih->x, ih->y, ',');
}
Beispiel #27
0
static char* iBaseGetNaturalSizeAttrib(Ihandle* ih)
{
  return iupStrReturnIntInt(ih->naturalwidth, ih->naturalheight, 'x');
}
Beispiel #28
0
char* iupButtonGetPaddingAttrib(Ihandle* ih)
{
  return iupStrReturnIntInt(ih->data->horiz_padding, ih->data->vert_padding, 'x');
}
static char* iGLProgressBarGetPaddingAttrib(Ihandle* ih)
{
  iGLProgressBar* pb = (iGLProgressBar*)iupAttribGet(ih, "_IUP_GLPROGRESSBAR");
  return iupStrReturnIntInt(pb->horiz_padding, pb->vert_padding, 'x');
}
Beispiel #30
0
static char* gtkDialogGetClientOffsetAttrib(Ihandle *ih)
{
  /* remove the menu because it is placed inside the client area */
  return iupStrReturnIntInt(0, -gtkDialogGetMenuSize(ih), 'x');
}