Exemplo n.º 1
0
static void iDialogAfterShow(Ihandle* ih)
{
  Ihandle* old_focus;
  IFni show_cb;
  int show_state;

  /* process all pending messages */
  IupFlush();

  old_focus = IupGetFocus();
  show_state = ih->data->show_state;

  show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");
  if (show_cb && show_cb(ih, show_state) == IUP_CLOSE)
  {
    IupExitLoop();
    return;
  }

  if (show_state == IUP_SHOW)
  {
    if (show_cb)
      IupFlush();  /* again to update focus */

    /* do it only if show_cb did NOT changed the current focus */
    if (old_focus == IupGetFocus())
    {
      Ihandle *startfocus = IupGetAttributeHandle(ih, "STARTFOCUS");
      if (startfocus)
        IupSetFocus(startfocus);
      else
        IupNextField(ih);
    }
  }
}
Exemplo n.º 2
0
static int uiStopCb(Ihandle *ih) {
    int ix;
    UNREFERENCED_PARAMETER(ih);
    
    // try stopping
    IupSetAttribute(filterButton, "ACTIVE", "NO");
    IupFlush(); // flush to show disabled state
    divertStop();

    IupSetAttribute(filterText, "ACTIVE", "YES");
    IupSetAttribute(filterButton, "TITLE", "Start");
    IupSetAttribute(filterButton, "ACTIVE", "YES");
    IupSetCallback(filterButton, "ACTION", uiStartCb);

    // stop timer and clean up icons
    IupSetAttribute(timer, "RUN", "NO");
    for (ix = 0; ix < MODULE_CNT; ++ix) {
        modules[ix]->processTriggered = 0; // use = here since is threads already stopped
        IupSetAttribute(modules[ix]->iconHandle, "IMAGE", "none_icon");
    }
    sendState = SEND_STATUS_NONE;
    IupSetAttribute(stateIcon, "IMAGE", "none_icon");

    showStatus("Successfully stoped. Edit criteria and click Start to begin again.");
    return IUP_DEFAULT;
}
Exemplo n.º 3
0
static int iPlayTimer_CB(Ihandle* timer)
{
  FILE* file = (FILE*)IupGetAttribute(timer, "_IUP_PLAYFILE");
  if(feof(file) || ferror(file))
  {
    fclose(file);
    IupSetAttribute(timer, "RUN", "NO");
    IupDestroy(timer);
    IupSetGlobal("_IUP_PLAYTIMER", NULL);
    return IUP_IGNORE;
  }
  else
  {
    int cont = 1;
    int mode = IupGetInt(timer, "_IUP_PLAYMODE");

/*    while (cont)    //did not work, menus do not receive the click, why? */
    {
      cont = iPlayAction(file, mode);

      if (cont == -1)  /* error */
      {
        fclose(file);
        IupSetAttribute(timer, "RUN", "NO");
        IupDestroy(timer);
        IupSetGlobal("_IUP_PLAYTIMER", NULL);
        return IUP_IGNORE;
      }
    }

    IupFlush();
  }

  return IUP_DEFAULT;
}
Exemplo n.º 4
0
void iupdrvActivate(Ihandle* ih)
{
  int is_toggle = IupClassMatch(ih, "toggle");
  int is_radio = 0;
  if (is_toggle)
    is_radio = IupGetInt(ih, "RADIO");

  /* do not use BM_CLICK because it changes the focus 
     and does not animates the button press */

  /* draw highlight */
  SendMessage(ih->handle, BM_SETSTATE, TRUE, 0);
  IupFlush();
  Sleep(150);

  /* must force a toggle change */
  if (is_toggle && !is_radio)
    IupSetAttribute(ih, "VALUE", "TOGGLE");

  /* notify */
  SendMessage(GetParent(ih->handle), WM_COMMAND, MAKEWPARAM(0, BN_CLICKED), (LPARAM)ih->handle);

  /* remove highlight */
  SendMessage(ih->handle, BM_SETSTATE, FALSE, 0);

  /* must force a radio change */
  if (is_toggle && is_radio)
    IupSetAttribute(ih, "VALUE", "TOGGLE");
}
Exemplo n.º 5
0
static int btn_key_cb (Ihandle* ih)
{
  Ihandle *mltline = IupGetDialogChild(ih, "mltline");
  Ihandle *text = IupGetDialogChild(ih, "text");
  IupSetFocus(mltline);
  IupFlush();
  return IUP_DEFAULT;
}
Exemplo n.º 6
0
Arquivo: text.c Projeto: sanikoyes/iup
static int btn_key_cb (Ihandle* ih)
{
  Ihandle *mltline = IupGetDialogChild(ih, "mltline");
  Ihandle *text = IupGetDialogChild(ih, "text");
  IupSetFocus(mltline);
  IupFlush();
  IupSetfAttribute(NULL, "KEY", "%d", IupGetInt(text, "VALUE"));
  return IUP_DEFAULT;
}
Exemplo n.º 7
0
static void iDialogAfterHide(Ihandle* ih)
{
  IFni show_cb;

  /* process all pending messages, make sure the dialog is hidden */
  IupFlush();

  show_cb = (IFni)IupGetCallback(ih, "SHOW_CB");
  if (show_cb && show_cb(ih, ih->data->show_state) == IUP_CLOSE)
  {
    IupExitLoop();
  }
}
Exemplo n.º 8
0
void iupdrvActivate(Ihandle* ih)
{
  /* do not use BM_CLICK because it changes the focus 
     and does not animates the button press */

  /* draw highlight */
  SendMessage(ih->handle, BM_SETSTATE, TRUE, 0);
  IupFlush();
  Sleep(150);

  if (IupClassMatch(ih, "toggle"))
    IupSetAttribute(ih, "VALUE", "TOGGLE");

  /* notify */
  SendMessage(GetParent(ih->handle), WM_COMMAND, MAKEWPARAM(0, BN_CLICKED), (LPARAM)ih->handle);

  /* remove highlight */
  SendMessage(ih->handle, BM_SETSTATE, FALSE, 0);
}
Exemplo n.º 9
0
static void gtkCanvasUpdateChildLayout(Ihandle *ih)
{
  GtkContainer* sb_win = (GtkContainer*)iupAttribGet(ih, "_IUP_EXTRAPARENT");
  GtkWidget* sb_horiz = (GtkWidget*)iupAttribGet(ih, "_IUPGTK_SBHORIZ");
  GtkWidget* sb_vert = (GtkWidget*)iupAttribGet(ih, "_IUPGTK_SBVERT");
  int sb_vert_width=0, sb_horiz_height=0;
  int width = ih->currentwidth;
  int height = ih->currentheight;
  int border = iupAttribGetInt(ih, "BORDERWIDTH");

  if (sb_vert && iupgtkIsVisible(sb_vert))
    sb_vert_width = iupdrvGetScrollbarSize();
  if (sb_horiz && iupgtkIsVisible(sb_horiz))
    sb_horiz_height = iupdrvGetScrollbarSize();

  if (sb_vert_width)
    iupgtkSetPosSize(sb_win, sb_vert, width-sb_vert_width-border, border, sb_vert_width, height-sb_horiz_height-2*border);
  if (sb_horiz_height)
    iupgtkSetPosSize(sb_win, sb_horiz, border, height-sb_horiz_height-border, width-sb_vert_width-2*border, sb_horiz_height);

  iupgtkSetPosSize(sb_win, ih->handle, border, border, width-sb_vert_width-2*border, height-sb_horiz_height-2*border);
  IupFlush();
}
Exemplo n.º 10
0
static int Flush(lua_State *L)
{
  (void)L; /* not used */
  IupFlush();
  return 0;
}
Exemplo n.º 11
0
int  guiMenu_OnValueChanged ( Ihandle *ih )
{
  Ihandle *kid = IupGetChild ( ih, 0 ), *fset[] =
  {
#ifndef EMULATOR
    guiOrg.main.fset,
    guiPfm.main.fset,
    guiTar.main.fset,
#endif
    guiPro.main.fset,
    guiQry.main.fset,
    guiRes.main.fset,
    NULL,
    guiHacks.main.fset,
    guiHack.main.fset,
    guiCodes->main.fset,
    guiCode->main.fset,
    NULL
  };
  Icallback cb[] =
  {
#ifndef EMULATOR
    guiOrg_OnShow,
    guiPfm_OnShow,
    guiTar_OnShow,
#endif
    guiPro_OnShow,
    guiQry_OnShow,
    guiRes_OnShow,
    NULL,
    guiHacks_OnShow,
    guiHack_OnShow,
    guiCodes_OnShow,
    guiCode_OnShow,
    NULL
  };
  //char  *title = IupGetAttribute ( kid, IUP_TITLE );
  int i = 1, c = IupGetChildCount ( guiDlg.vb );

  // Hide all groups first
  for ( ; i < c; ++i )
  {
    kid = IupGetChild ( guiDlg.vb, i );
    IupSetAttribute ( kid, "FLOATING", IUP_YES );
    IupHide ( kid );
  }

  for ( i = 0, c = IupGetChildCount ( guiOrg.main.vb ); i < c; ++i )
  {
    kid = IupGetChild ( guiOrg.main.vb, i );
    IupSetAttribute ( kid, "FLOATING", IUP_YES );
    IupHide ( kid );
  }

  // Find and show appropriate group
  i = IupGetInt ( ih, IUP_VALUE );
  IupSetInt( ih, "MEDIT_I", i );

  if ( ( --i ) >= 0 && fset[i] && cb[i] )
  {
    IupShow ( fset[i] );
    cb[i] ( fset[i] );
  }

  guiMenu_OnLang();
  // Force Update GUI
  IupRefresh ( guiDlg.vb );
  IupRedraw ( guiDlg.vb, 1 );
  IupFlush();
  return IUP_DEFAULT;
}
Exemplo n.º 12
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')", IupGetAttribute(ih, "TESTTITLE"), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)", IupGetAttribute(ih, "TESTTITLE"), c, iupKeyCodeToName(c));
  printf("  MODKEYSTATE(%s)\n", IupGetGlobal("MODKEYSTATE"));

  switch(c)
  {
  case K_r:
    IupSetAttribute(ih, "RASTERSIZE", "300x300");
    IupRefresh(ih);
    IupFlush();
    printf("  RASTERSIZE=%s\n", IupGetAttribute(ih, "RASTERSIZE"));
    break;
  case K_1:
    new_dialog(1, "SIZE=FULLxFULL + IupShow.\n"
                  "Check also F1 = RASTERSIZE+IupRefresh.\n"
                  "close_cb returns IGNORE.");
    break;
  case K_2:
    new_dialog(2, "Only common dlg decorations.\n"
                  "ShowXY.\n"
                  "min/max size.");
    break;
  case K_3:
    new_dialog(3, "NO decorations");
    break;
  case K_4:
    new_dialog(4, "PLACEMENT.\n"
                  "Repeat key to test variations.");
    break;
  case K_5:
    new_dialog(5, "IupPopup");
    break;
  case K_6:
    new_dialog(6, "FULLSCREEN");
    break;
  case K_p:
    {
      static int count = 0;
      if (count == 0)
        IupSetAttribute(ih, "PLACEMENT", "MAXIMIZED");
      else if (count == 1)
        IupSetAttribute(ih, "PLACEMENT", "MINIMIZED");
      else if (count == 2)
        IupSetAttribute(ih, "PLACEMENT", "NORMAL");
      else 
        IupSetAttribute(ih, "PLACEMENT", "FULL");

      count++;
      if (count == 4) // cicle from 0 to 3
        count = 0;

      IupShow(ih);
    }
    break;
  case K_s:
    IupShow(IupGetHandle("_MAIN_DIALOG_TEST_"));
    break;
  case K_f:
    if (IupGetInt(ih, "FULLSCREEN"))
      IupSetAttribute(ih, "FULLSCREEN", "NO");
    else 
      IupSetAttribute(ih, "FULLSCREEN", "YES");
    break;
  case K_ESC:
    IupDestroy(ih);
    return IUP_IGNORE;
  case K_c:
    return IUP_CLOSE;
  case K_h:
    IupHide(ih);
    break;
  }
  return IUP_DEFAULT;
}