コード例 #1
0
ファイル: iupsci_markers.c プロジェクト: svn2github/iup-iup
int iupScintillaSetMarkerDefineAttrib(Ihandle* ih, const char* value)
{
  char strNumb[25];
  char strSymb[25];
  int markerNumber;

  iupStrToStrStr(value, strNumb, strSymb, '=');

  /* Setting marker numbers */
  if (iupStrEqualNoCase(strNumb, "FOLDEREND"))
    markerNumber = SC_MARKNUM_FOLDEREND;
  else if (iupStrEqualNoCase(strNumb, "FOLDEROPENMID"))
    markerNumber = SC_MARKNUM_FOLDEROPENMID;
  else if (iupStrEqualNoCase(strNumb, "FOLDERMIDTAIL"))
    markerNumber = SC_MARKNUM_FOLDERMIDTAIL;
  else if (iupStrEqualNoCase(strNumb, "FOLDERTAIL"))
    markerNumber = SC_MARKNUM_FOLDERTAIL;
  else if (iupStrEqualNoCase(strNumb, "FOLDERSUB"))
    markerNumber = SC_MARKNUM_FOLDERSUB;
  else if (iupStrEqualNoCase(strNumb, "FOLDER"))
    markerNumber = SC_MARKNUM_FOLDER;
  else if (iupStrEqualNoCase(strNumb, "FOLDEROPEN"))
    markerNumber = SC_MARKNUM_FOLDEROPEN;
  else
  {
    if (!iupStrToInt(strNumb, &markerNumber))
      return 0;

    if (markerNumber<0 || markerNumber>31)
      return 0;
  }

  iupScintillaSetMarkerSymbolAttribId(ih, markerNumber, strSymb);
  return 0;
}
コード例 #2
0
ファイル: iupgtk_toggle.c プロジェクト: svn2github/iup-iup
static int gtkToggleSetAlignmentAttrib(Ihandle* ih, const char* value)
{
  GtkButton* button = (GtkButton*)ih->handle;
  float xalign, yalign;
  char value1[30]="", value2[30]="";

  if (ih->data->type == IUP_TOGGLE_TEXT)
    return 0;

  iupStrToStrStr(value, value1, value2, ':');

  if (iupStrEqualNoCase(value1, "ARIGHT"))
    xalign = 1.0f;
  else if (iupStrEqualNoCase(value1, "ACENTER"))
    xalign = 0.5f;
  else /* "ALEFT" */
    xalign = 0;

  if (iupStrEqualNoCase(value2, "ABOTTOM"))
    yalign = 1.0f;
  else if (iupStrEqualNoCase(value2, "ATOP"))
    yalign = 0;
  else  /* ACENTER (default) */
    yalign = 0.5f;

  gtk_button_set_alignment(button, xalign, yalign);

  return 1;
}
コード例 #3
0
ファイル: iup_flatbutton.c プロジェクト: ivanceras/iup-mirror
static int iFlatButtonSetAlignmentAttrib(Ihandle* ih, const char* value)
{
  char value1[30], value2[30];

  iupStrToStrStr(value, value1, value2, ':');

  if (iupStrEqualNoCase(value1, "ARIGHT"))
    ih->data->horiz_alignment = IUP_ALIGN_ARIGHT;
  else if (iupStrEqualNoCase(value1, "ALEFT"))
    ih->data->horiz_alignment = IUP_ALIGN_ALEFT;
  else /* "ACENTER" */
    ih->data->horiz_alignment = IUP_ALIGN_ACENTER;

  if (iupStrEqualNoCase(value2, "ABOTTOM"))
    ih->data->vert_alignment = IUP_ALIGN_ABOTTOM;
  else if (iupStrEqualNoCase(value2, "ATOP"))
    ih->data->vert_alignment = IUP_ALIGN_ATOP;
  else /* "ACENTER" */
    ih->data->vert_alignment = IUP_ALIGN_ACENTER;

  if (ih->handle)
    iupdrvRedrawNow(ih);

  return 1;
}
コード例 #4
0
static int winLabelSetAlignmentAttrib(Ihandle* ih, const char* value)
{
  if (ih->data->type != IUP_LABEL_SEP_HORIZ && ih->data->type != IUP_LABEL_SEP_VERT)
  {
    char value1[30] = "", value2[30] = "";

    iupStrToStrStr(value, value1, value2, ':');

    if (iupStrEqualNoCase(value1, "ARIGHT"))
      ih->data->horiz_alignment = IUP_ALIGN_ARIGHT;
    else if (iupStrEqualNoCase(value1, "ACENTER"))
      ih->data->horiz_alignment = IUP_ALIGN_ACENTER;
    else /* "ALEFT" */
      ih->data->horiz_alignment = IUP_ALIGN_ALEFT;

    if (iupStrEqualNoCase(value2, "ABOTTOM"))
      ih->data->vert_alignment = IUP_ALIGN_ABOTTOM;
    else if (iupStrEqualNoCase(value2, "ACENTER"))
      ih->data->vert_alignment = IUP_ALIGN_ACENTER;
    else /* "ATOP" */
      ih->data->vert_alignment = IUP_ALIGN_ATOP;

    iupdrvRedrawNow(ih);
  }
  return 0;
}
コード例 #5
0
ファイル: iupsci_lexer.c プロジェクト: svn2github/iup-iup
int iupScintillaSetPropertyAttrib(Ihandle* ih, const char* value)
{
  char strKey[50];
  char strVal[50];

  iupStrToStrStr(value, strKey, strVal, '=');

  iupScintillaSendMessage(ih, SCI_SETPROPERTY, (uptr_t)strKey, (sptr_t)strVal);

  return 0;
}
コード例 #6
0
ファイル: iupgtk_button.c プロジェクト: svn2github/iup-iup
static int gtkButtonSetAlignmentAttrib(Ihandle* ih, const char* value)
{
  GtkButton* button = (GtkButton*)ih->handle;
  PangoAlignment alignment;
  float xalign, yalign;
  char value1[30]="", value2[30]="";

  if (iupAttribGet(ih, "_IUPGTK_EVENTBOX"))
    return 0;

  iupStrToStrStr(value, value1, value2, ':');

  if (iupStrEqualNoCase(value1, "ARIGHT"))
  {
    xalign = 1.0f;
    alignment = PANGO_ALIGN_RIGHT;
  }
  else if (iupStrEqualNoCase(value1, "ACENTER"))
  {
    xalign = 0.5f;
    alignment = PANGO_ALIGN_CENTER;
  }
  else /* "ALEFT" */
  {
    xalign = 0;
    alignment = PANGO_ALIGN_LEFT;
  }

  if (iupStrEqualNoCase(value2, "ABOTTOM"))
    yalign = 1.0f;
  else if (iupStrEqualNoCase(value2, "ATOP"))
    yalign = 0;
  else  /* ACENTER (default) */
    yalign = 0.5f;

  gtk_button_set_alignment(button, xalign, yalign);

  if (ih->data->type == IUP_BUTTON_TEXT)   /* text only */
  {
    GtkLabel* label = gtkButtonGetLabel(ih);
    if (label)
    {
      PangoLayout* layout = gtk_label_get_layout(label);
      if (layout) 
        pango_layout_set_alignment(layout, alignment);
    }
  }

  return 1;
}
コード例 #7
0
ファイル: iupmot_button.c プロジェクト: svn2github/iup-github
static int motButtonSetAlignmentAttrib(Ihandle* ih, const char* value)
{
  unsigned char align;
  char value1[30], value2[30];

  iupStrToStrStr(value, value1, value2, ':');   /* value2 is ignored, NOT supported in Motif */

  if (iupStrEqualNoCase(value1, "ARIGHT"))
    align = XmALIGNMENT_END;
  else if (iupStrEqualNoCase(value1, "ALEFT"))
    align = XmALIGNMENT_BEGINNING;
  else /* "ACENTER" (default) */
    align = XmALIGNMENT_CENTER;

  XtVaSetValues (ih->handle, XmNalignment, align, NULL);
  return 1;
}
コード例 #8
0
ファイル: iupmot_toggle.c プロジェクト: svn2github/iup-iup
static int motToggleSetAlignmentAttrib(Ihandle* ih, const char* value)
{
  unsigned char align;
  char value1[30]="", value2[30]="";

  if (ih->data->type == IUP_TOGGLE_TEXT)
    return 0;

  iupStrToStrStr(value, value1, value2, ':');   /* value2 is ignored, NOT supported in Motif */

  if (iupStrEqualNoCase(value1, "ARIGHT"))
    align = XmALIGNMENT_END;
  else if (iupStrEqualNoCase(value1, "ACENTER"))
    align = XmALIGNMENT_CENTER;
  else /* "ALEFT" */
    align = XmALIGNMENT_BEGINNING;

  XtVaSetValues (ih->handle, XmNalignment, align, NULL);
  return 1;
}
コード例 #9
0
static void winToggleGetAlignment(Ihandle* ih, int *horiz_alignment, int *vert_alignment)
{
    char value1[30], value2[30];

    iupStrToStrStr(iupAttribGetStr(ih, "ALIGNMENT"), value1, value2, ':');

    if (iupStrEqualNoCase(value1, "ARIGHT"))
        *horiz_alignment = IUP_ALIGN_ARIGHT;
    else if (iupStrEqualNoCase(value1, "ALEFT"))
        *horiz_alignment = IUP_ALIGN_ALEFT;
    else /* "ACENTER" */
        *horiz_alignment = IUP_ALIGN_ACENTER;

    if (iupStrEqualNoCase(value2, "ABOTTOM"))
        *vert_alignment = IUP_ALIGN_ABOTTOM;
    else if (iupStrEqualNoCase(value2, "ATOP"))
        *vert_alignment = IUP_ALIGN_ATOP;
    else /* "ACENTER" */
        *vert_alignment = IUP_ALIGN_ACENTER;
}
コード例 #10
0
static Atom* motCreateTargetList(const char *value, int *count)
{
  int count_alloc = 10;
  Atom *targetlist = (Atom*)XtMalloc(sizeof(Atom) * count_alloc);
  char valueCopy[256];
  char valueTemp1[256];
  char valueTemp2[256];

  *count = 0;

  strcpy(valueCopy, value);
  while (iupStrToStrStr(valueCopy, valueTemp1, valueTemp2, ',') > 0)
  {
    targetlist[*count] = XInternAtom(iupmot_display, (char*)valueTemp1, False);
    (*count)++;

    if (iupStrEqualNoCase(valueTemp2, valueTemp1))
      break;

    if (*count == count_alloc)
    {
      count_alloc += 10;
      targetlist = (Atom*)XtRealloc((char*)targetlist, sizeof(Atom) * count_alloc);
    }

    strcpy(valueCopy, valueTemp2);
  }

  if (*count == 0)
  {
    XtFree((char*)targetlist);
    return NULL;
  }

  return targetlist;
}
コード例 #11
0
ファイル: iupgtk_dragdrop.c プロジェクト: LuaDist/iup
static GtkTargetList* gtkCreateTargetList(const char* value)
{
  GtkTargetList* targetlist = gtk_target_list_new((GtkTargetEntry*)NULL, 0);
  char valueCopy[256];
  char valueTemp[256];
  int info = 0;

  sprintf(valueCopy, "%s", value);
  while(iupStrToStrStr(valueCopy, valueTemp, valueCopy, ',') > 0)
  {
    gtk_target_list_add(targetlist, gdk_atom_intern(valueTemp, 0), 0, info++);

    if(iupStrEqualNoCase(valueCopy, valueTemp))
      break;
  }

  if (targetlist->ref_count == 0)
  {
    gtk_target_list_unref(targetlist);
    return NULL;
  }

  return targetlist;
}
コード例 #12
0
ファイル: iupmat_draw.c プロジェクト: ivanceras/iup-mirror
static void iMatrixGetCellAlign(Ihandle* ih, int lin, int col, int *col_alignment, int *lin_alignment)
{
  char* align = iupAttribGetId2(ih, "ALIGN", lin, col);
  if (align)
  {
    char col_align[30], lin_align[30];
    if (iupStrToStrStr(align, lin_align, col_align, ':'))
    {
      if (iupStrEqualNoCase(col_align, "ARIGHT"))
        *col_alignment = IMAT_ALIGN_END;
      else if (iupStrEqualNoCase(col_align, "ACENTER"))
        *col_alignment = IMAT_ALIGN_CENTER;
      else if (iupStrEqualNoCase(col_align, "ALEFT"))
        *col_alignment = IMAT_ALIGN_START;

      if (iupStrEqualNoCase(col_align, "ABOTTOM"))
        *lin_alignment = IMAT_ALIGN_END;
      else if (iupStrEqualNoCase(col_align, "ACENTER"))
        *lin_alignment = IMAT_ALIGN_CENTER;
      else if (iupStrEqualNoCase(col_align, "ATOP"))
        *lin_alignment = IMAT_ALIGN_START;
    }
  }
}
コード例 #13
0
ファイル: iup_matrixlist.c プロジェクト: Vulcanior/IUP
static int iMatrixListSetColumnOrderAttrib(Ihandle *ih, const char* value)
{
  ImatrixListData* mtxList = (ImatrixListData*)iupAttribGet(ih, "_IUPMTXLIST_DATA");
  char value1[30], value2[30], value3[30];
  int ret;

  /* valid only before map */
  if (ih->handle)
    return 0;

  ret = iupStrToStrStr(value, value1, value2, ':');
  if (ret == 0)
    return 0;

  if (iupStrEqualNoCase(value1, "IMAGE"))
  {
    mtxList->image_col = 1;
    mtxList->label_col = 0;
    mtxList->color_col = 0;
  }
  else if (iupStrEqualNoCase(value1, "COLOR"))
  {
    mtxList->color_col = 1;
    mtxList->label_col = 0;
    mtxList->image_col = 0;
  }
  else if (iupStrEqualNoCase(value1, "LABEL"))
  {
    mtxList->label_col = 1;
    mtxList->color_col = 0;
    mtxList->image_col = 0;
  }
  else
    return 0; /* must have a first column */

  if (ret==1)
  {
    if (!ih->handle)
      iMatrixListInitSize(ih, mtxList);
    return 0;
  }
  
  strcpy(value1, value2);
  ret = iupStrToStrStr(value1, value2, value3, ':');
  if (ret == 0)
    return 0;

  if (iupStrEqualNoCase(value2, "IMAGE"))
  {
    if (mtxList->image_col == 0)   /* don't allow repeated columns */
      mtxList->image_col = 2;
  }
  else if (iupStrEqualNoCase(value2, "COLOR"))
  {
    if (mtxList->color_col == 0)
      mtxList->color_col = 2;
  }
  else if (iupStrEqualNoCase(value2, "LABEL"))
  {
    if (mtxList->label_col == 0)
      mtxList->label_col = 2;
  }

  if (ret==1)
  {
    if (!ih->handle)
      iMatrixListInitSize(ih, mtxList);
    return 0;
  }

  if (mtxList->image_col != 2 &&
      mtxList->color_col != 2 &&
      mtxList->label_col != 2)
    return 0;  /* must have the second to allow the third */

  if (iupStrEqualNoCase(value3, "IMAGE"))
  {
    if (mtxList->image_col == 0)   /* don't allow repeated columns */
      mtxList->image_col = 3;
  }
  else if (iupStrEqualNoCase(value3, "COLOR"))
  {
    if (mtxList->color_col == 0)
      mtxList->color_col = 3;
  }
  else if (iupStrEqualNoCase(value3, "LABEL"))
  {
    if (mtxList->label_col == 0)
      mtxList->label_col = 3;
  }

  if (!ih->handle)
    iMatrixListInitSize(ih, mtxList);
  return 0;
}