• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ IupGetCallback函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IupGetCallback函数的典型用法代码示例。如果您正苦于以下问题:C++ IupGetCallback函数的具体用法?C++ IupGetCallback怎么用?C++ IupGetCallback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IupGetCallback函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: iupMatrixMarkBlockSet

void iupMatrixMarkBlockSet(Ihandle* ih, int ctrl, int lin1, int col1)
{
  int mark = 1, mark_full_all, lin, col;
  IFniii markedit_cb = NULL;
  IFnii mark_cb = NULL;

  iupMatrixMarkBlockReset(ih);
  iupMatrixPrepareDrawData(ih);

  if (!ih->data->mark_multiple || ih->data->mark_continuous || !ctrl)
  {
    iupMatrixMarkClearAll(ih, 1);
    iupMatrixDraw(ih, 0);
  }
  else
    mark = -1; /* toggle mark state */

  ih->data->mark_full1 = 0;
  mark_full_all = 0;

  if (lin1 == 0 && col1 == 0)
  {
    if ((ih->data->mark_mode == IMAT_MARK_CELL && ih->data->mark_multiple) ||
        ih->data->mark_mode == IMAT_MARK_COL ||
        ih->data->mark_mode == IMAT_MARK_LIN)
      mark_full_all = 1;
  }
  /* If it was pointing for a column title... */
  else if (lin1 == 0)
  {
    if ((ih->data->mark_mode == IMAT_MARK_CELL && ih->data->mark_multiple) || 
         ih->data->mark_mode & IMAT_MARK_COL)
      ih->data->mark_full1 = IMAT_PROCESS_COL;
  }
  /* If it was pointing for a line title... */
  else if (col1 == 0)
  {
    if ((ih->data->mark_mode == IMAT_MARK_CELL && ih->data->mark_multiple) || 
         ih->data->mark_mode & IMAT_MARK_LIN)
      ih->data->mark_full1 = IMAT_PROCESS_LIN;
  }

  if (ih->data->mark_mode == IMAT_MARK_CELL && ih->data->callback_mode)
  {
    markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");
    mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");
  }

  if (mark_full_all)
  {
    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      for (col = 1; col < ih->data->columns.num; col++)
      {
        for(lin = 1; lin < ih->data->lines.num; lin++)
          iMatrixMarkCellSet(ih, lin, col, mark, markedit_cb, mark_cb);
      }
    }
    else if (ih->data->mark_mode == IMAT_MARK_LIN)
    {
      for(lin = 1; lin < ih->data->lines.num; lin++)
        iMatrixMarkLinSet(ih, lin, mark);

      iupMatrixDrawTitleLines(ih, 1, ih->data->lines.num-1);
    }
    else if (ih->data->mark_mode == IMAT_MARK_COL)
    {
      for (col = 1; col < ih->data->columns.num; col++)
        iMatrixMarkColSet(ih, col, mark);

      iupMatrixDrawTitleColumns(ih, 1, ih->data->columns.num-1);
    }

    iupMatrixDrawCells(ih, 1, 1, ih->data->lines.num-1, ih->data->columns.num-1);
  }
  else
    iMatrixMarkItem(ih, lin1, col1, mark, markedit_cb, mark_cb);

  ih->data->mark_lin1 = lin1;
  ih->data->mark_col1 = col1;
  ih->data->mark_block = 1;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:82,代码来源:iupmat_mark.c


示例2: winDialogBaseProc

static int winDialogBaseProc(Ihandle* ih, UINT msg, WPARAM wp, LPARAM lp, LRESULT *result)
{
    if (iupwinBaseContainerProc(ih, msg, wp, lp, result))
        return 1;

    iupwinMenuDialogProc(ih, msg, wp, lp);

    switch (msg)
    {
    case WM_GETMINMAXINFO:
    {
        if (winDialogCheckMinMaxInfo(ih, (MINMAXINFO*)lp))
        {
            *result = 0;
            return 1;
        }
        break;
    }
    case WM_MOVE:
    {
        IFnii cb = (IFnii)IupGetCallback(ih, "MOVE_CB");
        int x, y;
        /* ignore LPARAM because they are the clientpos */
        iupdrvDialogGetPosition(ih, NULL, &x, &y);
        if (cb) cb(ih, x, y);
        break;
    }
    case WM_SIZE:
    {
        if (ih->data->ignore_resize)
            break;

        switch(wp)
        {
        case SIZE_MINIMIZED:
        {
            if (ih->data->show_state != IUP_MINIMIZE)
            {
                IFni show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");
                ih->data->show_state = IUP_MINIMIZE;
                if (show_cb && show_cb(ih, IUP_MINIMIZE) == IUP_CLOSE)
                    IupExitLoop();
            }
            break;
        }
        case SIZE_MAXIMIZED:
        {
            if (ih->data->show_state != IUP_MAXIMIZE)
            {
                IFni show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");
                ih->data->show_state = IUP_MAXIMIZE;
                if (show_cb && show_cb(ih, IUP_MAXIMIZE) == IUP_CLOSE)
                    IupExitLoop();
            }

            winDialogResize(ih, LOWORD(lp), HIWORD(lp));

            if (iupAttribGetBoolean(ih, "MDICHILD"))
            {
                /* WORKAROUND: when a child MDI dialog is maximized,
                   its title is displayed inside the MDI client area.
                   So we force a MDI client size update */
                RECT rect;
                Ihandle* client = (Ihandle*)iupAttribGet(ih, "MDICLIENT_HANDLE");
                GetClientRect(client->handle, &rect);
                PostMessage(client->handle, WM_SIZE, (WPARAM)SIZE_RESTORED, MAKELPARAM(rect.right-rect.left, rect.bottom-rect.top));
            }
            break;
        }
        case SIZE_RESTORED:
        {
            if (ih->data->show_state == IUP_MAXIMIZE || ih->data->show_state == IUP_MINIMIZE)
            {
                IFni show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");
                ih->data->show_state = IUP_RESTORE;
                if (show_cb && show_cb(ih, IUP_RESTORE) == IUP_CLOSE)
                    IupExitLoop();
            }

            winDialogResize(ih, LOWORD(lp), HIWORD(lp));
            break;
        }
        }

        if (iupAttribGetBoolean(ih, "MDIFRAME"))
        {
            /* We are going to manually position the MDI client,
               so abort MDI frame processing. */
            *result = 0;
            return 1;
        }
        else
            break;
    }
    case WM_USER+IUPWIN_TRAY_NOTIFICATION:
    {
        int dclick  = 0;
        int button  = 0;
        int pressed = 0;

//.........这里部分代码省略.........
开发者ID:xubingyue,项目名称:iup,代码行数:101,代码来源:iupwin_dialog.c


示例3: iupMatrixDrawCells


//.........这里部分代码省略.........
    y1 -= ih->data->lines.first_offset;
  for(lin = first_lin; lin < lin1; lin++)
    y1 += ih->data->lines.dt[lin].size;

  /* Find the final position of the last column */
  x2 = x1;
  for( ; col <= col2; col++)
    x2 += ih->data->columns.dt[col].size;

  /* Find the final position of the last line */
  y2 = y1;
  for( ; lin <= lin2; lin++)
    y2 += ih->data->lines.dt[lin].size;

  if ((col2 == ih->data->columns.num-1) && (old_x2 > x2))
  {
    emptyarea_color = cdIupConvertColor(ih->data->bgcolor_parent);
    cdCanvasForeground(ih->data->cd_canvas, emptyarea_color);

    /* If it was drawn until the last column and remains space in the right of it,
       then delete this area with the the background color. */
    iupMATRIX_BOX(ih, x2, old_x2, old_y1, old_y2);
  }

  if ((lin2 == ih->data->lines.num-1) && (old_y2 > y2))
  {
    if (emptyarea_color == -1)
      emptyarea_color = cdIupConvertColor(ih->data->bgcolor_parent);
    cdCanvasForeground(ih->data->cd_canvas, emptyarea_color);

    /* If it was drawn until the last line visible and remains space below it,
       then delete this area with the the background color. */
    iupMATRIX_BOX(ih, 0, old_x2, y2, old_y2);
  }

  /* after the background */
  cdCanvasClip(ih->data->cd_canvas, CD_CLIPAREA);

  /***** Draw the cell values and frame */
  old_y1 = y1;
  framecolor = cdIupConvertColor(iupAttribGetStr(ih, "FRAMECOLOR"));
  active = iupdrvIsActive(ih);

  mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");
  dropcheck_cb = (IFnii)IupGetCallback(ih, "DROPCHECK_CB");
  draw_cb = (IFniiiiiiC)IupGetCallback(ih, "DRAW_CB");

  for(col = col1; col <= col2; col++)  /* For all the columns in the region */
  {
    if (ih->data->columns.dt[col].size == 0)
      continue;

    alignment = iMatrixDrawGetColAlignment(ih, col);

    x2 = x1 + ih->data->columns.dt[col].size;

    for(lin = lin1; lin <= lin2; lin++)     /* For all lines in the region */
    {
      int drop = 0;
      int marked = 0;

      if (ih->data->lines.dt[lin].size == 0)
        continue;

      y2 = y1 + ih->data->lines.dt[lin].size;

      /* If the cell is marked, then draw it with attenuation color */
      marked = iupMatrixMarkCellGet(ih, lin, col, mark_cb);

      iMatrixDrawBackground(ih, x1, x2, y1, y2, marked, active, lin, col);

      iMatrixDrawFrameRectCell(ih, lin, col, x1, x2, y1, y2, framecolor);

      if (dropcheck_cb)
      {
        int ret = dropcheck_cb(ih, lin, col);
        if (ret == IUP_DEFAULT)
        {
          drop = IMAT_DROPBOX_W+IMAT_PADDING_W/2;
          iMatrixDrawDropFeedback(ih, x2, y1, y2, active, framecolor);
        }
        else if (ret == IUP_CONTINUE)
        {
          drop = IMAT_TOGGLE_SIZE + IMAT_PADDING_W;
          iMatrixDrawToggle(ih, x2, y1, y2, lin, col, marked, active);
        }
      }
        
      /* draw the cell contents */
      iMatrixDrawCellValue(ih, x1, x2-drop, y1, y2, alignment, marked, active, lin, col, draw_cb, framecolor);

      y1 = y2;
    }

    x1 = x2;
    y1 = old_y1;  /* must reset also y */
  }

  cdCanvasClip(ih->data->cd_canvas, CD_CLIPOFF);
}
开发者ID:sanikoyes,项目名称:iup,代码行数:101,代码来源:iupmat_draw.c


示例4: motTextModifyVerifyCallback

static void motTextModifyVerifyCallback(Widget w, Ihandle *ih, XmTextVerifyPtr text)
{
  int start, end, key = 0;
  char *value, *new_value, *insert_value;
  KeySym motcode = 0;
  IFnis cb;

  if (iupAttribGet(ih, "_IUPMOT_DISABLE_TEXT_CB"))
    return;

  if (iupAttribGet(ih, "_IUPMOT_SPIN_DISABLE_TEXT_CB"))
  {
    if (iupAttribGet(ih, "_IUPMOT_SPIN_NOAUTO"))
      text->doit = False;

    iupAttribSetStr(ih, "_IUPMOT_SPIN_DISABLE_TEXT_CB", NULL);
    return;
  }

  cb = (IFnis)IupGetCallback(ih, "ACTION");
  if (!cb && !ih->data->mask)
    return;

  if (text->event && text->event->type == KeyPress)
  {
    unsigned int state = ((XKeyEvent*)text->event)->state;
    if (state & ControlMask ||  /* Ctrl */
        state & Mod1Mask || 
        state & Mod5Mask ||  /* Alt */
        state & Mod4Mask) /* Apple/Win */
      return;

    motcode = XKeycodeToKeysym(iupmot_display, ((XKeyEvent*)text->event)->keycode, 0);
  }

  value = XmTextGetString(ih->handle);
  start = text->startPos;
  end = text->endPos;
  insert_value = text->text->ptr;

  if (motcode == XK_Delete)
  {
    new_value = value;
    iupStrRemove(value, start, end, 1);
  }
  else if (motcode == XK_BackSpace)
  {
    new_value = value;
    iupStrRemove(value, start, end, -1);
  }
  else
  {
    if (!value)
      new_value = iupStrDup(insert_value);
    else if (insert_value)
      new_value = iupStrInsert(value, insert_value, start, end);
    else
      new_value = value;
  }

  if (insert_value && insert_value[0]!=0 && insert_value[1]==0)
    key = insert_value[0];

  if (ih->data->mask && iupMaskCheck(ih->data->mask, new_value)==0)
  {
    if (new_value != value) free(new_value);
    XtFree(value);
    text->doit = False;     /* abort processing */
    return;
  }

  if (cb)
  {
    int cb_ret = cb(ih, key, (char*)new_value);
    if (cb_ret==IUP_IGNORE)
      text->doit = False;     /* abort processing */
    else if (cb_ret==IUP_CLOSE)
    {
      IupExitLoop();
      text->doit = False;     /* abort processing */
    }
    else if (cb_ret!=0 && key!=0 && 
             cb_ret != IUP_DEFAULT && cb_ret != IUP_CONTINUE)  
    {
      insert_value[0] = (char)cb_ret;  /* replace key */
    }
  }

  if (text->doit)
  {
    /* Spin is not automatically updated when you directly edit the text */
    Widget spinbox = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");
    if (spinbox && XmIsSpinBox(spinbox) && !iupAttribGet(ih, "_IUPMOT_SPIN_NOAUTO"))
    {
      int pos;
      if (iupStrToInt(new_value, &pos))
      {
        XmTextPosition caret_pos = text->currInsert;
        iupAttribSetStr(ih, "_IUPMOT_DISABLE_TEXT_CB", "1");
        XtVaSetValues(ih->handle, XmNposition, pos, NULL);
//.........这里部分代码省略.........
开发者ID:gcfavorites,项目名称:tastools,代码行数:101,代码来源:iupmot_text.c


示例5: iupBaseCallValueChangedCb

void iupBaseCallValueChangedCb(Ihandle* ih)
{
  IFn vc_cb = (IFn)IupGetCallback(ih, "VALUECHANGED_CB");
  if (vc_cb)
    vc_cb(ih);
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:6,代码来源:iup_classbase.c


示例6: iupwinMenuDialogProc

void iupwinMenuDialogProc(Ihandle* ih_dialog, UINT msg, WPARAM wp, LPARAM lp)
{
  /* called only from winDialogBaseProc */

  switch (msg)
  {
  case WM_INITMENUPOPUP:
    {
      HMENU hMenu = (HMENU)wp;
      Ihandle *ih = iupwinMenuGetHandle(hMenu);
      if (ih)
      {
        Icallback cb = (Icallback)IupGetCallback(ih, "OPEN_CB");
        if (!cb && ih->parent) cb = (Icallback)IupGetCallback(ih->parent, "OPEN_CB");  /* check also in the Submenu */
        if (cb) cb(ih);
      }
      break;
    }
  case WM_UNINITMENUPOPUP:
    {
      HMENU hMenu = (HMENU)wp;
      Ihandle *ih = iupwinMenuGetHandle(hMenu);
      if (ih)
      {
        Icallback cb = (Icallback)IupGetCallback(ih, "MENUCLOSE_CB");
        if (!cb && ih->parent) cb = (Icallback)IupGetCallback(ih->parent, "MENUCLOSE_CB");  /* check also in the Submenu */
        if (cb) cb(ih);
      }
      break;
    }
  case WM_MENUSELECT:
    {
      HMENU hMenu = (HMENU)lp;
      Ihandle *ih;

      if (!lp)
        break;

      if ((HIWORD(wp) & MF_POPUP) || (HIWORD(wp) & MF_SYSMENU)) /* drop-down ih or submenu. */
      {
        UINT menuindex = LOWORD(wp);
        HMENU hsubmenu = GetSubMenu(hMenu, menuindex);
        ih = iupwinMenuGetHandle(hsubmenu);  /* returns the handle of a IupMenu */
        if (ih) ih = ih->parent;  /* gets the submenu */
      }
      else /* ih item */
      {
        UINT menuID = LOWORD(wp);
        ih = iupwinMenuGetItemHandle(hMenu, menuID);
      }

      if (ih)
      {
        Icallback cb = IupGetCallback(ih, "HIGHLIGHT_CB");
        if (cb) cb(ih);
      }
      break;
    }
  case WM_MENUCOMMAND:
    {
      int menuId = GetMenuItemID((HMENU)lp, (int)wp);
      Icallback cb;
      Ihandle* ih;
        
      if (menuId >= IUP_MDI_FIRSTCHILD)
        break;
        
      ih  = iupwinMenuGetItemHandle((HMENU)lp, menuId);
      if (!ih)
        break;

      winItemCheckToggle(ih);

      cb = IupGetCallback(ih, "ACTION");
      if (cb && cb(ih) == IUP_CLOSE)
        IupExitLoop();

      break;
    }
  case WM_ENTERMENULOOP:
    {
      /* Simulate WM_KILLFOCUS when the menu interaction is started */
      Ihandle* lastfocus = (Ihandle*)iupAttribGet(ih_dialog, "_IUPWIN_LASTFOCUS");
      if (lastfocus) iupCallKillFocusCb(lastfocus);
      break;
    }
  case WM_EXITMENULOOP:
    {
      /* Simulate WM_GETFOCUS when the menu interaction is stopped */
      Ihandle* lastfocus = (Ihandle*)iupAttribGet(ih_dialog, "_IUPWIN_LASTFOCUS");
      if (lastfocus) iupCallGetFocusCb(lastfocus);
      break;
    }
  }
}
开发者ID:Archs,项目名称:iup-aio,代码行数:95,代码来源:iupwin_menu.c


示例7: gtkMessageDlgPopup

static int gtkMessageDlgPopup(Ihandle* ih, int x, int y)
{
  InativeHandle* parent = iupDialogGetNativeParent(ih);
  GtkMessageType type = GTK_MESSAGE_INFO;
  GtkWidget* dialog;
  char *icon, *buttons, *title;
  int response, num_but = 2;

  iupAttribSetInt(ih, "_IUPDLG_X", x);
  iupAttribSetInt(ih, "_IUPDLG_Y", y);

  icon = iupAttribGetStr(ih, "DIALOGTYPE");
  if (iupStrEqualNoCase(icon, "ERROR"))
    type = GTK_MESSAGE_ERROR;
  else if (iupStrEqualNoCase(icon, "WARNING"))
    type = GTK_MESSAGE_WARNING;
  else if (iupStrEqualNoCase(icon, "INFORMATION"))
    type = GTK_MESSAGE_INFO;
  else if (iupStrEqualNoCase(icon, "QUESTION"))
    type = GTK_MESSAGE_QUESTION;

  dialog = gtk_message_dialog_new((GtkWindow*)parent,
                                  0,
                                  type,
                                  GTK_BUTTONS_NONE,
                                  iupgtkStrConvertToUTF8(iupAttribGetStr(ih, "VALUE")));
  if (!dialog)
    return IUP_ERROR;

  title = iupAttribGetStr(ih, "TITLE");
  if (title)
    gtk_window_set_title(GTK_WINDOW(dialog), iupgtkStrConvertToUTF8(title));

  buttons = iupAttribGetStr(ih, "BUTTONS");
  if (iupStrEqualNoCase(buttons, "OKCANCEL"))
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_OK,
                          IUP_RESPONSE_1);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_CANCEL,
                          IUP_RESPONSE_2);
  }
  else if (iupStrEqualNoCase(buttons, "YESNO"))
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_YES,
                          IUP_RESPONSE_1);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_NO,
                          IUP_RESPONSE_2);
  }
  else /* OK */
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          GTK_STOCK_OK,
                          IUP_RESPONSE_1);
    num_but = 1;
  }

  if (IupGetCallback(ih, "HELP_CB"))
    gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_HELP, IUP_RESPONSE_HELP);

  if (num_but == 2 && iupAttribGetInt(ih, "BUTTONDEFAULT") == 2)
    gtk_dialog_set_default_response(GTK_DIALOG(dialog), IUP_RESPONSE_2);
  else
    gtk_dialog_set_default_response(GTK_DIALOG(dialog), IUP_RESPONSE_1);
  
  /* initialize the widget */
  gtk_widget_realize(dialog);
  
  ih->handle = dialog;
  iupDialogUpdatePosition(ih);
  ih->handle = NULL;

  do 
  {
    response = gtk_dialog_run(GTK_DIALOG(dialog));

    if (response == IUP_RESPONSE_HELP)
    {
      Icallback cb = IupGetCallback(ih, "HELP_CB");
      if (cb && cb(ih) == IUP_CLOSE)
        response = (num_but == 2)? IUP_RESPONSE_2: IUP_RESPONSE_1;
    }
  } while (response == IUP_RESPONSE_HELP);

  if (response == IUP_RESPONSE_1)
    IupSetAttribute(ih, "BUTTONRESPONSE", "1");
  else
    IupSetAttribute(ih, "BUTTONRESPONSE", "2");

  gtk_widget_destroy(dialog);  

  return IUP_NOERROR;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:96,代码来源:iupgtk_messagedlg.c


示例8: gtkColorDlgPopup

static int gtkColorDlgPopup(Ihandle* ih, int x, int y)
{
  InativeHandle* parent = iupDialogGetNativeParent(ih);
  GtkColorSelectionDialog* dialog;
  GtkColorSelection* colorsel;
  GdkColor color;
  char *value;
  unsigned char r = 0, g = 0, b = 0, a = 255;
  int response, ret;

  iupAttribSetInt(ih, "_IUPDLG_X", x);   /* used in iupDialogUpdatePosition */
  iupAttribSetInt(ih, "_IUPDLG_Y", y);

  dialog = (GtkColorSelectionDialog*)gtk_color_selection_dialog_new(iupgtkStrConvertToUTF8(iupAttribGet(ih, "TITLE")));
  if (!dialog)
    return IUP_ERROR;

  if (parent)
    gtk_window_set_transient_for((GtkWindow*)dialog, (GtkWindow*)parent);

  ret = iupStrToRGBA(iupAttribGet(ih, "VALUE"), &r, &g, &b, &a);

  colorsel = (GtkColorSelection*)dialog->colorsel;
  iupgdkColorSet(&color, r, g, b);
  gtk_color_selection_set_current_color(colorsel, &color);

  value = iupAttribGetStr(ih, "ALPHA");
  if (value)
  {
    int alpha;
    if (iupStrToInt(value, &alpha))
    {
      if (alpha<0) alpha=0;
      if (alpha>255) alpha=255;
      gtk_color_selection_set_has_opacity_control(colorsel, TRUE);
      gtk_color_selection_set_current_alpha(colorsel, iupCOLOR8TO16(alpha));
    }
  }
  else if (iupAttribGetBoolean(ih, "SHOWALPHA") || ret == 4)
  {
    gtk_color_selection_set_has_opacity_control(colorsel, TRUE);
    gtk_color_selection_set_current_alpha(colorsel, iupCOLOR8TO16(a));
  }
  else
    gtk_color_selection_set_has_opacity_control(colorsel, FALSE);

  value = iupAttribGetStr(ih, "COLORTABLE");
  if (value)
  {
    gtk_color_selection_set_has_palette (colorsel, TRUE);
    gtkColorDlgSetPalette(colorsel, value);
  }
  else if (iupAttribGetBoolean(ih, "SHOWCOLORTABLE"))
    gtk_color_selection_set_has_palette (colorsel, TRUE);
  else
    gtk_color_selection_set_has_palette (colorsel, FALSE);

  if (IupGetCallback(ih, "HELP_CB"))
    gtk_widget_show(dialog->help_button);
  
  /* initialize the widget */
  gtk_widget_realize(GTK_WIDGET(dialog));
  
  ih->handle = GTK_WIDGET(dialog);
  iupDialogUpdatePosition(ih);
  ih->handle = NULL;

  do 
  {
    response = gtk_dialog_run(GTK_DIALOG(dialog));

    if (response == GTK_RESPONSE_HELP)
    {
      Icallback cb = IupGetCallback(ih, "HELP_CB");
      if (cb && cb(ih) == IUP_CLOSE)
        response = GTK_RESPONSE_CANCEL;
    }
  } while (response == GTK_RESPONSE_HELP);

  if (response == GTK_RESPONSE_OK)
  {
    GdkColor color;
    gtk_color_selection_get_current_color(colorsel, &color);
    IupSetAttribute(ih, "STATUS", "1");

    if (gtk_color_selection_get_has_opacity_control(colorsel))
    {
      int alpha = gtk_color_selection_get_current_alpha(colorsel);
      iupAttribSetInt(ih, "ALPHA", (int)iupCOLOR16TO8(alpha));
      iupAttribSetStrf(ih, "VALUE", "%d %d %d %d", (int)iupCOLOR16TO8(color.red), (int)iupCOLOR16TO8(color.green), (int)iupCOLOR16TO8(color.blue), (int)iupCOLOR16TO8(alpha));
    }
    else
      iupAttribSetStrf(ih, "VALUE", "%d %d %d", (int)iupCOLOR16TO8(color.red), (int)iupCOLOR16TO8(color.green), (int)iupCOLOR16TO8(color.blue));

    if (gtk_color_selection_get_has_palette(colorsel))
      gtkColorDlgGetPalette(ih, colorsel);
  }
  else
  {
    iupAttribSetStr(ih, "ALPHA", NULL);
//.........这里部分代码省略.........
开发者ID:Airr,项目名称:iup_mac,代码行数:101,代码来源:iupgtk_colordlg.c


示例9: gtkMessageDlgPopup

static int gtkMessageDlgPopup(Ihandle* ih, int x, int y)
{
  InativeHandle* parent = iupDialogGetNativeParent(ih);
  GtkMessageType type = GTK_MESSAGE_OTHER;
  GtkWidget* dialog;
  char *icon, *buttons, *title;
  const char *ok, *cancel, *yes, *no, *help, *retry = IupGetLanguageString("IUP_RETRY");
  int response, button_def;

  iupAttribSetInt(ih, "_IUPDLG_X", x);   /* used in iupDialogUpdatePosition */
  iupAttribSetInt(ih, "_IUPDLG_Y", y);

  icon = iupAttribGetStr(ih, "DIALOGTYPE");
  if (iupStrEqualNoCase(icon, "ERROR"))
    type = GTK_MESSAGE_ERROR;
  else if (iupStrEqualNoCase(icon, "WARNING"))
    type = GTK_MESSAGE_WARNING;
  else if (iupStrEqualNoCase(icon, "INFORMATION"))
    type = GTK_MESSAGE_INFO;
  else if (iupStrEqualNoCase(icon, "QUESTION"))
    type = GTK_MESSAGE_QUESTION;

  dialog = gtk_message_dialog_new((GtkWindow*)parent,
                                  0,
                                  type,
                                  GTK_BUTTONS_NONE,
                                  "%s",
                                  iupgtkStrConvertToSystem(iupAttribGet(ih, "VALUE")));
  if (!dialog)
    return IUP_ERROR;

  title = iupAttribGet(ih, "TITLE");
  if (title)
    gtk_window_set_title(GTK_WINDOW(dialog), iupgtkStrConvertToSystem(title));

#if GTK_CHECK_VERSION(3, 10, 0)
  ok = "_OK";
  cancel = "_Cancel";
  yes = "_Yes";
  no = "_No";
  help = "_Help";
#else
  ok = GTK_STOCK_OK;
  cancel = GTK_STOCK_CANCEL;
  yes = GTK_STOCK_YES;
  no = GTK_STOCK_NO;
  help = GTK_STOCK_HELP;
#endif

  buttons = iupAttribGetStr(ih, "BUTTONS");
  if (iupStrEqualNoCase(buttons, "OKCANCEL"))
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          ok,
                          IUP_RESPONSE_1);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          cancel,
                          IUP_RESPONSE_2);
  }
  if (iupStrEqualNoCase(buttons, "RETRYCANCEL"))
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          retry,
                          IUP_RESPONSE_1);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          cancel,
                          IUP_RESPONSE_2);
  }
  else if (iupStrEqualNoCase(buttons, "YESNO"))
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          yes,
                          IUP_RESPONSE_1);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          no,
                          IUP_RESPONSE_2);
  }
  else if (iupStrEqualNoCase(buttons, "YESNOCANCEL"))
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          yes,
                          IUP_RESPONSE_1);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          no,
                          IUP_RESPONSE_2);
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          cancel,
                          IUP_RESPONSE_3);
  }
  else /* OK */
  {
    gtk_dialog_add_button(GTK_DIALOG(dialog),
                          ok,
                          IUP_RESPONSE_1);
  }

  if (IupGetCallback(ih, "HELP_CB"))
    gtk_dialog_add_button(GTK_DIALOG(dialog), help, IUP_RESPONSE_HELP);

  button_def = iupAttribGetInt(ih, "BUTTONDEFAULT");
//.........这里部分代码省略.........
开发者ID:ivanceras,项目名称:iup-mirror,代码行数:101,代码来源:iupgtk_messagedlg.c


示例10: iupmotKeyPressEvent

void iupmotKeyPressEvent(Widget w, Ihandle *ih, XEvent *evt, Boolean *cont)
{
    int result;
    int code = motKeyDecode((XKeyEvent*)evt);
    if (code == 0)
        return;

    if ((((XKeyEvent*)evt)->state & Mod1Mask || ((XKeyEvent*)evt)->state & Mod5Mask))  /* Alt */
    {
        KeySym motcode = XKeycodeToKeysym(iupmot_display, ((XKeyEvent*)evt)->keycode, 0);
        if (motcode < 128)
        {
            IFni cb;
            Ihandle* dialog = IupGetDialog(ih);
            char attrib[22] = "_IUPMOT_MNEMONIC_ _CB";
            attrib[17] = (char)toupper(motcode);
            cb = (IFni)IupGetCallback(dialog, attrib);
            if (cb)
            {
                cb(dialog, attrib[17]);
                return;
            }
        }
    }

    result = iupKeyCallKeyCb(ih, code);
    if (result == IUP_CLOSE)
    {
        IupExitLoop();
        return;
    }
    if (result == IUP_IGNORE)
    {
        *cont = False;
        return;
    }

    /* in the previous callback the dialog could be destroyed */
    if (iupObjectCheck(ih))
    {
        /* this is called only for canvas */
        if (ih->iclass->nativetype==IUP_TYPECANVAS)
        {
            result = iupKeyCallKeyPressCb(ih, code, 1);
            if (result == IUP_CLOSE)
            {
                IupExitLoop();
                return;
            }
            if (result == IUP_IGNORE)
            {
                *cont = False;
                return;
            }
        }

        if (!iupKeyProcessNavigation(ih, code, ((XKeyEvent*)evt)->state & ShiftMask))
        {
            *cont = False;
            return;
        }
    }

    (void)w;
}
开发者ID:gcfavorites,项目名称:tastools,代码行数:65,代码来源:iupmot_key.c


示例11: gtkDialogMapMethod


//.........这里部分代码省略.........
  g_signal_connect(G_OBJECT(ih->handle), "focus-in-event",     G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "focus-out-event",    G_CALLBACK(iupgtkFocusInOutEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "enter-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "leave-notify-event", G_CALLBACK(iupgtkEnterLeaveEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "show-help",          G_CALLBACK(iupgtkShowHelp), ih);

  /* The iupgtkKeyPressEvent of the control with the focus will propagate the key up to the dialog. */
  /* Inside iupgtkKeyPressEvent we test this to avoid duplicate calls. */
  g_signal_connect(G_OBJECT(ih->handle), "key-press-event",    G_CALLBACK(iupgtkKeyPressEvent), ih);

  g_signal_connect(G_OBJECT(ih->handle), "configure-event",    G_CALLBACK(gtkDialogConfigureEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "window-state-event", G_CALLBACK(gtkDialogWindowStateEvent), ih);
  g_signal_connect(G_OBJECT(ih->handle), "delete-event",       G_CALLBACK(iupgtkDialogDeleteEvent), ih);
                                    
  gtk_window_set_default_size((GtkWindow*)ih->handle, 100, 100); /* set this to avoid size calculation problems  */

  if (iupStrBoolean(iupAttribGet(ih, "DIALOGHINT"))) 
    gtk_window_set_type_hint(GTK_WINDOW(ih->handle), GDK_WINDOW_TYPE_HINT_DIALOG);

  /* the container that will receive the child element. */
  fixed = gtk_fixed_new();
  gtk_container_add((GtkContainer*)ih->handle, fixed);
  gtk_widget_show(fixed);

  /* initialize the widget */
  gtk_widget_realize(ih->handle);

  if (iupAttribGetInt(ih, "DIALOGFRAME")) {
    iupAttribSetStr(ih, "RESIZE", "NO");
  }

  if (!iupAttribGetInt(ih, "RESIZE")) {
    iupAttribSetStr(ih, "MAXBOX", "NO");  /* Must also remove these, so RESIZE=NO can work */
    iupAttribSetStr(ih, "MINBOX", "NO");
  }

  if (IupGetAttribute(ih, "TITLE")) {  /* must use IupGetAttribute to check from the native implementation */
    functions   |= GDK_FUNC_MOVE;
    decorations |= GDK_DECOR_TITLE;
  }

  if (iupAttribGetInt(ih, "MENUBOX")) {
    functions   |= GDK_FUNC_CLOSE;
    decorations |= GDK_DECOR_MENU;
  }

  if (iupAttribGetInt(ih, "MINBOX")) {
    functions   |= GDK_FUNC_MINIMIZE;
    decorations |= GDK_DECOR_MINIMIZE;
  }

  if (iupAttribGetInt(ih, "MAXBOX")) {
    functions   |= GDK_FUNC_MAXIMIZE;
    decorations |= GDK_DECOR_MAXIMIZE;
  }

  if (iupAttribGetInt(ih, "RESIZE")) {
    functions   |= GDK_FUNC_RESIZE;
    decorations |= GDK_DECOR_RESIZEH;
  }

  if (iupAttribGetInt(ih, "BORDER"))
    decorations |= GDK_DECOR_BORDER;

  if (decorations == 0)
    gtk_window_set_decorated((GtkWindow*)ih->handle, FALSE);
  else
  {
    GdkWindow* window = ih->handle->window;
    if (window)
    {
      gdk_window_set_decorations(window, (GdkWMDecoration)decorations);
      gdk_window_set_functions(window, (GdkWMFunction)functions);
    }
  }

  /* configure for DRAG&DROP */
  if (IupGetCallback(ih, "DROPFILES_CB"))
    iupAttribSetStr(ih, "DRAGDROP", "YES");

  {
    /* Reset the DLGBGCOLOR global attribute 
       if it is the first time a dialog is created. 
       The value returned by gtk_style_new is not accurate. */
    GtkStyle* style = gtk_widget_get_style(ih->handle);
    if (style && IupGetGlobal("_IUP_RESET_DLGBGCOLOR"))
    {
      iupgtkUpdateGlobalColors(style);
      IupSetGlobal("_IUP_RESET_DLGBGCOLOR", NULL);
    }
  }

  /* configure the size range */
  gtkDialogSetMinMax(ih, 1, 1, 65535, 65535);  /* MINSIZE and MAXSIZE default values */

  /* Ignore VISIBLE before mapping */
  iupAttribSetStr(ih, "VISIBLE", NULL);

  return IUP_NOERROR;
}
开发者ID:svn2github,项目名称:iup-iup,代码行数:101,代码来源:iupgtk_dialog.c


示例12: iupMatrixSetMarkAttrib

int iupMatrixSetMarkAttrib(Ihandle* ih, int lin, int col, const char* value)
{
  if (ih->data->mark_mode == IMAT_MARK_NO)
    return 0;

  if (lin >= 0 && col >= 0)  /* both are specified */
  {
    if (!iupMatrixCheckCellPos(ih, lin, col))
      return 0;

    if (ih->data->mark_mode == IMAT_MARK_CELL)
    {
      int mark, ret = 0;

      if (lin == 0 || col == 0) /* title can NOT have a mark */
        return 0;

      mark = iupStrBoolean(value);

      if (ih->data->callback_mode)
      {
        IFniii markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");
        if (markedit_cb && !ih->data->inside_markedit_cb)
        {
          ih->data->inside_markedit_cb = 1;
          markedit_cb(ih, lin, col, mark);
          ih->data->inside_markedit_cb = 0;
        }
        else
        {
          if (mark)
          {
            iupAttribSetId2(ih, "MARK", lin, col, "1");
            ret = 1;
          }
          else
            iupAttribSetId2(ih, "MARK", lin, col, NULL);
        }
      }
      else
      {
        if (mark)
          ih->data->cells[lin][col].flags |= IMAT_IS_MARKED;
        else
          ih->data->cells[lin][col].flags &= ~IMAT_IS_MARKED;
      }

      if (ih->handle)
      {
        /* This assumes that the matrix has been draw completely previously */
        iupMatrixPrepareDrawData(ih);
        iupMatrixDrawCells(ih, lin, col, lin, col);
      }

      return ret;
    }
    else
    {
      int mark = iupStrBoolean(value);

      if (ih->data->mark_mode & IMAT_MARK_LIN && lin>0)
      {
        if (mark)
          ih->data->lines.dt[lin].flags |= IMAT_IS_MARKED;
        else
          ih->data->lines.dt[lin].flags &= ~IMAT_IS_MARKED;
      }

      if (ih->data->mark_mode & IMAT_MARK_COL && col>0)
      {
        if (mark)
          ih->data->columns.dt[col].flags |= IMAT_IS_MARKED;
        else
          ih->data->columns.dt[col].flags &= ~IMAT_IS_MARKED;
      }

      if (ih->handle)
      {
        /* This assumes that the matrix has been drawn completely previously */
        iupMatrixPrepareDrawData(ih);
        iupMatrixDrawCells(ih, lin, col, lin, col);
      }
    }
  }

  return 0;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:87,代码来源:iupmat_mark.c


示例13: iupMatrixGetMarkedAttrib

char* iupMatrixGetMarkedAttrib(Ihandle* ih)
{
  int lin, col, size;
  IFnii mark_cb;
  char* p, *value = NULL;
  int exist_mark = 0;           /* Show if there is someone marked */

  if (ih->data->mark_mode == IMAT_MARK_NO)
    return NULL;

  mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");

  if (ih->data->mark_mode == IMAT_MARK_CELL)
  {
    size = (ih->data->lines.num-1) * (ih->data->columns.num-1) + 1;
    value = iupStrGetMemory(size);
    p = value;

    for(lin = 1; lin < ih->data->lines.num; lin++)
    {
      for(col = 1; col < ih->data->columns.num; col++)
      {
         if (iupMatrixMarkCellGet(ih, lin, col, mark_cb))
         {
           exist_mark = 1;
           *p++ = '1';
         }
         else
           *p++ = '0';
      }
    }
    *p = 0;
  }
  else
  {
    int marked_lines = 0, marked_cols = 0;

    if (ih->data->mark_mode == IMAT_MARK_LINCOL) /* must find which format to return */
    {
      /* look for a marked column */
      for(col = 1; col < ih->data->columns.num; col++)
      {
        if (ih->data->columns.dt[col].flags & IMAT_IS_MARKED)
        {
          marked_cols = 1; /* at least one column is marked */
          break;
        }
      }

      if (!marked_cols)
        marked_lines = 1;
    }
    else if (ih->data->mark_mode == IMAT_MARK_LIN)
      marked_lines = 1;
    else if (ih->data->mark_mode == IMAT_MARK_COL)
      marked_cols = 1;

    if (marked_lines)
    {
      size = 1 + (ih->data->lines.num-1) + 1;
      value = iupStrGetMemory(size);
      p = value;

      *p++ = 'L';

      for(lin = 1; lin < ih->data->lines.num; lin++)
      {
        if (ih->data->lines.dt[lin].flags & IMAT_IS_MARKED)
        {
          exist_mark = 1;
          *p++ = '1';
        }
        else
         *p++ = '0';
      }
      *p = 0;
    }
    else if (marked_cols)
    {
      size = 1 + (ih->data->columns.num-1) + 1;
      value = iupStrGetMemory(size);
      p = value;

      *p++ = 'C';

      for(col = 1; col < ih->data->columns.num; col++)
      {
        if (ih->data->columns.dt[col].flags & IMAT_IS_MARKED)
        {
          exist_mark = 1;
          *p++ = '1';
        }
        else
         *p++ = '0';
      }
      *p = 0;
    }
  }

  return exist_mark? value: NULL;
//.........这里部分代码省略.........
开发者ID:Vulcanior,项目名称:IUP,代码行数:101,代码来源:iupmat_mark.c


示例14: iupMatrixSetMarkedAttrib

int iupMatrixSetMarkedAttrib(Ihandle* ih, const char* value)
{
  int lin, col, mark;
  IFniii markedit_cb;

  if (ih->data->mark_mode == IMAT_MARK_NO)
    return 0;

  if (!value)
    iupMatrixMarkClearAll(ih, 1);
  else if (*value == 'C' || *value == 'c')  /* columns */
  {
    if (ih->data->mark_mode == IMAT_MARK_LIN)
      return 0;

    value++; /* skip C mark */
    if ((int)strlen(value) != ih->data->columns.num-1)
      return 0;

    markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");

    for(col = 1; col < ih->data->columns.num; col++)
    {
      if (*value++ == '1')
        mark = 1;
      else
        mark = 0;

      /* mark all the cells for that column */
      if (ih->data->mark_mode == IMAT_MARK_CELL)
      {
        for(lin = 1; lin < ih->data->lines.num; lin++)
          iMatrixMarkCellSet(ih, lin, col, mark, markedit_cb, NULL);
      }
      else
        iMatrixMarkColSet(ih, col, mark);
    }

    if (ih->data->mark_mode & IMAT_MARK_LIN)
      iMatrixMarkAllLinCol(&(ih->data->lines), 0);
  }
  else if (*value == 'L' || *value == 'l')  /* lines */
  {
    if (ih->data->mark_mode == IMAT_MARK_COL)
      return 0;

    value++; /* skip L mark */
    if ((int)strlen(value) != ih->data->lines.num-1)
      return 0;

    markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");

    for(lin = 1; lin < ih->data->lines.num; lin++)
    {
      if (*value++ == '1')
        mark = 1;
      else
        mark = 0;

      /* Mark all the cells for that line */
      if (ih->data->mark_mode == IMAT_MARK_CELL)
      {
        for(col = 1; col < ih->data->columns.num; col++)
          iMatrixMarkCellSet(ih, lin, col, mark, markedit_cb, NULL);
      }
      else
        iMatrixMarkLinSet(ih, lin, mark);
    }

    if (ih->data->mark_mode & IMAT_MARK_COL)
      iMatrixMarkAllLinCol(&(ih->data->columns), 0);
  }
  else if (ih->data->mark_mode == IMAT_MARK_CELL)  /* cells */
  {
    if ((int)strlen(value) != (ih->data->lines.num-1)*(ih->data->columns.num-1))
      return 0;

    markedit_cb = (IFniii)IupGetCallback(ih, "MARKEDIT_CB");

    for(lin = 1; lin < ih->data->lines.num; lin++)
    {
      for(col = 1; col < ih->data->columns.num; col++)
      {
        if (*value++ == '1')
          mark = 1;
        else
          mark = 0;

        iMatrixMarkCellSet(ih, lin, col, mark, markedit_cb, NULL);
      }
    }
  }

  if (ih->handle)
    iupMatrixDraw(ih, 1);

  return 0;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:98,代码来源:iupmat_mark.c


示例15: gtkDialogConfigureEvent

static gboolean gtkDialogConfigureEvent(GtkWidget *widget, GdkEventConfigure *evt, Ihandle *ih)
{
  int old_width, old_height, old_x, old_y;
  gint x, y;
  (void)widget;

#ifndef HILDON
  /* In hildon the menu is not a menubar */
  if (ih->data->menu && ih->data->menu->handle)
  {
    if (evt->width > 0)
      gtk_widget_set_size_request(ih->data->menu->handle, evt->width, -1);
  }
#endif

  if (ih->data->ignore_resize) 
    return FALSE; 

  old_width = iupAttribGetInt(ih, "_IUPGTK_OLD_WIDTH");
  old_height = iupAttribGetInt(ih, "_IUPGTK_OLD_HEIGHT");

  /* Check the size change, because configure is called also for position changes */
  if (evt->width != old_width || evt->height != old_height)
  {
    IFnii cb;
    int border, caption, menu;
    iupAttribSetInt(ih, "_IUPGTK_OLD_WIDTH", evt->width);
    iupAttribSetInt(ih, "_IUPGTK_OLD_HEIGHT", evt->height);

    iupdrvDialogGetDecoration(ih, &border, &caption, &menu);

  /* update dialog size */
#ifdef HILDON
    /* In Hildon, the configure event contains the window size, not the client area size */
    ih->currentwidth = evt->width;
    ih->currentheight = evt->height;
#else
    ih->currentwidth = evt->width + 2*border;
    ih->currentheight = evt->height + 2*border + caption;  /* menu is inside the window client area */
#endif

    cb = (IFnii)IupGetCallback(ih, "RESIZE_CB");
    if (!cb || cb(ih, evt->width, evt->height - menu)!=IUP_IGNORE)  /* width and height here are for the client area */
    {
      ih->data->ignore_resize = 1;
      IupRefresh(ih);
      ih->data->ignore_resize = 0;
    }
  }

  old_x = iupAttribGetInt(ih, "_IUPGTK_OLD_X");
  old_y = iupAttribGetInt(ih, "_IUPGTK_OLD_Y");
  iupdrvDialogGetPosition(ih, NULL, &x, &y);  /* ignore evt->x and evt->y because they are the clientpos and not X/Y */

  /* Check the position change, because configure is called also for size changes */
  if (x != old_x || y != old_y)
  {
    IFnii cb;
    iupAttribSetInt(ih, "_IUPGTK_OLD_X", x);
    iupAttribSetInt(ih, "_IUPGTK_OLD_Y", y);

    cb = (IFnii)IupGetCallback(ih, "MOVE_CB");
    if (cb)
      cb(ih, x, y);
  }

  return FALSE;
}
开发者ID:ivanceras,项目名称:iup-mirror,代码行数:68,代码来源:iupgtk_dialog.c


示例16: iupgtkKeyPressEvent

gboolean iupgtkKeyPressEvent(GtkWidget *widget, GdkEventKey *evt, Ihandle *ih)
{
  int result;
  int code = iupgtkKeyDecode(evt);
  if (code == 0) 
    return FALSE;

  /* Avoid duplicate calls if a child of a native container contains the focus.
     GTK will call the callback for the child and for the container.
     Ignore the one sent to the parent. For now only IupDialog and IupTabs
     have keyboard signals intercepted.
     */
  if (iupObjectIsNativeContainer(ih))
  {
    GtkWindow* win = (GtkWindow*)IupGetDialog(ih)->handle;
    GtkWidget *widget_focus = gtk_window_get_focus(win);
    if (widget_focus && widget_focus != widget)
      return FALSE;
  }

  result = iupKeyCallKeyCb(ih, code);
  if (result == IUP_CLOSE)
  {
    IupExitLoop();
    return FALSE;
  }
  if (result == IUP_IGNORE)
    return TRUE;

  /* in the previous callback the dialog could be destroyed */
  if (iupObjectCheck(ih))
  {
    /* this is called only for canvas */
    if (ih->iclass->nativetype == IUP_TYPECANVAS) 
    {
      result = iupKeyCallKeyPressCb(ih, code, 1);
      if (result == IUP_CLOSE)
      {
        IupExitLoop();
        return FALSE;
      }
      if (result == IUP_IGNORE)
        return TRUE;
    }

    if (!iupKeyProcessNavigation(ih, code, evt->state & GDK_SHIFT_MASK))
      return TRUE;

    /* compensate the 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IupGetDialog函数代码示例发布时间:2022-05-30
下一篇:
C++ IupGetAttribute函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap