Beispiel #1
0
void TimerTest(void)
{
  Ihandle *dlg;

  dlg = IupDialog(NULL);
  IupSetAttribute(dlg, "TITLE", "IupTimer Test");
  IupSetAttribute(dlg, "SIZE", "200x100");

  IupShow(dlg);

  timer1 = IupTimer();
  timer2 = IupTimer();
  timer3 = IupTimer();

  IupSetAttribute(timer1, "TIME",  "100");
  IupSetAttribute(timer1, "RUN",   "YES");
  IupSetCallback(timer1, "ACTION_CB", (Icallback)timer_cb);

  IupSetAttribute(timer2, "TIME",  "400");
  IupSetAttribute(timer2, "RUN",   "YES");
  IupSetCallback(timer2, "ACTION_CB", (Icallback)timer_cb);

  IupSetAttribute(timer3, "TIME",  "5000");
  IupSetAttribute(timer3, "RUN",   "YES");
  IupSetCallback(timer3, "ACTION_CB", (Icallback)timer_cb);
}
Beispiel #2
0
Iclass* iupSpinNewClass(void)
{
  Iclass* ic = iupClassNew(iupRegisterFindClass("vbox"));

  ic->name = "spin";
  ic->format = NULL;  /* no parameters */
  ic->nativetype = IUP_TYPEVOID;
  ic->childtype = IUP_CHILDNONE;
  ic->is_interactive = 0;

  /* Class functions */
  ic->New = iupSpinNewClass;
  ic->Create = iSpinCreateMethod;

  iupClassRegisterCallback(ic, "SPIN_CB", "i");

  if (!IupGetHandle("IupSpinUpImage") || !IupGetHandle("IupSpinDownImage"))
  {
    Ihandle* spin_timer = IupTimer();
    IupSetCallback(spin_timer, "ACTION_CB", (Icallback) iSpinTimerCB);
    IupSetHandle("IupSpinTimer", spin_timer);

    iSpinLoadImages();
  }

  return ic;
}
static int gtkProgressBarMapMethod(Ihandle* ih)
{
  ih->handle = gtk_progress_bar_new();
  if (!ih->handle)
    return IUP_ERROR;

  /* add to the parent, all GTK controls must call this. */
  iupgtkAddToParent(ih);

  gtk_widget_realize(ih->handle);

  if (iupStrEqualNoCase(iupAttribGetStr(ih, "ORIENTATION"), "VERTICAL"))
  {
#if GTK_CHECK_VERSION(3, 0, 0)
    gtk_orientable_set_orientation(GTK_ORIENTABLE(ih->handle), GTK_ORIENTATION_VERTICAL);
    gtk_progress_bar_set_inverted(GTK_PROGRESS_BAR(ih->handle), TRUE);
#else
    gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(ih->handle), GTK_PROGRESS_BOTTOM_TO_TOP);
#endif

    if (ih->userheight < ih->userwidth)
    {
      int tmp = ih->userheight;
      ih->userheight = ih->userwidth;
      ih->userwidth = tmp;
    }
  }
  else
  {
#if GTK_CHECK_VERSION(3, 0, 0)
    gtk_orientable_set_orientation(GTK_ORIENTABLE(ih->handle), GTK_ORIENTATION_HORIZONTAL);
#else
    gtk_progress_bar_set_orientation((GtkProgressBar*)ih->handle, GTK_PROGRESS_LEFT_TO_RIGHT);
#endif
  }

  if (iupAttribGetBoolean(ih, "MARQUEE"))
  {
#if GTK_CHECK_VERSION(3, 0, 0)
    gtk_progress_bar_pulse(GTK_PROGRESS_BAR(ih->handle));
#else
    gtk_progress_set_activity_mode((GtkProgress*)ih->handle, TRUE);
#endif

    ih->data->marquee = 1;

    ih->data->timer = IupTimer();
    IupSetCallback(ih->data->timer, "ACTION_CB", (Icallback)gtkProgressBarTimeCb);
    IupSetAttribute(ih->data->timer, "TIME", "100");
    iupAttribSet(ih->data->timer, "_IUP_PROGRESSBAR", (char*)ih);

    gtk_progress_bar_set_pulse_step((GtkProgressBar*)ih->handle, 0.02);
  }
  else
    ih->data->marquee = 0;

  return IUP_NOERROR;
}
Beispiel #4
0
int main(int argc, char **argv)
{
  Ihandle *dialog, *text;

  IupOpen(&argc, &argv);

  text = IupLabel("Timer example");
  IupSetHandle("quit", text);

  /* Creating main dialog */
  dialog = IupDialog(IupVbox(text, NULL));
  IupSetAttribute(dialog, "TITLE", "timer example");
  IupSetAttribute(dialog, "SIZE", "200x200");
  IupShowXY(dialog, IUP_CENTER, IUP_CENTER);

  timer1 = IupTimer();
  timer2 = IupTimer();

  IupSetAttribute(timer1, "TIME", "1000");
  IupSetAttribute(timer1, "RUN", "YES");
  IupSetCallback(timer1, "ACTION_CB", (Icallback)timer_cb);

  IupSetAttribute(timer2, "TIME", "4000");
  IupSetAttribute(timer2, "RUN", "YES");
  IupSetCallback(timer2, "ACTION_CB", (Icallback)timer_cb);

  IupMainLoop();

  /* Timers are NOT automatically destroyed, must be manually done */
  IupDestroy(timer1);
  IupDestroy(timer2);

  IupClose();

  return EXIT_SUCCESS;

}
Beispiel #5
0
// List method changes
static int _list_method_cb(/*@unused@*/ Ihandle *ih,
                                        /*@unused@*/ char *text, int pos, int state) {
    if( state == 0 )
        return IUP_DEFAULT;
    if( !run_task )
        run_task = IupSetAtt(NULL,IupTimer(),"TIME","100",NULL);
    switch(pos) {
    case 1:
        LOG(LOGVERBOSE,_("Running geocode with hostip"));
        IupSetAttribute(lbl_status,"VALUE","");
        IupSetfAttribute(lbl_status,"APPEND",
                         _("Downloading info, this may be slow..."));
        (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geocode);
        IupSetAttribute(run_task,"RUN","YES");
        IupSetAttribute(list_method,"VISIBLE","NO");
        break;
    case 2:
        LOG(LOGVERBOSE,_("Running geocode with geobytes"));
        IupSetAttribute(lbl_status,"VALUE","");
        IupSetfAttribute(lbl_status,"APPEND",
                         _("Downloading info, this may be slow..."));
        (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geobytes);
        IupSetAttribute(run_task,"RUN","YES");
        IupSetAttribute(list_method,"VISIBLE","NO");
        break;
    case 3: {
        edt_address = IupSetAtt(NULL,IupText(NULL),
                                "VALUE","Enter Address...",
                                "EXPAND","HORIZONTAL",NULL);
        (void)IupSetCallback(edt_address,"GETFOCUS_CB",(Icallback)_address_clear);
        btn_address = IupSetAtt(NULL,IupButton(_("Lookup"),NULL),NULL);
        (void)IupSetCallback(btn_address,"ACTION",(Icallback)_address_lookup);
        hbox_address = IupHbox(edt_address,btn_address,NULL);
        if( (vbox_method!=NULL)
                && (hbox_address!=NULL)
                && (lbl_status!=NULL) )
            (void)IupInsert(vbox_method,lbl_status,hbox_address);
        else {
            LOG(LOGERR,_("Location search controls not created!"));
            return IUP_DEFAULT;
        }
        IupSetAttribute(list_method,"VISIBLE","NO");
        (void)IupMap(hbox_address);
        IupRefresh(hbox_address);
        break;
    }
    };
    return IUP_DEFAULT;
}
Beispiel #6
0
static int iExpanderSetAutoShowAttrib(Ihandle* ih, const char* value)
{
  ih->data->auto_show = iupStrBoolean(value);
  if (ih->data->auto_show)
  {
    if (!ih->data->timer)
    {
      ih->data->timer = IupTimer();
      IupSetAttribute(ih->data->timer, "TIME", "1000");  /* 1 second */
      IupSetCallback(ih->data->timer, "ACTION_CB", iExpanderTimer_cb);
      iupAttribSetStr(ih->data->timer, "_IUP_EXPANDER", (char*)ih);  /* 1 second */
    }
  }
  else
  {
    if (ih->data->timer)
      IupSetAttribute(ih->data->timer, "RUN", "NO");
  }
  return 0; /* do not store value in hash table */
}
Beispiel #7
0
int main(int argc, char* argv[])
{
  Ihandle *dlg, *vbox, *hbox;
  Ihandle *btn_restart, *btn_accelerate, *btn_decelerate, *btn_show1, *btn_show2;
  
  IupOpen(&argc, &argv);                  /* IUP initialization */

  timer = IupTimer();
  IupSetCallback(timer, "ACTION_CB", (Icallback)time_cb);
  IupSetAttribute(timer, "TIME", "100");
  
  progressbar1 = IupProgressBar();
  progressbar2 = IupProgressBar();
 
  IupSetAttribute(progressbar1, "EXPAND", "YES");
  IupSetAttribute(progressbar1, "DASHED", "YES");

  IupSetAttribute(progressbar2, "ORIENTATION", "VERTICAL");
  IupSetAttribute(progressbar2, "BGCOLOR", "255 0 128");
  IupSetAttribute(progressbar2, "FGCOLOR", "0 128 0");
  IupSetAttribute(progressbar2, "RASTERSIZE", "30x100");
  IupSetAttribute(progressbar2, "MAX", "50");
  IupSetAttribute(progressbar2, "VALUE", "25");

  btn_restart = IupButton(NULL, NULL);
  btn_pause = IupButton(NULL, NULL);
  btn_accelerate = IupButton(NULL, NULL);
  btn_decelerate = IupButton(NULL, NULL);
  btn_show1 = IupButton("Dashed", NULL);
  btn_show2 = IupButton("Marquee", NULL);

  createimg_s();

  IupSetAttribute(btn_restart, "IMAGE", "img_restart");
  IupSetAttribute(btn_restart, "TIP", "Restart" );
  IupSetAttribute(btn_pause, "IMAGE", "img_pause");
  IupSetAttribute(btn_pause, "TIP", "Play/Pause");
  IupSetAttribute(btn_accelerate, "IMAGE", "img_forward");
  IupSetAttribute(btn_accelerate, "TIP", "Accelerate");
  IupSetAttribute(btn_decelerate, "IMAGE", "img_rewind");
  IupSetAttribute(btn_decelerate, "TIP", "Decelerate");
  IupSetAttribute(btn_show1, "TIP", "Dashed or Continuous");
  IupSetAttribute(btn_show2, "TIP", "Marquee or Defined");

  hbox = IupHbox
         (
           IupFill(), 
           btn_pause,
           btn_restart,
           btn_decelerate,
           btn_accelerate,
           btn_show1,
           btn_show2,
           IupFill(),
           NULL
         );

  vbox = IupHbox(IupVbox(progressbar1, hbox, NULL), progressbar2, NULL);
  IupSetAttribute(vbox, "MARGIN", "10x10");
  IupSetAttribute(vbox, "GAP", "5");

  dlg = IupDialog(vbox);
  
  IupSetAttribute(dlg, "TITLE", "IupProgressBar Test");

  IupSetCallback(btn_pause, "ACTION", (Icallback) btn_pause_cb);
  IupSetCallback(btn_restart, "ACTION", (Icallback) btn_restart_cb);
  IupSetCallback(btn_accelerate, "ACTION", (Icallback) btn_accelerate_cb);
  IupSetCallback(btn_decelerate, "ACTION", (Icallback) btn_decelerate_cb);
  IupSetCallback(btn_show1, "ACTION", (Icallback) btn_show1_cb);
  IupSetCallback(btn_show2, "ACTION", (Icallback) btn_show2_cb);
  
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  IupSetAttribute(timer, "RUN", "YES");

  IupMainLoop();

  IupClose();

  return EXIT_SUCCESS;

}
static int motProgressBarMapMethod(Ihandle* ih)
{
  int num_args = 0;
  Arg args[30];
 
  /* Core */
  iupMOT_SETARG(args, num_args, XmNmappedWhenManaged, False);  /* not visible when managed */
  iupMOT_SETARG(args, num_args, XmNx, 0);  /* x-position */
  iupMOT_SETARG(args, num_args, XmNy, 0);  /* y-position */
  iupMOT_SETARG(args, num_args, XmNwidth, 10);  /* default width to avoid 0 */
  iupMOT_SETARG(args, num_args, XmNheight, 10); /* default height to avoid 0 */
  /* Primitive */
  iupMOT_SETARG(args, num_args, XmNtraversalOn, False);
  iupMOT_SETARG(args, num_args, XmNhighlightThickness, 0);
  /* Scale */
  iupMOT_SETARG(args, num_args, XmNminimum,   0);
  iupMOT_SETARG(args, num_args, XmNmaximum, SHRT_MAX);
  iupMOT_SETARG(args, num_args, XmNsliderMark, XmNONE);
  iupMOT_SETARG(args, num_args, XmNsliderVisual, XmTROUGH_COLOR);
  iupMOT_SETARG(args, num_args, XmNeditable, False);
  iupMOT_SETARG(args, num_args, XmNshowValue, XmNONE);

  if (iupStrEqualNoCase(iupAttribGetStr(ih, "ORIENTATION"), "VERTICAL"))
  {
    iupMOT_SETARG(args, num_args, XmNorientation, XmVERTICAL);

    if (ih->currentheight < ih->currentwidth)
    {
      int tmp = ih->currentheight;
      ih->currentheight = ih->currentwidth;
      ih->currentwidth = tmp;
    }
  }
  else
    iupMOT_SETARG(args, num_args, XmNorientation, XmHORIZONTAL);

  if (iupAttribGetBoolean(ih, "MARQUEE"))
  {
    ih->data->marquee = 1;
    ih->data->timer = IupTimer();
    IupSetCallback(ih->data->timer, "ACTION_CB", (Icallback)motProgressBarTimeCb);
    IupSetAttribute(ih->data->timer, "TIME", "100");
    iupAttribSet(ih->data->timer, "_IUP_PROGRESSBAR", (char*)ih);
    iupMOT_SETARG(args, num_args, XmNslidingMode, XmSLIDER);
  }
  else
  {
    iupMOT_SETARG(args, num_args, XmNslidingMode, XmTHERMOMETER);
    ih->data->marquee = 0;
  }
  
  ih->handle = XtCreateManagedWidget(
    iupDialogGetChildIdStr(ih),  /* child identifier */
    xmScaleWidgetClass,          /* widget class */
    iupChildTreeGetNativeParentHandle(ih), /* widget parent */
    args, num_args);

  if (!ih->handle)
    return IUP_ERROR;

  ih->serial = iupDialogGetChildId(ih); /* must be after using the string */

  XtAddEventHandler(ih->handle, EnterWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih);
  XtAddEventHandler(ih->handle, LeaveWindowMask, False, (XtEventHandler)iupmotEnterLeaveWindowEvent, (XtPointer)ih);

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

  return IUP_NOERROR;
}
Beispiel #9
0
void init(int argc, char* argv[]) {
    UINT ix;
    Ihandle *topVbox, *bottomVbox, *dialogVBox, *controlHbox;
    Ihandle *noneIcon, *doingIcon, *errorIcon;
    char* arg_value = NULL;

    // fill in config
    loadConfig();

    // iup inits
    IupOpen(&argc, &argv);

    // this is so easy to get wrong so it's pretty worth noting in the program
    statusLabel = IupLabel("NOTICE: When capturing localhost (loopback) packets, you CAN'T include inbound criteria.\n"
        "Filters like 'udp' need to be 'udp and outbound' to work. See readme for more info.");
    IupSetAttribute(statusLabel, "EXPAND", "HORIZONTAL");
    IupSetAttribute(statusLabel, "PADDING", "8x8");

    topFrame = IupFrame(
        topVbox = IupVbox(
            filterText = IupText(NULL),
            controlHbox = IupHbox(
                stateIcon = IupLabel(NULL),
                filterButton = IupButton("Start", NULL),
                IupFill(),
                IupLabel("Presets:  "),
                filterSelectList = IupList(NULL),
                NULL
            ),
            NULL
        )
    );

    // parse arguments and set globals *before* setting up UI.
    // arguments can be read and set after callbacks are setup
    // FIXME as Release is built as WindowedApp, stdout/stderr won't show
    LOG("argc: %d", argc);
    if (argc > 1) {
        if (!parseArgs(argc, argv)) {
            fprintf(stderr, "invalid argument count. ensure you're using options as \"--drop on\"");
            exit(-1); // fail fast.
        }
        parameterized = 1;
    }

    IupSetAttribute(topFrame, "TITLE", "Filtering");
    IupSetAttribute(topFrame, "EXPAND", "HORIZONTAL");
    IupSetAttribute(filterText, "EXPAND", "HORIZONTAL");
    IupSetCallback(filterText, "VALUECHANGED_CB", (Icallback)uiFilterTextCb);
    IupSetAttribute(filterButton, "PADDING", "8x");
    IupSetCallback(filterButton, "ACTION", uiStartCb);
    IupSetAttribute(topVbox, "NCMARGIN", "4x4");
    IupSetAttribute(topVbox, "NCGAP", "4x2");
    IupSetAttribute(controlHbox, "ALIGNMENT", "ACENTER");

    // setup state icon
    IupSetAttribute(stateIcon, "IMAGE", "none_icon");
    IupSetAttribute(stateIcon, "PADDING", "4x");

    // fill in options and setup callback
    IupSetAttribute(filterSelectList, "VISIBLECOLUMNS", "24");
    IupSetAttribute(filterSelectList, "DROPDOWN", "YES");
    for (ix = 0; ix < filtersSize; ++ix) {
        char ixBuf[4];
        sprintf(ixBuf, "%d", ix+1); // ! staring from 1, following lua indexing
        IupStoreAttribute(filterSelectList, ixBuf, filters[ix].filterName);
    }
    IupSetAttribute(filterSelectList, "VALUE", "1");
    IupSetCallback(filterSelectList, "ACTION", (Icallback)uiListSelectCb);
    // set filter text value since the callback won't take effect before main loop starts
    IupSetAttribute(filterText, "VALUE", filters[0].filterValue);

    // functionalities frame 
    bottomFrame = IupFrame(
        bottomVbox = IupVbox(
            NULL
        )
    );
    IupSetAttribute(bottomFrame, "TITLE", "Functions");
    IupSetAttribute(bottomVbox, "NCMARGIN", "4x4");
    IupSetAttribute(bottomVbox, "NCGAP", "4x2");

    // create icons
    noneIcon = IupImage(8, 8, icon8x8);
    doingIcon = IupImage(8, 8, icon8x8);
    errorIcon = IupImage(8, 8, icon8x8);
    IupSetAttribute(noneIcon, "0", "BGCOLOR");
    IupSetAttribute(noneIcon, "1", "224 224 224");
    IupSetAttribute(doingIcon, "0", "BGCOLOR");
    IupSetAttribute(doingIcon, "1", "109 170 44");
    IupSetAttribute(errorIcon, "0", "BGCOLOR");
    IupSetAttribute(errorIcon, "1", "208 70 72");
    IupSetHandle("none_icon", noneIcon);
    IupSetHandle("doing_icon", doingIcon);
    IupSetHandle("error_icon", errorIcon);

    // setup module uis
    for (ix = 0; ix < MODULE_CNT; ++ix) {
        uiSetupModule(*(modules+ix), bottomVbox);
    }

    // dialog
    dialog = IupDialog(
        dialogVBox = IupVbox(
            topFrame,
            bottomFrame,
            statusLabel,
            NULL
        )
    );

    IupSetAttribute(dialog, "TITLE", "clumsy " CLUMSY_VERSION);
    IupSetAttribute(dialog, "SIZE", "400x"); // add padding manually to width
    IupSetAttribute(dialog, "RESIZE", "NO");
    IupSetCallback(dialog, "SHOW_CB", (Icallback)uiOnDialogShow);


    // global layout settings to affect childrens
    IupSetAttribute(dialogVBox, "ALIGNMENT", "ACENTER");
    IupSetAttribute(dialogVBox, "NCMARGIN", "4x4");
    IupSetAttribute(dialogVBox, "NCGAP", "4x2");

    // setup timer
    timer = IupTimer();
    IupSetAttribute(timer, "TIME", STR(ICON_UPDATE_MS));
    IupSetCallback(timer, "ACTION_CB", uiTimerCb);

    // setup timeout of program
    arg_value = IupGetGlobal("timeout");
    if(arg_value != NULL)
    {
        char valueBuf[16];
        sprintf(valueBuf, "%s000", arg_value);  // convert from seconds to milliseconds

        timeout = IupTimer();
        IupStoreAttribute(timeout, "TIME", valueBuf);
        IupSetCallback(timeout, "ACTION_CB", uiTimeoutCb);
        IupSetAttribute(timeout, "RUN", "YES");
    }
}
Beispiel #10
0
int IupPlayInput(const char* filename)
{
  Ihandle* timer = (Ihandle*)IupGetGlobal("_IUP_PLAYTIMER");
  FILE* file;
  char sig[9], mode_str[4];
  int mode;

  if (timer)
  {
    if (filename && filename[0]==0)
    {
      if (IupGetInt(timer, "RUN"))
        IupSetAttribute(timer, "RUN", "NO");
      else
        IupSetAttribute(timer, "RUN", "Yes");
      return IUP_NOERROR;
    }

    file = (FILE*)IupGetAttribute(timer, "_IUP_PLAYFILE");

    fclose(file);
    IupSetAttribute(timer, "RUN", "NO");
    IupDestroy(timer);
    IupSetGlobal("_IUP_PLAYTIMER", NULL);
  }
  else
  {
    if (!filename || filename[0]==0)
      return IUP_ERROR;
  }

  if (!filename)
    return IUP_NOERROR;

  file = fopen(filename, "rb");
  if (!file)
    return IUP_ERROR;

  iPlayReadStr(file, sig, 8, IUP_RECTEXT);
  iPlayReadStr(file, mode_str, 3, IUP_RECTEXT); /* read also the eol */
  if (ferror(file))
  {
    fclose(file);
    return IUP_ERROR;
  }

  if (!iupStrEqual(sig, "IUPINPUT"))
  {
    fclose(file);
    return IUP_ERROR;
  }

  mode = IUP_RECBINARY;
  if (iupStrEqual(mode_str, "TXT"))
    mode = IUP_RECTEXT;

  irec_lastclock = iRecClock();

  timer = IupTimer();
  IupSetCallback(timer, "ACTION_CB", (Icallback)iPlayTimer_CB);
  IupSetAttribute(timer, "TIME", "20");
  IupSetAttribute(timer, "_IUP_PLAYFILE", (char*)file);
  IupSetfAttribute(timer, "_IUP_PLAYMODE", "%d", mode);
  IupSetAttribute(timer, "RUN", "YES");

  IupSetGlobal("_IUP_PLAYTIMER", (char*)timer);
  return IUP_NOERROR;
}
Beispiel #11
0
static void CreateTimer(void)
{
  lua_pushusertag(IupTimer(), iuplua_tag);
}
Beispiel #12
0
void GaugeTest(void)
{
  Ihandle *dlg, *vbox, *hbox;
  Ihandle *btn_restart, *btn_accelerate, *btn_decelerate, *btn_show1, *btn_show2;
  
  timer = IupTimer();
  IupSetCallback(timer, "ACTION_CB", (Icallback)time_cb);
  IupSetAttribute(timer, "TIME", "100");
  
  gauge = IupGauge();
 
  IupSetAttribute(gauge, "EXPAND", "YES");
//  IupSetAttribute(gauge, "BGCOLOR", "255 0 128");
//  IupSetAttribute(gauge, "FGCOLOR", "0 128 0");

  btn_restart = IupButton(NULL, NULL);
  btn_pause = IupButton(NULL, NULL);
  btn_accelerate = IupButton(NULL, NULL);
  btn_decelerate = IupButton(NULL, NULL);
  btn_show1 = IupButton("Dashed", NULL);
  btn_show2 = IupButton("Text", NULL);

  createimg_s();

  IupSetAttribute(btn_restart, "IMAGE", "img_restart");
  IupSetAttribute(btn_restart, "TIP", "Restart" );
  IupSetAttribute(btn_pause, "IMAGE", "img_pause");
  IupSetAttribute(btn_pause, "TIP", "Play/Pause");
  IupSetAttribute(btn_accelerate, "IMAGE", "img_forward");
  IupSetAttribute(btn_accelerate, "TIP", "Accelerate");
  IupSetAttribute(btn_decelerate, "IMAGE", "img_rewind");
  IupSetAttribute(btn_decelerate, "TIP", "Decelerate");
  IupSetAttribute(btn_show1, "TIP", "Dashed or Continuous");
  IupSetAttribute(btn_show2, "TIP", "Text or None");

  hbox = IupHbox
         (
           IupFill(), 
           btn_pause,
           btn_restart,
           btn_decelerate,
           btn_accelerate,
           btn_show1,
           btn_show2,
           IupFill(),
           NULL
         );

  vbox = IupVbox(gauge, hbox, NULL);
  IupSetAttribute(vbox, "MARGIN", "10x10");
  IupSetAttribute(vbox, "GAP", "5");

  dlg = IupDialog(vbox);
  
  IupSetAttribute(dlg, "TITLE", "IupGauge Test");

  IupSetCallback(btn_pause, "ACTION", (Icallback) btn_pause_cb);
  IupSetCallback(btn_restart, "ACTION", (Icallback) btn_restart_cb);
  IupSetCallback(btn_accelerate, "ACTION", (Icallback) btn_accelerate_cb);
  IupSetCallback(btn_decelerate, "ACTION", (Icallback) btn_decelerate_cb);
  IupSetCallback(btn_show1, "ACTION", (Icallback) btn_show1_cb);
  IupSetCallback(btn_show2, "ACTION", (Icallback) btn_show2_cb);
  
  IupSetAttribute(timer, "RUN", "YES");

  IupPopup(dlg, IUP_CENTER, IUP_CENTER);

  IupDestroy(timer);
}
Beispiel #13
0
void ProgressbarTest(void)
{
  Ihandle *dlg, *vbox, *hbox;
  Ihandle *btn_restart, *btn_accelerate, *btn_decelerate, *btn_show1, *btn_show2;

  /* timer to update progressbar2 */
  if (timer)
    IupDestroy(timer);
  timer = IupTimer();
  IupSetCallback(timer, "ACTION_CB", (Icallback)time_cb);
  IupSetAttribute(timer, "TIME", "100");
  
  progressbar1 = IupProgressBar();
  progressbar2 = IupProgressBar();
 
  IupSetAttribute(progressbar1, "EXPAND", "YES");
  IupSetAttribute(progressbar1, "MARQUEE", "YES");

  IupSetAttribute(progressbar2, "ORIENTATION", "VERTICAL");
  IupSetAttribute(progressbar2, "BGCOLOR", "255 0 128");
  IupSetAttribute(progressbar2, "FGCOLOR", "0 128 0");
  IupSetAttribute(progressbar2, "RASTERSIZE", "30x100");
  IupSetAttribute(progressbar2, "MAX", "50");
  IupSetAttribute(progressbar2, "VALUE", "25");
  //IupSetAttribute(progressbar2, "DASHED", "YES");

  btn_restart = IupButton(NULL, NULL);
  btn_pause = IupButton(NULL, NULL);
  btn_accelerate = IupButton(NULL, NULL);
  btn_decelerate = IupButton(NULL, NULL);
  btn_show1 = IupButton("Dashed", NULL);
  btn_show2 = IupButton("Marquee", NULL);

  createimg_s();

  IupSetAttribute(btn_restart, "IMAGE", "img_restart");
  IupSetAttribute(btn_restart, "TIP", "Restart" );
  IupSetAttribute(btn_pause, "IMAGE", "img_pause");
  IupSetAttribute(btn_pause, "TIP", "Play/Pause");
  IupSetAttribute(btn_accelerate, "IMAGE", "img_forward");
  IupSetAttribute(btn_accelerate, "TIP", "Accelerate");
  IupSetAttribute(btn_decelerate, "IMAGE", "img_rewind");
  IupSetAttribute(btn_decelerate, "TIP", "Decelerate");
  IupSetAttribute(btn_show1, "TIP", "Dashed or Continuous");
  IupSetAttribute(btn_show2, "TIP", "Marquee or Defined");

  hbox = IupHbox
         (
           IupFill(), 
           btn_pause,
           btn_restart,
           btn_decelerate,
           btn_accelerate,
           btn_show1,
           btn_show2,
           IupFill(),
           NULL
         );

  vbox = IupHbox(IupVbox(progressbar1, hbox, NULL), progressbar2, NULL);
  IupSetAttribute(vbox, "MARGIN", "10x10");
  IupSetAttribute(vbox, "GAP", "5");

  dlg = IupDialog(vbox);
  
  IupSetAttribute(dlg, "TITLE", "IupProgressBar Test");
  IupSetCallback(dlg, "UNMAP_CB", (Icallback) unmap_cb);

  IupSetCallback(btn_pause, "ACTION", (Icallback) btn_pause_cb);
  IupSetCallback(btn_restart, "ACTION", (Icallback) btn_restart_cb);
  IupSetCallback(btn_accelerate, "ACTION", (Icallback) btn_accelerate_cb);
  IupSetCallback(btn_decelerate, "ACTION", (Icallback) btn_decelerate_cb);
  IupSetCallback(btn_show1, "ACTION", (Icallback) btn_show1_cb);
  IupSetCallback(btn_show2, "ACTION", (Icallback) btn_show2_cb);
  
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  IupSetAttribute(timer, "RUN", "YES");
}